16#ifndef QGSATTRIBUTEEDITORCONTEXT_H
17#define QGSATTRIBUTEEDITORCONTEXT_H
81 : mParentContext( &parentContext )
82 , mVectorLayerTools( parentContext.mVectorLayerTools )
83 , mMapCanvas( parentContext.mMapCanvas )
84 , mMainMessageBar( parentContext.mMainMessageBar )
85 , mCadDockWidget( parentContext.mCadDockWidget )
86 , mDistanceArea( parentContext.mDistanceArea )
87 , mFormFeature( parentContext.mFormFeature )
88 , mFormMode( formMode )
94 : mParentContext( &parentContext )
95 , mVectorLayerTools( parentContext.mVectorLayerTools )
96 , mMapCanvas( parentContext.mMapCanvas )
97 , mMainMessageBar( parentContext.mMainMessageBar )
98 , mCadDockWidget( parentContext.mCadDockWidget )
99 , mDistanceArea( parentContext.mDistanceArea )
100 , mRelation( relation )
101 , mRelationMode( relationMode )
102 , mFormMode( widgetMode )
116 mDistanceArea = distanceArea;
278 const QMetaEnum metaEnum( QMetaEnum::fromType<Mode>() );
279 return metaEnum.valueToKey(
static_cast<int>( mAttributeFormMode ) );
303 RelationMode mRelationMode = Undefined;
308 FormMode mFormMode = Embed;
309 bool mAllowCustomUi =
true;
310 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
Constructor for QgsAttributeEditorContext.
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 vector layer which manages a vector based data sets.