18 #include <QRegularExpression>
23 slst.reserve( lst.size() );
26 QStringList indexPathStr;
27 const QVector<int> indexPath = ref.symbolLayerId().symbolLayerIndexPath();
28 indexPathStr.reserve( indexPath.size() );
29 for (
int index : indexPath )
31 indexPathStr.append( QString::number( index ) );
35 slst.append( QStringLiteral(
"%1,%2,%3" ).arg( ref.layerId(), ref.symbolLayerId().symbolKey(), indexPathStr.join(
',' ) ) );
37 return slst.join(
';' );
46 const QRegularExpression partsRx( QStringLiteral(
"((?:.*?),(?:.*?),(?:(?:\\d+,)+)?(?:\\d+);)" ) );
47 QRegularExpressionMatchIterator partsIt = partsRx.globalMatch(
str +
';' );
49 while ( partsIt.hasNext() )
51 QRegularExpressionMatch partMatch = partsIt.next();
52 const QString tuple = partMatch.captured( 1 );
57 const QRegularExpression rx( QStringLiteral(
"(.*?),(.*?),((?:\\d+,)+)?(\\d+)" ) );
59 const QRegularExpressionMatch match = rx.match( tuple );
60 if ( !match.hasMatch() )
63 const QString layerId = match.captured( 1 );
64 const QString symbolKey = match.captured( 2 );
65 const QStringList indices = QString( match.captured( 3 ) + match.captured( 4 ) ).split(
',' );
67 QVector<int> indexPath;
68 indexPath.reserve( indices.size() );
69 for (
const QString &index : indices )
71 indexPath.append( index.toInt() );
We may need stable references to symbol layers, when pointers to symbol layers is not usable (when a ...
Type used to refer to a specific symbol layer in a symbol of a layer.
QString symbolLayerReferenceListToString(const QgsSymbolLayerReferenceList &lst)
Utilitary function to turn a QgsSymbolLayerReferenceList into a string.
QgsSymbolLayerReferenceList stringToSymbolLayerReferenceList(const QString &str)
Utilitary function to parse a string originated from symbolLayerReferenceListToString into a QgsSymbo...
QList< QgsSymbolLayerReference > QgsSymbolLayerReferenceList