diff framework/MainWindowBase.cpp @ 443:345d41a3567f tonioni

Revisit menu items without shortcuts, now that fixes are arriving in Qt
author Chris Cannam
date Wed, 25 Mar 2015 11:01:18 +0000
parents 7fa74786dec5
children ba789baf642b
line wrap: on
line diff
--- a/framework/MainWindowBase.cpp	Tue Mar 24 16:41:38 2015 +0000
+++ b/framework/MainWindowBase.cpp	Wed Mar 25 11:01:18 2015 +0000
@@ -345,6 +345,12 @@
     // "ambiguous shortcut" errors from the menu entry actions and
     // will need to update the code.)
 
+    // Update: The bug was fixed in Qt 5.4 for shortcuts with no
+    // modifier, and I believe it is fixed in Qt 5.5 for shortcuts
+    // with Shift modifiers. The below reflects that
+
+#if (QT_VERSION < QT_VERSION_CHECK(5, 5, 0))
+
     if (!m_menuShortcutMapper) {
         m_menuShortcutMapper = new QSignalMapper(this);
         connect(m_menuShortcutMapper, SIGNAL(mapped(QObject *)),
@@ -374,9 +380,17 @@
             // working and that we need to handle here includes those
             // with the Shift modifier mask as well as those with no
             // modifier at all
+#if (QT_VERSION >= QT_VERSION_CHECK(5, 5, 0))
+            // Nothing needed
+            if (false) {
+#elif (QT_VERSION >= QT_VERSION_CHECK(5, 4, 0))
+            if (sc.count() == 1 &&
+                (sc[0] & Qt::KeyboardModifierMask) == Qt::ShiftModifier) {
+#else
             if (sc.count() == 1 &&
                 ((sc[0] & Qt::KeyboardModifierMask) == Qt::NoModifier ||
                  (sc[0] & Qt::KeyboardModifierMask) == Qt::ShiftModifier)) {
+#endif
                 QShortcut *newSc = new QShortcut(sc, a->parentWidget());
                 QObject::connect(newSc, SIGNAL(activated()),
                                  m_menuShortcutMapper, SLOT(map()));
@@ -386,6 +400,7 @@
         }
     }
 #endif
+#endif
 }
 
 void