From 56c9e66a6d7c798394478660f6088b943fe4e96d Mon Sep 17 00:00:00 2001 From: Jonas Schnelli Date: Sat, 23 Jan 2016 00:05:14 +0100 Subject: [PATCH] [Qt] keep scroll position in GUI console after changing font size --- src/qt/forms/debugwindow.ui | 4 ++-- src/qt/rpcconsole.cpp | 2 ++ 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/qt/forms/debugwindow.ui b/src/qt/forms/debugwindow.ui index 045eb80d9568b..2f4613099090e 100644 --- a/src/qt/forms/debugwindow.ui +++ b/src/qt/forms/debugwindow.ui @@ -480,7 +480,7 @@ - Decrease Font Size + Decrease font size @@ -512,7 +512,7 @@ - Increase Font Size + Increase font size diff --git a/src/qt/rpcconsole.cpp b/src/qt/rpcconsole.cpp index 40c54225f5af1..dca34ed043702 100644 --- a/src/qt/rpcconsole.cpp +++ b/src/qt/rpcconsole.cpp @@ -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()