Details
-
Bug
-
Resolution: Done
-
P2: Important
-
5.9.2, 5.10.0 Beta 4
-
None
-
a79feeee451bcf28673292555795677a789e8513
Description
when a QML scene is embedded in a QQuickWidget and the Shortcut {} element is used, the shortcut won't actually work, because in qquickshortcut.cpp, the matcher does:
static bool qQuickShortcutContextMatcher(QObject *obj, Qt::ShortcutContext context)
{
switch (context) {
case Qt::ApplicationShortcut:
return true;
case Qt::WindowShortcut:
while (obj && !obj->isWindowType()) {
obj = obj->parent();
if (QQuickItem *item = qobject_cast<QQuickItem *>(obj))
obj = item->window();
}
return obj && obj == QGuiApplication::focusWindow();
default:
return false;
}
}
so it will never match as the internal QWindow of a QQuickWidget will never be the qguiapplication's focusWindow
Attachments
Issue Links
- duplicates
-
QTBUG-62990 QML Shortcut does not work with Qt.WindowShortcut with QQuickWidget
- Closed
- is duplicated by
-
QTBUG-64367 Shortcut in QML foes not work with QQuickRenderControl
- Closed
- relates to
-
QTBUG-64367 Shortcut in QML foes not work with QQuickRenderControl
- Closed