QGIS API Documentation 3.34.0-Prizren (ffbdd678812)
Loading...
Searching...
No Matches
qgsoptionsdialoghighlightwidget.h
Go to the documentation of this file.
1/***************************************************************************
2 qgsoptionsdialoghighlightwidget.h
3 -------------------------------
4 Date : February 2018
5 Copyright : (C) 2018 Denis Rouzaud
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
27
28#ifndef SIP_RUN
29
31
38class QgsOptionsDialogHighlightWidgetEventFilter : public QObject
39{
40 Q_OBJECT
41 public:
43 QgsOptionsDialogHighlightWidgetEventFilter( QgsOptionsDialogHighlightWidget *highlightWidget );
44 bool eventFilter( QObject *obj, QEvent *event ) override;
45 private:
46 QgsOptionsDialogHighlightWidget *mHighlightWidget;
47
48};
49
51
52#endif
53
64{
65 public:
66
73 static QgsOptionsDialogHighlightWidget *createWidget( QWidget *widget ) SIP_FACTORY;
74
76
80 bool isValid() { return !mWidget.isNull(); }
81
86 bool searchHighlight( const QString &text );
87
91 QWidget *widget() {return mWidget;}
92
93 protected:
94
98 virtual bool searchText( const QString &text ) = 0;
99
104 virtual bool highlightText( const QString &text ) = 0;
105
109 virtual void reset() = 0;
110
115 explicit QgsOptionsDialogHighlightWidget( QWidget *widget = nullptr );
116
118 QPointer< QWidget > mWidget;
119
120 private:
121 friend class QgsOptionsDialogHighlightWidgetEventFilter;
122
123 QString mSearchText = QString();
124 bool mChangedStyle = false;
125 QgsOptionsDialogHighlightWidgetEventFilter *mEventFilter = nullptr;
126};
127
128#endif // QGSOPTIONSDIALOGHIGHLIGHTWIDGET_H
Container for a widget to be used to search text in the option dialog If the widget type is handled,...
virtual ~QgsOptionsDialogHighlightWidget()=default
QPointer< QWidget > mWidget
Pointer to the widget.
virtual void reset()=0
reset the style of the widgets to its original state
virtual bool searchText(const QString &text)=0
Search for the text in the widget and return true if it was found.
virtual bool highlightText(const QString &text)=0
Highlight the text in 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:76