QGIS API Documentation 3.41.0-Master (af5edcb665c)
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
46 private:
47 QgsOptionsDialogHighlightWidget *mHighlightWidget;
48};
49
51
52#endif
53
63{
64 public:
71 static QgsOptionsDialogHighlightWidget *createWidget( QWidget *widget ) SIP_FACTORY;
72
74
78 bool isValid() { return !mWidget.isNull(); }
79
84 bool searchHighlight( const QString &text );
85
89 QWidget *widget() { return mWidget; }
90
91 protected:
95 virtual bool searchText( const QString &text ) = 0;
96
101 virtual bool highlightText( const QString &text ) = 0;
102
106 virtual void reset() = 0;
107
112 explicit QgsOptionsDialogHighlightWidget( QWidget *widget = nullptr );
113
115 QPointer<QWidget> mWidget;
116
117 private:
118 friend class QgsOptionsDialogHighlightWidgetEventFilter;
119
120 QString mSearchText = QString();
121 bool mChangedStyle = false;
122 QgsOptionsDialogHighlightWidgetEventFilter *mEventFilter = nullptr;
123};
124
125#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
virtual void reset()=0
reset the style of the widgets to its original state
QPointer< QWidget > mWidget
Pointer to the widget.
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