From: Dominique Fuchs <32204802+DominiqueFuchs@users.noreply.github.com> Date: Thu, 2 Jan 2020 07:56:07 +0000 (+0100) Subject: Fall back to primary screen on QT version < 5.10 instead of icon position detection X-Git-Tag: archive/raspbian/3.16.7-1_deb13u1+rpi1~1^2~222^2^2~413^2~90 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=d4b334636e70263f3e8344102dfb2dd8196c548b;p=nextcloud-desktop.git Fall back to primary screen on QT version < 5.10 instead of icon position detection Signed-off-by: Dominique Fuchs <32204802+DominiqueFuchs@users.noreply.github.com> --- diff --git a/src/gui/systray.cpp b/src/gui/systray.cpp index 520450dd9..642b49453 100644 --- a/src/gui/systray.cpp +++ b/src/gui/systray.cpp @@ -101,7 +101,12 @@ void Systray::setToolTip(const QString &tip) int Systray::calcTrayWindowX() { - QScreen* trayScreen = QGuiApplication::screenAt(this->geometry().topRight()); +#if QT_VERSION >= QT_VERSION_CHECK(5, 10, 0) + QScreen *trayScreen = QGuiApplication::screenAt(this->geometry().topRight()); +#else + QScreen *trayScreen = QGuiApplication::primaryScreen(); +#endif + // get coordinates from top center point of tray icon int trayIconTopCenterX = (this->geometry().topRight() - ((this->geometry().topRight() - this->geometry().topLeft()) * 0.5)).x(); int trayIconTopCenterY = (this->geometry().topRight() - ((this->geometry().topRight() - this->geometry().topLeft()) * 0.5)).y(); @@ -129,7 +134,12 @@ int Systray::calcTrayWindowX() } int Systray::calcTrayWindowY() { +#if QT_VERSION >= QT_VERSION_CHECK(5,10,0) QScreen *trayScreen = QGuiApplication::screenAt(this->geometry().topRight()); +#else + QScreen *trayScreen = QGuiApplication::primaryScreen(); +#endif + // get coordinates from top center point of tray icon int trayIconTopCenterX = (this->geometry().topRight() - ((this->geometry().topRight() - this->geometry().topLeft()) * 0.5)).x(); int trayIconTopCenterY = (this->geometry().topRight() - ((this->geometry().topRight() - this->geometry().topLeft()) * 0.5)).y();