QGIS API Documentation 3.40.0-Bratislava (b56115d8743)
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
63{
64 public:
65
72 static QgsOptionsDialogHighlightWidget *createWidget( QWidget *widget ) SIP_FACTORY;
73
75
79 bool isValid() { return !mWidget.isNull(); }
80
85 bool searchHighlight( const QString &text );
86
90 QWidget *widget() {return mWidget;}
91
92 protected:
93
97 virtual bool searchText( const QString &text ) = 0;
98
103 virtual bool highlightText( const QString &text ) = 0;
104
108 virtual void reset() = 0;
109
114 explicit QgsOptionsDialogHighlightWidget( QWidget *widget = nullptr );
115
117 QPointer< QWidget > mWidget;
118
119 private:
120 friend class QgsOptionsDialogHighlightWidgetEventFilter;
121
122 QString mSearchText = QString();
123 bool mChangedStyle = false;
124 QgsOptionsDialogHighlightWidgetEventFilter *mEventFilter = nullptr;
125};
126
127#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