QGIS API Documentation  2.18.21-Las Palmas (9fba24a)
qgsattributeformeditorwidget.h
Go to the documentation of this file.
1 /***************************************************************************
2  qgsattributeformeditorwidget.h
3  -----------------------------
4  Date : March 2016
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 QGSATTRIBUTEFORMEDITORWIDGET_H
17 #define QGSATTRIBUTEFORMEDITORWIDGET_H
18 
19 #include <QWidget>
20 #include <QVariant>
21 #include "qgseditorwidgetconfig.h"
23 #include "qgssearchwidgetwrapper.h"
24 
25 class QgsAttributeForm;
29 class QgsVectorLayer;
30 class QStackedWidget;
32 
41 class GUI_EXPORT QgsAttributeFormEditorWidget : public QWidget
42 {
43  Q_OBJECT
44 
45  public:
46 
48  enum Mode
49  {
53  };
54 
60  QgsAttributeForm* form );
61 
63 
71  void createSearchWidgetWrappers( const QString& widgetId, int fieldIdx,
72  const QgsEditorWidgetConfig& config,
74 
80  void setMode( Mode mode );
81 
85  Mode mode() const { return mMode; }
86 
91  void initialize( const QVariant& initialValue, bool mixedValues = false );
92 
96  bool hasChanged() const { return mIsChanged; }
97 
100  QVariant currentValue() const;
101 
106  QString currentFilterExpression() const;
107 
108  public slots:
109 
113  void setIsMixed( bool mixed );
114 
117  void changesCommitted();
118 
121  void resetSearch();
122 
123  signals:
124 
127  void valueChanged( const QVariant& value );
128 
129  private slots:
130 
132  void editorWidgetChanged( const QVariant& value );
133 
135  void resetValue();
136 
138  void setFieldTriggered();
139 
141  void searchWidgetFlagsChanged( QgsSearchWidgetWrapper::FilterFlags flags );
142 
143  protected:
144 
149  QgsSearchWidgetToolButton* searchWidgetToolButton();
150 
159  void setSearchWidgetWrapper( QgsSearchWidgetWrapper* wrapper );
160 
166  QWidget* searchWidgetFrame();
167 
173  QList< QgsSearchWidgetWrapper* > searchWidgetWrappers();
174 
175  private:
176 
177  QWidget* mEditPage;
178  QWidget* mSearchPage;
179  QStackedWidget* mStack;
180  QWidget* mSearchFrame;
181 
182  QgsEditorWidgetWrapper* mWidget;
183  QList< QgsSearchWidgetWrapper* > mSearchWidgets;
184  QgsAttributeForm* mForm;
185  Mode mMode;
186 
187  QgsMultiEditToolButton* mMultiEditButton;
188  QgsSearchWidgetToolButton* mSearchWidgetToolButton;
189  QVariant mPreviousValue;
190  bool mBlockValueUpdate;
191  bool mIsMixed;
192  bool mIsChanged;
193 
194 
195  QgsVectorLayer* layer();
196  void updateWidgets();
197 };
198 
199 #endif // QGSATTRIBUTEFORMEDITORWIDGET_H
Manages an editor widget Widget and wrapper share the same parent.
bool hasChanged() const
Returns true if the widget&#39;s value has been changed since it was initialized.
This class contains context information for attribute editor widgets.
Manages an editor widget Widget and wrapper share the same parent.
A tool button widget which is displayed next to search widgets in forms, and allows for controlling h...
A tool button widget which is displayed next to editor widgets in attribute forms, and allows for controlling how the widget behaves and interacts with the form while in multi edit mode.
A widget consisting of both an editor widget and additional widgets for controlling the behaviour of ...
QVariantMap QgsEditorWidgetConfig
Holds a set of configuration parameters for a editor widget wrapper.
Mode mode() const
Returns the current mode for the widget.
Represents a vector layer which manages a vector based data sets.