On Wed, Jul 16, 2014 at 11:28:48PM +0200, Enrico Forestieri wrote:
> On Wed, Jul 16, 2014 at 10:57:55PM +0200, Enrico Forestieri wrote:
> >
> > It seems to be a known Qt5 "feature", related to ShortcutOverride events.
> > See https://bugreports.qt-project.org/browse/QTBUG-30164
>
> Sorry, that bug was for Macs, here is the right one:
> https://bugreports.qt-project.org/browse/QTBUG-38986
I have applied the patch mentioned there to the 5.3.0 sources and
recompiled libQt5Widgets. After replacing the shared library, the
problem with the tab key and the shortcuts disappeared. So, the
next release should fix this issue. I attach here the patch I used.
--
Enrico
Index: src/widgets/kernel/qapplication.cpp
===================================================================
--- src/widgets/kernel/qapplication.cpp.old 2014-05-15 19:12:12.000000000
+0200
+++ src/widgets/kernel/qapplication.cpp 2014-07-16 23:57:24.000000000 +0200
@@ -2926,14 +2926,15 @@
QKeyEvent* key = static_cast<QKeyEvent*>(e);
#ifndef QT_NO_SHORTCUT
// Try looking for a Shortcut before sending key events
- QObject *shortcutReceiver = receiver;
+ QObject *shortcutReceiver = Q_NULLPTR;
if (!isWidget && isWindow) {
- QWindow *w = qobject_cast<QWindow *>(receiver);
- QObject *focus = w ? w->focusObject() : 0;
- if (focus)
+ QObject *focus = static_cast<QWindow
*>(receiver)->focusObject();
+ if (focus && !focus->isWidgetType()) // QWidgetWindow
takes care.
shortcutReceiver = focus;
+ } else {
+ shortcutReceiver = receiver;
}
- if
(qApp->d_func()->shortcutMap.tryShortcutEvent(shortcutReceiver, key))
+ if (shortcutReceiver &&
d->shortcutMap.tryShortcutEvent(shortcutReceiver, key))
return true;
#endif
qt_in_tab_key_event = (key->key() == Qt::Key_Backtab