diff options
author | Frederik Gladhorn <frederik.gladhorn@theqtcompany.com> | 2015-07-14 18:31:03 +0200 |
---|---|---|
committer | Frederik Gladhorn <frederik.gladhorn@theqtcompany.com> | 2015-08-05 16:15:05 +0000 |
commit | 4067bbc24cf7a6d3058387225d9e67ad093991cd (patch) | |
tree | 2e9a6dae92d646d5b1e7050b9ddb4224ff2bf5f7 /src/plugins/platforms/cocoa/qnsview.mm | |
parent | 771235285c5306dd385fbd0be64ab4120a916e1c (diff) |
Fix shortcut handling with modifiers
Since d7ca800a87a2291c94c6580f0cfe068bb2280caf the shortcut events were
only sent once. The one sent by QGuiApplication did not create a
QKeyEvent with the full native modifier state - basically the extended
key event expected everywhere.
That means that shortcuts on some keyboard layouts - like ctrl-shift-7 on
the German keyboard (resulting in ctrl+/) - would not work when the
shortcut override was tested from QGuiApplication, but then the same shortcut was
sent from QApplication with the full information, so it worked the
second time. Shortcuts of this type in Qt Quick were broken before.
Task-number: QTBUG-47062
Change-Id: I8390b9a96d0d998a2a538ac65503702e0d299cc7
Reviewed-by: Andy Shaw <andy.shaw@theqtcompany.com>
Reviewed-by: Gatis Paeglis <gatis.paeglis@digia.com>
Diffstat (limited to 'src/plugins/platforms/cocoa/qnsview.mm')
-rw-r--r-- | src/plugins/platforms/cocoa/qnsview.mm | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/plugins/platforms/cocoa/qnsview.mm b/src/plugins/platforms/cocoa/qnsview.mm index 456c9d8c68..d802a36676 100644 --- a/src/plugins/platforms/cocoa/qnsview.mm +++ b/src/plugins/platforms/cocoa/qnsview.mm @@ -1430,8 +1430,12 @@ static QTabletEvent::TabletDevice wacomTabletDevice(NSEvent *theEvent) if (eventType == QEvent::KeyPress) { - if (m_composingText.isEmpty()) - m_sendKeyEvent = !QWindowSystemInterface::tryHandleShortcutEvent(focusWindow, timestamp, keyCode, modifiers, text, [nsevent isARepeat], 1); + if (m_composingText.isEmpty()) { + QKeyEvent override(QEvent::ShortcutOverride, keyCode, modifiers, + nativeScanCode, nativeVirtualKey, nativeModifiers, text, [nsevent isARepeat], 1); + override.setTimestamp(timestamp); + m_sendKeyEvent = !QWindowSystemInterface::tryHandleShortcutOverrideEvent(focusWindow, &override); + } QObject *fo = QGuiApplication::focusObject(); if (m_sendKeyEvent && fo) { |