QGIS API Documentation  3.8.0-Zanzibar (11aff65)
qgsoptionsdialoghighlightwidget.h
Go to the documentation of this file.
1 /***************************************************************************
2  qgsoptionsdialoghighlightwidget.h
3  -------------------------------
4  Date : February 2018
5  Copyright : (C) 2018 Denis Rouzaud
6  Email : [email protected]
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 QGSOPTIONSDIALOGHIGHLIGHTWIDGET_H
17 #define QGSOPTIONSDIALOGHIGHLIGHTWIDGET_H
18 
19 #include <QObject>
20 #include <QPointer>
21 #include <QWidget>
22 
23 #include "qgis_gui.h"
24 #include "qgis_sip.h"
25 
35 class GUI_EXPORT QgsOptionsDialogHighlightWidget : public QObject
36 {
37 
38  Q_OBJECT
39  public:
40 
47  static QgsOptionsDialogHighlightWidget *createWidget( QWidget *widget ) SIP_FACTORY;
48 
52  bool isValid() { return !mWidget.isNull(); }
53 
58  bool searchHighlight( const QString &text );
59 
63  QWidget *widget() {return mWidget;}
64 
65 
66  bool eventFilter( QObject *obj, QEvent *event ) override;
67 
68 
69  protected:
70 
74  virtual bool searchText( const QString &text ) = 0;
75 
80  virtual bool highlightText( const QString &text ) = 0;
81 
85  virtual void reset() = 0;
86 
91  explicit QgsOptionsDialogHighlightWidget( QWidget *widget = nullptr );
92 
94  QPointer< QWidget > mWidget;
95 
96  private:
97  QString mSearchText = QString();
98  bool mChangedStyle = false;
99  bool mInstalledFilter = false;
100 };
101 
102 #endif // QGSOPTIONSDIALOGHIGHLIGHTWIDGET_H
QPointer< QWidget > mWidget
Pointer to the widget.
bool isValid()
Returns if it valid: if the widget type is handled and if the widget is not still available...
#define SIP_FACTORY
Definition: qgis_sip.h:69
Container for a widget to be used to search text in the option dialog If the widget type is handled...
QWidget * widget()
Returns the widget.