File indexing completed on 2024-05-26 05:37:03

0001 /*
0002     SPDX-FileCopyrightText: 2019 Harald Sitter <sitter@kde.org>
0003 
0004     SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL
0005 */
0006 
0007 #include "application.h"
0008 
0009 #include <QKeyEvent>
0010 
0011 bool Application::notify(QObject *receiver, QEvent *event)
0012 {
0013     if (event->type() == QEvent::KeyPress || event->type() == QEvent::KeyRelease) {
0014         Q_EMIT keyEvent(dynamic_cast<QKeyEvent *>(event));
0015     }
0016     return QGuiApplication::notify(receiver, event);
0017 }
0018 
0019 Application *Application::instance()
0020 {
0021     return qobject_cast<Application *>(qGuiApp);
0022 }