QGIS API Documentation 3.28.0-Firenze (ed3ad0430f)
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"
23
27class QgsVectorLayer;
28class QStackedWidget;
30class QLabel;
32
43{
44 Q_OBJECT
45
46 public:
47
55 explicit QgsAttributeFormEditorWidget( QgsEditorWidgetWrapper *editorWidget, const QString &widgetType,
57
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
Offers a toolbutton to choose between different aggregate functions.
This class contains context information for attribute editor widgets.
A widget consisting of both an editor widget and additional widgets for controlling the behavior of t...
bool hasChanged() const
Returns true if the widget's value has been changed since it was initialized.
void valuesChanged(const QVariant &value, const QVariantList &additionalFieldValues)
Emitted when the widget's value changes.
Q_DECL_DEPRECATED void valueChanged(const QVariant &value)
Emitted when the widget's value changes.
Base class for all widgets shown on a QgsAttributeForm.
virtual void createSearchWidgetWrappers(const QgsAttributeEditorContext &context=QgsAttributeEditorContext())=0
Creates the search widget wrappers for the widget used when the form is in search mode.
Manages an editor widget Widget and wrapper share the same parent.
ConstraintResult
Result of constraint checks.
A tool button widget which is displayed next to editor widgets in attribute forms,...
A tool button widget which is displayed next to search widgets in forms, and allows for controlling h...
Represents a vector layer which manages a vector based data sets.
#define SIP_TRANSFERTHIS
Definition: qgis_sip.h:53