QAbstractNativeEventFilter: Add a Windows example

Change-Id: Ic378174e7f192abc27524cbcd925705c8bb46502
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
This commit is contained in:
Laszlo Papp 2022-08-01 19:10:48 +01:00
parent 357db9ceab
commit aa69457533
2 changed files with 23 additions and 0 deletions

View File

@ -0,0 +1,20 @@
// Copyright (C) 2022 Laszlo Papp <lpapp@kde.org>
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
//! [0]
class MyMSGEventFilter : public QAbstractNativeEventFilter
{
public:
bool nativeEventFilter(const QByteArray &eventType, void *message, qintptr *) override
{
if (eventType == "windows_generic_MSG") {
MSG *msg = static_cast<MSG *>(message);
// ...
} else if (eventType == "windows_dispatcher_MSG") {
MSG *msg = static_cast<MSG *>(message);
// ...
}
return false;
}
};
//! [0]

View File

@ -69,6 +69,9 @@ QAbstractNativeEventFilter::~QAbstractNativeEventFilter()
\b {Linux example}
\snippet code/src_corelib_kernel_qabstractnativeeventfilter.cpp 0
\b {Windows example}
\snippet code/src_corelib_kernel_qabstractnativeeventfilter_win.cpp 0
\b {macOS example}
mycocoaeventfilter.h: