Skip to content

Commit 9901cf4

Browse files
AllanDoensenUdjinM6
authored andcommitted
Fix for dash-qt issue with startup and multiple monitors. (#1461)
* Fix for issues with startup and multiple monitors on windows. * Improvements to centering code after a suggestion from zander.
1 parent 82a4643 commit 9901cf4

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

src/qt/guiutil.cpp

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -889,14 +889,17 @@ void restoreWindowGeometry(const QString& strSetting, const QSize& defaultSize,
889889
QPoint pos = settings.value(strSetting + "Pos").toPoint();
890890
QSize size = settings.value(strSetting + "Size", defaultSize).toSize();
891891

892-
if (!pos.x() && !pos.y()) {
893-
QRect screen = QApplication::desktop()->screenGeometry();
894-
pos.setX((screen.width() - size.width()) / 2);
895-
pos.setY((screen.height() - size.height()) / 2);
896-
}
897-
898892
parent->resize(size);
899893
parent->move(pos);
894+
895+
if ((!pos.x() && !pos.y()) || (QApplication::desktop()->screenNumber(parent) == -1))
896+
{
897+
QRect screen = QApplication::desktop()->screenGeometry();
898+
QPoint defaultPos = screen.center() -
899+
QPoint(defaultSize.width() / 2, defaultSize.height() / 2);
900+
parent->resize(defaultSize);
901+
parent->move(defaultPos);
902+
}
900903
}
901904

902905
// Return name of current UI-theme or default theme if no theme was found

0 commit comments

Comments
 (0)