Skip to content

Commit e9ff818

Browse files
AllanDoensenlaanwj
authored andcommitted
Fix for issues with startup and multiple monitors on windows.
1 parent f93f9b9 commit e9ff818

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
@@ -843,14 +843,17 @@ void restoreWindowGeometry(const QString& strSetting, const QSize& defaultSize,
843843
QPoint pos = settings.value(strSetting + "Pos").toPoint();
844844
QSize size = settings.value(strSetting + "Size", defaultSize).toSize();
845845

846-
if (!pos.x() && !pos.y()) {
847-
QRect screen = QApplication::desktop()->screenGeometry();
848-
pos.setX((screen.width() - size.width()) / 2);
849-
pos.setY((screen.height() - size.height()) / 2);
850-
}
851-
852846
parent->resize(size);
853847
parent->move(pos);
848+
849+
if ((!pos.x() && !pos.y()) || (QApplication::desktop()->screenNumber(parent) == -1))
850+
{
851+
QRect screen = QApplication::desktop()->screenGeometry();
852+
QPoint defaultPos((screen.width() - defaultSize.width()) / 2,
853+
(screen.height() - defaultSize.height()) / 2);
854+
parent->resize(defaultSize);
855+
parent->move(defaultPos);
856+
}
854857
}
855858

856859
void setClipboard(const QString& str)

0 commit comments

Comments
 (0)