QGIS API Documentation 3.41.0-Master (cea29feecf2)
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:
53 explicit QgsAttributeFormEditorWidget( QgsEditorWidgetWrapper *editorWidget, const QString &widgetType, QgsAttributeForm *form SIP_TRANSFERTHIS );
54
56
58
65 void initialize( const QVariant &initialValue, bool mixedValues = false, const QVariantList &additionalFieldValues = QVariantList() );
66
71 bool hasChanged() const { return mIsChanged; }
72
76 QVariant currentValue() const;
77
81 void setConstraintStatus( const QString &constraint, const QString &description, const QString &err, QgsEditorWidgetWrapper::ConstraintResult result );
82
86 void setConstraintResultVisible( bool editable );
87
92 QgsEditorWidgetWrapper *editorWidget() const;
93
94 public slots:
95
100 void setIsMixed( bool mixed );
101
105 void changesCommitted();
106
107 signals:
108
114 Q_DECL_DEPRECATED void valueChanged( const QVariant &value );
115
122 void valuesChanged( const QVariant &value, const QVariantList &additionalFieldValues );
123
124 private slots:
125
127 void editorWidgetValuesChanged( const QVariant &value, const QVariantList &additionalFieldValues );
128
130 void resetValue();
131
133 void setFieldTriggered();
134
135 void onAggregateChanged();
136
137 private:
138 QString mWidgetType;
139 QgsEditorWidgetWrapper *mEditorWidget = nullptr;
140 QgsAttributeForm *mForm = nullptr;
141 QLabel *mConstraintResultLabel = nullptr;
142
143 QgsMultiEditToolButton *mMultiEditButton = nullptr;
144 QgsAggregateToolButton *mAggregateButton = nullptr;
145 QVariant mPreviousValue;
146 QVariantList mPreviousAdditionalValues;
147 bool mBlockValueUpdate;
148 bool mIsMixed;
149 bool mIsChanged;
150
151 void updateWidgets() final;
152
153 friend class TestQgsAttributeForm;
154};
155
156#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