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,6 +463,12 @@ void MainWindow::keyReleaseEvent(QKeyEvent* ev)
void MainWindow::showEvent(QShowEvent* event) void MainWindow::showEvent(QShowEvent* event)
{ {
QMainWindow::showEvent(event); QMainWindow::showEvent(event);
static bool firstShowEvent = true;
bool restored = false;
if (firstShowEvent)
{
auto& uiSettings = settings::UiSettings::Instance(); auto& uiSettings = settings::UiSettings::Instance();
// restore the geometry state // restore the geometry state
@ -473,8 +479,12 @@ void MainWindow::showEvent(QShowEvent* event)
// restore the UI state // restore the UI state
std::string uiState = uiSettings.main_ui_state().GetValue(); std::string uiState = uiSettings.main_ui_state().GetValue();
bool restored = restored = restoreState(
restoreState(QByteArray::fromBase64(QByteArray::fromStdString(uiState))); QByteArray::fromBase64(QByteArray::fromStdString(uiState)));
firstShowEvent = false;
}
if (!restored) if (!restored)
{ {
resizeDocks({ui->radarToolboxDock}, {194}, Qt::Horizontal); resizeDocks({ui->radarToolboxDock}, {194}, Qt::Horizontal);