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 (
const 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(
';' );
48 const thread_local QRegularExpression partsRx( QStringLiteral(
"((?:.*?),(?:.*?),(?:(?:\\d+,)+)?(?:\\d+);)" ) );
49 QRegularExpressionMatchIterator partsIt = partsRx.globalMatch(
str +
';' );
51 while ( partsIt.hasNext() )
53 const QRegularExpressionMatch partMatch = partsIt.next();
54 const QString tuple = partMatch.captured( 1 );
59 const thread_local QRegularExpression rx( QStringLiteral(
"(.*?),(.*?),((?:\\d+,)+)?(\\d+)" ) );
61 const QRegularExpressionMatch match = rx.match( tuple );
62 if ( !match.hasMatch() )
65 const QString layerId = match.captured( 1 );
66 const QString symbolKey = match.captured( 2 );
67 const QStringList indices = QString( match.captured( 3 ) + match.captured( 4 ) ).split(
',' );
69 QVector<int> indexPath;
70 indexPath.reserve( indices.size() );
71 for (
const QString &index : indices )
73 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