Skip to content
Permalink
Browse files
__repr__ fro QgsSymbolLayerReference, QgsSymbolLayerId
  • Loading branch information
nyalldawson committed May 24, 2021
1 parent 22c2d72 commit 5ded8b664340adfe9fbf63b765eff056b3b7d7cc
@@ -73,6 +73,18 @@ Returns the symbol layer index path inside the symbol

bool operator<( const QgsSymbolLayerId &other ) const;

SIP_PYOBJECT __repr__();
%MethodCode

QStringList pathString;
for ( int path : sipCpp->symbolLayerIndexPath() )
{
pathString.append( QString::number( path ) );
}
QString str = QStringLiteral( "<QgsSymbolLayerId: %1 (%2)>" ).arg( sipCpp->symbolKey(), pathString.join( ',' ) );
sipRes = PyUnicode_FromString( str.toUtf8().constData() );
%End

};

class QgsSymbolLayerReference
@@ -110,6 +122,18 @@ The symbol layer's id

bool operator==( const QgsSymbolLayerReference &other ) const;

SIP_PYOBJECT __repr__();
%MethodCode

QStringList pathString;
for ( int path : sipCpp->symbolLayerId().symbolLayerIndexPath() )
{
pathString.append( QString::number( path ) );
}
QString str = QStringLiteral( "<QgsSymbolLayerReference: %1 - %2 (%3)>" ).arg( sipCpp->layerId(), sipCpp->symbolLayerId().symbolKey(), pathString.join( ',' ) );
sipRes = PyUnicode_FromString( str.toUtf8().constData() );
%End

};

uint qHash( const QgsSymbolLayerId &id );
@@ -99,6 +99,20 @@ class CORE_EXPORT QgsSymbolLayerId
: mSymbolKey < other.mSymbolKey;
}

#ifdef SIP_RUN
SIP_PYOBJECT __repr__();
% MethodCode

QStringList pathString;
for ( int path : sipCpp->symbolLayerIndexPath() )
{
pathString.append( QString::number( path ) );
}
QString str = QStringLiteral( "<QgsSymbolLayerId: %1 (%2)>" ).arg( sipCpp->symbolKey(), pathString.join( ',' ) );
sipRes = PyUnicode_FromString( str.toUtf8().constData() );
% End
#endif

private:
//! Symbol unique identifier (legend key)
QString mSymbolKey;
@@ -142,6 +156,20 @@ class CORE_EXPORT QgsSymbolLayerReference
mSymbolLayerId == other.mSymbolLayerId;
}

#ifdef SIP_RUN
SIP_PYOBJECT __repr__();
% MethodCode

QStringList pathString;
for ( int path : sipCpp->symbolLayerId().symbolLayerIndexPath() )
{
pathString.append( QString::number( path ) );
}
QString str = QStringLiteral( "<QgsSymbolLayerReference: %1 - %2 (%3)>" ).arg( sipCpp->layerId(), sipCpp->symbolLayerId().symbolKey(), pathString.join( ',' ) );
sipRes = PyUnicode_FromString( str.toUtf8().constData() );
% End
#endif

private:
QString mLayerId;
QgsSymbolLayerId mSymbolLayerId;

0 comments on commit 5ded8b6

Please sign in to comment.