Qt 6.x
The Qt SDK
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
filterobject.cpp
Go to the documentation of this file.
1// Copyright (C) 2016 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
3
4#include <QtGui>
5
6#include "filterobject.h"
7
10{
11}
12
15{
16 if (object == target && event->type() == QEvent::KeyPress) {
17 QKeyEvent *keyEvent = static_cast<QKeyEvent *>(event);
18 if (keyEvent->key() == Qt::Key_Tab) {
19 // Special tab handling
20 return true;
21 } else
22 return false;
23 }
24 return false;
25}
27
29{
30 if (target)
31 target->removeEventFilter(this);
32
33 target = object;
34
35 if (target)
36 target->installEventFilter(this);
37}
bool eventFilter(QObject *object, QEvent *event) override
[0]
FilterObject(QObject *parent=nullptr)
void setFilteredObject(QObject *object)
[0]
\inmodule QtCore
Definition qcoreevent.h:45
@ KeyPress
Definition qcoreevent.h:64
The QKeyEvent class describes a key event.
Definition qevent.h:423
int key() const
Returns the code of the key that was pressed or released.
Definition qevent.h:433
\inmodule QtCore
Definition qobject.h:90
@ Key_Tab
Definition qnamespace.h:659
GLuint object
[3]
GLenum target
struct _cl_event * event
IUIAutomationTreeWalker __RPC__deref_out_opt IUIAutomationElement ** parent