Debian Codegraph @

src/album/controller/globaleventfilter.cpp

raw
1 /*
2 * Copyright (C) 2020 ~ 2021 Uniontech Software Technology Co., Ltd.
3 *
4 * Author: ZhangYong <[email protected]>
5 *
6 * Maintainer: ZhangYong <[email protected]>
7 *
8 * This program is free software: you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation, either version 3 of the License, or
11 * any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program. If not, see <http://www.gnu.org/licenses/>.
20 */
21 #include "globaleventfilter.h"
22 #include "utils/baseutils.h"
23 #include <QDebug>
24 #include <QEvent>
25 #include <QWindowStateChangeEvent>
26
27 GlobalEventFilter::GlobalEventFilter(QObject *parent) : QObject(parent)
28 {
29
30 }
31
32 bool GlobalEventFilter::eventFilter(QObject *obj, QEvent *e)
33 {
34 Q_UNUSED(obj)
35 if (e->type() == QEvent::KeyPress) {
36 QKeyEvent *event = static_cast<QKeyEvent *>(e);
37 if (event->key() == Qt::Key_Tab) {
38 event->ignore();
39 return true;
40 }
41 }
42
43 // if (e->type() != QEvent::Paint &&
44 // e->type() != QEvent::MetaCall &&
45 // e->type() != QEvent::UpdateRequest &&
46 // e->type() != QEvent::MouseMove &&
47 // e->type() != QEvent::ChildAdded &&
48 // e->type() != QEvent::ChildRemoved &&
49 // e->type() != QEvent::LayoutRequest &&
50 // e->type() != QEvent::Move &&
51 // e->type() != QEvent::Timer &&
52 // e->type() != QEvent::FutureCallOut &&
53 // e->type() != QEvent::DeferredDelete &&
54 // e->type() != QEvent::Resize) {
55
56 // qDebug() << e->type();
57 // }
58 // if (e->type() == QEvent::WindowStateChange) {
59 // if (QWindowStateChangeEvent *we = static_cast<QWindowStateChangeEvent *>(e)) {
60 // emit SignalManager::instance()->windowStatesChanged(we->oldState());
61 // }
62 // }
63 return false;
64 }