16#ifndef QGSATTRIBUTEEDITORCONTEXT_H
17#define QGSATTRIBUTEEDITORCONTEXT_H
79 : mParentContext( &parentContext )
80 , mVectorLayerTools( parentContext.mVectorLayerTools )
81 , mMapCanvas( parentContext.mMapCanvas )
82 , mMainMessageBar( parentContext.mMainMessageBar )
83 , mCadDockWidget( parentContext.mCadDockWidget )
84 , mDistanceArea( parentContext.mDistanceArea )
85 , mFormFeature( parentContext.mFormFeature )
86 , mFormMode( formMode )
92 : mParentContext( &parentContext )
93 , mVectorLayerTools( parentContext.mVectorLayerTools )
94 , mMapCanvas( parentContext.mMapCanvas )
95 , mMainMessageBar( parentContext.mMainMessageBar )
96 , mCadDockWidget( parentContext.mCadDockWidget )
97 , mDistanceArea( parentContext.mDistanceArea )
98 , mRelation( relation )
99 , mRelationMode( relationMode )
100 , mFormMode( widgetMode )
113 mDistanceArea = distanceArea;
177 mRelation = relation;
178 mRelationMode = mode;
270 const QMetaEnum metaEnum( QMetaEnum::fromType<Mode>() );
271 return metaEnum.valueToKey(
static_cast<int>( mAttributeFormMode ) );
295 RelationMode mRelationMode = Undefined;
300 FormMode mFormMode = Embed;
301 bool mAllowCustomUi =
true;
302 Mode mAttributeFormMode = SingleEditMode;
This class contains context information for attribute editor widgets.
void setMapCanvas(QgsMapCanvas *mapCanvas)
Sets the associated map canvas, mapCanvas, (e.g.
RelationMode relationMode() const
Returns the attribute relation mode.
QgsAttributeEditorContext()=default
QgsMapCanvas * mapCanvas() const
Returns the associated map canvas (e.g.
FormMode formMode() const
Returns the form mode.
void setFormFeature(const QgsFeature &feature)
Set current feature for the currently edited form or table row.
void setRelation(const QgsRelation &relation, RelationMode mode)
Set attribute relation and mode.
const QgsDistanceArea & distanceArea() const
Returns the distance area object used for area/length calculations.
QgsAdvancedDigitizingDockWidget * cadDockWidget() const
Returns the associated CAD dock widget (e.g.
QString attributeFormModeString() const
Returns given attributeFormMode as string.
RelationMode
Determines in which direction a relation was resolved.
@ Multiple
When showing a list of features (e.g. houses as an embedded form in a district form)
@ Undefined
This context is not defined by a relation.
QgsFeature parentFormFeature() const
Returns the feature of the currently edited parent form in its actual state.
const QgsVectorLayerTools * vectorLayerTools() const
Returns the associated vector layer tools.
@ Embed
A form was embedded as a widget on another form.
@ StandaloneDialog
A form was opened as a new dialog.
void setParentFormFeature(const QgsFeature &feature)
Sets the feature of the currently edited parent form.
QgsAttributeEditorContext(const QgsAttributeEditorContext &parentContext, const QgsRelation &relation, RelationMode relationMode, FormMode widgetMode)
void setFormMode(FormMode mode)
Sets the form mode.
QgsMessageBar * mainMessageBar()
Returns the main message bar.
void setVectorLayerTools(QgsVectorLayerTools *vlTools)
Sets the associated vector layer tools.
void setMainMessageBar(QgsMessageBar *messageBar)
Set current messageBar as the main message bar.
QgsAttributeEditorContext(const QgsAttributeEditorContext &parentContext, FormMode formMode)
bool allowCustomUi() const
Returns true if the attribute editor should permit use of custom UI forms.
@ SearchMode
Form values are used for searching/filtering the layer.
@ FixAttributeMode
Fix feature mode, for modifying the feature attributes without saving. The updated feature is availab...
@ SingleEditMode
Single edit mode, for editing a single feature.
@ AggregateSearchMode
Form is in aggregate search mode, show each widget in this mode.
@ MultiEditMode
Multi edit mode, for editing fields of multiple features at once.
void setAttributeFormMode(const Mode &attributeFormMode)
Set attributeFormMode for the edited form.
QgsFeature formFeature() const
Returns current feature from the currently edited form or table row.
void setAllowCustomUi(bool allow)
Sets whether the attribute editor should permit use of custom UI forms.
const QgsAttributeEditorContext * parentContext() const
const QgsRelation & relation() const
Returns the attribute relation.
Mode attributeFormMode() const
Returns current attributeFormMode.
void setDistanceArea(const QgsDistanceArea &distanceArea)
Sets distance area object, distanceArea, for area/length calculations.
A general purpose distance and area calculator, capable of performing ellipsoid based calculations.
void setSourceCrs(const QgsCoordinateReferenceSystem &crs, const QgsCoordinateTransformContext &context)
Sets source spatial reference system crs.
The feature class encapsulates a single feature including its unique ID, geometry and a list of field...
Map canvas is a class for displaying all GIS data types on a canvas.
A bar for displaying non-blocking messages to the user.
static QgsProject * instance()
Returns the QgsProject singleton instance.
QgsCoordinateTransformContext transformContext
Represents a relationship between two vector layers.
Represents a vector layer which manages a vector based data sets.