QGIS API Documentation  2.18.21-Las Palmas (9fba24a)
qgscheckboxsearchwidgetwrapper.h
Go to the documentation of this file.
1 /***************************************************************************
2  qgscheckboxsearchwidgetwrapper.h
3  -------------------------------
4  Date : 2016-05-23
5  Copyright : (C) 2016 Nyall Dawson
6  Email : nyall dot dawson 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 QGSCHECKBOXSEARCHWIDGETWRAPPER_H
17 #define QGSCHECKBOXSEARCHWIDGETWRAPPER_H
18 
19 #include "qgssearchwidgetwrapper.h"
21 
22 #include <QComboBox>
23 #include <QListWidget>
24 #include <QLineEdit>
25 
27 
35 {
36  Q_OBJECT
37 
38  public:
39 
45  explicit QgsCheckboxSearchWidgetWrapper( QgsVectorLayer* vl, int fieldIdx, QWidget* parent = nullptr );
46 
52  QVariant value() const;
53 
54  bool applyDirectly() override;
55  QString expression() override;
56  bool valid() const override;
57  FilterFlags supportedFlags() const override;
58  FilterFlags defaultFlags() const override;
59  virtual QString createExpression( FilterFlags flags ) const override;
60 
61  public slots:
62 
63  virtual void clearWidget() override;
64  virtual void setEnabled( bool enabled ) override;
65 
66  protected:
67  QWidget* createWidget( QWidget* parent ) override;
68  void initWidget( QWidget* editor ) override;
69 
70  protected slots:
71  void setExpression( QString exp ) override;
72 
73  private slots:
74  void stateChanged( int state );
75 
76  private:
77  QCheckBox* mCheckBox;
78  QgsVectorLayer* mLayer;
79 
81 };
82 
83 #endif // QGSCHECKBOXSEARCHWIDGETWRAPPER_H
Manages an editor widget Widget and wrapper share the same parent.
virtual QString createExpression(FilterFlags flags) const
Creates a filter expression based on the current state of the search widget and the specified filter ...
virtual void setEnabled(bool enabled) override
Toggles whether the search widget is enabled or disabled.
virtual void setExpression(QString value)=0
virtual QString expression()=0
Will be used to access the widget&#39;s value.
virtual void clearWidget()
Clears the widget&#39;s current value and resets it back to the default state.
virtual bool valid() const =0
Return true if the widget has been properly initialized.
virtual QWidget * createWidget(QWidget *parent)=0
This method should create a new widget with the provided parent.
virtual void initWidget(QWidget *editor)
This method should initialize the editor widget with runtime data.
Wraps a checkbox edit widget for searching.
virtual bool applyDirectly()=0
If this is true, then this search widget should take effect directly when its expression changes...
virtual FilterFlags defaultFlags() const
Returns the filter flags which should be set by default for the search widget.
Represents a vector layer which manages a vector based data sets.
virtual FilterFlags supportedFlags() const
Returns filter flags supported by the search widget.