QGIS API Documentation 3.32.0-Lima (311a8cb8a6)
qgsattributeformwidget.h
Go to the documentation of this file.
1/***************************************************************************
2 qgsattributeformwidget.h
3 ---------------------
4 begin : November 2017
5 copyright : (C) 2017 by Matthias Kuhn
6 email : matthias at opengis dot ch
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#ifndef QGSATTRIBUTEFORMWIDGET_H
16#define QGSATTRIBUTEFORMWIDGET_H
17
18#include "qgis_sip.h"
19#include "qgis_gui.h"
22
23#include <QWidget>
24#include <QVariant>
25
27class QStackedWidget;
29
38class GUI_EXPORT QgsAttributeFormWidget : public QWidget // SIP_ABSTRACT
39{
40 Q_OBJECT
41
42 public:
43
45 enum Mode
46 {
51 };
52
57
58 ~QgsAttributeFormWidget() override;
59
67
73 virtual QString currentFilterExpression() const;
74
75
82 void setMode( Mode mode );
83
88 Mode mode() const { return mMode; }
89
93 QgsVectorLayer *layer();
94
98 QgsAttributeForm *form() const;
99
106 QWidget *searchWidgetFrame() SIP_SKIP;
107
108
118 void setSearchWidgetWrapper( QgsSearchWidgetWrapper *wrapper );
119
124 void addAdditionalSearchWidgetWrapper( QgsSearchWidgetWrapper *wrapper );
125
132 QList< QgsSearchWidgetWrapper * > searchWidgetWrappers();
133
137 void resetSearch();
138
143 bool searchWidgetToolButtonVisible() const;
144
149 void setSearchWidgetToolButtonVisible( bool searchWidgetToolButtonVisible );
150
151 protected:
152
159 QWidget *editPage() const SIP_SKIP;
160
167 QStackedWidget *stack() const SIP_SKIP;
168
175 QWidget *searchPage() const SIP_SKIP;
176
182 void setVisiblePageForMode( QgsAttributeFormWidget::Mode mode );
183
184 private slots:
185
187 void searchWidgetFlagsChanged( QgsSearchWidgetWrapper::FilterFlags flags );
188
189 private:
190 virtual void updateWidgets();
191 QgsAttributeFormWidget::Mode mMode = DefaultMode;
192 QgsSearchWidgetToolButton *mSearchWidgetToolButton = nullptr;
193 QWidget *mEditPage = nullptr;
194 QWidget *mSearchPage = nullptr;
195 QStackedWidget *mStack = nullptr;
196 QWidget *mSearchFrame = nullptr;
197 QgsAttributeForm *mForm = nullptr;
198 QList< QgsSearchWidgetWrapper * > mSearchWidgets;
199 QgsWidgetWrapper *mWidget = nullptr;
200};
201
202#endif // QGSATTRIBUTEFORMWIDGET_H
This class contains context information for attribute editor widgets.
Base class for all widgets shown on a QgsAttributeForm.
Mode mode() const
Returns the current mode for the widget.
virtual void createSearchWidgetWrappers(const QgsAttributeEditorContext &context=QgsAttributeEditorContext())=0
Creates the search widget wrappers for the widget used when the form is in search mode.
@ SearchMode
Layer search/filter mode.
@ MultiEditMode
Multi edit mode, both the editor widget and a QgsMultiEditToolButton is shown.
@ DefaultMode
Default mode, only the editor widget is shown.
@ AggregateSearchMode
Embedded in a search form, show additional aggregate function toolbutton.
A tool button widget which is displayed next to search widgets in forms, and allows for controlling h...
Shows a search widget on a filter form.
Represents a vector layer which manages a vector based data sets.
Manages an editor widget Widget and wrapper share the same parent.
#define SIP_SKIP
Definition: qgis_sip.h:126
#define SIP_PYARGREMOVE
Definition: qgis_sip.h:151