From 23e76a12b9419e1b213cbacf625d3a0b1921dd92 Mon Sep 17 00:00:00 2001 From: Samuel Gaist Date: Sun, 28 Aug 2016 17:33:35 +0200 Subject: Doc: add macOS example of QAbstractNativeEventFilter implementation MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This patch adds a sample native event filter that can be easily integrated in a project. Task-number: QTBUG-53209 Change-Id: Iedf6df33a3de5b01dc7871cca5e7897a5b485733 Reviewed-by: Topi Reiniƶ --- src/corelib/kernel/qabstractnativeeventfilter.cpp | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) (limited to 'src/corelib/kernel/qabstractnativeeventfilter.cpp') diff --git a/src/corelib/kernel/qabstractnativeeventfilter.cpp b/src/corelib/kernel/qabstractnativeeventfilter.cpp index 9892cc7333..15e6d17c18 100644 --- a/src/corelib/kernel/qabstractnativeeventfilter.cpp +++ b/src/corelib/kernel/qabstractnativeeventfilter.cpp @@ -90,7 +90,7 @@ QAbstractNativeEventFilter::~QAbstractNativeEventFilter() In both cases, the \a message can be casted to a MSG pointer. The \a result pointer is only used on Windows, and corresponds to the LRESULT pointer. - On Mac, \a eventType is set to "mac_generic_NSEvent", and the \a message can be casted to an EventRef. + On macOS, \a eventType is set to "mac_generic_NSEvent", and the \a message can be casted to an NSEvent pointer. On Blackberry (not plain QNX) \a eventType is set to "bps_event_t", and the \a message can be casted to a bps_event_t pointer. @@ -99,8 +99,19 @@ QAbstractNativeEventFilter::~QAbstractNativeEventFilter() the \a message out, i.e. stop it being handled further, return true; otherwise return false. - Example: + \b {Linux example} \snippet code/src_corelib_kernel_qabstractnativeeventfilter.cpp 0 + + \b {macOS example} + + mycocoaeventfilter.h: + \snippet code/src_corelib_kernel_qabstractnativeeventfilter.h 0 + + mycocoaeventfilter.mm: + \snippet code/src_corelib_kernel_qabstractnativeeventfilter.mm 0 + + myapp.pro: + \snippet code/src_corelib_kernel_qabstractnativeeventfilter.pro 0 */ QT_END_NAMESPACE -- cgit v1.2.3