QGIS API Documentation
3.99.0-Master (26c88405ac0)
Loading...
Searching...
No Matches
src
gui
qgsfocuskeeper.cpp
Go to the documentation of this file.
1
/***************************************************************************
2
qgsfocuskeeper.cpp
3
-----------------
4
Date : May 2020
5
Copyright : (C) 2020 Even Rouault
6
Email : even dot rouault at spatialys dot com
7
***************************************************************************
8
* *
9
* This program is free software; you can redistribute it and/or modify *
10
* it under the terms of the GNU General Public License as published by *
11
* the Free Software Foundation; either version 2 of the License, or *
12
* (at your option) any later version. *
13
* *
14
***************************************************************************/
15
16
#include "
qgsfocuskeeper.h
"
17
18
#include <QApplication>
19
#include <QEvent>
20
#include <QWidget>
21
22
#include "moc_qgsfocuskeeper.cpp"
23
24
QgsFocusKeeper::QgsFocusKeeper
()
25
: mWidgetToKeepFocused( QApplication::focusWidget() )
26
{
27
if
( mWidgetToKeepFocused )
28
mWidgetToKeepFocused->installEventFilter(
this
);
29
}
30
31
QgsFocusKeeper::~QgsFocusKeeper
()
32
{
33
if
( mWidgetToKeepFocused )
34
mWidgetToKeepFocused->removeEventFilter(
this
);
35
}
36
37
bool
QgsFocusKeeper::eventFilter
( QObject *obj, QEvent *event )
38
{
39
if
( obj == mWidgetToKeepFocused && event && ( event->type() == QEvent::FocusOut || event->type() == QEvent::FocusAboutToChange ) )
40
{
41
return
true
;
42
}
43
return
QObject::eventFilter( obj, event );
44
}
QgsFocusKeeper::~QgsFocusKeeper
~QgsFocusKeeper() override
Definition
qgsfocuskeeper.cpp:31
QgsFocusKeeper::eventFilter
bool eventFilter(QObject *obj, QEvent *event) override
Definition
qgsfocuskeeper.cpp:37
QgsFocusKeeper::QgsFocusKeeper
QgsFocusKeeper()
Definition
qgsfocuskeeper.cpp:24
qgsfocuskeeper.h
Generated on
for QGIS API Documentation by
1.15.0