@@ -38,10 +38,16 @@ class GUI_EXPORT QgsAttributeEditorContext
3838 */
3939 enum RelationMode
4040 {
41- Undefined, // !< This context is not defined by a relation
42- EmbedMultiple, // !< When embedding a list of features (e.g. houses as an embedded form in a district form)
43- EmbedSingle, // !< When embedding a single feature (e.g. district information when looking at the form of a house)
44- StandaloneSingle // !< When showing a new dialog for a single feature (e.g. district information when looking at the form of a house)
41+ Undefined, // !< This context is not defined by a relation
42+ Multiple, // !< When showing a list of features (e.g. houses as an embedded form in a district form)
43+ Single // !< When showing a single feature (e.g. district information when looking at the form of a house)
44+ };
45+
46+ enum FormMode
47+ {
48+ Embed, // !< A form was embedded as a widget on another form
49+ StandaloneDialog, // !< A form was opened as a new dialog
50+ Popup // !< A widget was opened as a popup (e.g. attribute table editor widget)
4551 };
4652
4753 QgsAttributeEditorContext ()
@@ -51,13 +57,25 @@ class GUI_EXPORT QgsAttributeEditorContext
5157 , mRelationMode ( Undefined )
5258 {}
5359
54- QgsAttributeEditorContext ( const QgsAttributeEditorContext& parentContext, const QgsRelation& relation, RelationMode mode )
60+ QgsAttributeEditorContext ( const QgsAttributeEditorContext& parentContext, FormMode formMode )
61+ : mParentContext ( &parentContext )
62+ , mLayer ( 0 )
63+ , mVectorLayerTools ( parentContext.mVectorLayerTools )
64+ , mDistanceArea ( parentContext.mDistanceArea )
65+ , mRelationMode ( Undefined )
66+ , mFormMode ( formMode )
67+ {
68+ Q_ASSERT ( parentContext.vectorLayerTools () );
69+ }
70+
71+ QgsAttributeEditorContext ( const QgsAttributeEditorContext& parentContext, const QgsRelation& relation, RelationMode relationMode, FormMode widgetMode )
5572 : mParentContext ( &parentContext )
5673 , mLayer ( 0 )
5774 , mVectorLayerTools ( parentContext.mVectorLayerTools )
5875 , mDistanceArea ( parentContext.mDistanceArea )
5976 , mRelation ( relation )
60- , mRelationMode ( mode )
77+ , mRelationMode ( relationMode )
78+ , mFormMode ( widgetMode )
6179 {
6280 Q_ASSERT ( parentContext.vectorLayerTools () );
6381 }
@@ -80,6 +98,8 @@ class GUI_EXPORT QgsAttributeEditorContext
8098 inline const QgsRelation& relation () const { return mRelation ; }
8199 inline RelationMode relationMode () const { return mRelationMode ; }
82100
101+ inline FormMode formMode () const { return mFormMode ; }
102+
83103 inline const QgsAttributeEditorContext* parentContext () const { return mParentContext ; }
84104
85105 private:
@@ -89,6 +109,7 @@ class GUI_EXPORT QgsAttributeEditorContext
89109 QgsDistanceArea mDistanceArea ;
90110 QgsRelation mRelation ;
91111 RelationMode mRelationMode ;
112+ FormMode mFormMode ;
92113};
93114
94115#endif // QGSATTRIBUTEEDITORCONTEXT_H
0 commit comments