68 SymbolLayerFillVisitor( QTreeWidgetItem *layerItem,
const QgsVectorLayer *layer, QHash<QgsSymbolLayerReference, QTreeWidgetItem *> &items, QScreen *screen )
69 : mLayerItem( layerItem )
86 bool visitSymbol( QTreeWidgetItem *rootItem,
const QString &identifier,
const QgsSymbol *symbol, QVector<int> rootPath )
94 QVector<int> indexPath = rootPath;
95 indexPath.append( idx );
97 std::unique_ptr< QTreeWidgetItem > slItem = std::make_unique< QTreeWidgetItem >( rootItem );
99 slItem->setIcon( 0, slIcon );
102 slItem->setText( 0, QObject::tr(
"Mask symbol layer" ) );
103 slItem->setFlags( slItem->flags() | Qt::ItemIsUserCheckable );
104 slItem->setCheckState( 0, Qt::Unchecked );
107 if ( ( sl->
layerType() ==
"MaskMarker" ) ||
108 ( subSymbol && visitSymbol( slItem.get(), identifier, subSymbol, indexPath ) ) )
111 mItems[ref] = slItem.get();
112 rootItem->addChild( slItem.release() );
125 const QgsSymbol *symbol = symbolEntity->symbol();
129 std::unique_ptr< QTreeWidgetItem > symbolItem = std::make_unique< QTreeWidgetItem >( mLayerItem, QStringList() << ( mCurrentDescription + leaf.
description ) );
131 symbolItem->setIcon( 0, icon );
133 if ( visitSymbol( symbolItem.get(), leaf.
identifier, symbol, {} ) )
134 mLayerItem->addChild( symbolItem.release() );
140 QString mCurrentDescription;
141 QString mCurrentIdentifier;
142 QTreeWidgetItem *mLayerItem;
144 QHash<QgsSymbolLayerReference, QTreeWidgetItem *> &mItems;
145 QPointer< QScreen > mScreen;
151 LabelMasksVisitor( QTreeWidgetItem *layerItem,
const QgsVectorLayer *layer, QHash<QgsSymbolLayerReference, QTreeWidgetItem *> &items ):
152 mLayerItem( layerItem ), mLayer( layer ), mItems( items )
169 if ( labelSettingsEntity->settings().format().mask().enabled() )
171 const QString maskTitle = currentRule.isEmpty()
172 ? QObject::tr(
"Label mask" )
173 : QObject::tr(
"Label mask for '%1' rule" ).arg( currentDescription );
174 QTreeWidgetItem *slItem =
new QTreeWidgetItem( mLayerItem, QStringList() << maskTitle );
175 slItem->setFlags( slItem->flags() | Qt::ItemIsUserCheckable );
176 slItem->setCheckState( 0, Qt::Unchecked );
177 mLayerItem->addChild( slItem );
184 QHash<QString, QHash<QString, QSet<QgsSymbolLayerId>>> masks;
187 QString currentDescription;
188 QTreeWidgetItem *mLayerItem;
190 QHash<QgsSymbolLayerReference, QTreeWidgetItem *> &mItems;
204 std::unique_ptr< QTreeWidgetItem > layerItem = std::make_unique< QTreeWidgetItem >( mTree, QStringList() << layer->
name() );
205 layerItem->setData( 0, Qt::UserRole, QVariant::fromValue( vl ) );
209 LabelMasksVisitor lblVisitor( layerItem.get(), vl, mItems );
213 SymbolLayerFillVisitor slVisitor( layerItem.get(), vl, mItems, screen() );
216 if ( layerItem->childCount() > 0 )
217 mTree->addTopLevelItem( layerItem.release() );
220 expandAll( mTree->invisibleRootItem() );