QGIS API Documentation  3.17.0-Master (7a14973234)
Public Types | Public Member Functions | List of all members
QgsAttributeEditorRelation Class Reference

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

#include <qgsattributeeditorelement.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...
 
- Public Types inherited from QgsAttributeEditorElement
enum  AttributeEditorType {
  AeTypeContainer, AeTypeField, AeTypeRelation, AeTypeInvalid,
  AeTypeQmlElement, AeTypeHtmlElement
}
 

Public Member Functions

Q_DECL_DEPRECATED QgsAttributeEditorRelation (const QString &name, const QString &relationId, QgsAttributeEditorElement *parent)
 
Q_DECL_DEPRECATED QgsAttributeEditorRelation (const QString &name, const QgsRelation &relation, QgsAttributeEditorElement *parent)
 
 QgsAttributeEditorRelation (const QString &relationId, QgsAttributeEditorElement *parent)
 Creates a new element which embeds a relation. More...
 
 QgsAttributeEditorRelation (const QgsRelation &relation, QgsAttributeEditorElement *parent)
 Creates a new element which embeds a relation. More...
 
QgsAttributeEditorElementclone (QgsAttributeEditorElement *parent) const override
 Returns a clone of this element. More...
 
bool forceSuppressFormPopup () const
 Determines the force suppress form popup status. More...
 
bool init (QgsRelationManager *relManager)
 Initializes the relation from the id. More...
 
QString label () const
 Determines the label of this element. More...
 
QVariant nmRelationId () const
 Determines the relation id of the second relation involved in an N:M relation. More...
 
const QgsRelationrelation () const
 Gets the id of the relation which shall be embedded. More...
 
void setForceSuppressFormPopup (bool forceSuppressFormPopup)
 Sets force suppress form popup status to forceSuppressFormPopup. More...
 
void setLabel (const QString &label=QString())
 Sets label for this element If it's empty it takes the relation id as label. More...
 
void setNmRelationId (const QVariant &nmRelationId=QVariant())
 Sets nmRelationId for the relation id of the second relation involved in an N:M relation. More...
 
Q_DECL_DEPRECATED void setShowLinkButton (bool showLinkButton)
 Determines if the "link feature" button should be shown. More...
 
Q_DECL_DEPRECATED void setShowSaveChildEditsButton (bool showChildEdits)
 Determines if the "Save child layer edits" button should be shown. More...
 
Q_DECL_DEPRECATED void setShowUnlinkButton (bool showUnlinkButton)
 Determines if the "unlink feature" button should be shown. More...
 
void setVisibleButtons (const QgsAttributeEditorRelation::Buttons &buttons)
 Defines the buttons which are shown. More...
 
Q_DECL_DEPRECATED bool showLinkButton () const
 Determines if the "link feature" button should be shown. More...
 
Q_DECL_DEPRECATED bool showSaveChildEditsButton () const
 Determines if the "Save child layer edits" button should be shown. More...
 
Q_DECL_DEPRECATED bool showUnlinkButton () const
 Determines if the "unlink feature" button should be shown. More...
 
QgsAttributeEditorRelation::Buttons visibleButtons () const
 Returns the buttons which are shown. More...
 
- Public Member Functions inherited from QgsAttributeEditorElement
 QgsAttributeEditorElement (AttributeEditorType type, const QString &name, QgsAttributeEditorElement *parent=nullptr)
 Constructor. More...
 
virtual ~QgsAttributeEditorElement ()=default
 
QString name () const
 Returns the name of this element. More...
 
QgsAttributeEditorElementparent () const
 Gets the parent of this element. More...
 
void setShowLabel (bool showLabel)
 Controls if this element should be labeled with a title (field, relation or groupname). More...
 
bool showLabel () const
 Controls if this element should be labeled with a title (field, relation or groupname). More...
 
QDomElement toDomElement (QDomDocument &doc) const
 Gets the XML Dom element to save this element. More...
 
AttributeEditorType type () const
 The type of this element. More...
 

Additional Inherited Members

- Protected Attributes inherited from QgsAttributeEditorElement
QString mName
 
QgsAttributeEditorElementmParent = nullptr
 
bool mShowLabel
 
AttributeEditorType mType
 

Detailed Description

This element will load a relation editor onto the form.

Definition at line 334 of file qgsattributeeditorelement.h.

Member Enumeration Documentation

◆ Button

Possible buttons shown in the relation editor.

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 343 of file qgsattributeeditorelement.h.

Constructor & Destructor Documentation

◆ QgsAttributeEditorRelation() [1/4]

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

The name parameter is not used for anything and overwritten by the relationId internally.

Definition at line 361 of file qgsattributeeditorelement.h.

◆ QgsAttributeEditorRelation() [2/4]

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

The name parameter is not used for anything and overwritten by the relationId internally.

Definition at line 369 of file qgsattributeeditorelement.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 381 of file qgsattributeeditorelement.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 392 of file qgsattributeeditorelement.h.

Member Function Documentation

◆ clone()

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

Returns a clone of this element.

To be implemented by subclasses.

Since
QGIS 3.0

Implements QgsAttributeEditorElement.

Definition at line 95 of file qgsattributeeditorelement.cpp.

◆ forceSuppressFormPopup()

bool QgsAttributeEditorRelation::forceSuppressFormPopup ( ) const

Determines the force suppress form popup status.

Since
QGIS 3.16

Definition at line 189 of file qgsattributeeditorelement.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 89 of file qgsattributeeditorelement.cpp.

◆ label()

QString QgsAttributeEditorRelation::label ( ) const

Determines the label of this element.

Since
QGIS 3.16

Definition at line 209 of file qgsattributeeditorelement.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 199 of file qgsattributeeditorelement.cpp.

◆ relation()

const QgsRelation& QgsAttributeEditorRelation::relation ( ) const
inline

Gets the id of the relation which shall be embedded.

Returns
the id

Definition at line 404 of file qgsattributeeditorelement.h.

◆ 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 184 of file qgsattributeeditorelement.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 204 of file qgsattributeeditorelement.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 194 of file qgsattributeeditorelement.cpp.

◆ setShowLinkButton()

void QgsAttributeEditorRelation::setShowLinkButton ( bool  showLinkButton)

Determines if the "link feature" button should be shown.

Since
QGIS 2.18
Deprecated:
since QGIS 3.16 use setVisibleButtons() instead

Definition at line 154 of file qgsattributeeditorelement.cpp.

◆ setShowSaveChildEditsButton()

void QgsAttributeEditorRelation::setShowSaveChildEditsButton ( bool  showChildEdits)

Determines if the "Save child layer edits" button should be shown.

Since
QGIS 3.14
Deprecated:
since QGIS 3.16 use setVisibleButtons() instead

Definition at line 169 of file qgsattributeeditorelement.cpp.

◆ setShowUnlinkButton()

void QgsAttributeEditorRelation::setShowUnlinkButton ( bool  showUnlinkButton)

Determines if the "unlink feature" button should be shown.

Since
QGIS 2.18
Deprecated:
since QGIS 3.16 use setVisibleButtons() instead

Definition at line 164 of file qgsattributeeditorelement.cpp.

◆ setVisibleButtons()

void QgsAttributeEditorRelation::setVisibleButtons ( const QgsAttributeEditorRelation::Buttons &  buttons)

Defines the buttons which are shown.

Since
QGIS 3.16

Definition at line 179 of file qgsattributeeditorelement.cpp.

◆ showLinkButton()

bool QgsAttributeEditorRelation::showLinkButton ( ) const

Determines if the "link feature" button should be shown.

Since
QGIS 2.18
Deprecated:
since QGIS 3.16 use visibleButtons() instead

Definition at line 149 of file qgsattributeeditorelement.cpp.

◆ showSaveChildEditsButton()

bool QgsAttributeEditorRelation::showSaveChildEditsButton ( ) const

Determines if the "Save child layer edits" button should be shown.

Since
QGIS 3.14
Deprecated:
since QGIS 3.16 use visibleButtons() instead

Definition at line 174 of file qgsattributeeditorelement.cpp.

◆ showUnlinkButton()

bool QgsAttributeEditorRelation::showUnlinkButton ( ) const

Determines if the "unlink feature" button should be shown.

Since
QGIS 2.18
Deprecated:
since QGIS 3.16 use visibleButtons() instead

Definition at line 159 of file qgsattributeeditorelement.cpp.

◆ visibleButtons()

QgsAttributeEditorRelation::Buttons QgsAttributeEditorRelation::visibleButtons ( ) const
inline

Returns the buttons which are shown.

Since
QGIS 3.16

Definition at line 468 of file qgsattributeeditorelement.h.


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