Skip to content

Commit

Permalink
Don't allow non-polygon avoid intersection layers (#59331)
Browse files Browse the repository at this point in the history
  • Loading branch information
JuhoErvasti authored Nov 5, 2024
1 parent 342a92c commit 47b812b
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 1 deletion.
1 change: 1 addition & 0 deletions python/PyQt6/core/auto_generated/project/qgsproject.sip.in
Original file line number Diff line number Diff line change
Expand Up @@ -1065,6 +1065,7 @@ A list of layers with which intersections should be avoided.
%Docstring
Sets the list of layers with which intersections should be avoided.
Only used if the avoid intersection mode is set to advanced.
Line and point layers will not be added.
%End

void setAvoidIntersectionsMode( const Qgis::AvoidIntersectionsMode mode );
Expand Down
1 change: 1 addition & 0 deletions python/core/auto_generated/project/qgsproject.sip.in
Original file line number Diff line number Diff line change
Expand Up @@ -1065,6 +1065,7 @@ A list of layers with which intersections should be avoided.
%Docstring
Sets the list of layers with which intersections should be avoided.
Only used if the avoid intersection mode is set to advanced.
Line and point layers will not be added.
%End

void setAvoidIntersectionsMode( const Qgis::AvoidIntersectionsMode mode );
Expand Down
7 changes: 6 additions & 1 deletion src/core/project/qgsproject.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2824,8 +2824,13 @@ void QgsProject::setAvoidIntersectionsLayers( const QList<QgsVectorLayer *> &lay

QStringList list;
list.reserve( layers.size() );

for ( QgsVectorLayer *layer : layers )
list << layer->id();
{
if ( layer->geometryType() == Qgis::GeometryType::Polygon )
list << layer->id();
}

writeEntry( QStringLiteral( "Digitizing" ), QStringLiteral( "/AvoidIntersectionsList" ), list );
emit avoidIntersectionsLayersChanged();
}
Expand Down
1 change: 1 addition & 0 deletions src/core/project/qgsproject.h
Original file line number Diff line number Diff line change
Expand Up @@ -1113,6 +1113,7 @@ class CORE_EXPORT QgsProject : public QObject, public QgsExpressionContextGenera
/**
* Sets the list of layers with which intersections should be avoided.
* Only used if the avoid intersection mode is set to advanced.
* Line and point layers will not be added.
*
*/
void setAvoidIntersectionsLayers( const QList<QgsVectorLayer *> &layers );
Expand Down

0 comments on commit 47b812b

Please sign in to comment.