QGIS API Documentation 3.41.0-Master (af5edcb665c)
Loading...
Searching...
No Matches
Public Types | Public Member Functions | List of all members
QgsAttributeEditorRelation Class Reference

This element will load a relation editor onto the form. More...

#include <qgsattributeeditorrelation.h>

Inheritance diagram for QgsAttributeEditorRelation:
Inheritance graph
[legend]

Public Types

enum  Button {
  Link = 1 << 1 , Unlink = 1 << 2 , SaveChildEdits = 1 << 3 , AddChildFeature = 1 << 4 ,
  DuplicateChildFeature = 1 << 5 , DeleteChildFeature = 1 << 6 , ZoomToChildFeature = 1 << 7 , AllButtons = Link | Unlink | SaveChildEdits | AddChildFeature | DuplicateChildFeature | DeleteChildFeature | ZoomToChildFeature
}
 Possible buttons shown in the relation editor. More...
 
typedef QFlags< ButtonButtons
 

Public Member Functions

 QgsAttributeEditorRelation (const QgsRelation &relation, QgsAttributeEditorElement *parent)
 Creates a new element which embeds a relation.
 
Q_DECL_DEPRECATED QgsAttributeEditorRelation (const QString &name, const QgsRelation &relation, QgsAttributeEditorElement *parent)
 
Q_DECL_DEPRECATED QgsAttributeEditorRelation (const QString &name, const QString &relationId, QgsAttributeEditorElement *parent)
 
 QgsAttributeEditorRelation (const QString &relationId, QgsAttributeEditorElement *parent)
 Creates a new element which embeds a relation.
 
QgsAttributeEditorElementclone (QgsAttributeEditorElement *parent) const override
 Returns a clone of this element.
 
bool forceSuppressFormPopup () const
 Determines the force suppress form popup status.
 
bool init (QgsRelationManager *relManager)
 Initializes the relation from the id.
 
QString label () const
 Determines the label of this element.
 
QVariant nmRelationId () const
 Determines the relation id of the second relation involved in an N:M relation.
 
const QgsRelationrelation () const
 Gets the id of the relation which shall be embedded.
 
QVariantMap relationEditorConfiguration () const
 Returns the relation editor widget configuration.
 
QString relationWidgetTypeId () const
 Returns the current relation widget type id.
 
void setForceSuppressFormPopup (bool forceSuppressFormPopup)
 Sets force suppress form popup status to forceSuppressFormPopup.
 
void setLabel (const QString &label=QString())
 Sets label for this element If it's empty it takes the relation id as label.
 
void setNmRelationId (const QVariant &nmRelationId=QVariant())
 Sets nmRelationId for the relation id of the second relation involved in an N:M relation.
 
void setRelationEditorConfiguration (const QVariantMap &config)
 Sets the relation editor configuration.
 
void setRelationWidgetTypeId (const QString &relationWidgetTypeId)
 Sets the relation widget type.
 
- Public Member Functions inherited from QgsAttributeEditorElement
 QgsAttributeEditorElement (Qgis::AttributeEditorType type, const QString &name, QgsAttributeEditorElement *parent=nullptr)
 Constructor.
 
virtual ~QgsAttributeEditorElement ()=default
 
int horizontalStretch () const
 Returns the horizontal stretch factor for the element.
 
LabelStyle labelStyle () const
 Returns the label style.
 
QString name () const
 Returns the name of this element.
 
QgsAttributeEditorElementparent () const
 Gets the parent of this element.
 
void setHorizontalStretch (int stretch)
 Sets the horizontal stretch factor for the element.
 
void setLabelStyle (const LabelStyle &labelStyle)
 Sets the labelStyle.
 
void setShowLabel (bool showLabel)
 Controls if this element should be labeled with a title (field, relation or groupname).
 
void setVerticalStretch (int stretch)
 Sets the vertical stretch factor for the element.
 
bool showLabel () const
 Controls if this element should be labeled with a title (field, relation or groupname).
 
QDomElement toDomElement (QDomDocument &doc) const
 Gets the XML Dom element to save this element.
 
Qgis::AttributeEditorType type () const
 The type of this element.
 
int verticalStretch () const
 Returns the vertical stretch factor for the element.
 

Additional Inherited Members

- Static Public Member Functions inherited from QgsAttributeEditorElement
static QgsAttributeEditorElementcreate (const QDomElement &element, const QString &layerId, const QgsFields &fields, const QgsReadWriteContext &context, QgsAttributeEditorElement *parent=nullptr)
 Constructs the editor element from the given element.
 
- Protected Attributes inherited from QgsAttributeEditorElement
int mHorizontalStretch = 0
 
LabelStyle mLabelStyle
 
QString mName
 
QgsAttributeEditorElementmParent = nullptr
 
bool mShowLabel = true
 
Qgis::AttributeEditorType mType = Qgis::AttributeEditorType::Invalid
 
int mVerticalStretch = 0
 

Detailed Description

This element will load a relation editor onto the form.

Definition at line 30 of file qgsattributeeditorrelation.h.

Member Typedef Documentation

◆ Buttons

Definition at line 55 of file qgsattributeeditorrelation.h.

Member Enumeration Documentation

◆ Button

Possible buttons shown in the relation editor.

Deprecated:
QGIS 3.18. Use QgsRelationEditorWidget::Button instead.
Since
QGIS 3.16
Enumerator
Link 

Link button.

Unlink 

Unlink button.

SaveChildEdits 

Save child edits button.

AddChildFeature 

Add child feature (as in some projects we only want to allow linking/unlinking existing features)

DuplicateChildFeature 

Duplicate child feature.

DeleteChildFeature 

Delete child feature button.

ZoomToChildFeature 

Zoom to child feature.

AllButtons 

All buttons.

Definition at line 40 of file qgsattributeeditorrelation.h.

Constructor & Destructor Documentation

◆ QgsAttributeEditorRelation() [1/4]

Q_DECL_DEPRECATED QgsAttributeEditorRelation::QgsAttributeEditorRelation ( const QString &  name,
const QString &  relationId,
QgsAttributeEditorElement parent 
)
inline
Deprecated:
QGIS 3.16

Definition at line 61 of file qgsattributeeditorrelation.h.

◆ QgsAttributeEditorRelation() [2/4]

Q_DECL_DEPRECATED QgsAttributeEditorRelation::QgsAttributeEditorRelation ( const QString &  name,
const QgsRelation relation,
QgsAttributeEditorElement parent 
)
inline
Deprecated:
QGIS 3.16

Definition at line 69 of file qgsattributeeditorrelation.h.

◆ QgsAttributeEditorRelation() [3/4]

QgsAttributeEditorRelation::QgsAttributeEditorRelation ( const QString &  relationId,
QgsAttributeEditorElement parent 
)
inline

Creates a new element which embeds a relation.

Parameters
relationIdThe id of the relation to embed
parentThe parent (used as container)

Definition at line 81 of file qgsattributeeditorrelation.h.

◆ QgsAttributeEditorRelation() [4/4]

QgsAttributeEditorRelation::QgsAttributeEditorRelation ( const QgsRelation relation,
QgsAttributeEditorElement parent 
)
inline

Creates a new element which embeds a relation.

Parameters
relationThe relation to embed
parentThe parent (used as container)

Definition at line 92 of file qgsattributeeditorrelation.h.

Member Function Documentation

◆ clone()

QgsAttributeEditorElement * QgsAttributeEditorRelation::clone ( QgsAttributeEditorElement parent) const
overridevirtual

Returns a clone of this element.

To be implemented by subclasses.

Implements QgsAttributeEditorElement.

Definition at line 27 of file qgsattributeeditorrelation.cpp.

◆ forceSuppressFormPopup()

bool QgsAttributeEditorRelation::forceSuppressFormPopup ( ) const

Determines the force suppress form popup status.

Since
QGIS 3.16

Definition at line 125 of file qgsattributeeditorrelation.cpp.

◆ init()

bool QgsAttributeEditorRelation::init ( QgsRelationManager relManager)

Initializes the relation from the id.

Parameters
relManagerThe relation manager to use for the initialization
Returns
true if the relation was found in the relationmanager

Definition at line 21 of file qgsattributeeditorrelation.cpp.

◆ label()

QString QgsAttributeEditorRelation::label ( ) const

Determines the label of this element.

Since
QGIS 3.16

Definition at line 145 of file qgsattributeeditorrelation.cpp.

◆ nmRelationId()

QVariant QgsAttributeEditorRelation::nmRelationId ( ) const

Determines the relation id of the second relation involved in an N:M relation.

Since
QGIS 3.16

Definition at line 135 of file qgsattributeeditorrelation.cpp.

◆ relation()

const QgsRelation & QgsAttributeEditorRelation::relation ( ) const
inline

Gets the id of the relation which shall be embedded.

Returns
the id

Definition at line 104 of file qgsattributeeditorrelation.h.

◆ relationEditorConfiguration()

QVariantMap QgsAttributeEditorRelation::relationEditorConfiguration ( ) const

Returns the relation editor widget configuration.

Since
QGIS 3.18

Definition at line 160 of file qgsattributeeditorrelation.cpp.

◆ relationWidgetTypeId()

QString QgsAttributeEditorRelation::relationWidgetTypeId ( ) const

Returns the current relation widget type id.

Since
QGIS 3.18

Definition at line 150 of file qgsattributeeditorrelation.cpp.

◆ setForceSuppressFormPopup()

void QgsAttributeEditorRelation::setForceSuppressFormPopup ( bool  forceSuppressFormPopup)

Sets force suppress form popup status to forceSuppressFormPopup.

This flag is to override the layer and general settings regarding the automatic opening of the attribute form dialog when digitizing is completed.

Since
QGIS 3.16

Definition at line 120 of file qgsattributeeditorrelation.cpp.

◆ setLabel()

void QgsAttributeEditorRelation::setLabel ( const QString &  label = QString())

Sets label for this element If it's empty it takes the relation id as label.

Since
QGIS 3.16

Definition at line 140 of file qgsattributeeditorrelation.cpp.

◆ setNmRelationId()

void QgsAttributeEditorRelation::setNmRelationId ( const QVariant &  nmRelationId = QVariant())

Sets nmRelationId for the relation id of the second relation involved in an N:M relation.

If it's empty, then it's considered as a 1:M relationship.

Since
QGIS 3.16

Definition at line 130 of file qgsattributeeditorrelation.cpp.

◆ setRelationEditorConfiguration()

void QgsAttributeEditorRelation::setRelationEditorConfiguration ( const QVariantMap &  config)

Sets the relation editor configuration.

Since
QGIS 3.18

Definition at line 165 of file qgsattributeeditorrelation.cpp.

◆ setRelationWidgetTypeId()

void QgsAttributeEditorRelation::setRelationWidgetTypeId ( const QString &  relationWidgetTypeId)

Sets the relation widget type.

Since
QGIS 3.18

Definition at line 155 of file qgsattributeeditorrelation.cpp.


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