From 063f23f5b8d12ed5bb0b3d89ac3a3edf77f75c2b Mon Sep 17 00:00:00 2001 From: peri4 Date: Fri, 28 Oct 2022 13:23:52 +0300 Subject: [PATCH] fix SessionManager maximized windows --- libs/application/emainwindow.cpp | 1 - libs/widgets/session_manager.cpp | 7 +++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/libs/application/emainwindow.cpp b/libs/application/emainwindow.cpp index 9bbfe86..a540b00 100644 --- a/libs/application/emainwindow.cpp +++ b/libs/application/emainwindow.cpp @@ -10,7 +10,6 @@ action_show_all_docks(this), action_hide_all_docks(this), first_show(true) { menu_recent = 0; action_clear_recent = new QAction(QIcon(":/icons/edit-clear.png"), tr("Clear recent list"), this); connect(action_clear_recent, SIGNAL(triggered()), this, SLOT(clearRecent())); - connect(this, &QMainWindow::tabifiedDockWidgetActivated, this, [](QDockWidget*w){qDebug() << "tabifiedDockWidgetActivated" << w;}); qRegisterMetaType("Qt::DockWidgetArea"); action_show_all_tools.setText(tr("Show all")); action_show_all_docks.setText(tr("Show all")); diff --git a/libs/widgets/session_manager.cpp b/libs/widgets/session_manager.cpp index ffb00cb..ebbdfd0 100644 --- a/libs/widgets/session_manager.cpp +++ b/libs/widgets/session_manager.cpp @@ -1,6 +1,7 @@ #include #include #include +#include #if QT_VERSION < 0x050000 # include #else @@ -131,8 +132,9 @@ void restoreWindowState(QWidget * w, QPIConfig & sr, QString name) { int wstate = sr.getValue(name + " window state").toInt(); w->setWindowState(Qt::WindowNoState); w->restoreGeometry(sr.getValue(name + " geometry 0").toByteArray()); - if (wstate == Qt::WindowMaximized) - w->setWindowState((Qt::WindowState)wstate); + if (wstate == Qt::WindowMaximized) { + QTimer::singleShot(0, w, [w,wstate](){w->setWindowState((Qt::WindowState)wstate);}); + } bool wnd_ok = false; QRect srect; #if QT_VERSION < 0x050000 @@ -149,6 +151,7 @@ void restoreWindowState(QWidget * w, QPIConfig & sr, QString name) { } } srect = QApplication::primaryScreen()->geometry(); + qDebug() << w << wnd_ok << wstate << w->geometry(); #endif if (!wnd_ok) { w->setWindowState(Qt::WindowNoState);