Fix contextmenu actions for Qt5 78/head
authorSebastian Goth <seezer@roath.org>
Tue, 17 Jun 2014 19:33:21 +0000 (21:33 +0200)
committerSebastian Goth <seezer@roath.org>
Tue, 17 Jun 2014 19:36:21 +0000 (21:36 +0200)
As documented for QObject::connectNotify

src/uisupport/actioncollection.cpp
src/uisupport/actioncollection.h

index 4ebb65b..c918c82 100644 (file)
@@ -203,7 +203,7 @@ void ActionCollection::actionDestroyed(QObject *obj)
 }
 
 #if QT_VERSION >= 0x050000
-void ActionCollection::connectNotify(const QMetaMethod &method)
+void ActionCollection::connectNotify(const QMetaMethod &signal)
 #else
 void ActionCollection::connectNotify(const char *signal)
 #endif
@@ -212,17 +212,21 @@ void ActionCollection::connectNotify(const char *signal)
         return;
 
 #if QT_VERSION >= 0x050000
-    QByteArray signal = method.methodSignature();
-#endif
-
+    if (QMetaMethod::fromSignal(&ActionCollection::actionHovered) == signal) {
+#else
     if (QMetaObject::normalizedSignature(SIGNAL(actionHovered(QAction *))) == signal) {
+#endif
         if (!_connectHovered) {
             _connectHovered = true;
             foreach(QAction* action, actions())
             connect(action, SIGNAL(hovered()), SLOT(slotActionHovered()));
         }
     }
+#if QT_VERSION >= 0x050000
+    else if (QMetaMethod::fromSignal(&ActionCollection::actionTriggered) == signal) {
+#else
     else if (QMetaObject::normalizedSignature(SIGNAL(actionTriggered(QAction *))) == signal) {
+#endif
         if (!_connectTriggered) {
             _connectTriggered = true;
             foreach(QAction* action, actions())
@@ -230,11 +234,7 @@ void ActionCollection::connectNotify(const char *signal)
         }
     }
 
-#if QT_VERSION >= 0x050000
-    QObject::connectNotify(method);
-#else
     QObject::connectNotify(signal);
-#endif
 }
 
 
index 22b0748..d14981a 100644 (file)
@@ -97,7 +97,7 @@ signals:
 
 protected slots:
 #if QT_VERSION >= 0x050000
-    virtual void connectNotify(const QMetaMethod &method);
+    virtual void connectNotify(const QMetaMethod &signal);
 #else
     virtual void connectNotify(const char *signal);
 #endif