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

@@ -10,7 +10,6 @@ action_show_all_docks(this), action_hide_all_docks(this), first_show(true) {
menu_recent = 0; menu_recent = 0;
action_clear_recent = new QAction(QIcon(":/icons/edit-clear.png"), tr("Clear recent list"), this); 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(action_clear_recent, SIGNAL(triggered()), this, SLOT(clearRecent()));
connect(this, &QMainWindow::tabifiedDockWidgetActivated, this, [](QDockWidget*w){qDebug() << "tabifiedDockWidgetActivated" << w;});
qRegisterMetaType<Qt::DockWidgetArea>("Qt::DockWidgetArea"); qRegisterMetaType<Qt::DockWidgetArea>("Qt::DockWidgetArea");
action_show_all_tools.setText(tr("Show all")); action_show_all_tools.setText(tr("Show all"));
action_show_all_docks.setText(tr("Show all")); action_show_all_docks.setText(tr("Show all"));

View File

@@ -1,6 +1,7 @@
#include <QApplication> #include <QApplication>
#include <QFileInfo> #include <QFileInfo>
#include <QMetaMethod> #include <QMetaMethod>
#include <QTimer>
#if QT_VERSION < 0x050000 #if QT_VERSION < 0x050000
# include <QDesktopWidget> # include <QDesktopWidget>
#else #else
@@ -131,8 +132,9 @@ void restoreWindowState(QWidget * w, QPIConfig & sr, QString name) {
int wstate = sr.getValue(name + " window state").toInt(); int wstate = sr.getValue(name + " window state").toInt();
w->setWindowState(Qt::WindowNoState); w->setWindowState(Qt::WindowNoState);
w->restoreGeometry(sr.getValue(name + " geometry 0").toByteArray()); w->restoreGeometry(sr.getValue(name + " geometry 0").toByteArray());
if (wstate == Qt::WindowMaximized) if (wstate == Qt::WindowMaximized) {
w->setWindowState((Qt::WindowState)wstate); QTimer::singleShot(0, w, [w,wstate](){w->setWindowState((Qt::WindowState)wstate);});
}
bool wnd_ok = false; bool wnd_ok = false;
QRect srect; QRect srect;
#if QT_VERSION < 0x050000 #if QT_VERSION < 0x050000
@@ -149,6 +151,7 @@ void restoreWindowState(QWidget * w, QPIConfig & sr, QString name) {
} }
} }
srect = QApplication::primaryScreen()->geometry(); srect = QApplication::primaryScreen()->geometry();
qDebug() << w << wnd_ok << wstate << w->geometry();
#endif #endif
if (!wnd_ok) { if (!wnd_ok) {
w->setWindowState(Qt::WindowNoState); w->setWindowState(Qt::WindowNoState);