QGIS API Documentation  3.25.0-Master (6b426f5f8a)
qgsfocuskeeper.h
Go to the documentation of this file.
1 /***************************************************************************
2  qgsfocuskeeper.h
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 #ifndef QGSFOCUSKEEPER_H
17 #define QGSFOCUSKEEPER_H
18 
19 #include "qgis_gui.h"
20 
21 #define SIP_NO_FILE
22 
23 #include <QObject>
24 #include <QPointer>
25 
26 class QWidget;
27 
35 class GUI_EXPORT QgsFocusKeeper : public QObject
36 {
37  Q_OBJECT
38 
39  QPointer<QWidget> mWidgetToKeepFocused;
40 
41  public:
43  ~QgsFocusKeeper() override;
44 
45  protected:
46  bool eventFilter( QObject *obj, QEvent *event ) override;
47 };
48 
49 #endif // QGSFOCUSKEEPER_H
Trick to keep a widget focused and avoid QT crashes.