Skip to content

Commit 51833a1

Browse files
committed
Merge #10156: Fix for issues with startup and multiple monitors on windows.
e9ff818 Fix for issues with startup and multiple monitors on windows. (Allan Doensen) Tree-SHA512: 8502042a9b5a2fd6f5e409163bee9bd7c85e34c158754f393065f8cc6cdd0f8505b9a1803069d01fc1fb2df04d1b2ed6291388851f2ed3608eb2dd53fc22e06e
2 parents 1fa4ae6 + e9ff818 commit 51833a1

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

858-
if (!pos.x() && !pos.y()) {
859-
QRect screen = QApplication::desktop()->screenGeometry();
860-
pos.setX((screen.width() - size.width()) / 2);
861-
pos.setY((screen.height() - size.height()) / 2);
862-
}
863-
864858
parent->resize(size);
865859
parent->move(pos);
860+
861+
if ((!pos.x() && !pos.y()) || (QApplication::desktop()->screenNumber(parent) == -1))
862+
{
863+
QRect screen = QApplication::desktop()->screenGeometry();
864+
QPoint defaultPos((screen.width() - defaultSize.width()) / 2,
865+
(screen.height() - defaultSize.height()) / 2);
866+
parent->resize(defaultSize);
867+
parent->move(defaultPos);
868+
}
866869
}
867870

868871
void setClipboard(const QString& str)

0 commit comments

Comments
 (0)