mirror of
https://github.com/qgis/QGIS.git
synced 2025-04-18 00:03:05 -04:00
Deprecate vector layer setter/getter within QgsSymbol
It's not used, and potentially very dangerous
This commit is contained in:
parent
e63fedfa36
commit
5e1d1a4c8c
@ -387,14 +387,21 @@ Returns whether the symbol utilizes any data defined properties.
|
|||||||
.. versionadded:: 2.12
|
.. versionadded:: 2.12
|
||||||
%End
|
%End
|
||||||
|
|
||||||
void setLayer( const QgsVectorLayer *layer );
|
void setLayer( const QgsVectorLayer *layer ) /Deprecated/;
|
||||||
%Docstring
|
%Docstring
|
||||||
|
|
||||||
.. note::
|
.. note::
|
||||||
|
|
||||||
the layer will be NULL after stopRender
|
the layer will be NULL after stopRender
|
||||||
|
|
||||||
|
.. deprecated:: Will be removed in QGIS 4.0
|
||||||
|
%End
|
||||||
|
|
||||||
|
const QgsVectorLayer *layer() const /Deprecated/;
|
||||||
|
%Docstring
|
||||||
|
|
||||||
|
.. deprecated:: Will be removed in QGIS 4.0
|
||||||
%End
|
%End
|
||||||
const QgsVectorLayer *layer() const;
|
|
||||||
|
|
||||||
void renderFeature( const QgsFeature &feature, QgsRenderContext &context, int layer = -1, bool selected = false, bool drawVertexMarker = false, int currentVertexMarkerType = 0, int currentVertexMarkerSize = 0 );
|
void renderFeature( const QgsFeature &feature, QgsRenderContext &context, int layer = -1, bool selected = false, bool drawVertexMarker = false, int currentVertexMarkerType = 0, int currentVertexMarkerSize = 0 );
|
||||||
%Docstring
|
%Docstring
|
||||||
|
@ -78,6 +78,7 @@ QgsProperty scaleWholeSymbol( double scaleFactorX, double scaleFactorY, const Qg
|
|||||||
|
|
||||||
////////////////////
|
////////////////////
|
||||||
|
|
||||||
|
Q_NOWARN_DEPRECATED_PUSH // because of deprecated mLayer
|
||||||
QgsSymbol::QgsSymbol( SymbolType type, const QgsSymbolLayerList &layers )
|
QgsSymbol::QgsSymbol( SymbolType type, const QgsSymbolLayerList &layers )
|
||||||
: mType( type )
|
: mType( type )
|
||||||
, mLayers( layers )
|
, mLayers( layers )
|
||||||
@ -97,6 +98,7 @@ QgsSymbol::QgsSymbol( SymbolType type, const QgsSymbolLayerList &layers )
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Q_NOWARN_DEPRECATED_POP
|
||||||
|
|
||||||
QPolygonF QgsSymbol::_getLineString( QgsRenderContext &context, const QgsCurve &curve, bool clipToExtent )
|
QPolygonF QgsSymbol::_getLineString( QgsRenderContext &context, const QgsCurve &curve, bool clipToExtent )
|
||||||
{
|
{
|
||||||
@ -434,7 +436,9 @@ void QgsSymbol::stopRender( QgsRenderContext &context )
|
|||||||
|
|
||||||
mSymbolRenderContext.reset( nullptr );
|
mSymbolRenderContext.reset( nullptr );
|
||||||
|
|
||||||
|
Q_NOWARN_DEPRECATED_PUSH
|
||||||
mLayer = nullptr;
|
mLayer = nullptr;
|
||||||
|
Q_NOWARN_DEPRECATED_POP
|
||||||
}
|
}
|
||||||
|
|
||||||
void QgsSymbol::setColor( const QColor &color )
|
void QgsSymbol::setColor( const QColor &color )
|
||||||
@ -669,6 +673,20 @@ bool QgsSymbol::hasDataDefinedProperties() const
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void QgsSymbol::setLayer( const QgsVectorLayer *layer )
|
||||||
|
{
|
||||||
|
Q_NOWARN_DEPRECATED_PUSH
|
||||||
|
mLayer = layer;
|
||||||
|
Q_NOWARN_DEPRECATED_POP
|
||||||
|
}
|
||||||
|
|
||||||
|
const QgsVectorLayer *QgsSymbol::layer() const
|
||||||
|
{
|
||||||
|
Q_NOWARN_DEPRECATED_PUSH
|
||||||
|
return mLayer;
|
||||||
|
Q_NOWARN_DEPRECATED_POP
|
||||||
|
}
|
||||||
|
|
||||||
///@cond PRIVATE
|
///@cond PRIVATE
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -1554,7 +1572,9 @@ QgsMarkerSymbol *QgsMarkerSymbol::clone() const
|
|||||||
{
|
{
|
||||||
QgsMarkerSymbol *cloneSymbol = new QgsMarkerSymbol( cloneLayers() );
|
QgsMarkerSymbol *cloneSymbol = new QgsMarkerSymbol( cloneLayers() );
|
||||||
cloneSymbol->setOpacity( mOpacity );
|
cloneSymbol->setOpacity( mOpacity );
|
||||||
|
Q_NOWARN_DEPRECATED_PUSH
|
||||||
cloneSymbol->setLayer( mLayer );
|
cloneSymbol->setLayer( mLayer );
|
||||||
|
Q_NOWARN_DEPRECATED_POP
|
||||||
cloneSymbol->setClipFeaturesToExtent( mClipFeaturesToExtent );
|
cloneSymbol->setClipFeaturesToExtent( mClipFeaturesToExtent );
|
||||||
return cloneSymbol;
|
return cloneSymbol;
|
||||||
}
|
}
|
||||||
@ -1771,7 +1791,9 @@ QgsLineSymbol *QgsLineSymbol::clone() const
|
|||||||
{
|
{
|
||||||
QgsLineSymbol *cloneSymbol = new QgsLineSymbol( cloneLayers() );
|
QgsLineSymbol *cloneSymbol = new QgsLineSymbol( cloneLayers() );
|
||||||
cloneSymbol->setOpacity( mOpacity );
|
cloneSymbol->setOpacity( mOpacity );
|
||||||
|
Q_NOWARN_DEPRECATED_PUSH
|
||||||
cloneSymbol->setLayer( mLayer );
|
cloneSymbol->setLayer( mLayer );
|
||||||
|
Q_NOWARN_DEPRECATED_POP
|
||||||
cloneSymbol->setClipFeaturesToExtent( mClipFeaturesToExtent );
|
cloneSymbol->setClipFeaturesToExtent( mClipFeaturesToExtent );
|
||||||
return cloneSymbol;
|
return cloneSymbol;
|
||||||
}
|
}
|
||||||
@ -1889,7 +1911,9 @@ QgsFillSymbol *QgsFillSymbol::clone() const
|
|||||||
{
|
{
|
||||||
QgsFillSymbol *cloneSymbol = new QgsFillSymbol( cloneLayers() );
|
QgsFillSymbol *cloneSymbol = new QgsFillSymbol( cloneLayers() );
|
||||||
cloneSymbol->setOpacity( mOpacity );
|
cloneSymbol->setOpacity( mOpacity );
|
||||||
|
Q_NOWARN_DEPRECATED_PUSH
|
||||||
cloneSymbol->setLayer( mLayer );
|
cloneSymbol->setLayer( mLayer );
|
||||||
|
Q_NOWARN_DEPRECATED_POP
|
||||||
cloneSymbol->setClipFeaturesToExtent( mClipFeaturesToExtent );
|
cloneSymbol->setClipFeaturesToExtent( mClipFeaturesToExtent );
|
||||||
return cloneSymbol;
|
return cloneSymbol;
|
||||||
}
|
}
|
||||||
|
@ -394,9 +394,16 @@ class CORE_EXPORT QgsSymbol
|
|||||||
*/
|
*/
|
||||||
bool hasDataDefinedProperties() const;
|
bool hasDataDefinedProperties() const;
|
||||||
|
|
||||||
//! \note the layer will be NULL after stopRender
|
/**
|
||||||
void setLayer( const QgsVectorLayer *layer ) { mLayer = layer; }
|
* \note the layer will be NULL after stopRender
|
||||||
const QgsVectorLayer *layer() const { return mLayer; }
|
* \deprecated Will be removed in QGIS 4.0
|
||||||
|
*/
|
||||||
|
Q_DECL_DEPRECATED void setLayer( const QgsVectorLayer *layer ) SIP_DEPRECATED;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \deprecated Will be removed in QGIS 4.0
|
||||||
|
*/
|
||||||
|
Q_DECL_DEPRECATED const QgsVectorLayer *layer() const SIP_DEPRECATED;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Render a feature. Before calling this the startRender() method should be called to initialize
|
* Render a feature. Before calling this the startRender() method should be called to initialize
|
||||||
@ -483,7 +490,7 @@ class CORE_EXPORT QgsSymbol
|
|||||||
RenderHints mRenderHints = nullptr;
|
RenderHints mRenderHints = nullptr;
|
||||||
bool mClipFeaturesToExtent = true;
|
bool mClipFeaturesToExtent = true;
|
||||||
|
|
||||||
const QgsVectorLayer *mLayer = nullptr; //current vectorlayer
|
Q_DECL_DEPRECATED const QgsVectorLayer *mLayer = nullptr; //current vectorlayer
|
||||||
|
|
||||||
private:
|
private:
|
||||||
#ifdef SIP_RUN
|
#ifdef SIP_RUN
|
||||||
|
@ -472,7 +472,9 @@ void QgsSymbolSelectorWidget::layerChanged()
|
|||||||
{
|
{
|
||||||
mDataDefineRestorer.reset();
|
mDataDefineRestorer.reset();
|
||||||
// then it must be a symbol
|
// then it must be a symbol
|
||||||
|
Q_NOWARN_DEPRECATED_PUSH
|
||||||
currentItem->symbol()->setLayer( mVectorLayer );
|
currentItem->symbol()->setLayer( mVectorLayer );
|
||||||
|
Q_NOWARN_DEPRECATED_POP
|
||||||
// Now populate symbols of that type using the symbols list widget:
|
// Now populate symbols of that type using the symbols list widget:
|
||||||
QgsSymbolsListWidget *symbolsList = new QgsSymbolsListWidget( currentItem->symbol(), mStyle, mAdvancedMenu, this, mVectorLayer );
|
QgsSymbolsListWidget *symbolsList = new QgsSymbolsListWidget( currentItem->symbol(), mStyle, mAdvancedMenu, this, mVectorLayer );
|
||||||
symbolsList->setContext( mContext );
|
symbolsList->setContext( mContext );
|
||||||
|
Loading…
x
Reference in New Issue
Block a user