QGIS API Documentation  3.14.0-Pi (9f7028fd23)
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
Definition: qgssearchwidgettoolbutton.h:38
QgsEditorWidgetWrapper::ConstraintResult
ConstraintResult
Result of constraint checks.
Definition: qgseditorwidgetwrapper.h:60
QgsEditorWidgetWrapper
Definition: qgseditorwidgetwrapper.h:47
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
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
Definition: qgsmultiedittoolbutton.h:32
QgsVectorLayer
Definition: qgsvectorlayer.h:385
QgsAttributeFormEditorWidget
Definition: qgsattributeformeditorwidget.h:42
QgsAggregateToolButton
Definition: qgsaggregatetoolbutton.h:33
QgsAttributeForm
Definition: qgsattributeform.h:44
QgsAttributeEditorContext
Definition: qgsattributeeditorcontext.h:40
SIP_TRANSFERTHIS
#define SIP_TRANSFERTHIS
Definition: qgis_sip.h:53
QgsAttributeFormWidget
Definition: qgsattributeformwidget.h:38