Only restore geometry on first show, not restore from minimize

This commit is contained in:
Dan Paulat 2025-08-28 18:30:23 -05:00
parent de43670ec2
commit 3c5c9ea27e

View file

@ -463,18 +463,28 @@ void MainWindow::keyReleaseEvent(QKeyEvent* ev)
void MainWindow::showEvent(QShowEvent* event) void MainWindow::showEvent(QShowEvent* event)
{ {
QMainWindow::showEvent(event); QMainWindow::showEvent(event);
auto& uiSettings = settings::UiSettings::Instance();
// restore the geometry state static bool firstShowEvent = true;
std::string uiGeometry = uiSettings.main_ui_geometry().GetValue(); bool restored = false;
restoreGeometry(
QByteArray::fromBase64(QByteArray::fromStdString(uiGeometry)));
// restore the UI state if (firstShowEvent)
std::string uiState = uiSettings.main_ui_state().GetValue(); {
auto& uiSettings = settings::UiSettings::Instance();
// restore the geometry state
std::string uiGeometry = uiSettings.main_ui_geometry().GetValue();
restoreGeometry(
QByteArray::fromBase64(QByteArray::fromStdString(uiGeometry)));
// restore the UI state
std::string uiState = uiSettings.main_ui_state().GetValue();
restored = restoreState(
QByteArray::fromBase64(QByteArray::fromStdString(uiState)));
firstShowEvent = false;
}
bool restored =
restoreState(QByteArray::fromBase64(QByteArray::fromStdString(uiState)));
if (!restored) if (!restored)
{ {
resizeDocks({ui->radarToolboxDock}, {194}, Qt::Horizontal); resizeDocks({ui->radarToolboxDock}, {194}, Qt::Horizontal);