QGIS API Documentation  3.16.0-Hannover (43b64b13f3)
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 
68  void initialize( const QVariant &initialValue, bool mixedValues = false, const QVariantList &additionalFieldValues = QVariantList() );
69 
74  bool hasChanged() const { return mIsChanged; }
75 
79  QVariant currentValue() const;
80 
84  void setConstraintStatus( const QString &constraint, const QString &description, const QString &err, QgsEditorWidgetWrapper::ConstraintResult result );
85 
89  void setConstraintResultVisible( bool editable );
90 
95  QgsEditorWidgetWrapper *editorWidget() const;
96 
97  public slots:
98 
103  void setIsMixed( bool mixed );
104 
108  void changesCommitted();
109 
110  signals:
111 
117  Q_DECL_DEPRECATED void valueChanged( const QVariant &value );
118 
125  void valuesChanged( const QVariant &value, const QVariantList &additionalFieldValues );
126 
127  private slots:
128 
130  void editorWidgetValuesChanged( const QVariant &value, const QVariantList &additionalFieldValues );
131 
133  void resetValue();
134 
136  void setFieldTriggered();
137 
138  void onAggregateChanged();
139 
140  private:
141  QString mWidgetType;
142  QgsEditorWidgetWrapper *mEditorWidget = nullptr;
143  QgsAttributeForm *mForm = nullptr;
144  QLabel *mConstraintResultLabel = nullptr;
145 
146  QgsMultiEditToolButton *mMultiEditButton = nullptr;
147  QgsAggregateToolButton *mAggregateButton = nullptr;
148  QVariant mPreviousValue;
149  QVariantList mPreviousAdditionalValues;
150  bool mBlockValueUpdate;
151  bool mIsMixed;
152  bool mIsChanged;
153 
154  void updateWidgets() override;
155 
156  friend class TestQgsAttributeForm;
157 };
158 
159 #endif // QGSATTRIBUTEFORMEDITORWIDGET_H
qgseditorwidgetwrapper.h
QgsSearchWidgetToolButton
A tool button widget which is displayed next to search widgets in forms, and allows for controlling h...
Definition: qgssearchwidgettoolbutton.h:39
QgsEditorWidgetWrapper::ConstraintResult
ConstraintResult
Result of constraint checks.
Definition: qgseditorwidgetwrapper.h:61
QgsAttributeFormEditorWidget::valueChanged
Q_DECL_DEPRECATED void valueChanged(const QVariant &value)
Emitted when the widget's value changes.
QgsEditorWidgetWrapper
Manages an editor widget Widget and wrapper share the same parent.
Definition: qgseditorwidgetwrapper.h:48
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.h
QgsAttributeFormEditorWidget::valuesChanged
void valuesChanged(const QVariant &value, const QVariantList &additionalFieldValues)
Emitted when the widget's value changes.
qgis_sip.h
QgsAttributeFormEditorWidget::hasChanged
bool hasChanged() const
Returns true if the widget's value has been changed since it was initialized.
Definition: qgsattributeformeditorwidget.h:74
QgsMultiEditToolButton
A tool button widget which is displayed next to editor widgets in attribute forms,...
Definition: qgsmultiedittoolbutton.h:33
QgsVectorLayer
Represents a vector layer which manages a vector based data sets.
Definition: qgsvectorlayer.h:387
QgsAttributeFormEditorWidget
A widget consisting of both an editor widget and additional widgets for controlling the behavior of t...
Definition: qgsattributeformeditorwidget.h:43
QgsAggregateToolButton
Offers a toolbutton to choose between different aggregate functions.
Definition: qgsaggregatetoolbutton.h:34
QgsAttributeForm
Definition: qgsattributeform.h:45
QgsAttributeEditorContext
This class contains context information for attribute editor widgets.
Definition: qgsattributeeditorcontext.h:41
SIP_TRANSFERTHIS
#define SIP_TRANSFERTHIS
Definition: qgis_sip.h:53
QgsAttributeFormWidget
Base class for all widgets shown on a QgsAttributeForm.
Definition: qgsattributeformwidget.h:39