diff options
author | Laszlo Papp <lpapp@kde.org> | 2022-08-01 19:10:48 +0100 |
---|---|---|
committer | Laszlo Papp <lpapp@kde.org> | 2022-08-02 19:12:39 +0100 |
commit | aa694575331ea0bda30cb4cc76174ced4d20df89 (patch) | |
tree | 1975f31002df0dc86941aba64ff8ab7065ed7c67 /src/corelib/doc/snippets/code | |
parent | 357db9ceabddcdce95ee1bc7f534eb00e6e10bad (diff) |
QAbstractNativeEventFilter: Add a Windows example
Change-Id: Ic378174e7f192abc27524cbcd925705c8bb46502
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'src/corelib/doc/snippets/code')
-rw-r--r-- | src/corelib/doc/snippets/code/src_corelib_kernel_qabstractnativeeventfilter_win.cpp | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/src/corelib/doc/snippets/code/src_corelib_kernel_qabstractnativeeventfilter_win.cpp b/src/corelib/doc/snippets/code/src_corelib_kernel_qabstractnativeeventfilter_win.cpp new file mode 100644 index 0000000000..de03f7b6d4 --- /dev/null +++ b/src/corelib/doc/snippets/code/src_corelib_kernel_qabstractnativeeventfilter_win.cpp @@ -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] |