Investigating this bug in-between release tasks. I'm starting to think
we might not be able to fix this without modifying Qt5 in the end.
Looking at Qt5 QShortcut code, there even is a very specific 'hack' to
enable shortcuts for MacOSX systems that also have a global menu. The
shortcut map is being passed a contextMatcher, and one of the first
checks in the context matcher is the check if the owning widget is
visible or not. In the case of the usage of platform menu bars, as
mentioned in comment #6, the source QMenuBar is hidden. In other words,
at that place the shortcut is basically not considered when the widget
is not visible. So how does OSX still have shortcuts working? By an ugly
ifdef in the Qt code:

    bool visible = w->isVisible();
#ifdef Q_OS_MAC
    if (!qApp->testAttribute(Qt::AA_DontUseNativeMenuBar) && 
qobject_cast<QMenuBar *>(w))
        visible = true;
#endif

    if (!visible || !w->isEnabled())
        return false;

So basically OSX is a 'special case' here. I hate ifdefs... this should
really be some configurable option, or even better - some option you can
define in the QPlatformTheme or QPlatformMenu* objects.

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/1380702

Title:
  No keyboards shortcuts in QT apps

To manage notifications about this bug go to:
https://bugs.launchpad.net/appmenu-qt5/+bug/1380702/+subscriptions

-- 
ubuntu-bugs mailing list
ubuntu-bugs@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to