Skip to content

Commit 47b812b

Browse files
authored
Don't allow non-polygon avoid intersection layers (qgis#59331)
1 parent 342a92c commit 47b812b

File tree

4 files changed

+9
-1
lines changed

4 files changed

+9
-1
lines changed

python/PyQt6/core/auto_generated/project/qgsproject.sip.in

+1
Original file line numberDiff line numberDiff line change
@@ -1065,6 +1065,7 @@ A list of layers with which intersections should be avoided.
10651065
%Docstring
10661066
Sets the list of layers with which intersections should be avoided.
10671067
Only used if the avoid intersection mode is set to advanced.
1068+
Line and point layers will not be added.
10681069
%End
10691070

10701071
void setAvoidIntersectionsMode( const Qgis::AvoidIntersectionsMode mode );

python/core/auto_generated/project/qgsproject.sip.in

+1
Original file line numberDiff line numberDiff line change
@@ -1065,6 +1065,7 @@ A list of layers with which intersections should be avoided.
10651065
%Docstring
10661066
Sets the list of layers with which intersections should be avoided.
10671067
Only used if the avoid intersection mode is set to advanced.
1068+
Line and point layers will not be added.
10681069
%End
10691070

10701071
void setAvoidIntersectionsMode( const Qgis::AvoidIntersectionsMode mode );

src/core/project/qgsproject.cpp

+6-1
Original file line numberDiff line numberDiff line change
@@ -2824,8 +2824,13 @@ void QgsProject::setAvoidIntersectionsLayers( const QList<QgsVectorLayer *> &lay
28242824

28252825
QStringList list;
28262826
list.reserve( layers.size() );
2827+
28272828
for ( QgsVectorLayer *layer : layers )
2828-
list << layer->id();
2829+
{
2830+
if ( layer->geometryType() == Qgis::GeometryType::Polygon )
2831+
list << layer->id();
2832+
}
2833+
28292834
writeEntry( QStringLiteral( "Digitizing" ), QStringLiteral( "/AvoidIntersectionsList" ), list );
28302835
emit avoidIntersectionsLayersChanged();
28312836
}

src/core/project/qgsproject.h

+1
Original file line numberDiff line numberDiff line change
@@ -1113,6 +1113,7 @@ class CORE_EXPORT QgsProject : public QObject, public QgsExpressionContextGenera
11131113
/**
11141114
* Sets the list of layers with which intersections should be avoided.
11151115
* Only used if the avoid intersection mode is set to advanced.
1116+
* Line and point layers will not be added.
11161117
*
11171118
*/
11181119
void setAvoidIntersectionsLayers( const QList<QgsVectorLayer *> &layers );

0 commit comments

Comments
 (0)