fix SessionManager maximized windows

This commit is contained in:
2022-10-28 13:23:52 +03:00
parent 6ef0fd1b74
commit 063f23f5b8
2 changed files with 5 additions and 3 deletions

View File

@@ -1,6 +1,7 @@
#include <QApplication>
#include <QFileInfo>
#include <QMetaMethod>
#include <QTimer>
#if QT_VERSION < 0x050000
# include <QDesktopWidget>
#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);