QGIS API Documentation 3.99.0-Master (26c88405ac0)
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 "qgis_gui.h"
20#include "qgis_sip.h"
21
22#include <QObject>
23#include <QPointer>
24#include <QWidget>
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
65{
66 public:
67
75
77
81 bool isValid() { return !mWidget.isNull(); }
82
87 bool searchHighlight( const QString &text );
88
92 QWidget *widget() { return mWidget; }
93
94 protected:
95
99 virtual bool searchText( const QString &text ) = 0;
100
105 virtual bool highlightText( const QString &text ) = 0;
106
110 virtual void reset() = 0;
111
116 explicit QgsOptionsDialogHighlightWidget( QWidget *widget = nullptr );
117
119 QPointer<QWidget> mWidget;
120
121 private:
123
124 QString mSearchText = QString();
125 bool mChangedStyle = false;
126 QgsOptionsDialogHighlightWidgetEventFilter *mEventFilter = nullptr;
127};
128
129#endif // QGSOPTIONSDIALOGHIGHLIGHTWIDGET_H
Container for a widget to be used to search text in the option dialog.
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.
static QgsOptionsDialogHighlightWidget * createWidget(QWidget *widget)
create a highlight widget implementation for the proper widget type.
bool isValid()
Returns if it valid: if the widget type is handled and if the widget is not still available.
QgsOptionsDialogHighlightWidget(QWidget *widget=nullptr)
Constructor.
#define SIP_FACTORY
Definition qgis_sip.h:84