Tray: Enable workaround for Qt5 only #3765
authorChristian Kamm <mail@ckamm.de>
Mon, 7 Sep 2015 05:44:07 +0000 (07:44 +0200)
committerChristian Kamm <mail@ckamm.de>
Mon, 7 Sep 2015 05:44:07 +0000 (07:44 +0200)
src/gui/owncloudgui.cpp

index 359baeb0101088692f4d37108b8ecb8ce88700f8..0aa7d431941005b9548cd09f15266478637d794f 100644 (file)
@@ -395,12 +395,19 @@ void ownCloudGui::setupContextMenu()
         // In particular QTBUG-47863 #3672 (tray menu fails to update and
         // becomes unresponsive) and QTBUG-48068 #3722 (click signal is
         // emitted several times)
+        // The Qt version check intentionally uses 5.0.0 (where platformMenu()
+        // was introduced) instead of 5.5.0 to avoid issues where the Qt
+        // version used to build is different from the one used at runtime.
+#ifdef Q_OS_LINUX
+#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
         QObject* platformMenu = reinterpret_cast<QObject*>(_tray->contextMenu()->platformMenu());
         if (platformMenu
                 && platformMenu->metaObject()->className() == QLatin1String("QDBusPlatformMenu")) {
             _qdbusmenuWorkaround = true;
             qDebug() << "Enabled QDBusPlatformMenu workaround";
         }
+#endif
+#endif
     }
     _contextMenu->setTitle(Theme::instance()->appNameGUI() );
     // We must call deleteLater because we might be called from the press in one of the action.