QGIS API Documentation  3.6.0-Noosa (5873452)
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 "qgis_sip.h"
20 #include "qgis_gui.h"
21 #include "qgseditorwidgetwrapper.h"
22 #include "qgsattributeformwidget.h"
23 
27 class QgsVectorLayer;
28 class QStackedWidget;
30 class QLabel;
32 
43 {
44  Q_OBJECT
45 
46  public:
47 
55  explicit QgsAttributeFormEditorWidget( QgsEditorWidgetWrapper *editorWidget, const QString &widgetType,
57 
58  ~QgsAttributeFormEditorWidget() override;
59 
61 
67  void initialize( const QVariant &initialValue, bool mixedValues = false );
68 
73  bool hasChanged() const { return mIsChanged; }
74 
78  QVariant currentValue() const;
79 
83  void setConstraintStatus( const QString &constraint, const QString &description, const QString &err, QgsEditorWidgetWrapper::ConstraintResult result );
84 
88  void setConstraintResultVisible( bool editable );
89 
90  public slots:
91 
96  void setIsMixed( bool mixed );
97 
101  void changesCommitted();
102 
103  signals:
104 
109  void valueChanged( const QVariant &value );
110 
111  private slots:
112 
114  void editorWidgetChanged( const QVariant &value );
115 
117  void resetValue();
118 
120  void setFieldTriggered();
121 
122  void onAggregateChanged();
123 
124  private:
125  QString mWidgetType;
126  QgsEditorWidgetWrapper *mWidget = nullptr;
127  QgsAttributeForm *mForm = nullptr;
128  QLabel *mConstraintResultLabel = nullptr;
129 
130  QgsMultiEditToolButton *mMultiEditButton = nullptr;
131  QgsAggregateToolButton *mAggregateButton = nullptr;
132  QVariant mPreviousValue;
133  bool mBlockValueUpdate;
134  bool mIsMixed;
135  bool mIsChanged;
136 
137  void updateWidgets() override;
138 };
139 
140 #endif // QGSATTRIBUTEFORMEDITORWIDGET_H
bool hasChanged() const
Returns true if the widget's value has been changed since it was initialized.
#define SIP_TRANSFERTHIS
Definition: qgis_sip.h:46
Base class for all widgets shown on a QgsAttributeForm.
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.
Offers a toolbutton to choose between different aggregate functions.
A widget consisting of both an editor widget and additional widgets for controlling the behavior of t...
ConstraintResult
Result of constraint checks.
virtual void createSearchWidgetWrappers(const QgsAttributeEditorContext &context=QgsAttributeEditorContext())=0
Creates the search widget wrappers for the widget used when the form is in search mode...
Represents a vector layer which manages a vector based data sets.