Hey all!
I have a quick question: When using a splitter, I would like it to restore itself to the position it was at last time the application closed. I have been able to restore the main window's geometry just fine, but when attempting to restore a splitter, it doesn't work.
When the application starts:
// Main window settings
settings.beginGroup("mainWindow");
restoreGeometry(settings.value("geometry").toByteArray());
splitter->restoreState(settings.value("splitterState").toByteArray());
settings.endGroup();
QSettings settings;
// Main window settings
settings.beginGroup("mainWindow");
restoreGeometry(settings.value("geometry").toByteArray());
splitter->restoreState(settings.value("splitterState").toByteArray());
settings.endGroup();
To copy to clipboard, switch view to plain text mode
When a close event is called:
// Main window settings
settings.beginGroup("mainWindow");
settings.setValue("geometry", saveGeometry());
settings.setValue("splitterState", splitter->saveState());
settings.endGroup();
QSettings settings;
// Main window settings
settings.beginGroup("mainWindow");
settings.setValue("geometry", saveGeometry());
settings.setValue("splitterState", splitter->saveState());
settings.endGroup();
To copy to clipboard, switch view to plain text mode
The splitter always starts in the middle, regardless of where I leave it at close.
Any help?
Bookmarks