Skip to content

Commit 8a720ce

Browse files
author
MarcoFalke
committed
Merge #165: Save QSplitter state in QSettings
90f9fc2 qt: Save QSplitter state in QSettings (Hennadii Stepanov) Pull request description: This PR adds the ability to save the `QSplitter` widget state in `QSettings` during shutdown, and restore it on startup. A user no longer needs to adjust the splitter every time :) ![DeepinScreenshot_select-area_20201225211422](https://user-images.githubusercontent.com/32963518/103141024-046c3980-46f7-11eb-9a8c-83613527ffe1.png) ACKs for top commit: jonasschnelli: utACK 90f9fc2 jonatack: ACK 90f9fc2 this sets the "PeersTabSplitterSizes" value in the RPCConsole dtor and restores it in the RPCConsole ctor; tested in Debian with various split settings, tab open/close sequences, and shutdown methods, and the Peers window split state was faithfully maintained. Tree-SHA512: efbd6a4cee512982944955d36775e75a8a217b1dc49e62d42c6e402d2710dd44324b2c3c1edeb5fe38d9229e0e4a39734d1f4e63405ade8694762e1bbf72020b
2 parents f13e03c + 90f9fc2 commit 8a720ce

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

src/qt/rpcconsole.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -457,6 +457,8 @@ RPCConsole::RPCConsole(interfaces::Node& node, const PlatformStyle *_platformSty
457457
move(QGuiApplication::primaryScreen()->availableGeometry().center() - frameGeometry().center());
458458
}
459459

460+
ui->splitter->restoreState(settings.value("PeersTabSplitterSizes").toByteArray());
461+
460462
QChar nonbreaking_hyphen(8209);
461463
ui->dataDir->setToolTip(ui->dataDir->toolTip().arg(QString(nonbreaking_hyphen) + "datadir"));
462464
ui->blocksDir->setToolTip(ui->blocksDir->toolTip().arg(QString(nonbreaking_hyphen) + "blocksdir"));
@@ -502,6 +504,7 @@ RPCConsole::~RPCConsole()
502504
{
503505
QSettings settings;
504506
settings.setValue("RPCConsoleWindowGeometry", saveGeometry());
507+
settings.setValue("PeersTabSplitterSizes", ui->splitter->saveState());
505508
m_node.rpcUnsetTimerInterface(rpcTimerInterface);
506509
delete rpcTimerInterface;
507510
delete ui;

0 commit comments

Comments
 (0)