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 <QLabel>
|
||||||
#include <QMenuBar>
|
#include <QMenuBar>
|
||||||
#include <QMessageBox>
|
#include <QMessageBox>
|
||||||
|
#include <QSettings>
|
||||||
#include <QStatusBar>
|
#include <QStatusBar>
|
||||||
#include <QToolBar>
|
#include <QToolBar>
|
||||||
|
|
||||||
@ -68,6 +69,10 @@ MainWindow::MainWindow(QWidget* parent) : QMainWindow(parent)
|
|||||||
|
|
||||||
m_settings.load();
|
m_settings.load();
|
||||||
applySettings(m_settings);
|
applySettings(m_settings);
|
||||||
|
|
||||||
|
QSettings s;
|
||||||
|
restoreGeometry(s.value(QStringLiteral("window/geometry")).toByteArray());
|
||||||
|
restoreState(s.value(QStringLiteral("window/state")).toByteArray());
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::buildActions()
|
void MainWindow::buildActions()
|
||||||
@ -254,10 +259,14 @@ void MainWindow::runSimulation(bool enabled)
|
|||||||
|
|
||||||
void MainWindow::closeEvent(QCloseEvent* event)
|
void MainWindow::closeEvent(QCloseEvent* event)
|
||||||
{
|
{
|
||||||
if (maybeSave())
|
if (!maybeSave()) {
|
||||||
event->accept();
|
|
||||||
else
|
|
||||||
event->ignore();
|
event->ignore();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
QSettings s;
|
||||||
|
s.setValue(QStringLiteral("window/geometry"), saveGeometry());
|
||||||
|
s.setValue(QStringLiteral("window/state"), saveState());
|
||||||
|
event->accept();
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace diag
|
} // namespace diag
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user