QGIS API Documentation 3.99.0-Master (26c88405ac0)
Loading...
Searching...
No Matches
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 "qgis_gui.h"
20#include "qgis_sip.h"
22
23#include <QComboBox>
24#include <QLineEdit>
25#include <QListWidget>
26
27class QgsRelationReferenceWidgetFactory;
28class QgsMapCanvas;
30
36
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;
61
66 QString createExpression( QgsSearchWidgetWrapper::FilterFlags flags ) const override;
67
68 public slots:
69
70 void clearWidget() override;
71 void setEnabled( bool enabled ) override;
72
73 protected:
74 QWidget *createWidget( QWidget *parent ) override;
75 void initWidget( QWidget *editor ) override;
76
77 public slots:
78
83 Q_DECL_DEPRECATED void onValueChanged( const QVariant &value ) SIP_DEPRECATED;
84
85 protected slots:
86 void setExpression( const QString &exp ) override;
87
88 private:
89 void onValuesChanged( const QVariantList &values );
90
91 QgsRelationReferenceWidget *mWidget = nullptr;
92 QgsVectorLayer *mLayer = nullptr;
93 QgsMapCanvas *mCanvas = nullptr;
94
96};
97
98#endif // QGSRELATIONREFERENCESEARCHWIDGETWRAPPER_H
Map canvas is a class for displaying all GIS data types on a canvas.
Q_DECL_DEPRECATED void onValueChanged(const QVariant &value)
Called when current value of search widget changes.
QgsRelationReferenceSearchWidgetWrapper(QgsVectorLayer *vl, int fieldIdx, QgsMapCanvas *canvas, QWidget *parent=nullptr)
Constructor for QgsRelationReferenceSearchWidgetWrapper.
QVariant value() const
Returns a variant representing the current state of the widget.
A widget which shows related features.
void setEnabled(bool enabled) override
Toggles whether the search widget is enabled or disabled.
virtual QString createExpression(FilterFlags flags) const
Creates a filter expression based on the current state of the search widget and the specified filter ...
virtual QString expression() const =0
Will be used to access the widget's value.
QgsSearchWidgetWrapper(QgsVectorLayer *vl, int fieldIdx, QWidget *parent=nullptr)
Create a new widget wrapper.
virtual FilterFlags defaultFlags() const
Returns the filter flags which should be set by default for the search widget.
virtual void setExpression(const QString &expression)=0
Set the expression which is currently used as filter for this widget.
virtual FilterFlags supportedFlags() const
Returns filter flags supported by the search widget.
virtual bool applyDirectly()=0
If this is true, then this search widget should take effect directly when its expression changes.
virtual void clearWidget()
Clears the widget's current value and resets it back to the default state.
QFlags< FilterFlag > FilterFlags
Represents a vector layer which manages a vector based dataset.
virtual bool valid() const =0
Returns true if the widget has been properly initialized.
virtual void initWidget(QWidget *editor)
This method should initialize the editor widget with runtime data.
virtual QWidget * createWidget(QWidget *parent)=0
This method should create a new widget with the provided parent.
#define SIP_DEPRECATED
Definition qgis_sip.h:114