QGIS API Documentation  3.14.0-Pi (9f7028fd23)
qgsrelationreferencesearchwidgetwrapper.h
Go to the documentation of this file.
1 /***************************************************************************
2  qgsrelationreferencesearchwidgetwrapper.h
3  ----------------------------------------
4  Date : 2016-05-25
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 QGSRELATIONREFERENCESEARCHWIDGETWRAPPER_H
17 #define QGSRELATIONREFERENCESEARCHWIDGETWRAPPER_H
18 
19 #include "qgssearchwidgetwrapper.h"
20 
21 #include <QComboBox>
22 #include <QListWidget>
23 #include <QLineEdit>
24 
25 #include "qgis_gui.h"
26 #include "qgis_sip.h"
27 
28 class QgsRelationReferenceWidgetFactory;
29 class QgsMapCanvas;
31 
40 {
41  Q_OBJECT
42 
43  public:
44 
52  explicit QgsRelationReferenceSearchWidgetWrapper( QgsVectorLayer *vl, int fieldIdx, QgsMapCanvas *canvas, QWidget *parent = nullptr );
53 
57  QVariant value() const;
58 
59  bool applyDirectly() override;
60  QString expression() const override;
61  bool valid() const override;
62  QgsSearchWidgetWrapper::FilterFlags supportedFlags() const override;
63  QString createExpression( QgsSearchWidgetWrapper::FilterFlags flags ) const override;
64 
65  public slots:
66 
67  void clearWidget() override;
68  void setEnabled( bool enabled ) override;
69 
70  protected:
71  QWidget *createWidget( QWidget *parent ) override;
72  void initWidget( QWidget *editor ) override;
73 
74  public slots:
75 
80  Q_DECL_DEPRECATED void onValueChanged( const QVariant &value ) SIP_DEPRECATED;
81 
82  protected slots:
83  void setExpression( const QString &exp ) override;
84 
85  private:
86  void onValuesChanged( const QVariantList &values );
87 
88  QgsRelationReferenceWidget *mWidget = nullptr;
89  QgsVectorLayer *mLayer = nullptr;
90  QgsMapCanvas *mCanvas = nullptr;
91 
92  friend class QgsRelationReferenceWidgetFactory;
93 };
94 
95 #endif // QGSRELATIONREFERENCESEARCHWIDGETWRAPPER_H
QgsSearchWidgetWrapper::clearWidget
virtual void clearWidget()
Clears the widget's current value and resets it back to the default state.
Definition: qgssearchwidgetwrapper.h:222
QgsRelationReferenceWidget
Definition: qgsrelationreferencewidget.h:57
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.
QgsRelationReferenceSearchWidgetWrapper
Definition: qgsrelationreferencesearchwidgetwrapper.h:39
QgsSearchWidgetWrapper::expression
virtual QString expression() const =0
Will be used to access the widget's value.
QgsMapCanvas
Definition: qgsmapcanvas.h:83
QgsSearchWidgetWrapper
Definition: qgssearchwidgetwrapper.h:85
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.
SIP_DEPRECATED
#define SIP_DEPRECATED
Definition: qgis_sip.h:106
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:183
QgsVectorLayer
Definition: qgsvectorlayer.h:385
QgsSearchWidgetWrapper::setEnabled
void setEnabled(bool enabled) override
Toggles whether the search widget is enabled or disabled.
Definition: qgssearchwidgetwrapper.h:228
QgsWidgetWrapper::createWidget
virtual QWidget * createWidget(QWidget *parent)=0
This method should create a new widget with the provided parent.