Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
Loading...
Searching...
No Matches
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
9 : QObject(parent), target(0)
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:424
int key() const
Returns the code of the key that was pressed or released.
Definition qevent.h:434
\inmodule QtCore
Definition qobject.h:103
@ Key_Tab
Definition qnamespace.h:664
GLuint object
[3]
GLenum target
struct _cl_event * event