QGIS API Documentation
3.16.0-Hannover (43b64b13f3)
src
gui
qgsfocuswatcher.cpp
Go to the documentation of this file.
1
/***************************************************************************
2
qgsfocuswatcher.h
3
-----------------
4
Date : April 2016
5
Copyright : (C) 2016 by Nyall Dawson
6
Email : nyall dot dawson at gmail 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 "
qgsfocuswatcher.h
"
17
#include <QEvent>
18
19
QgsFocusWatcher::QgsFocusWatcher
( QObject *parent )
20
: QObject( parent )
21
{
22
Q_ASSERT( parent );
23
parent->installEventFilter(
this
);
24
}
25
26
bool
QgsFocusWatcher::eventFilter
( QObject *, QEvent *event )
27
{
28
switch
( event->type() )
29
{
30
case
QEvent::FocusIn:
31
emit
focusChanged
(
true
);
32
emit
focusIn
();
33
break
;
34
case
QEvent::FocusOut:
35
emit
focusChanged
(
false
);
36
emit
focusOut
();
37
break
;
38
default
:
39
break
;
40
}
41
return
false
;
42
}
QgsFocusWatcher::focusIn
void focusIn()
Emitted when parent object gains focus.
QgsFocusWatcher::QgsFocusWatcher
QgsFocusWatcher(QObject *parent)
Constructor for QgsFocusWatcher.
Definition:
qgsfocuswatcher.cpp:19
QgsFocusWatcher::eventFilter
bool eventFilter(QObject *obj, QEvent *event) override
Definition:
qgsfocuswatcher.cpp:26
qgsfocuswatcher.h
QgsFocusWatcher::focusOut
void focusOut()
Emitted when parent object loses focus.
QgsFocusWatcher::focusChanged
void focusChanged(bool focused)
Emitted when parent object's focus changes.
Generated on Sat Oct 24 2020 17:43:09 for QGIS API Documentation by
1.8.20