QGIS API Documentation  3.8.0-Zanzibar (11aff65)
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 #include "qgis_gui.h"
25 
26 class QgsRelationReferenceWidgetFactory;
27 class QgsMapCanvas;
29 
38 {
39  Q_OBJECT
40 
41  public:
42 
50  explicit QgsRelationReferenceSearchWidgetWrapper( QgsVectorLayer *vl, int fieldIdx, QgsMapCanvas *canvas, QWidget *parent = nullptr );
51 
55  QVariant value() const;
56 
57  bool applyDirectly() override;
58  QString expression() const override;
59  bool valid() const override;
60  QgsSearchWidgetWrapper::FilterFlags supportedFlags() const override;
61  QString createExpression( QgsSearchWidgetWrapper::FilterFlags flags ) const override;
62 
63  public slots:
64 
65  void clearWidget() override;
66  void setEnabled( bool enabled ) override;
67 
68  protected:
69  QWidget *createWidget( QWidget *parent ) override;
70  void initWidget( QWidget *editor ) override;
71 
72  public slots:
73 
75  void onValueChanged( const QVariant &value );
76 
77  protected slots:
78  void setExpression( const QString &exp ) override;
79 
80  private:
81 
82  QgsRelationReferenceWidget *mWidget = nullptr;
83  QgsVectorLayer *mLayer = nullptr;
84  QgsMapCanvas *mCanvas = nullptr;
85 
86  friend class QgsRelationReferenceWidgetFactory;
87 };
88 
89 #endif // QGSRELATIONREFERENCESEARCHWIDGETWRAPPER_H
Shows a search widget on a filter form.
virtual QString createExpression(FilterFlags flags) const
Creates a filter expression based on the current state of the search widget and the specified filter ...
void setEnabled(bool enabled) override
Toggles whether the search widget is enabled or disabled.
Map canvas is a class for displaying all GIS data types on a canvas.
Definition: qgsmapcanvas.h:73
virtual void clearWidget()
Clears the widget&#39;s current value and resets it back to the default state.
virtual bool valid() const =0
Returns 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.
virtual bool applyDirectly()=0
If this is true, then this search widget should take effect directly when its expression changes...
virtual QString expression() const =0
Will be used to access the widget&#39;s value.
virtual void setExpression(const QString &expression)=0
Set the expression which is currently used as filter for this widget.
Represents a vector layer which manages a vector based data sets.
virtual FilterFlags supportedFlags() const
Returns filter flags supported by the search widget.