[Qt] keep scroll position in GUI console after changing font size
This commit is contained in:
parent
3a3a927325
commit
56c9e66a6d
|
@ -480,7 +480,7 @@
|
||||||
</size>
|
</size>
|
||||||
</property>
|
</property>
|
||||||
<property name="toolTip">
|
<property name="toolTip">
|
||||||
<string>Decrease Font Size</string>
|
<string>Decrease font size</string>
|
||||||
</property>
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string/>
|
<string/>
|
||||||
|
@ -512,7 +512,7 @@
|
||||||
</size>
|
</size>
|
||||||
</property>
|
</property>
|
||||||
<property name="toolTip">
|
<property name="toolTip">
|
||||||
<string>Increase Font Size</string>
|
<string>Increase font size</string>
|
||||||
</property>
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string/>
|
<string/>
|
||||||
|
|
|
@ -490,8 +490,10 @@ void RPCConsole::setFontSize(int newSize)
|
||||||
settings.setValue(fontSizeSettingsKey, consoleFontSize);
|
settings.setValue(fontSizeSettingsKey, consoleFontSize);
|
||||||
|
|
||||||
// clear console (reset icon sizes, default stylesheet) and re-add the content
|
// 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();
|
clear();
|
||||||
ui->messagesWidget->setHtml(str);
|
ui->messagesWidget->setHtml(str);
|
||||||
|
ui->messagesWidget->verticalScrollBar()->setValue(oldPosFactor * ui->messagesWidget->verticalScrollBar()->maximum());
|
||||||
}
|
}
|
||||||
|
|
||||||
void RPCConsole::clear()
|
void RPCConsole::clear()
|
||||||
|
|
Loading…
Reference in New Issue