From d3baa13dadefc635fc56688fb168d8e5ca3be6b2 Mon Sep 17 00:00:00 2001 From: Raul Metsma Date: Thu, 25 Aug 2022 08:21:47 +0300 Subject: [PATCH] Workaround Qt 5.9 build (#1111) IB-7411 Signed-off-by: Raul Metsma Signed-off-by: Raul Metsma --- .github/workflows/build.yml | 2 +- client/Application.cpp | 17 +++++++++++++++-- 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 0975c97be..6f3a95808 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -146,7 +146,7 @@ jobs: toolset: 14.29 - vcver: 143 image: windows-2022 - toolset: 14.32 + toolset: 14.33 - vcver: 142 arch: x86 qtver: 5.12.12 diff --git a/client/Application.cpp b/client/Application.cpp index ef09e1419..e5fe516a7 100644 --- a/client/Application.cpp +++ b/client/Application.cpp @@ -1109,8 +1109,21 @@ void Application::showClient(const QStringList ¶ms, bool crypto, bool sign, #ifdef Q_OS_LINUX else { - QRect rect = QGuiApplication::screenAt(w->pos())->availableGeometry(); - w->move(rect.center() - w->frameGeometry().adjusted(0, 0, 10, 40).center()); +#if QT_VERSION < QT_VERSION_CHECK(5, 10, 0) + QScreen *screen = [w]() -> QScreen* { + for (const QScreen *screen : QGuiApplication::screens()) { + for (QScreen *sibling : screen->virtualSiblings()) { + if (sibling->geometry().contains(w->pos())) + return sibling; + } + } + return nullptr; + }(); +#else + QScreen *screen = QGuiApplication::screenAt(w->pos()); +#endif + if(screen) + w->move(screen->availableGeometry().center() - w->frameGeometry().adjusted(0, 0, 10, 40).center()); } #endif }