Skip to content

Commit 56c9e66

Browse files
committed
[Qt] keep scroll position in GUI console after changing font size
1 parent 3a3a927 commit 56c9e66

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

src/qt/forms/debugwindow.ui

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -480,7 +480,7 @@
480480
</size>
481481
</property>
482482
<property name="toolTip">
483-
<string>Decrease Font Size</string>
483+
<string>Decrease font size</string>
484484
</property>
485485
<property name="text">
486486
<string/>
@@ -512,7 +512,7 @@
512512
</size>
513513
</property>
514514
<property name="toolTip">
515-
<string>Increase Font Size</string>
515+
<string>Increase font size</string>
516516
</property>
517517
<property name="text">
518518
<string/>

src/qt/rpcconsole.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -490,8 +490,10 @@ void RPCConsole::setFontSize(int newSize)
490490
settings.setValue(fontSizeSettingsKey, consoleFontSize);
491491

492492
// clear console (reset icon sizes, default stylesheet) and re-add the content
493+
float oldPosFactor = 1.0 / ui->messagesWidget->verticalScrollBar()->maximum() * ui->messagesWidget->verticalScrollBar()->value();
493494
clear();
494495
ui->messagesWidget->setHtml(str);
496+
ui->messagesWidget->verticalScrollBar()->setValue(oldPosFactor * ui->messagesWidget->verticalScrollBar()->maximum());
495497
}
496498

497499
void RPCConsole::clear()

0 commit comments

Comments
 (0)