34 , mRelation( relation )
35 , mRelationEditorId( relationEditorName )
49 QgsLogger::warning( QStringLiteral(
"Failed to create relation widget \"%1\", fallback to \"basic\" relation widget" ).arg( mRelationEditorId ) );
58 if ( mWidget && mRelation.
isValid() )
65 mWidget->setVisible( visible );
68 void QgsRelationWidgetWrapper::aboutToSave()
103 if ( mWidget && attributeChanged )
106 if ( feature.attribute( attribute ) != newValue )
121 return visibleButtons().testFlag( QgsAttributeEditorRelation::Button::Unlink );
162 editor->layout()->addWidget( w );
169 if (
config( QStringLiteral(
"force-suppress-popup" ),
false ).toBool() )
192 w->setVisible(
false );
213 return visibleButtons().testFlag( QgsAttributeEditorRelation::Button::Link );
227 return visibleButtons().testFlag( QgsAttributeEditorRelation::Button::SaveChildEdits );
243 return qgsFlagKeysToValue( mWidget->
config().value( QStringLiteral(
"buttons" ) ).toString(), QgsAttributeEditorRelation::AllButtons );
282 mWidget->setVisible(
false );
310 return mWidget->
label();
322 return mWidget ? mWidget->
config() : QVariantMap();
This class contains context information for attribute editor widgets.
const QgsAttributeEditorContext * parentContext() const
FormMode formMode() const
Returns the form mode.
const QgsRelation & relation() const
Returns the attribute relation.
@ Multiple
When showing a list of features (e.g. houses as an embedded form in a district form)
@ Embed
A form was embedded as a widget on another form.
void setParentFormFeature(const QgsFeature &feature)
Sets the feature of the currently edited parent form.
const QgsVectorLayerTools * vectorLayerTools() const
Returns the associated vector layer tools.
The feature class encapsulates a single feature including its id, geometry and a list of field/values...
bool setAttribute(int field, const QVariant &attr)
Set an attribute's value by field index.
static QgsGui * instance()
Returns a pointer to the singleton instance.
static QgsRelationWidgetRegistry * relationWidgetRegistry()
Returns the global relation widget registry, used for managing all known relation widget factories.
static void warning(const QString &msg)
Goes to qWarning.
QgsRelationManager * relationManager
static QgsProject * instance()
Returns the QgsProject singleton instance.
Q_INVOKABLE QgsRelation relation(const QString &id) const
Gets access to a relation by its id.
QgsVectorLayer * referencedLayer
QgsVectorLayer * referencingLayer
Represents a vector layer which manages a vector based data sets.
virtual bool isModified() const
Returns true if the provider has been modified since the last commit.
#define Q_NOWARN_DEPRECATED_POP
#define Q_NOWARN_DEPRECATED_PUSH
T qgsFlagKeysToValue(const QString &keys, const T &defaultValue)
Returns the value corresponding to the given keys of a flag.
QString qgsFlagValueToKeys(const T &value)
Returns the value for the given keys of a flag.