Fix ShortcutOverride for QtQuick on OSX
tryShortcutOverride on OSX gets called via QWindowSystemInterface::tryHandleShortcutEvent. This change fixes that to use the QWindow's focus object. Task-number: QTBUG-32928 Change-Id: I51beb774e1fb91e0d8e2c12d087176d917357311 Reviewed-by: Frederik Gladhorn <frederik.gladhorn@theqtcompany.com>bb10
parent
ae89aa330f
commit
929d6d6b9b
|
|
@ -201,9 +201,13 @@ bool QWindowSystemInterface::tryHandleShortcutEvent(QWindow *w, ulong timestamp,
|
|||
#ifndef QT_NO_SHORTCUT
|
||||
QGuiApplicationPrivate::modifier_buttons = mods;
|
||||
|
||||
QObject *focus = w->focusObject();
|
||||
if (!focus)
|
||||
focus = w;
|
||||
|
||||
QKeyEvent qevent(QEvent::ShortcutOverride, k, mods, text, autorep, count);
|
||||
qevent.setTimestamp(timestamp);
|
||||
return QGuiApplicationPrivate::instance()->shortcutMap.tryShortcutEvent(w, &qevent);
|
||||
return QGuiApplicationPrivate::instance()->shortcutMap.tryShortcutEvent(focus, &qevent);
|
||||
#else
|
||||
Q_UNUSED(w)
|
||||
Q_UNUSED(timestamp)
|
||||
|
|
@ -231,9 +235,13 @@ bool QWindowSystemInterface::tryHandleExtendedShortcutEvent(QWindow *w, ulong ti
|
|||
#ifndef QT_NO_SHORTCUT
|
||||
QGuiApplicationPrivate::modifier_buttons = mods;
|
||||
|
||||
QObject *focus = w->focusObject();
|
||||
if (!focus)
|
||||
focus = w;
|
||||
|
||||
QKeyEvent qevent(QEvent::ShortcutOverride, k, mods, nativeScanCode, nativeVirtualKey, nativeModifiers, text, autorep, count);
|
||||
qevent.setTimestamp(timestamp);
|
||||
return QGuiApplicationPrivate::instance()->shortcutMap.tryShortcutEvent(w, &qevent);
|
||||
return QGuiApplicationPrivate::instance()->shortcutMap.tryShortcutEvent(focus, &qevent);
|
||||
#else
|
||||
Q_UNUSED(w)
|
||||
Q_UNUSED(timestamp)
|
||||
|
|
|
|||
Loading…
Reference in New Issue