Skip to content

Commit

Permalink
[Qt] keep scroll position in GUI console after changing font size
Browse files Browse the repository at this point in the history
  • Loading branch information
jonasschnelli committed Jan 22, 2016
1 parent 3a3a927 commit 56c9e66
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/qt/forms/debugwindow.ui
Original file line number Diff line number Diff line change
Expand Up @@ -480,7 +480,7 @@
</size>
</property>
<property name="toolTip">
<string>Decrease Font Size</string>
<string>Decrease font size</string>
</property>
<property name="text">
<string/>
Expand Down Expand Up @@ -512,7 +512,7 @@
</size>
</property>
<property name="toolTip">
<string>Increase Font Size</string>
<string>Increase font size</string>
</property>
<property name="text">
<string/>
Expand Down
2 changes: 2 additions & 0 deletions src/qt/rpcconsole.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -490,8 +490,10 @@ void RPCConsole::setFontSize(int newSize)
settings.setValue(fontSizeSettingsKey, consoleFontSize);

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

void RPCConsole::clear()
Expand Down

0 comments on commit 56c9e66

Please sign in to comment.