| Line | Source Code | Coverage |
|---|
| 1 | /**************************************************************************** | - |
| 2 | ** | - |
| 3 | ** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). | - |
| 4 | ** Contact: http://www.qt-project.org/legal | - |
| 5 | ** | - |
| 6 | ** This file is part of the QtCore module of the Qt Toolkit. | - |
| 7 | ** | - |
| 8 | ** $QT_BEGIN_LICENSE:LGPL$ | - |
| 9 | ** Commercial License Usage | - |
| 10 | ** Licensees holding valid commercial Qt licenses may use this file in | - |
| 11 | ** accordance with the commercial license agreement provided with the | - |
| 12 | ** Software or, alternatively, in accordance with the terms contained in | - |
| 13 | ** a written agreement between you and Digia. For licensing terms and | - |
| 14 | ** conditions see http://qt.digia.com/licensing. For further information | - |
| 15 | ** use the contact form at http://qt.digia.com/contact-us. | - |
| 16 | ** | - |
| 17 | ** GNU Lesser General Public License Usage | - |
| 18 | ** Alternatively, this file may be used under the terms of the GNU Lesser | - |
| 19 | ** General Public License version 2.1 as published by the Free Software | - |
| 20 | ** Foundation and appearing in the file LICENSE.LGPL included in the | - |
| 21 | ** packaging of this file. Please review the following information to | - |
| 22 | ** ensure the GNU Lesser General Public License version 2.1 requirements | - |
| 23 | ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. | - |
| 24 | ** | - |
| 25 | ** In addition, as a special exception, Digia gives you certain additional | - |
| 26 | ** rights. These rights are described in the Digia Qt LGPL Exception | - |
| 27 | ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. | - |
| 28 | ** | - |
| 29 | ** GNU General Public License Usage | - |
| 30 | ** Alternatively, this file may be used under the terms of the GNU | - |
| 31 | ** General Public License version 3.0 as published by the Free Software | - |
| 32 | ** Foundation and appearing in the file LICENSE.GPL included in the | - |
| 33 | ** packaging of this file. Please review the following information to | - |
| 34 | ** ensure the GNU General Public License version 3.0 requirements will be | - |
| 35 | ** met: http://www.gnu.org/copyleft/gpl.html. | - |
| 36 | ** | - |
| 37 | ** | - |
| 38 | ** $QT_END_LICENSE$ | - |
| 39 | ** | - |
| 40 | ****************************************************************************/ | - |
| 41 | | - |
| 42 | #include "qabstractnativeeventfilter.h" | - |
| 43 | #include "qabstracteventdispatcher.h" | - |
| 44 | | - |
| 45 | QT_BEGIN_NAMESPACE | - |
| 46 | | - |
| 47 | /*! | - |
| 48 | \class QAbstractNativeEventFilter | - |
| 49 | \inmodule QtCore | - |
| 50 | \since 5.0 | - |
| 51 | | - |
| 52 | \brief The QAbstractNativeEventFilter class provides an interface for receiving native | - |
| 53 | events, such as MSG or XCB event structs. | - |
| 54 | */ | - |
| 55 | | - |
| 56 | /*! | - |
| 57 | Creates a native event filter. | - |
| 58 | | - |
| 59 | By default this doesn't do anything. Remember to install it on the application | - |
| 60 | object. | - |
| 61 | */ | - |
| 62 | QAbstractNativeEventFilter::QAbstractNativeEventFilter() | - |
| 63 | { | - |
| 64 | } | - |
| 65 | | - |
| 66 | /*! | - |
| 67 | Destroys the native event filter. | - |
| 68 | | - |
| 69 | This automatically removes it from the application. | - |
| 70 | */ | - |
| 71 | QAbstractNativeEventFilter::~QAbstractNativeEventFilter() | - |
| 72 | { | - |
| 73 | QAbstractEventDispatcher *eventDispatcher = QAbstractEventDispatcher::instance(); executed (the execution status of this line is deduced): QAbstractEventDispatcher *eventDispatcher = QAbstractEventDispatcher::instance(); | - |
| 74 | if (eventDispatcher) partially evaluated: eventDispatcher| yes Evaluation Count:1 | no Evaluation Count:0 |
| 0-1 |
| 75 | eventDispatcher->removeNativeEventFilter(this); executed: eventDispatcher->removeNativeEventFilter(this);Execution Count:1 | 1 |
| 76 | } executed: }Execution Count:1 | 1 |
| 77 | | - |
| 78 | /*! | - |
| 79 | \fn bool QAbstractNativeEventFilter::nativeEventFilter(const QByteArray &eventType, void *message, long *result) | - |
| 80 | | - |
| 81 | This method is called for every native event. | - |
| 82 | | - |
| 83 | \note The filter function here receives native messages, | - |
| 84 | for example, MSG or XCB event structs. | - |
| 85 | | - |
| 86 | It is called by the QPA platform plugin. On Windows, it is called by | - |
| 87 | the event dispatcher. | - |
| 88 | | - |
| 89 | The type of event \a eventType is specific to the platform plugin chosen at run-time, | - |
| 90 | and can be used to cast \a message to the right type. | - |
| 91 | | - |
| 92 | On X11, \a eventType is set to "xcb_generic_event_t", and the \a message can be casted | - |
| 93 | to a xcb_generic_event_t pointer. | - |
| 94 | | - |
| 95 | On Windows, \a eventType is set to "windows_generic_MSG" for messages sent to toplevel windows, | - |
| 96 | and "windows_dispatcher_MSG" for system-wide messages such as messages from a registered hot key. | - |
| 97 | In both cases, the \a message can be casted to a MSG pointer. | - |
| 98 | The \a result pointer is only used on Windows, and corresponds to the LRESULT pointer. | - |
| 99 | | - |
| 100 | On Mac, \a eventType is set to "mac_generic_NSEvent", and the \a message can be casted to an EventRef. | - |
| 101 | | - |
| 102 | On Blackberry (not plain QNX) \a eventType is set to "bps_event_t", and the \a message can be casted | - |
| 103 | to a bps_event_t pointer. | - |
| 104 | | - |
| 105 | In your reimplementation of this function, if you want to filter | - |
| 106 | the \a message out, i.e. stop it being handled further, return | - |
| 107 | true; otherwise return false. | - |
| 108 | | - |
| 109 | Example: | - |
| 110 | \snippet code/src_corelib_kernel_qabstractnativeeventfilter.cpp 0 | - |
| 111 | */ | - |
| 112 | | - |
| 113 | QT_END_NAMESPACE | - |
| 114 | | - |
| | |