diff options
author | Morten Johan Sørvig <morten.sorvig@theqtcompany.com> | 2015-11-10 16:01:01 +0100 |
---|---|---|
committer | Timur Pocheptsov <timur.pocheptsov@theqtcompany.com> | 2016-03-21 16:26:27 +0000 |
commit | 68987d5454a347807c227ba3e2e2db3e050911df (patch) | |
tree | 1875d76a306dc17f11ec167d41db8af151ed6646 /src/plugins/platforms/cocoa/qnsview.h | |
parent | 820e69d6c214f95e6db101c6e7caf28b0a248c69 (diff) |
Cocoa: Forward rejected key events.
Forward rejected key events to the next responder
by checking the return value from QWindowSystemInterface
and calling the superclass event handler.
This is useful when Qt is running as a plugin in a
host application; the host can now react to key
events even if Qt has focus.
Qt will often not accept keyUp events, even if the
corresponding keyDown was accepted, for example in
the case of text controls. We don't want to forward
'bare' keyUps, so keep track of which keyDowns have
been seen.
Change-Id: I976448a5d305a657a0e91aeb271b158f8b598286
Task-number: QTBUG-45768
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@theqtcompany.com>
Diffstat (limited to 'src/plugins/platforms/cocoa/qnsview.h')
-rw-r--r-- | src/plugins/platforms/cocoa/qnsview.h | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/plugins/platforms/cocoa/qnsview.h b/src/plugins/platforms/cocoa/qnsview.h index 59df75b980..e5f136d0cd 100644 --- a/src/plugins/platforms/cocoa/qnsview.h +++ b/src/plugins/platforms/cocoa/qnsview.h @@ -43,6 +43,7 @@ #include <AppKit/AppKit.h> #include <QtCore/QPointer> +#include <QtCore/QSet> #include <QtGui/QImage> #include <QtGui/QAccessible> @@ -85,6 +86,7 @@ Q_FORWARD_DECLARE_OBJC_CLASS(QT_MANGLE_NAMESPACE(QNSViewMouseMoveHelper)); bool m_exposedOnMoveToWindow; NSEvent *m_currentlyInterpretedKeyEvent; bool m_isMenuView; + QSet<quint32> m_acceptedKeyDowns; } - (id)init; @@ -142,7 +144,7 @@ Q_FORWARD_DECLARE_OBJC_CLASS(QT_MANGLE_NAMESPACE(QNSViewMouseMoveHelper)); - (int) convertKeyCode : (QChar)keyCode; + (Qt::KeyboardModifiers) convertKeyModifiers : (ulong)modifierFlags; -- (void)handleKeyEvent:(NSEvent *)theEvent eventType:(int)eventType; +- (bool)handleKeyEvent:(NSEvent *)theEvent eventType:(int)eventType; - (void)keyDown:(NSEvent *)theEvent; - (void)keyUp:(NSEvent *)theEvent; |