QGIS API Documentation  3.16.0-Hannover (43b64b13f3)
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"
21 #include "qgssearchwidgetwrapper.h"
22 
23 #include <QWidget>
24 #include <QVariant>
25 
26 class QgsAttributeForm;
27 class QStackedWidget;
29 
38 class GUI_EXPORT QgsAttributeFormWidget : public QWidget // SIP_ABSTRACT
39 {
40  Q_OBJECT
41 
42  public:
43 
45  enum Mode
46  {
51  };
52 
56  explicit QgsAttributeFormWidget( QgsWidgetWrapper *widget, QgsAttributeForm *form );
57 
65 
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 
175  private slots:
176 
178  void searchWidgetFlagsChanged( QgsSearchWidgetWrapper::FilterFlags flags );
179 
180  private:
181  virtual void updateWidgets();
182  QgsAttributeFormWidget::Mode mMode = DefaultMode;
183  QgsSearchWidgetToolButton *mSearchWidgetToolButton = nullptr;
184  QWidget *mEditPage = nullptr;
185  QWidget *mSearchPage = nullptr;
186  QStackedWidget *mStack = nullptr;
187  QWidget *mSearchFrame = nullptr;
188  QgsAttributeForm *mForm = nullptr;
189  QList< QgsSearchWidgetWrapper * > mSearchWidgets;
190  QgsWidgetWrapper *mWidget = nullptr;
191 };
192 
193 #endif // QGSATTRIBUTEFORMWIDGET_H
QgsAttributeFormWidget::DefaultMode
@ DefaultMode
Default mode, only the editor widget is shown.
Definition: qgsattributeformwidget.h:47
QgsWidgetWrapper
Manages an editor widget Widget and wrapper share the same parent.
Definition: qgswidgetwrapper.h:53
QgsAttributeFormWidget::mode
Mode mode() const
Returns the current mode for the widget.
Definition: qgsattributeformwidget.h:86
QgsSearchWidgetToolButton
A tool button widget which is displayed next to search widgets in forms, and allows for controlling h...
Definition: qgssearchwidgettoolbutton.h:39
QgsSearchWidgetWrapper
Shows a search widget on a filter form.
Definition: qgssearchwidgetwrapper.h:86
QgsAttributeFormWidget::AggregateSearchMode
@ AggregateSearchMode
Embedded in a search form, show additional aggregate function toolbutton.
Definition: qgsattributeformwidget.h:50
SIP_PYARGREMOVE
#define SIP_PYARGREMOVE
Definition: qgis_sip.h:146
QgsAttributeFormWidget::createSearchWidgetWrappers
virtual void createSearchWidgetWrappers(const QgsAttributeEditorContext &context=QgsAttributeEditorContext())=0
Creates the search widget wrappers for the widget used when the form is in search mode.
QgsAttributeFormWidget::Mode
Mode
Widget modes.
Definition: qgsattributeformwidget.h:46
QgsAttributeFormWidget::MultiEditMode
@ MultiEditMode
Multi edit mode, both the editor widget and a QgsMultiEditToolButton is shown.
Definition: qgsattributeformwidget.h:48
SIP_SKIP
#define SIP_SKIP
Definition: qgis_sip.h:126
qgssearchwidgetwrapper.h
qgis_sip.h
qgsattributeeditorcontext.h
QgsAttributeFormWidget::SearchMode
@ SearchMode
Layer search/filter mode.
Definition: qgsattributeformwidget.h:49
QgsVectorLayer
Represents a vector layer which manages a vector based data sets.
Definition: qgsvectorlayer.h:387
QgsAttributeForm
Definition: qgsattributeform.h:45
QgsAttributeEditorContext
This class contains context information for attribute editor widgets.
Definition: qgsattributeeditorcontext.h:41
QgsAttributeFormWidget
Base class for all widgets shown on a QgsAttributeForm.
Definition: qgsattributeformwidget.h:39