Skip to content

Commit d75eaff

Browse files
committed
Fixes to arrow line symbology:
- Fix crash in Python bindings caused by subsymbol ownership - Make symbol work correctly with categorised and graduated renderers
1 parent ca74cc0 commit d75eaff

File tree

3 files changed

+16
-2
lines changed

3 files changed

+16
-2
lines changed

python/core/symbology-ng/qgsarrowsymbollayer.sip

+5-2
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ class QgsArrowSymbolLayer : public QgsLineSymbolLayerV2
2323
virtual QgsSymbolV2* subSymbol();
2424

2525
/** Set the sub symbol used for filling */
26-
virtual bool setSubSymbol( QgsSymbolV2* symbol );
26+
virtual bool setSubSymbol( QgsSymbolV2* symbol /Transfer/ );
2727

2828
/** Return a list of attributes required to render this feature */
2929
virtual QSet<QString> usedAttributes() const;
@@ -106,6 +106,9 @@ class QgsArrowSymbolLayer : public QgsLineSymbolLayerV2
106106

107107
/** Main drawing method */
108108
void renderPolyline( const QPolygonF& points, QgsSymbolV2RenderContext& context );
109-
private:
109+
110+
void setColor( const QColor& c );
111+
112+
private:
110113
QgsArrowSymbolLayer( const QgsArrowSymbolLayer& );
111114
};

src/core/symbology-ng/qgsarrowsymbollayer.cpp

+9
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ bool QgsArrowSymbolLayer::setSubSymbol( QgsSymbolV2* symbol )
4545
mSymbol.reset( static_cast<QgsFillSymbolV2*>( symbol ) );
4646
return true;
4747
}
48+
delete symbol;
4849
return false;
4950
}
5051

@@ -604,3 +605,11 @@ void QgsArrowSymbolLayer::renderPolyline( const QPolygonF& points, QgsSymbolV2Re
604605
context.renderContext().expressionContext().popScope();
605606
}
606607

608+
void QgsArrowSymbolLayer::setColor( const QColor& c )
609+
{
610+
if ( mSymbol.data() )
611+
mSymbol->setColor( c );
612+
613+
mColor = c;
614+
}
615+

src/core/symbology-ng/qgsarrowsymbollayer.h

+2
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,8 @@ class CORE_EXPORT QgsArrowSymbolLayer : public QgsLineSymbolLayerV2
127127
/** Main drawing method */
128128
void renderPolyline( const QPolygonF& points, QgsSymbolV2RenderContext& context ) override;
129129

130+
void setColor( const QColor& c ) override;
131+
130132
private:
131133
/** Filling sub symbol */
132134
QScopedPointer<QgsFillSymbolV2> mSymbol;

0 commit comments

Comments
 (0)