feat(app): persist window geometry and dock layout across sessions
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
parent
3129440e60
commit
ef14fed305
@ -14,6 +14,7 @@
|
||||
#include <QLabel>
|
||||
#include <QMenuBar>
|
||||
#include <QMessageBox>
|
||||
#include <QSettings>
|
||||
#include <QStatusBar>
|
||||
#include <QToolBar>
|
||||
|
||||
@ -68,6 +69,10 @@ MainWindow::MainWindow(QWidget* parent) : QMainWindow(parent)
|
||||
|
||||
m_settings.load();
|
||||
applySettings(m_settings);
|
||||
|
||||
QSettings s;
|
||||
restoreGeometry(s.value(QStringLiteral("window/geometry")).toByteArray());
|
||||
restoreState(s.value(QStringLiteral("window/state")).toByteArray());
|
||||
}
|
||||
|
||||
void MainWindow::buildActions()
|
||||
@ -254,10 +259,14 @@ void MainWindow::runSimulation(bool enabled)
|
||||
|
||||
void MainWindow::closeEvent(QCloseEvent* event)
|
||||
{
|
||||
if (maybeSave())
|
||||
event->accept();
|
||||
else
|
||||
if (!maybeSave()) {
|
||||
event->ignore();
|
||||
return;
|
||||
}
|
||||
QSettings s;
|
||||
s.setValue(QStringLiteral("window/geometry"), saveGeometry());
|
||||
s.setValue(QStringLiteral("window/state"), saveState());
|
||||
event->accept();
|
||||
}
|
||||
|
||||
} // namespace diag
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user