# HG changeset patch # User Chris Cannam # Date 1427281278 0 # Node ID 345d41a3567f44ff4febf5ef4c4022e79d31eba4 # Parent 88ae0e53a5da2fdab673fb1f3921c2d57071ca7a Revisit menu items without shortcuts, now that fixes are arriving in Qt diff -r 88ae0e53a5da -r 345d41a3567f framework/MainWindowBase.cpp --- 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