Skip to content

Commit

Permalink
don't deprecate a class, sip fails
Browse files Browse the repository at this point in the history
  • Loading branch information
troopa81 committed Feb 27, 2023
1 parent 11e88ad commit b0cce7a
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 41 deletions.
Expand Up @@ -9,8 +9,10 @@




class QgsSymbolLayerId
%Docstring
{
%Docstring(signature="appended")
We may need stable references to symbol layers, when pointers to symbol layers is not usable
(when a symbol or a feature renderer is cloned for example).

Expand Down Expand Up @@ -38,18 +40,21 @@ path to symbol layers of the sub symbol are given by a list of indexes:
.. deprecated:: QGIS 3.30
Replaced by QUuid to identify symbol layers
%End
{

%TypeHeaderCode
#include "qgssymbollayerreference.h"
%End
public:
QgsSymbolLayerId();

QgsSymbolLayerId( const QString &key, int index );
%Docstring
:py:class:`QgsSymbolLayerId` constructor with a symbol key and a unique symbol layer index
QgsSymbolLayerId constructor with a symbol key and a unique symbol layer index
%End

QgsSymbolLayerId( const QString &key, const QVector<int> &indexPath );
%Docstring
:py:class:`QgsSymbolLayerId` constructor with a symbol key and an index path
QgsSymbolLayerId constructor with a symbol key and an index path
%End

QgsSymbolLayerId( const QgsSymbolLayerId &other );
Expand Down Expand Up @@ -112,9 +117,6 @@ Constructor

QgsSymbolLayerReference( const QString &layerId, const QString &symbolLayerId );

QgsSymbolLayerReference( const QgsSymbolLayerReference &other );


QString layerId() const;
%Docstring
The referenced vector layer / feature renderer
Expand Down
43 changes: 9 additions & 34 deletions src/core/symbology/qgssymbollayerreference.h
Expand Up @@ -25,6 +25,8 @@

class QgsVectorLayer;

// TODO QGIS 4 : Remove class QgsSymbolLayerId

/**
* We may need stable references to symbol layers, when pointers to symbol layers is not usable
* (when a symbol or a feature renderer is cloned for example).
Expand Down Expand Up @@ -52,7 +54,7 @@ class QgsVectorLayer;
* \since QGIS 3.12
* \deprecated since QGIS 3.30 Replaced by QUuid to identify symbol layers
*/
class Q_DECL_DEPRECATED CORE_EXPORT QgsSymbolLayerId
class CORE_EXPORT QgsSymbolLayerId
{
public:
QgsSymbolLayerId() {}
Expand Down Expand Up @@ -147,30 +149,6 @@ class CORE_EXPORT QgsSymbolLayerReference
: mLayerId( layerId ), mSymbolLayerId( symbolLayerId )
{}

// TODO QGIS 4 : remove this method, default copy constructor is just fine
Q_DECL_DEPRECATED QgsSymbolLayerReference( const QgsSymbolLayerReference &other )
: mLayerId( other.mLayerId ), mSymbolLayerId( other.mSymbolLayerId )
{
Q_NOWARN_DEPRECATED_PUSH
mDeprecatedSymbolLayerId = other.mDeprecatedSymbolLayerId;
Q_NOWARN_DEPRECATED_POP
}

Q_DECL_DEPRECATED QgsSymbolLayerReference &operator=( const QgsSymbolLayerReference &other )
{
if ( this == &other )
return *this;

mLayerId = other.mLayerId;
mSymbolLayerId = other.mSymbolLayerId;

Q_NOWARN_DEPRECATED_PUSH
mDeprecatedSymbolLayerId = other.mDeprecatedSymbolLayerId;
Q_NOWARN_DEPRECATED_POP

return *this;
}

/**
* The referenced vector layer / feature renderer
*/
Expand All @@ -191,14 +169,9 @@ class CORE_EXPORT QgsSymbolLayerReference
//! Comparison operator
bool operator==( const QgsSymbolLayerReference &other ) const
{
bool res = ( mLayerId == other.mLayerId
&& mSymbolLayerId == other.mSymbolLayerId );

Q_NOWARN_DEPRECATED_PUSH
res = res && mDeprecatedSymbolLayerId == other.mDeprecatedSymbolLayerId;
Q_NOWARN_DEPRECATED_POP

return res;
return mLayerId == other.mLayerId
&& mSymbolLayerId == other.mSymbolLayerId
&& mDeprecatedSymbolLayerId == other.mDeprecatedSymbolLayerId;
}

#ifdef SIP_RUN
Expand All @@ -217,7 +190,9 @@ class CORE_EXPORT QgsSymbolLayerReference

private:
QString mLayerId;
Q_DECL_DEPRECATED QgsSymbolLayerId mDeprecatedSymbolLayerId;

// TODO QGIS 4 : remove mDeprecatedSymbolLayerId
QgsSymbolLayerId mDeprecatedSymbolLayerId;

QString mSymbolLayerId;
};
Expand Down

0 comments on commit b0cce7a

Please sign in to comment.