QGIS API Documentation 3.37.0-Master (fdefdf9c27f)
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
37class GUI_EXPORT QgsAttributeFormWidget : public QWidget // SIP_ABSTRACT
38{
39 Q_OBJECT
40
41 public:
42
44 enum Mode
45 {
50 };
51
56
57 ~QgsAttributeFormWidget() override;
58
66
71 virtual QString currentFilterExpression() const;
72
73
80 void setMode( Mode mode );
81
86 Mode mode() const { return mMode; }
87
91 QgsVectorLayer *layer();
92
96 QgsAttributeForm *form() const;
97
104 QWidget *searchWidgetFrame() SIP_SKIP;
105
106
116 void setSearchWidgetWrapper( QgsSearchWidgetWrapper *wrapper );
117
122 void addAdditionalSearchWidgetWrapper( QgsSearchWidgetWrapper *wrapper );
123
130 QList< QgsSearchWidgetWrapper * > searchWidgetWrappers();
131
135 void resetSearch();
136
141 bool searchWidgetToolButtonVisible() const;
142
147 void setSearchWidgetToolButtonVisible( bool searchWidgetToolButtonVisible );
148
149 protected:
150
157 QWidget *editPage() const SIP_SKIP;
158
165 QStackedWidget *stack() const SIP_SKIP;
166
173 QWidget *searchPage() const SIP_SKIP;
174
180 void setVisiblePageForMode( QgsAttributeFormWidget::Mode mode );
181
182 private slots:
183
185 void searchWidgetFlagsChanged( QgsSearchWidgetWrapper::FilterFlags flags );
186
187 private:
188 virtual void updateWidgets();
189 QgsAttributeFormWidget::Mode mMode = DefaultMode;
190 QgsSearchWidgetToolButton *mSearchWidgetToolButton = nullptr;
191 QWidget *mEditPage = nullptr;
192 QWidget *mSearchPage = nullptr;
193 QStackedWidget *mStack = nullptr;
194 QWidget *mSearchFrame = nullptr;
195 QgsAttributeForm *mForm = nullptr;
196 QList< QgsSearchWidgetWrapper * > mSearchWidgets;
197 QgsWidgetWrapper *mWidget = nullptr;
198};
199
200#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