Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion app/qml/form/editors/MMFormGalleryEditor.qml
Comment thread
xkello marked this conversation as resolved.
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ MMPrivateComponents.MMBaseInput {
}
}

header: __activeProject.projectRole !== "reader" ? addFeatureComponent : null
header: (__activeProject.projectRole !== "reader" && !rmodel?.layer?.readOnly) ? addFeatureComponent : null
}

Component {
Expand Down
2 changes: 1 addition & 1 deletion app/qml/form/editors/MMFormRelationEditor.qml
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ MMPrivateComponents.MMBaseInput {
height: privates.itemHeight
radius: 8 * __dp
color: __style.lightGreenColor
visible: __activeProject.projectRole !== "reader"
visible: (__activeProject.projectRole !== "reader" && !rmodel?.layer?.readOnly)

MMComponents.MMIcon {
anchors.centerIn: parent
Expand Down
9 changes: 5 additions & 4 deletions app/relationfeaturesmodel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -75,12 +75,10 @@ void RelationFeaturesModel::setParentFeatureLayerPair( FeatureLayerPair pair )

if ( !InputUtils::isFeatureIdValid( pair.feature().id() ) )
{
//
// Clear the model in case parent feature has invalid id (e.g. is new) and do not populate it
//
// Parent has no valid id yet (e.g. new feature) - clear features but keep mLayer known.

beginResetModel();
reset();
mFeatures.clear();
endResetModel();
}
else
Expand All @@ -96,6 +94,9 @@ void RelationFeaturesModel::setRelation( QgsRelation relation )
mRelation = relation;
emit relationChanged( mRelation );

// set layer early so it's known even before the parent feature has a valid id (e.g. new feature)
LayerFeaturesModel::setLayer( mRelation.isValid() ? mRelation.referencingLayer() : nullptr );

setup();
}
}
Expand Down
Loading