QGIS API Documentation  3.16.0-Hannover (43b64b13f3)
qgsdefaultsearchwidgetwrapper.h
Go to the documentation of this file.
1 /***************************************************************************
2  qgsdefaultsearchwidgetwrapper.h
3  --------------------------------------
4  Date : 21.5.2015
5  Copyright : (C) 2015 Karolina Alexiou
6  Email : carolinegr at gmail dot com
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 QGSDEFAULTSEARCHWIDGETWRAPPER_H
17 #define QGSDEFAULTSEARCHWIDGETWRAPPER_H
18 
19 #include "qgssearchwidgetwrapper.h"
20 #include "qgis_sip.h"
21 #include "qgsfilterlineedit.h"
22 
23 #include <QCheckBox>
24 #include "qgis_gui.h"
25 
32 {
33  Q_OBJECT
34  public:
35 
37  explicit QgsDefaultSearchWidgetWrapper( QgsVectorLayer *vl, int fieldIdx, QWidget *parent SIP_TRANSFERTHIS = nullptr );
38 
39  // QgsSearchWidgetWrapper interface
40  public:
41  QString expression() const override;
42  bool applyDirectly() override;
43  QgsSearchWidgetWrapper::FilterFlags supportedFlags() const override;
44  QgsSearchWidgetWrapper::FilterFlags defaultFlags() const override;
45  QString createExpression( QgsSearchWidgetWrapper::FilterFlags flags ) const override;
46 
47  public slots:
48 
49  void clearWidget() override;
50 
51  void setEnabled( bool enabled ) override;
52 
53  protected slots:
54  void setExpression( const QString &exp ) override;
55 
56  private slots:
57  void setCaseString( int caseSensitiveCheckState );
58  void filterChanged();
59  void textChanged( const QString &text );
60 
61  protected:
62  QWidget *createWidget( QWidget *parent ) override;
63  void initWidget( QWidget *editor ) override;
64  bool valid() const override;
65 
71  QgsFilterLineEdit *lineEdit();
72 
78  QCheckBox *caseSensitiveCheckBox();
79 
80  private:
81  QgsFilterLineEdit *mLineEdit = nullptr;
82  QCheckBox *mCheckbox = nullptr;
83  QWidget *mContainer = nullptr;
84  QString mCaseString;
85 };
86 
87 #endif // QGSDEFAULTSEARCHWIDGETWRAPPER_H
QgsSearchWidgetWrapper::clearWidget
virtual void clearWidget()
Clears the widget's current value and resets it back to the default state.
Definition: qgssearchwidgetwrapper.h:223
QgsDefaultSearchWidgetWrapper
Wraps a search widget.
Definition: qgsdefaultsearchwidgetwrapper.h:32
QgsWidgetWrapper::initWidget
virtual void initWidget(QWidget *editor)
This method should initialize the editor widget with runtime data.
Definition: qgswidgetwrapper.cpp:106
QgsWidgetWrapper::valid
virtual bool valid() const =0
Returns true if the widget has been properly initialized.
QgsSearchWidgetWrapper::applyDirectly
virtual bool applyDirectly()=0
If this is true, then this search widget should take effect directly when its expression changes.
QgsSearchWidgetWrapper::expression
virtual QString expression() const =0
Will be used to access the widget's value.
QgsSearchWidgetWrapper
Shows a search widget on a filter form.
Definition: qgssearchwidgetwrapper.h:86
qgsfilterlineedit.h
QgsFilterLineEdit
QLineEdit subclass with built in support for clearing the widget's value and handling custom null val...
Definition: qgsfilterlineedit.h:40
QgsSearchWidgetWrapper::supportedFlags
virtual FilterFlags supportedFlags() const
Returns filter flags supported by the search widget.
Definition: qgssearchwidgetwrapper.cpp:94
QgsSearchWidgetWrapper::setExpression
virtual void setExpression(const QString &expression)=0
Set the expression which is currently used as filter for this widget.
QgsSearchWidgetWrapper::defaultFlags
virtual FilterFlags defaultFlags() const
Returns the filter flags which should be set by default for the search widget.
Definition: qgssearchwidgetwrapper.cpp:99
qgssearchwidgetwrapper.h
qgis_sip.h
QgsSearchWidgetWrapper::createExpression
virtual QString createExpression(FilterFlags flags) const
Creates a filter expression based on the current state of the search widget and the specified filter ...
Definition: qgssearchwidgetwrapper.h:184
QgsVectorLayer
Represents a vector layer which manages a vector based data sets.
Definition: qgsvectorlayer.h:387
QgsSearchWidgetWrapper::setEnabled
void setEnabled(bool enabled) override
Toggles whether the search widget is enabled or disabled.
Definition: qgssearchwidgetwrapper.h:229
SIP_TRANSFERTHIS
#define SIP_TRANSFERTHIS
Definition: qgis_sip.h:53
QgsWidgetWrapper::createWidget
virtual QWidget * createWidget(QWidget *parent)=0
This method should create a new widget with the provided parent.