mirror of
https://github.com/nextcloud/desktop.git
synced 2024-11-23 13:35:58 +03:00
Fallback to primary screen if screen under pointer not found
Fixes #3252 Signed-off-by: Felix Weilbach <felix.weilbach@nextcloud.com>
This commit is contained in:
parent
8716877e61
commit
aadee15008
1 changed files with 4 additions and 1 deletions
|
@ -116,7 +116,10 @@ OwncloudWizard::OwncloudWizard(QWidget *parent)
|
|||
void OwncloudWizard::centerWindow()
|
||||
{
|
||||
const auto wizardWindow = window();
|
||||
const auto screenGeometry = QGuiApplication::screenAt(wizardWindow->pos())->geometry();
|
||||
const auto screen = QGuiApplication::screenAt(wizardWindow->pos())
|
||||
? QGuiApplication::screenAt(wizardWindow->pos())
|
||||
: QGuiApplication::primaryScreen();
|
||||
const auto screenGeometry = screen->geometry();
|
||||
const auto windowGeometry = wizardWindow->geometry();
|
||||
const auto newWindowPosition = screenGeometry.center() - QPoint(windowGeometry.width() / 2, windowGeometry.height() / 2);
|
||||
wizardWindow->move(newWindowPosition);
|
||||
|
|
Loading…
Reference in a new issue