22 mRelation = relationManager->
relation( mRelationId );
29 element->mRelation = mRelation;
30 element->mButtons = mButtons;
31 element->mForceSuppressFormPopup = mForceSuppressFormPopup;
32 element->mNmRelationId = mNmRelationId;
33 element->mLabel = mLabel;
34 element->mRelationEditorConfig = mRelationEditorConfig;
35 element->mRelationWidgetTypeId = mRelationWidgetTypeId;
41 void QgsAttributeEditorRelation::saveConfiguration( QDomElement &elem, QDomDocument &doc )
const
43 elem.setAttribute( QStringLiteral(
"relation" ), mRelation.
id() );
44 elem.setAttribute( QStringLiteral(
"forceSuppressFormPopup" ), mForceSuppressFormPopup );
45 elem.setAttribute( QStringLiteral(
"nmRelationId" ), mNmRelationId.toString() );
46 elem.setAttribute( QStringLiteral(
"label" ), mLabel );
47 elem.setAttribute( QStringLiteral(
"relationWidgetTypeId" ), mRelationWidgetTypeId );
50 elemConfig.setTagName( QStringLiteral(
"editor_configuration" ) );
51 elem.appendChild( elemConfig );
54 void QgsAttributeEditorRelation::loadConfiguration(
const QDomElement &element,
const QString &layerId,
const QgsReadWriteContext &context,
const QgsFields &fields )
63 if ( config.isEmpty() )
67 if ( ! config.contains( QStringLiteral(
"buttons" ) ) )
69 if ( element.hasAttribute(
"buttons" ) )
76 const QString buttonString = element.attribute( QStringLiteral(
"buttons" ),
qgsFlagValueToKeys( QgsAttributeEditorRelation::Button::AllButtons ) );
84 QgsAttributeEditorRelation::Buttons buttons = QgsAttributeEditorRelation::Button::AllButtons;
85 buttons.setFlag( QgsAttributeEditorRelation::Button::Link, element.attribute( QStringLiteral(
"showLinkButton" ), QStringLiteral(
"1" ) ).toInt() );
86 buttons.setFlag( QgsAttributeEditorRelation::Button::Unlink, element.attribute( QStringLiteral(
"showUnlinkButton" ), QStringLiteral(
"1" ) ).toInt() );
87 buttons.setFlag( QgsAttributeEditorRelation::Button::SaveChildEdits, element.attribute( QStringLiteral(
"showSaveChildEditsButton" ), QStringLiteral(
"1" ) ).toInt() );
97 if ( element.hasAttribute( QStringLiteral(
"nmRelationId" ) ) )
99 setNmRelationId( element.attribute( QStringLiteral(
"nmRelationId" ) ) );
102 if ( element.hasAttribute(
"label" ) )
104 const QString
label = element.attribute( QStringLiteral(
"label" ) );
107 if ( element.hasAttribute(
"relationWidgetTypeId" ) )
109 const QString
relationWidgetTypeId = element.attribute( QStringLiteral(
"relationWidgetTypeId" ) );
114 QString QgsAttributeEditorRelation::typeIdentifier()
const
116 return QStringLiteral(
"attributeEditorRelation" );
126 return mForceSuppressFormPopup;
136 return mNmRelationId;
151 return mRelationWidgetTypeId;
161 return mRelationEditorConfig;
166 mRelationEditorConfig = config;