QGIS API Documentation  3.17.0-Master (a035f434f4)
Public Types | Public Member Functions | List of all members
QgsAttributeEditorContext Class Reference

This class contains context information for attribute editor widgets. More...

#include <qgsattributeeditorcontext.h>

Public Types

enum  FormMode { Embed, StandaloneDialog, Popup }
 
enum  Mode {
  SingleEditMode, AddFeatureMode, FixAttributeMode, MultiEditMode,
  SearchMode, AggregateSearchMode, IdentifyMode
}
 modes More...
 
enum  RelationMode { Undefined, Multiple, Single }
 Determines in which direction a relation was resolved. More...
 

Public Member Functions

 QgsAttributeEditorContext ()=default
 Constructor for QgsAttributeEditorContext. More...
 
 QgsAttributeEditorContext (const QgsAttributeEditorContext &parentContext, FormMode formMode)
 
 QgsAttributeEditorContext (const QgsAttributeEditorContext &parentContext, const QgsRelation &relation, RelationMode relationMode, FormMode widgetMode)
 
bool allowCustomUi () const
 Returns true if the attribute editor should permit use of custom UI forms. More...
 
Mode attributeFormMode () const
 Returns current attributeFormMode. More...
 
QString attributeFormModeString () const
 Returns given attributeFormMode as string. More...
 
QgsAdvancedDigitizingDockWidgetcadDockWidget () const
 Returns the associated CAD dock widget (e.g. More...
 
const QgsDistanceAreadistanceArea () const
 Returns the distance area object used for area/length calculations. More...
 
QgsFeature formFeature () const
 Returns current feature from the currently edited form or table row. More...
 
FormMode formMode () const
 Returns the form mode. More...
 
QgsMessageBarmainMessageBar ()
 Returns the main message bar. More...
 
QgsMapCanvasmapCanvas () const
 Returns the associated map canvas (e.g. More...
 
const QgsAttributeEditorContextparentContext () const
 
QgsFeature parentFormFeature () const
 Returns the feature of the currently edited parent form in its actual state. More...
 
const QgsRelationrelation () const
 Returns the attribute relation. More...
 
RelationMode relationMode () const
 Returns the attribute relation mode. More...
 
void setAllowCustomUi (bool allow)
 Sets whether the attribute editor should permit use of custom UI forms. More...
 
void setAttributeFormMode (const Mode &attributeFormMode)
 Set attributeFormMode for the edited form. More...
 
void setCadDockWidget (QgsAdvancedDigitizingDockWidget *cadDockWidget)
 Sets the associated CAD dock widget, cadDockWidget, (e.g. More...
 
void setDistanceArea (const QgsDistanceArea &distanceArea)
 Sets distance area object, distanceArea, for area/length calculations. More...
 
void setFormFeature (const QgsFeature &feature)
 Set current feature for the currently edited form or table row. More...
 
void setFormMode (FormMode mode)
 Sets the form mode. More...
 
void setMainMessageBar (QgsMessageBar *messageBar)
 Set current messageBar as the main message bar. More...
 
void setMapCanvas (QgsMapCanvas *mapCanvas)
 Sets the associated map canvas, mapCanvas, (e.g. More...
 
void setParentFormFeature (const QgsFeature &feature)
 Sets the feature of the currently edited parent form. More...
 
void setRelation (const QgsRelation &relation, RelationMode mode)
 Set attribute relation and mode. More...
 
void setVectorLayerTools (QgsVectorLayerTools *vlTools)
 Sets the associated vector layer tools. More...
 
const QgsVectorLayerToolsvectorLayerTools () const
 Returns the associated vector layer tools. More...
 

Detailed Description

This class contains context information for attribute editor widgets.

It will be passed to embedded widgets whenever this occurs (e.g. when showing an embedded form due to relations)

Definition at line 40 of file qgsattributeeditorcontext.h.

Member Enumeration Documentation

◆ FormMode

Enumerator
Embed 

A form was embedded as a widget on another form.

StandaloneDialog 

A form was opened as a new dialog.

Popup 

A widget was opened as a popup (e.g. attribute table editor widget)

Definition at line 70 of file qgsattributeeditorcontext.h.

◆ Mode

modes

Enumerator
SingleEditMode 

Single edit mode, for editing a single feature.

AddFeatureMode 

Add feature mode, for setting attributes for a new feature. In this mode the dialog will be editable even with an invalid feature and will add a new feature when the form is accepted.

FixAttributeMode 

Fix feature mode, for modifying the feature attributes without saving. The updated feature is available via feature() after save()

MultiEditMode 

Multi edit mode, for editing fields of multiple features at once.

SearchMode 

Form values are used for searching/filtering the layer.

AggregateSearchMode 

Form is in aggregate search mode, show each widget in this mode.

Since
QGIS 3.0
IdentifyMode 

Identify the feature.

Since
QGIS 3.0

Definition at line 47 of file qgsattributeeditorcontext.h.

◆ RelationMode

Determines in which direction a relation was resolved.

Enumerator
Undefined 

This context is not defined by a relation.

Multiple 

When showing a list of features (e.g. houses as an embedded form in a district form)

Single 

When showing a single feature (e.g. district information when looking at the form of a house)

Definition at line 63 of file qgsattributeeditorcontext.h.

Constructor & Destructor Documentation

◆ QgsAttributeEditorContext() [1/3]

QgsAttributeEditorContext::QgsAttributeEditorContext ( )
default

Constructor for QgsAttributeEditorContext.

◆ QgsAttributeEditorContext() [2/3]

QgsAttributeEditorContext::QgsAttributeEditorContext ( const QgsAttributeEditorContext parentContext,
FormMode  formMode 
)
inline

Definition at line 80 of file qgsattributeeditorcontext.h.

◆ QgsAttributeEditorContext() [3/3]

QgsAttributeEditorContext::QgsAttributeEditorContext ( const QgsAttributeEditorContext parentContext,
const QgsRelation relation,
RelationMode  relationMode,
FormMode  widgetMode 
)
inline

Definition at line 93 of file qgsattributeeditorcontext.h.

Member Function Documentation

◆ allowCustomUi()

bool QgsAttributeEditorContext::allowCustomUi ( ) const
inline

Returns true if the attribute editor should permit use of custom UI forms.

See also
setAllowCustomUi()
Since
QGIS 2.16

Definition at line 219 of file qgsattributeeditorcontext.h.

◆ attributeFormMode()

Mode QgsAttributeEditorContext::attributeFormMode ( ) const
inline

Returns current attributeFormMode.

Since
QGIS 3.4

Definition at line 264 of file qgsattributeeditorcontext.h.

◆ attributeFormModeString()

QString QgsAttributeEditorContext::attributeFormModeString ( ) const
inline

Returns given attributeFormMode as string.

Since
QGIS 3.4

Definition at line 276 of file qgsattributeeditorcontext.h.

◆ cadDockWidget()

QgsAdvancedDigitizingDockWidget* QgsAttributeEditorContext::cadDockWidget ( ) const
inline

Returns the associated CAD dock widget (e.g.

to be used in map tools).

Note
Unstable API. This method is unstable API and may be modified or removed at any time.
See also
setCadDockWidget()
Since
QGIS 3.10

Definition at line 156 of file qgsattributeeditorcontext.h.

◆ distanceArea()

const QgsDistanceArea& QgsAttributeEditorContext::distanceArea ( ) const
inline

Returns the distance area object used for area/length calculations.

See also
setDistanceArea()
Since
QGIS 2.2

Definition at line 126 of file qgsattributeeditorcontext.h.

◆ formFeature()

QgsFeature QgsAttributeEditorContext::formFeature ( ) const
inline

Returns current feature from the currently edited form or table row.

See also
setFormFeature()
Since
QGIS 3.2

Definition at line 237 of file qgsattributeeditorcontext.h.

◆ formMode()

FormMode QgsAttributeEditorContext::formMode ( ) const
inline

Returns the form mode.

See also
setFormMode()

Definition at line 204 of file qgsattributeeditorcontext.h.

◆ mainMessageBar()

QgsMessageBar* QgsAttributeEditorContext::mainMessageBar ( )
inline

Returns the main message bar.

Since
QGIS 3.12

Definition at line 292 of file qgsattributeeditorcontext.h.

◆ mapCanvas()

QgsMapCanvas* QgsAttributeEditorContext::mapCanvas ( ) const
inline

Returns the associated map canvas (e.g.

to zoom to related features).

See also
setMapCanvas()
Since
QGIS 3.2

Definition at line 140 of file qgsattributeeditorcontext.h.

◆ parentContext()

const QgsAttributeEditorContext* QgsAttributeEditorContext::parentContext ( ) const
inline

Definition at line 230 of file qgsattributeeditorcontext.h.

◆ parentFormFeature()

QgsFeature QgsAttributeEditorContext::parentFormFeature ( ) const
inline

Returns the feature of the currently edited parent form in its actual state.

See also
setParentFormFeature()
Since
QGIS 3.14

Definition at line 251 of file qgsattributeeditorcontext.h.

◆ relation()

const QgsRelation& QgsAttributeEditorContext::relation ( ) const
inline

Returns the attribute relation.

See also
setRelation()
relationMode()
Since
QGIS 2.6

Definition at line 190 of file qgsattributeeditorcontext.h.

◆ relationMode()

RelationMode QgsAttributeEditorContext::relationMode ( ) const
inline

Returns the attribute relation mode.

See also
setRelation()
relation()
Since
QGIS 2.6

Definition at line 198 of file qgsattributeeditorcontext.h.

◆ setAllowCustomUi()

void QgsAttributeEditorContext::setAllowCustomUi ( bool  allow)
inline

Sets whether the attribute editor should permit use of custom UI forms.

Parameters
allowset to true to allow custom UI forms, or false to disable them and use default generated QGIS forms
See also
allowCustomUi()
Since
QGIS 2.16

Definition at line 228 of file qgsattributeeditorcontext.h.

◆ setAttributeFormMode()

void QgsAttributeEditorContext::setAttributeFormMode ( const Mode attributeFormMode)
inline

Set attributeFormMode for the edited form.

Since
QGIS 3.4

Definition at line 270 of file qgsattributeeditorcontext.h.

◆ setCadDockWidget()

void QgsAttributeEditorContext::setCadDockWidget ( QgsAdvancedDigitizingDockWidget cadDockWidget)

Sets the associated CAD dock widget, cadDockWidget, (e.g.

to be used in map tools).

Note
Unstable API. This method is unstable API and may be modified or removed at any time.
See also
cadDockWidget()
Since
QGIS 3.10

Definition at line 18 of file qgsattributeeditorcontext.cpp.

◆ setDistanceArea()

void QgsAttributeEditorContext::setDistanceArea ( const QgsDistanceArea distanceArea)
inline

Sets distance area object, distanceArea, for area/length calculations.

See also
distanceArea()
Since
QGIS 2.2

Definition at line 112 of file qgsattributeeditorcontext.h.

◆ setFormFeature()

void QgsAttributeEditorContext::setFormFeature ( const QgsFeature feature)
inline

Set current feature for the currently edited form or table row.

See also
formFeature()
Since
QGIS 3.2

Definition at line 244 of file qgsattributeeditorcontext.h.

◆ setFormMode()

void QgsAttributeEditorContext::setFormMode ( FormMode  mode)
inline

Sets the form mode.

Parameters
modeform mode
See also
formMode()
Since
QGIS 2.16

Definition at line 212 of file qgsattributeeditorcontext.h.

◆ setMainMessageBar()

void QgsAttributeEditorContext::setMainMessageBar ( QgsMessageBar messageBar)
inline

Set current messageBar as the main message bar.

Since
QGIS 3.12

Definition at line 286 of file qgsattributeeditorcontext.h.

◆ setMapCanvas()

void QgsAttributeEditorContext::setMapCanvas ( QgsMapCanvas mapCanvas)
inline

Sets the associated map canvas, mapCanvas, (e.g.

to zoom to related features).

See also
mapCanvas()
Since
QGIS 3.2

Definition at line 133 of file qgsattributeeditorcontext.h.

◆ setParentFormFeature()

void QgsAttributeEditorContext::setParentFormFeature ( const QgsFeature feature)
inline

Sets the feature of the currently edited parent form.

See also
parentFormFeature()
Since
QGIS 3.14

Definition at line 258 of file qgsattributeeditorcontext.h.

◆ setRelation()

void QgsAttributeEditorContext::setRelation ( const QgsRelation relation,
RelationMode  mode 
)
inline

Set attribute relation and mode.

Parameters
relationrelation
moderelation mode
See also
relation()
relationMode()
Since
QGIS 2.6

Definition at line 182 of file qgsattributeeditorcontext.h.

◆ setVectorLayerTools()

void QgsAttributeEditorContext::setVectorLayerTools ( QgsVectorLayerTools vlTools)
inline

Sets the associated vector layer tools.

Parameters
vlToolsvector layer tools
See also
vectorLayerTools()
Since
QGIS 2.2

Definition at line 164 of file qgsattributeeditorcontext.h.

◆ vectorLayerTools()

const QgsVectorLayerTools* QgsAttributeEditorContext::vectorLayerTools ( ) const
inline

Returns the associated vector layer tools.

See also
setVectorLayerTools()
Since
QGIS 2.2

Definition at line 172 of file qgsattributeeditorcontext.h.


The documentation for this class was generated from the following files: