QGIS API Documentation 3.41.0-Master (3440c17df1d)
Loading...
Searching...
No Matches
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
42{
43 Q_OBJECT
44
45 public:
46
54 explicit QgsAttributeFormEditorWidget( QgsEditorWidgetWrapper *editorWidget, const QString &widgetType,
56
58
60
67 void initialize( const QVariant &initialValue, bool mixedValues = false, const QVariantList &additionalFieldValues = QVariantList() );
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
94 QgsEditorWidgetWrapper *editorWidget() const;
95
96 public slots:
97
102 void setIsMixed( bool mixed );
103
107 void changesCommitted();
108
109 signals:
110
116 Q_DECL_DEPRECATED void valueChanged( const QVariant &value );
117
124 void valuesChanged( const QVariant &value, const QVariantList &additionalFieldValues );
125
126 private slots:
127
129 void editorWidgetValuesChanged( const QVariant &value, const QVariantList &additionalFieldValues );
130
132 void resetValue();
133
135 void setFieldTriggered();
136
137 void onAggregateChanged();
138
139 private:
140 QString mWidgetType;
141 QgsEditorWidgetWrapper *mEditorWidget = nullptr;
142 QgsAttributeForm *mForm = nullptr;
143 QLabel *mConstraintResultLabel = nullptr;
144
145 QgsMultiEditToolButton *mMultiEditButton = nullptr;
146 QgsAggregateToolButton *mAggregateButton = nullptr;
147 QVariant mPreviousValue;
148 QVariantList mPreviousAdditionalValues;
149 bool mBlockValueUpdate;
150 bool mIsMixed;
151 bool mIsChanged;
152
153 void updateWidgets() final;
154
155 friend class TestQgsAttributeForm;
156};
157
158#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