File indexing completed on 2025-03-16 05:18:23

0001 /*
0002  * Copyright 2020 by Aditya Mehra <aix.m@outlook.com>
0003  *
0004  * Licensed under the Apache License, Version 2.0 (the "License");
0005  * you may not use this file except in compliance with the License.
0006  * You may obtain a copy of the License at
0007  *
0008  *    http://www.apache.org/licenses/LICENSE-2.0
0009  *
0010  * Unless required by applicable law or agreed to in writing, software
0011  * distributed under the License is distributed on an "AS IS" BASIS,
0012  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
0013  * See the License for the specific language governing permissions and
0014  * limitations under the License.
0015  *
0016  */
0017 
0018 #include <QtGui>
0019 #include <QtQml>
0020 #include "keyfilter.h"
0021 
0022 KeyFilter::KeyFilter(QObject *parent) 
0023     : QObject(parent)
0024 {
0025 }
0026 
0027 bool KeyFilter::eventFilter(QObject *watched, QEvent *event)
0028 {
0029     QKeyEvent *key = static_cast<QKeyEvent *>(event);
0030     if (event->type() == QEvent::KeyPress && key->key() == Qt::Key_Back) {
0031             globalBackReceived();
0032             return true;
0033     }
0034     return false;
0035 }