17#include "moc_qgsattributeeditorrelation.cpp" 
   23  mRelation = relationManager->
relation( mRelationId );
 
 
   30  element->mRelation = mRelation;
 
   31  element->mButtons = mButtons;
 
   32  element->mForceSuppressFormPopup = mForceSuppressFormPopup;
 
   33  element->mNmRelationId = mNmRelationId;
 
   34  element->mLabel = mLabel;
 
   35  element->mRelationEditorConfig = mRelationEditorConfig;
 
   36  element->mRelationWidgetTypeId = mRelationWidgetTypeId;
 
 
   42void QgsAttributeEditorRelation::saveConfiguration( QDomElement &elem, QDomDocument &doc )
 const 
   44  elem.setAttribute( QStringLiteral( 
"relation" ), mRelationId );
 
   45  elem.setAttribute( QStringLiteral( 
"forceSuppressFormPopup" ), mForceSuppressFormPopup );
 
   46  elem.setAttribute( QStringLiteral( 
"nmRelationId" ), mNmRelationId.toString() );
 
   47  elem.setAttribute( QStringLiteral( 
"label" ), mLabel );
 
   48  elem.setAttribute( QStringLiteral( 
"relationWidgetTypeId" ), mRelationWidgetTypeId );
 
   51  elemConfig.setTagName( QStringLiteral( 
"editor_configuration" ) );
 
   52  elem.appendChild( elemConfig );
 
   55void QgsAttributeEditorRelation::loadConfiguration( 
const QDomElement &element, 
const QString &layerId, 
const QgsReadWriteContext &context, 
const QgsFields &fields )
 
   64  if ( config.isEmpty() )
 
   68  if ( ! config.contains( QStringLiteral( 
"buttons" ) ) )
 
   70    if ( element.hasAttribute( 
"buttons" ) )
 
   98  if ( element.hasAttribute( QStringLiteral( 
"nmRelationId" ) ) )
 
  100    setNmRelationId( element.attribute( QStringLiteral( 
"nmRelationId" ) ) );
 
  103  if ( element.hasAttribute( 
"label" ) )
 
  105    const QString 
label = element.attribute( QStringLiteral( 
"label" ) );
 
  108  if ( element.hasAttribute( 
"relationWidgetTypeId" ) )
 
  110    const QString 
relationWidgetTypeId = element.attribute( QStringLiteral( 
"relationWidgetTypeId" ) );
 
  115QString QgsAttributeEditorRelation::typeIdentifier()
 const 
  117  return QStringLiteral( 
"attributeEditorRelation" );
 
  127  return mForceSuppressFormPopup;
 
 
  137  return mNmRelationId;
 
 
  152  return mRelationWidgetTypeId;
 
 
  162  return mRelationEditorConfig;
 
 
  167  mRelationEditorConfig = config;
 
 
An abstract base class for any elements of a drag and drop form.
 
QgsAttributeEditorElement * parent() const
Gets the parent of this element.
 
This element will load a relation editor onto the form.
 
void setNmRelationId(const QVariant &nmRelationId=QVariant())
Sets nmRelationId for the relation id of the second relation involved in an N:M relation.
 
bool init(QgsRelationManager *relManager)
Initializes the relation from the id.
 
void setRelationWidgetTypeId(const QString &relationWidgetTypeId)
Sets the relation widget type.
 
QgsAttributeEditorElement * clone(QgsAttributeEditorElement *parent) const override
Returns a clone of this element.
 
QVariantMap relationEditorConfiguration() const
Returns the relation editor widget configuration.
 
void setForceSuppressFormPopup(bool forceSuppressFormPopup)
Sets force suppress form popup status to forceSuppressFormPopup.
 
@ SaveChildEdits
Save child edits button.
 
QVariant nmRelationId() const
Determines the relation id of the second relation involved in an N:M relation.
 
bool forceSuppressFormPopup() const
Determines the force suppress form popup status.
 
QString relationWidgetTypeId() const
Returns the current relation widget type id.
 
void setRelationEditorConfiguration(const QVariantMap &config)
Sets the relation editor configuration.
 
void setLabel(const QString &label=QString())
Sets label for this element If it's empty it takes the relation id as label.
 
QString label() const
Determines the label of this element.
 
Container of fields for a vector layer.
 
A container for the context for various read/write operations on objects.
 
Manages a set of relations between layers.
 
Q_INVOKABLE QgsRelation relation(const QString &id) const
Gets access to a relation by its id.
 
static QDomElement writeVariant(const QVariant &value, QDomDocument &doc)
Write a QVariant to a QDomElement.
 
static QVariant readVariant(const QDomElement &element)
Read a QVariant from a QDomElement.
 
#define Q_NOWARN_DEPRECATED_POP
 
QString qgsFlagValueToKeys(const T &value, bool *returnOk=nullptr)
Returns the value for the given keys of a flag.
 
T qgsFlagKeysToValue(const QString &keys, const T &defaultValue, bool tryValueAsKey=true, bool *returnOk=nullptr)
Returns the value corresponding to the given keys of a flag.
 
#define Q_NOWARN_DEPRECATED_PUSH