QGIS API Documentation  3.4.15-Madeira (e83d02e274)
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.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 
64  virtual void createSearchWidgetWrappers( const QgsAttributeEditorContext &context SIP_PYARGREMOVE = QgsAttributeEditorContext() ) = 0;
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
Shows a search widget on a filter form.
Base class for all widgets shown on a QgsAttributeForm.
This class contains context information for attribute editor widgets.
A tool button widget which is displayed next to search widgets in forms, and allows for controlling h...
Default mode, only the editor widget is shown.
#define SIP_SKIP
Definition: qgis_sip.h:119
#define SIP_PYARGREMOVE
Definition: qgis_sip.h:139
Multi edit mode, both the editor widget and a QgsMultiEditToolButton is shown.
Mode mode() const
Returns the current mode for the widget.
Embedded in a search form, show additional aggregate function toolbutton.
Represents a vector layer which manages a vector based data sets.
Manages an editor widget Widget and wrapper share the same parent.