QGIS API Documentation
3.41.0-Master (fda2aa46e9a)
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
#include "moc_qgsfocuskeeper.cpp"
18
19
#include <QApplication>
20
#include <QEvent>
21
#include <QWidget>
22
23
QgsFocusKeeper::QgsFocusKeeper
(): mWidgetToKeepFocused( QApplication::focusWidget() )
24
{
25
if
( mWidgetToKeepFocused )
26
mWidgetToKeepFocused->installEventFilter(
this
);
27
}
28
29
QgsFocusKeeper::~QgsFocusKeeper
()
30
{
31
if
( mWidgetToKeepFocused )
32
mWidgetToKeepFocused->removeEventFilter(
this
);
33
}
34
35
bool
QgsFocusKeeper::eventFilter
( QObject *obj, QEvent *event )
36
{
37
if
( obj == mWidgetToKeepFocused && event &&
38
( event->type() == QEvent::FocusOut || event->type() == QEvent::FocusAboutToChange ) )
39
{
40
return
true
;
41
}
42
return
QObject::eventFilter( obj, event );
43
}
QgsFocusKeeper::~QgsFocusKeeper
~QgsFocusKeeper() override
Definition
qgsfocuskeeper.cpp:29
QgsFocusKeeper::eventFilter
bool eventFilter(QObject *obj, QEvent *event) override
Definition
qgsfocuskeeper.cpp:35
QgsFocusKeeper::QgsFocusKeeper
QgsFocusKeeper()
Definition
qgsfocuskeeper.cpp:23
qgsfocuskeeper.h
Generated on Sun Nov 10 2024 14:15:43 for QGIS API Documentation by
1.9.8