37 #include <QFileDialog> 38 #include <QInputDialog> 39 #include <QMessageBox> 40 #include <QPushButton> 41 #include <QStandardItemModel> 52 QgsCheckableStyleModel::QgsCheckableStyleModel(
QgsStyle *style, QObject *parent,
bool readOnly )
55 , mReadOnly( readOnly )
60 void QgsCheckableStyleModel::setCheckable(
bool checkable )
62 if ( checkable == mCheckable )
65 mCheckable = checkable;
66 emit dataChanged( index( 0, 0 ), index( rowCount() - 1, 0 ), QVector< int >() << Qt::CheckStateRole );
69 void QgsCheckableStyleModel::setCheckTag(
const QString &tag )
71 if ( tag == mCheckTag )
75 emit dataChanged( index( 0, 0 ), index( rowCount() - 1, 0 ), QVector< int >() << Qt::CheckStateRole );
78 Qt::ItemFlags QgsCheckableStyleModel::flags(
const QModelIndex &index )
const 80 Qt::ItemFlags f = QgsStyleProxyModel::flags( index );
81 if ( !mReadOnly && mCheckable && index.column() == 0 )
82 f |= Qt::ItemIsUserCheckable;
85 f &= ~Qt::ItemIsEditable;
90 QVariant QgsCheckableStyleModel::data(
const QModelIndex &index,
int role )
const 97 QFont f = QgsStyleProxyModel::data( index, role ).value< QFont >();
102 case Qt::CheckStateRole:
104 if ( !mCheckable || index.column() != 0 )
108 return tags.contains( mCheckTag ) ? Qt::Checked : Qt::Unchecked;
115 return QgsStyleProxyModel::data( index, role );
118 bool QgsCheckableStyleModel::setData(
const QModelIndex &i,
const QVariant &value,
int role )
120 if ( i.row() < 0 || i.row() >= rowCount( QModelIndex() ) ||
121 ( role != Qt::EditRole && role != Qt::CheckStateRole ) )
127 if ( role == Qt::CheckStateRole )
129 if ( !mCheckable || mCheckTag.isEmpty() )
132 const QString name = data( index( i.row(),
QgsStyleModel::Name ), Qt::DisplayRole ).toString();
135 if ( value.toInt() == Qt::Checked )
136 return mStyle->
tagSymbol( entity, name, QStringList() << mCheckTag );
138 return mStyle->
detagSymbol( entity, name, QStringList() << mCheckTag );
140 return QgsStyleProxyModel::setData( i, value, role );
149 : QDialog( parent, flags )
151 , mReadOnly( readOnly )
154 connect( tabItemType, &QTabWidget::currentChanged,
this, &QgsStyleManagerDialog::tabItemType_currentChanged );
159 mMessageBar->setSizePolicy( QSizePolicy::Minimum, QSizePolicy::Fixed );
160 mVerticalLayout->insertWidget( 0, mMessageBar );
163 setWindowModality( Qt::WindowModal );
168 restoreGeometry( settings.
value( QStringLiteral(
"Windows/StyleV2Manager/geometry" ) ).toByteArray() );
169 mSplitter->setSizes( QList<int>() << 170 << 540 );
170 mSplitter->restoreState( settings.
value( QStringLiteral(
"Windows/StyleV2Manager/splitter" ) ).toByteArray() );
172 tabItemType->setDocumentMode(
true );
173 searchBox->setShowSearchIcon(
true );
174 searchBox->setPlaceholderText( tr(
"Filter symbols…" ) );
182 connect( btnAddItem, &QPushButton::clicked,
this, [ = ](
bool ) {
addItem(); }
184 connect( btnEditItem, &QPushButton::clicked,
this, [ = ](
bool ) {
editItem(); }
186 connect( actnEditItem, &QAction::triggered,
this, [ = ](
bool ) {
editItem(); }
188 connect( btnRemoveItem, &QPushButton::clicked,
this, [ = ](
bool ) {
removeItem(); }
190 connect( actnRemoveItem, &QAction::triggered,
this, [ = ](
bool ) {
removeItem(); }
195 btnAddTag->setEnabled(
false );
196 btnAddSmartgroup->setEnabled(
false );
199 QMenu *shareMenu =
new QMenu( tr(
"Share Menu" ),
this );
200 QAction *exportAction =
new QAction( tr(
"Export Item(s)…" ),
this );
202 shareMenu->addAction( exportAction );
205 QAction *importAction =
new QAction( tr(
"Import Item(s)…" ),
this );
207 shareMenu->addAction( importAction );
212 mActionCopyToDefault =
new QAction( tr(
"Copy Selection to Default Style…" ),
this );
213 shareMenu->addAction( mActionCopyToDefault );
214 connect( mActionCopyToDefault, &QAction::triggered,
this, &QgsStyleManagerDialog::copyItemsToDefault );
215 connect( mCopyToDefaultButton, &QPushButton::clicked,
this, &QgsStyleManagerDialog::copyItemsToDefault );
219 mCopyToDefaultButton->hide();
222 shareMenu->addSeparator();
223 shareMenu->addAction( actnExportAsPNG );
224 shareMenu->addAction( actnExportAsSVG );
229 btnShare->setMenu( shareMenu );
232 listItems->setIconSize( QSize( static_cast< int >( iconSize ), static_cast< int >( iconSize * 0.9 ) ) );
234 mSymbolTreeView->setIconSize( QSize( static_cast< int >( treeIconSize ), static_cast< int >( treeIconSize ) ) );
236 mModel =
new QgsCheckableStyleModel( mStyle,
this, mReadOnly );
237 mModel->addDesiredIconSize( listItems->iconSize() );
238 mModel->addDesiredIconSize( mSymbolTreeView->iconSize() );
239 listItems->setModel( mModel );
240 mSymbolTreeView->setModel( mModel );
242 listItems->setSelectionBehavior( QAbstractItemView::SelectRows );
243 listItems->setSelectionMode( QAbstractItemView::ExtendedSelection );
244 mSymbolTreeView->setSelectionModel( listItems->selectionModel() );
245 mSymbolTreeView->setSelectionMode( listItems->selectionMode() );
247 connect( listItems->selectionModel(), &QItemSelectionModel::currentChanged,
249 connect( listItems->selectionModel(), &QItemSelectionModel::selectionChanged,
252 QStandardItemModel *groupModel =
new QStandardItemModel( groupTree );
253 groupTree->setModel( groupModel );
254 groupTree->setHeaderHidden(
true );
256 groupTree->setCurrentIndex( groupTree->model()->index( 0, 0 ) );
258 connect( groupTree->selectionModel(), &QItemSelectionModel::currentChanged,
262 connect( groupModel, &QStandardItemModel::itemChanged,
268 QMenu *groupMenu =
new QMenu( tr(
"Group Actions" ),
this );
270 groupMenu->addAction( actnTagSymbols );
272 actnFinishTagging->setVisible(
false );
273 groupMenu->addAction( actnFinishTagging );
274 groupMenu->addAction( actnEditSmartGroup );
275 btnManageGroups->setMenu( groupMenu );
279 btnManageGroups->setEnabled(
false );
285 groupTree->setContextMenuPolicy( Qt::CustomContextMenu );
286 connect( groupTree, &QWidget::customContextMenuRequested,
290 listItems->setContextMenuPolicy( Qt::CustomContextMenu );
291 connect( listItems, &QWidget::customContextMenuRequested,
293 mSymbolTreeView->setContextMenuPolicy( Qt::CustomContextMenu );
294 connect( mSymbolTreeView, &QWidget::customContextMenuRequested,
300 QStringList rampTypes;
301 rampTypes << tr(
"Gradient" ) << tr(
"Color presets" ) << tr(
"Random" ) << tr(
"Catalog: cpt-city" );
302 rampTypes << tr(
"Catalog: ColorBrewer" );
304 mMenuBtnAddItemAll =
new QMenu(
this );
305 mMenuBtnAddItemColorRamp =
new QMenu(
this );
307 QAction *item =
new QAction( tr(
"Marker" ),
this );
309 mMenuBtnAddItemAll->addAction( item );
310 item =
new QAction( tr(
"Line" ),
this );
312 mMenuBtnAddItemAll->addAction( item );
313 item =
new QAction( tr(
"Fill" ),
this );
315 mMenuBtnAddItemAll->addAction( item );
316 mMenuBtnAddItemAll->addSeparator();
317 for (
const QString &rampType : qgis::as_const( rampTypes ) )
319 item =
new QAction( rampType,
this );
320 connect( item, &QAction::triggered,
this, [ = ](
bool ) {
addColorRamp( item ); } );
321 mMenuBtnAddItemAll->addAction( item );
322 mMenuBtnAddItemColorRamp->addAction(
new QAction( rampType,
this ) );
325 connect( mMenuBtnAddItemColorRamp, &QMenu::triggered,
330 mGroupMenu =
new QMenu(
this );
331 mGroupListMenu =
new QMenu( mGroupMenu );
332 mGroupListMenu->setTitle( tr(
"Add to Tag" ) );
333 mGroupListMenu->setEnabled(
false );
337 mGroupMenu->addAction( actnAddFavorite );
339 mGroupMenu->addAction( actnRemoveFavorite );
340 mGroupMenu->addSeparator()->setParent(
this );
341 mGroupMenu->addMenu( mGroupListMenu );
342 actnDetag->setData( 0 );
344 mGroupMenu->addAction( actnDetag );
345 mGroupMenu->addSeparator()->setParent(
this );
346 mGroupMenu->addAction( actnRemoveItem );
347 mGroupMenu->addAction( actnEditItem );
348 mGroupMenu->addSeparator()->setParent(
this );
352 btnAddItem->setVisible(
false );
353 btnRemoveItem->setVisible(
false );
354 btnEditItem->setVisible(
false );
355 btnAddSmartgroup->setVisible(
false );
356 btnAddTag->setVisible(
false );
357 btnManageGroups->setVisible(
false );
359 if ( mActionCopyToDefault )
361 mGroupMenu->addAction( mActionCopyToDefault );
363 mGroupMenu->addAction( actnExportAsPNG );
364 mGroupMenu->addAction( actnExportAsSVG );
367 mGroupTreeContextMenu =
new QMenu(
this );
371 mGroupTreeContextMenu->addAction( actnEditSmartGroup );
372 connect( actnAddTag, &QAction::triggered,
this, [ = ](
bool ) {
addTag(); }
374 mGroupTreeContextMenu->addAction( actnAddTag );
375 connect( actnAddSmartgroup, &QAction::triggered,
this, [ = ](
bool ) {
addSmartgroup(); }
377 mGroupTreeContextMenu->addAction( actnAddSmartgroup );
379 mGroupTreeContextMenu->addAction( actnRemoveGroup );
382 tabItemType_currentChanged( 0 );
387 connect( mButtonIconView, &QToolButton::toggled,
this, [ = ](
bool active )
391 mSymbolViewStackedWidget->setCurrentIndex( 0 );
396 connect( mButtonListView, &QToolButton::toggled,
this, [ = ](
bool active )
401 mSymbolViewStackedWidget->setCurrentIndex( 1 );
405 const int currentView = settings.
value( QStringLiteral(
"Windows/StyleV2Manager/lastIconView" ), 0,
QgsSettings::Gui ).toInt();
406 if ( currentView == 0 )
407 mButtonIconView->setChecked(
true );
409 mButtonListView->setChecked(
true );
411 mSymbolTreeView->header()->restoreState( settings.
value( QStringLiteral(
"Windows/StyleV2Manager/treeState" ), QByteArray(),
QgsSettings::Gui ).toByteArray() );
412 connect( mSymbolTreeView->header(), &QHeaderView::sectionResized,
this, [
this]
424 if ( mModified && !mReadOnly )
431 settings.
setValue( QStringLiteral(
"Windows/StyleV2Manager/splitter" ), mSplitter->saveState() );
438 void QgsStyleManagerDialog::tabItemType_currentChanged(
int )
442 searchBox->setPlaceholderText( isSymbol ? tr(
"Filter symbols…" ) : tr(
"Filter color ramps…" ) );
444 if ( !mReadOnly && !isSymbol )
446 btnAddItem->setMenu( mMenuBtnAddItemColorRamp );
448 else if ( !mReadOnly && tabItemType->currentIndex() == 0 )
450 btnAddItem->setMenu( mMenuBtnAddItemAll );
454 btnAddItem->setMenu(
nullptr );
457 actnExportAsPNG->setVisible( isSymbol );
458 actnExportAsSVG->setVisible( isSymbol );
461 mModel->setEntityFilterEnabled( !allTypesSelected() );
462 mModel->setSymbolTypeFilterEnabled( isSymbol && !allTypesSelected() );
463 if ( isSymbol && !allTypesSelected() )
464 mModel->setSymbolType( static_cast< QgsSymbol::SymbolType >(
currentItemType() ) );
469 void QgsStyleManagerDialog::copyItemsToDefault()
471 const QList< ItemDetails > items = selectedItems();
472 if ( !items.empty() )
475 const QString tags = QInputDialog::getText(
this, tr(
"Import Items" ),
476 tr(
"Additional tags to add (comma separated)" ), QLineEdit::Normal,
481 const QStringList parts = tags.split(
',', QString::SkipEmptyParts );
482 QStringList additionalTags;
483 additionalTags.reserve( parts.count() );
484 for (
const QString &tag : parts )
485 additionalTags << tag.trimmed();
487 auto cursorOverride = qgis::make_unique< QgsTemporaryCursorOverride >( Qt::WaitCursor );
488 const int count = copyItems( items, mStyle,
QgsStyle::defaultStyle(),
this, cursorOverride,
true, additionalTags,
false,
false );
489 cursorOverride.reset();
492 mMessageBar->
pushSuccess( tr(
"Import Items" ), count > 1 ? tr(
"Successfully imported %1 items." ).arg( count ) : tr(
"Successfully imported item." ) );
497 int QgsStyleManagerDialog::selectedItemType()
499 QModelIndex index = listItems->selectionModel()->currentIndex();
500 if ( !index.isValid() )
510 bool QgsStyleManagerDialog::allTypesSelected()
const 512 return tabItemType->currentIndex() == 0;
515 QList< QgsStyleManagerDialog::ItemDetails > QgsStyleManagerDialog::selectedItems()
517 QList<QgsStyleManagerDialog::ItemDetails > res;
518 QModelIndexList indices = listItems->selectionModel()->selectedRows();
519 for (
const QModelIndex &index : indices )
521 if ( !index.isValid() )
528 details.name = mModel->data( mModel->index( index.row(),
QgsStyleModel::Name, index.parent() ), Qt::DisplayRole ).toString();
535 int QgsStyleManagerDialog::copyItems(
const QList<QgsStyleManagerDialog::ItemDetails> &items,
QgsStyle *src,
QgsStyle *dst, QWidget *parentWidget,
536 std::unique_ptr< QgsTemporaryCursorOverride > &cursorOverride,
bool isImport,
const QStringList &importTags,
bool addToFavorites,
bool ignoreSourceTags )
539 bool overwriteAll =
true;
545 for (
auto &details : items )
547 QStringList symbolTags;
548 if ( !ignoreSourceTags )
550 symbolTags = src->
tagsOfSymbol( details.entityType, details.name );
553 bool addItemToFavorites =
false;
556 symbolTags << importTags;
557 addItemToFavorites = addToFavorites;
560 switch ( details.entityType )
564 std::unique_ptr< QgsSymbol > symbol( src->
symbol( details.name ) );
568 const bool hasDuplicateName = dst->
symbolNames().contains( details.name );
569 bool overwriteThis =
false;
571 addItemToFavorites = favoriteSymbols.contains( details.name );
573 if ( hasDuplicateName && prompt )
575 cursorOverride.reset();
576 int res = QMessageBox::warning( parentWidget, isImport ? tr(
"Import Symbol" ) : tr(
"Export Symbol" ),
577 tr(
"A symbol with the name “%1” already exists.\nOverwrite?" )
578 .arg( details.name ),
579 QMessageBox::Yes | QMessageBox::YesToAll | QMessageBox::No | QMessageBox::NoToAll | QMessageBox::Cancel );
580 cursorOverride = qgis::make_unique< QgsTemporaryCursorOverride >( Qt::WaitCursor );
583 case QMessageBox::Cancel:
586 case QMessageBox::No:
589 case QMessageBox::Yes:
590 overwriteThis =
true;
593 case QMessageBox::YesToAll:
598 case QMessageBox::NoToAll:
600 overwriteAll =
false;
605 if ( !hasDuplicateName || overwriteAll || overwriteThis )
608 dst->
addSymbol( details.name, symbol.release() );
609 dst->
saveSymbol( details.name, newSymbol, addItemToFavorites, symbolTags );
617 std::unique_ptr< QgsColorRamp > ramp( src->
colorRamp( details.name ) );
621 const bool hasDuplicateName = dst->
colorRampNames().contains( details.name );
622 bool overwriteThis =
false;
624 addItemToFavorites = favoriteColorramps.contains( details.name );
626 if ( hasDuplicateName && prompt )
628 cursorOverride.reset();
629 int res = QMessageBox::warning( parentWidget, isImport ? tr(
"Import Color Ramp" ) : tr(
"Export Color Ramp" ),
630 tr(
"A color ramp with the name “%1” already exists.\nOverwrite?" )
631 .arg( details.name ),
632 QMessageBox::Yes | QMessageBox::YesToAll | QMessageBox::No | QMessageBox::NoToAll | QMessageBox::Cancel );
633 cursorOverride = qgis::make_unique< QgsTemporaryCursorOverride >( Qt::WaitCursor );
636 case QMessageBox::Cancel:
639 case QMessageBox::No:
642 case QMessageBox::Yes:
643 overwriteThis =
true;
646 case QMessageBox::YesToAll:
651 case QMessageBox::NoToAll:
653 overwriteAll =
false;
658 if ( !hasDuplicateName || overwriteAll || overwriteThis )
662 dst->
saveColorRamp( details.name, newRamp, addItemToFavorites, symbolTags );
679 groupChanged( groupTree->selectionModel()->currentIndex() );
692 switch ( tabItemType->currentIndex() )
709 QModelIndex index = listItems->selectionModel()->currentIndex();
710 if ( !index.isValid() )
713 return mModel->data( mModel->index( index.row(),
QgsStyleModel::Name, index.parent() ), Qt::DisplayRole ).toString();
718 bool changed =
false;
729 Q_ASSERT(
false &&
"not implemented" );
742 QString name = tr(
"new symbol" );
747 name = tr(
"new marker" );
751 name = tr(
"new line" );
755 name = tr(
"new fill symbol" );
758 Q_ASSERT(
false &&
"unknown symbol type" );
768 if ( dlg.exec() == 0 )
775 if ( !saveDlg.exec() )
781 name = saveDlg.
name();
784 bool nameInvalid =
true;
785 while ( nameInvalid )
788 if ( name.isEmpty() )
790 QMessageBox::warning(
this, tr(
"Save Symbol" ),
791 tr(
"Cannot save symbol without name. Enter a name." ) );
795 int res = QMessageBox::warning(
this, tr(
"Save Symbol" ),
796 tr(
"Symbol with name '%1' already exists. Overwrite?" )
798 QMessageBox::Yes | QMessageBox::No );
799 if ( res == QMessageBox::Yes )
813 name = QInputDialog::getText(
this, tr(
"Symbol Name" ),
814 tr(
"Please enter a name for new symbol:" ),
815 QLineEdit::Normal, name, &ok );
824 QStringList symbolTags = saveDlg.
tags().split(
',' );
839 if ( rampType.isEmpty() )
841 QStringList rampTypes;
842 rampTypes << tr(
"Gradient" ) << tr(
"Color presets" ) << tr(
"Random" ) << tr(
"Catalog: cpt-city" );
843 rampTypes << tr(
"Catalog: ColorBrewer" );
844 rampType = QInputDialog::getItem( parent, tr(
"Color Ramp Type" ),
845 tr(
"Please select color ramp type:" ), rampTypes, 0,
false, &ok );
847 if ( !ok || rampType.isEmpty() )
850 QString name = tr(
"new ramp" );
852 std::unique_ptr< QgsColorRamp > ramp;
853 if ( rampType == tr(
"Gradient" ) )
861 name = tr(
"new gradient ramp" );
863 else if ( rampType == tr(
"Random" ) )
871 name = tr(
"new random ramp" );
873 else if ( rampType == tr(
"Catalog: ColorBrewer" ) )
883 else if ( rampType == tr(
"Color presets" ) )
891 name = tr(
"new preset ramp" );
893 else if ( rampType == tr(
"Catalog: cpt-city" ) )
915 QgsDebugMsg( QStringLiteral(
"invalid ramp type %1" ).arg( rampType ) );
920 if ( !saveDlg.exec() )
925 name = saveDlg.
name();
928 bool nameInvalid =
true;
929 while ( nameInvalid )
932 if ( name.isEmpty() )
934 QMessageBox::warning( parent, tr(
"Save Color Ramp" ),
935 tr(
"Cannot save color ramp without name. Enter a name." ) );
939 int res = QMessageBox::warning( parent, tr(
"Save Color Ramp" ),
940 tr(
"Color ramp with name '%1' already exists. Overwrite?" )
942 QMessageBox::Yes | QMessageBox::No );
943 if ( res == QMessageBox::Yes )
956 name = QInputDialog::getText( parent, tr(
"Color Ramp Name" ),
957 tr(
"Please enter a name for new color ramp:" ),
958 QLineEdit::Normal, name, &ok );
966 QStringList colorRampTags = saveDlg.
tags().split(
',' );
978 mFavoritesGroupVisible = show;
984 mSmartGroupVisible = show;
996 setWindowState( windowState() & ~Qt::WindowMinimized );
1009 action ? action->text() : QString() );
1010 if ( !rampName.isEmpty() )
1022 if ( selectedItemType() < 3 )
1026 else if ( selectedItemType() == 3 )
1032 Q_ASSERT(
false &&
"not implemented" );
1039 if ( symbolName.isEmpty() )
1042 std::unique_ptr< QgsSymbol > symbol( mStyle->
symbol( symbolName ) );
1046 if ( dlg.exec() == 0 )
1052 mStyle->
addSymbol( symbolName, symbol.release(), true );
1060 if ( name.isEmpty() )
1063 std::unique_ptr< QgsColorRamp > ramp( mStyle->
colorRamp( name ) );
1065 if ( ramp->type() == QLatin1String(
"gradient" ) )
1075 else if ( ramp->type() == QLatin1String(
"random" ) )
1085 else if ( ramp->type() == QLatin1String(
"colorbrewer" ) )
1095 else if ( ramp->type() == QLatin1String(
"preset" ) )
1105 else if ( ramp->type() == QLatin1String(
"cpt-city" ) )
1124 Q_ASSERT(
false &&
"invalid ramp type" );
1135 const QList< ItemDetails > items = selectedItems();
1137 if ( allTypesSelected() )
1139 if ( QMessageBox::Yes != QMessageBox::question(
this, tr(
"Remove Items" ),
1140 QString( tr(
"Do you really want to remove %n item(s)?",
nullptr, items.count() ) ),
1149 if ( QMessageBox::Yes != QMessageBox::question(
this, tr(
"Remove Symbol" ),
1150 QString( tr(
"Do you really want to remove %n symbol(s)?",
nullptr, items.count() ) ),
1157 if ( QMessageBox::Yes != QMessageBox::question(
this, tr(
"Remove Color Ramp" ),
1158 QString( tr(
"Do you really want to remove %n ramp(s)?",
nullptr, items.count() ) ),
1167 for (
const ItemDetails &details : items )
1169 if ( details.name.isEmpty() )
1197 QString dir = QFileDialog::getExistingDirectory(
this, tr(
"Export Selected Symbols as PNG" ),
1198 QDir::home().absolutePath(),
1199 QFileDialog::ShowDirsOnly
1200 | QFileDialog::DontResolveSymlinks );
1206 QString dir = QFileDialog::getExistingDirectory(
this, tr(
"Export Selected Symbols as SVG" ),
1207 QDir::home().absolutePath(),
1208 QFileDialog::ShowDirsOnly
1209 | QFileDialog::DontResolveSymlinks );
1216 if ( dir.isEmpty() )
1219 const QList< ItemDetails > items = selectedItems();
1220 for (
const ItemDetails &details : items )
1225 QString path = dir +
'/' + details.name +
'.' + format;
1226 std::unique_ptr< QgsSymbol > sym( mStyle->
symbol( details.name ) );
1228 sym->exportImage( path, format, size );
1248 QFont font = item->font();
1249 font.setBold(
true );
1250 item->setFont( font );
1255 if ( mBlockGroupUpdates )
1258 QStandardItemModel *model = qobject_cast<QStandardItemModel *>( groupTree->model() );
1261 if ( mFavoritesGroupVisible )
1263 QStandardItem *favoriteSymbols =
new QStandardItem( tr(
"Favorites" ) );
1264 favoriteSymbols->setData(
"favorite" );
1265 favoriteSymbols->setEditable(
false );
1267 model->appendRow( favoriteSymbols );
1270 QStandardItem *allSymbols =
new QStandardItem( tr(
"All" ) );
1271 allSymbols->setData(
"all" );
1272 allSymbols->setEditable(
false );
1274 model->appendRow( allSymbols );
1276 QStandardItem *taggroup =
new QStandardItem( QString() );
1277 taggroup->setData(
"tags" );
1278 taggroup->setEditable(
false );
1279 QStringList tags = mStyle->
tags();
1281 for (
const QString &tag : qgis::as_const( tags ) )
1283 QStandardItem *item =
new QStandardItem( tag );
1284 item->setData( mStyle->
tagId( tag ) );
1285 item->setEditable( !mReadOnly );
1286 taggroup->appendRow( item );
1288 taggroup->setText( tr(
"Tags" ) );
1290 model->appendRow( taggroup );
1292 if ( mSmartGroupVisible )
1294 QStandardItem *smart =
new QStandardItem( tr(
"Smart Groups" ) );
1295 smart->setData(
"smartgroups" );
1296 smart->setEditable(
false );
1299 QgsSymbolGroupMap::const_iterator i = sgMap.constBegin();
1300 while ( i != sgMap.constEnd() )
1302 QStandardItem *item =
new QStandardItem( i.value() );
1303 item->setData( i.key() );
1304 item->setEditable( !mReadOnly );
1305 smart->appendRow( item );
1308 model->appendRow( smart );
1312 int rows = model->rowCount( model->indexFromItem( model->invisibleRootItem() ) );
1313 for (
int i = 0; i < rows; i++ )
1315 groupTree->setExpanded( model->indexFromItem( model->item( i ) ),
true );
1321 QStringList groupSymbols;
1323 const QString category = index.data( Qt::UserRole + 1 ).toString();
1324 if ( mGroupingMode )
1326 mModel->setTagId( -1 );
1327 mModel->setSmartGroupId( -1 );
1328 mModel->setFavoritesOnly(
false );
1329 mModel->setCheckTag( index.data( Qt::DisplayRole ).toString() );
1331 else if ( category == QLatin1String(
"all" ) || category == QLatin1String(
"tags" ) || category == QLatin1String(
"smartgroups" ) )
1334 if ( category == QLatin1String(
"tags" ) )
1336 actnAddTag->setEnabled( !mReadOnly );
1337 actnAddSmartgroup->setEnabled(
false );
1339 else if ( category == QLatin1String(
"smartgroups" ) )
1341 actnAddTag->setEnabled(
false );
1342 actnAddSmartgroup->setEnabled( !mReadOnly );
1345 mModel->setTagId( -1 );
1346 mModel->setSmartGroupId( -1 );
1347 mModel->setFavoritesOnly(
false );
1349 else if ( category == QLatin1String(
"favorite" ) )
1352 mModel->setTagId( -1 );
1353 mModel->setSmartGroupId( -1 );
1354 mModel->setFavoritesOnly(
true );
1356 else if ( index.parent().data( Qt::UserRole + 1 ) ==
"smartgroups" )
1358 actnRemoveGroup->setEnabled( !mReadOnly );
1359 btnManageGroups->setEnabled( !mReadOnly );
1360 const int groupId = index.data( Qt::UserRole + 1 ).toInt();
1361 mModel->setTagId( -1 );
1362 mModel->setSmartGroupId( groupId );
1363 mModel->setFavoritesOnly(
false );
1368 int tagId = index.data( Qt::UserRole + 1 ).toInt();
1369 mModel->setTagId( tagId );
1370 mModel->setSmartGroupId( -1 );
1371 mModel->setFavoritesOnly(
false );
1374 actnEditSmartGroup->setVisible(
false );
1375 actnAddTag->setVisible(
false );
1376 actnAddSmartgroup->setVisible(
false );
1377 actnRemoveGroup->setVisible(
false );
1378 actnTagSymbols->setVisible(
false );
1379 actnFinishTagging->setVisible(
false );
1381 if ( index.parent().isValid() )
1383 if ( index.parent().data( Qt::UserRole + 1 ).toString() == QLatin1String(
"smartgroups" ) )
1385 actnEditSmartGroup->setVisible( !mGroupingMode && !mReadOnly );
1387 else if ( index.parent().data( Qt::UserRole + 1 ).toString() == QLatin1String(
"tags" ) )
1389 actnAddTag->setVisible( !mGroupingMode && !mReadOnly );
1390 actnTagSymbols->setVisible( !mGroupingMode && !mReadOnly );
1391 actnFinishTagging->setVisible( mGroupingMode && !mReadOnly );
1393 actnRemoveGroup->setVisible( !mReadOnly );
1395 else if ( index.data( Qt::UserRole + 1 ) ==
"smartgroups" )
1397 actnAddSmartgroup->setVisible( !mGroupingMode && !mReadOnly );
1399 else if ( index.data( Qt::UserRole + 1 ) ==
"tags" )
1401 actnAddTag->setVisible( !mGroupingMode && !mReadOnly );
1407 QStandardItemModel *model = qobject_cast<QStandardItemModel *>( groupTree->model() );
1409 for (
int i = 0; i < groupTree->model()->rowCount(); i++ )
1411 index = groupTree->model()->index( i, 0 );
1412 QString data = index.data( Qt::UserRole + 1 ).toString();
1413 if ( data == QLatin1String(
"tags" ) )
1422 itemName = QInputDialog::getText(
this, tr(
"Add Tag" ),
1423 tr(
"Please enter name for the new tag:" ), QLineEdit::Normal, tr(
"New tag" ), &ok ).trimmed();
1424 if ( !ok || itemName.isEmpty() )
1427 int check = mStyle->
tagId( itemName );
1430 mMessageBar->
pushCritical( tr(
"Add Tag" ), tr(
"The tag “%1” already exists." ).arg( itemName ) );
1436 mBlockGroupUpdates++;
1437 id = mStyle->
addTag( itemName );
1438 mBlockGroupUpdates--;
1442 mMessageBar->
pushCritical( tr(
"Add Tag" ), tr(
"New tag could not be created — There was a problem with the symbol database." ) );
1446 QStandardItem *parentItem = model->itemFromIndex( index );
1447 QStandardItem *childItem =
new QStandardItem( itemName );
1448 childItem->setData(
id );
1449 parentItem->appendRow( childItem );
1456 QStandardItemModel *model = qobject_cast<QStandardItemModel *>( groupTree->model() );
1458 for (
int i = 0; i < groupTree->model()->rowCount(); i++ )
1460 index = groupTree->model()->index( i, 0 );
1461 QString data = index.data( Qt::UserRole + 1 ).toString();
1462 if ( data == QLatin1String(
"smartgroups" ) )
1471 if ( dlg.exec() == QDialog::Rejected )
1476 mBlockGroupUpdates++;
1478 mBlockGroupUpdates--;
1484 QStandardItem *parentItem = model->itemFromIndex( index );
1485 QStandardItem *childItem =
new QStandardItem( itemName );
1486 childItem->setData(
id );
1487 parentItem->appendRow( childItem );
1494 QStandardItemModel *model = qobject_cast<QStandardItemModel *>( groupTree->model() );
1495 QModelIndex index = groupTree->currentIndex();
1498 QString data = index.data( Qt::UserRole + 1 ).toString();
1499 if ( data == QLatin1String(
"all" ) || data == QLatin1String(
"favorite" ) || data == QLatin1String(
"tags" ) || index.data() ==
"smartgroups" )
1502 int err = QMessageBox::critical(
this, tr(
"Remove Group" ),
1503 tr(
"Invalid selection. Cannot delete system defined categories.\n" 1504 "Kindly select a group or smart group you might want to delete." ) );
1509 QStandardItem *parentItem = model->itemFromIndex( index.parent() );
1513 mBlockGroupUpdates++;
1515 if ( parentItem->data( Qt::UserRole + 1 ).toString() == QLatin1String(
"smartgroups" ) )
1524 mBlockGroupUpdates--;
1525 parentItem->removeRow( index.row() );
1530 QgsDebugMsg( QStringLiteral(
"Symbol group edited: data=%1 text=%2" ).arg( item->data( Qt::UserRole + 1 ).toString(), item->text() ) );
1531 int id = item->data( Qt::UserRole + 1 ).toInt();
1532 QString name = item->text();
1533 mBlockGroupUpdates++;
1534 if ( item->parent()->data( Qt::UserRole + 1 ) ==
"smartgroups" )
1542 mBlockGroupUpdates--;
1547 QStandardItemModel *treeModel = qobject_cast<QStandardItemModel *>( groupTree->model() );
1549 if ( mGroupingMode )
1551 mGroupingMode =
false;
1552 mModel->setCheckable(
false );
1553 actnTagSymbols->setVisible(
true );
1554 actnFinishTagging->setVisible(
false );
1562 connect( treeModel, &QStandardItemModel::itemChanged,
1566 listItems->setSelectionMode( QAbstractItemView::ExtendedSelection );
1567 mSymbolTreeView->setSelectionMode( QAbstractItemView::ExtendedSelection );
1571 bool validGroup =
false;
1573 QModelIndex present = groupTree->currentIndex();
1574 while ( present.parent().isValid() )
1576 if ( present.parent().data() ==
"Tags" )
1581 present = present.parent();
1586 mGroupingMode =
true;
1588 actnTagSymbols->setVisible(
false );
1589 actnFinishTagging->setVisible(
true );
1591 disconnect( treeModel, &QStandardItemModel::itemChanged,
1597 btnManageGroups->setEnabled(
true );
1599 mModel->setCheckable(
true );
1602 listItems->setSelectionMode( QAbstractItemView::NoSelection );
1603 mSymbolTreeView->setSelectionMode( QAbstractItemView::NoSelection );
1617 mModel->setFilterString( qword );
1622 actnEditItem->setEnabled( index.isValid() && !mGroupingMode && !mReadOnly );
1627 Q_UNUSED( selected )
1628 Q_UNUSED( deselected )
1629 bool nothingSelected = listItems->selectionModel()->selectedIndexes().empty();
1630 actnRemoveItem->setDisabled( nothingSelected || mReadOnly );
1631 actnAddFavorite->setDisabled( nothingSelected || mReadOnly );
1632 actnRemoveFavorite->setDisabled( nothingSelected || mReadOnly );
1633 mGroupListMenu->setDisabled( nothingSelected || mReadOnly );
1634 actnDetag->setDisabled( nothingSelected || mReadOnly );
1635 actnExportAsPNG->setDisabled( nothingSelected );
1636 actnExportAsSVG->setDisabled( nothingSelected );
1637 if ( mActionCopyToDefault )
1638 mActionCopyToDefault->setDisabled( nothingSelected );
1639 mCopyToDefaultButton->setDisabled( nothingSelected );
1640 actnEditItem->setDisabled( nothingSelected || mReadOnly );
1645 groupTree->setEnabled( enable );
1646 btnAddTag->setEnabled( enable && !mReadOnly );
1647 btnAddSmartgroup->setEnabled( enable && !mReadOnly );
1648 actnAddTag->setEnabled( enable && !mReadOnly );
1649 actnAddSmartgroup->setEnabled( enable && !mReadOnly );
1650 actnRemoveGroup->setEnabled( enable && !mReadOnly );
1651 btnManageGroups->setEnabled( !mReadOnly && ( enable || mGroupingMode ) );
1652 searchBox->setEnabled( enable );
1657 actnRemoveGroup->setEnabled( enable && !mReadOnly );
1658 btnManageGroups->setEnabled( !mReadOnly && ( enable || mGroupingMode ) );
1663 QStandardItemModel *treeModel = qobject_cast<QStandardItemModel *>( groupTree->model() );
1664 for (
int i = 0; i < treeModel->rowCount(); i++ )
1666 treeModel->item( i )->setEnabled( enable );
1668 if ( treeModel->item( i )->data() ==
"smartgroups" )
1670 for (
int j = 0; j < treeModel->item( i )->rowCount(); j++ )
1672 treeModel->item( i )->child( j )->setEnabled( enable );
1679 for (
int i = 0; i < symbolBtnsLayout->count(); i++ )
1681 QWidget *w = symbolBtnsLayout->itemAt( i )->widget();
1683 w->setEnabled( enable );
1687 actnRemoveItem->setEnabled( enable );
1688 actnEditItem->setEnabled( enable );
1693 QPoint globalPos = groupTree->viewport()->mapToGlobal( point );
1695 QModelIndex index = groupTree->indexAt( point );
1696 if ( index.isValid() && !mGroupingMode )
1697 mGroupTreeContextMenu->popup( globalPos );
1702 QPoint globalPos = mSymbolViewStackedWidget->currentIndex() == 0
1703 ? listItems->viewport()->mapToGlobal( point )
1704 : mSymbolTreeView->viewport()->mapToGlobal( point );
1707 mGroupListMenu->clear();
1711 QAction *a =
nullptr;
1712 QStringList tags = mStyle->
tags();
1714 for (
const QString &tag : qgis::as_const( tags ) )
1716 a =
new QAction( tag, mGroupListMenu );
1720 mGroupListMenu->addAction( a );
1723 if ( tags.count() > 0 )
1725 mGroupListMenu->addSeparator();
1727 a =
new QAction( tr(
"Create New Tag…" ), mGroupListMenu );
1730 mGroupListMenu->addAction( a );
1733 mGroupMenu->popup( globalPos );
1738 const QList< ItemDetails > items = selectedItems();
1739 for (
const ItemDetails &details : items )
1741 mStyle->
addFavorite( details.entityType, details.name );
1747 const QList< ItemDetails > items = selectedItems();
1748 for (
const ItemDetails &details : items )
1756 QAction *selectedItem = qobject_cast<QAction *>( sender() );
1759 const QList< ItemDetails > items = selectedItems();
1769 tag = mStyle->
tag(
id );
1773 tag = selectedItem->data().toString();
1776 for (
const ItemDetails &details : items )
1778 mStyle->
tagSymbol( details.entityType, details.name, QStringList( tag ) );
1785 QAction *selectedItem = qobject_cast<QAction *>( sender() );
1789 const QList< ItemDetails > items = selectedItems();
1790 for (
const ItemDetails &details : items )
1792 mStyle->
detagSymbol( details.entityType, details.name );
1799 QStandardItemModel *treeModel = qobject_cast<QStandardItemModel *>( groupTree->model() );
1802 QModelIndex present = groupTree->currentIndex();
1803 if ( present.parent().data( Qt::UserRole + 1 ) !=
"smartgroups" )
1806 QMessageBox::critical(
this, tr(
"Edit Smart Group" ),
1807 tr(
"You have not selected a Smart Group. Kindly select a Smart Group to edit." ) );
1810 QStandardItem *item = treeModel->itemFromIndex( present );
1818 if ( dlg.exec() == QDialog::Rejected )
1821 mBlockGroupUpdates++;
1824 mBlockGroupUpdates--;
1827 mMessageBar->
pushCritical( tr(
"Edit Smart Group" ), tr(
"There was an error while editing the smart group." ) );
1831 item->setData(
id );
1843 QgsHelp::openHelp( QStringLiteral(
"working_with_vector/style_library.html#the-style-manager" ) );
void setBaseStyleName(const QString &name)
Sets the base name for the style, which is used by the dialog to reflect the original style/XML file ...
void groupChanged(const QModelIndex &)
Trigerred when the current group (or tag) is changed.
void tagSymbolsAction()
Toggles the interactive item tagging mode.
void setSmartGroupsVisible(bool show)
Sets whether smart groups should be shown.
void editItem()
Triggers the dialog for editing the current item.
QString tags() const
returns the text value of the tags element
Temporarily sets a cursor override for the QApplication for the lifetime of the object.
bool addColorRamp(const QString &name, QgsColorRamp *colorRamp, bool update=false)
Adds a color ramp to the style.
void symbolSaved(const QString &name, QgsSymbol *symbol)
Emitted every time a new symbol has been added to the database.
Q_DECL_DEPRECATED void regrouped(QStandardItem *) SIP_DEPRECATED
void setBold(QStandardItem *)
sets the text of the item with bold font
bool save(QString filename=QString())
Saves style into a file (will use current filename if empty string is passed)
A dialog allowing users to customize and populate a QgsStyle.
QgsStyleManagerDialog(QgsStyle *style, QWidget *parent SIP_TRANSFERTHIS=nullptr, Qt::WindowFlags flags=Qt::WindowFlags(), bool readOnly=false)
Constructor for QgsStyleManagerDialog, with the specified parent widget and window flags...
Abstract base class for all rendered symbols.
a dialog for setting properties of a newly saved style.
static const double UI_SCALE_FACTOR
UI scaling factor.
This class is a composition of two QSettings instances:
QgsColorBrewerColorRamp * clone() const override
Creates a clone of the color ramp.
void populateList()
Refreshes the list of items.
void onFinished()
Called when the dialog is going to be closed.
QgsSmartConditionMap conditionMap()
returns the condition map
int addSmartgroup()
Triggers the dialog to add a new smart group.
QVariant value(const QString &key, const QVariant &defaultValue=QVariant(), Section section=NoSection) const
Returns the value for setting key.
void selectedSymbolsChanged(const QItemSelection &selected, const QItemSelection &deselected)
Perform tasks when the selected symbols change.
QStringList tagsOfSymbol(StyleEntity type, const QString &symbol)
Returns the tags associated with the symbol.
QString name() const
returns the text value of the name element
Abstract base class for color ramps.
QMap< int, QString > QgsSymbolGroupMap
QString schemeName() const
static QString iconPath(const QString &iconFile)
Returns path to the desired icon file.
bool saveColorRamp(const QString &name, QgsColorRamp *ramp, bool favorite, const QStringList &tags)
Adds the colorramp to the DB.
void populateGroups()
populate the groups
bool tagSymbol(StyleEntity type, const QString &symbol, const QStringList &tags)
Tags the symbol with the tags in the list.
A bar for displaying non-blocking messages to the user.
void importItems()
Triggers the dialog to import items.
bool addColorRamp()
add a new color ramp to style
Q_DECL_DEPRECATED void populateTypes() SIP_DEPRECATED
Populate combo box with known style items (symbols, color ramps).
A dialog which allows users to modify the properties of a QgsColorBrewerColorRamp.
QgsColorRamp * colorRamp(const QString &name) const
Returns a new copy of the specified color ramp.
Q_DECL_DEPRECATED void itemChanged(QStandardItem *item) SIP_DEPRECATED
QString smartgroupName()
returns the value from mNameLineEdit
bool removeColorRamp(const QString &name)
Removes color ramp from style (and delete it)
bool rename(StyleEntity type, int id, const QString &newName)
Renames the given entity with the specified id.
void pushSuccess(const QString &title, const QString &message)
Pushes a success message with default timeout to the message bar.
A dialog which allows users to modify the properties of a QgsGradientColorRamp.
A dialog which allows users to modify the properties of a QgsPresetSchemeColorRamp.
A marker symbol type, for rendering Point and MultiPoint geometries.
A line symbol type, for rendering LineString and MultiLineString geometries.
static QgsStyle * defaultStyle()
Returns default application-wide style.
A dialog which allows users to modify the properties of a QgsLimitedRandomColorRamp.
StyleEntity
Enum for Entities involved in a style.
void saveGeometry(QWidget *widget, const QString &keyName)
Save the wigget geometry into settings.
QString currentItemName()
SymbolType
Type of the symbol.
void tagSelectedSymbols(bool newTag=false)
Tag selected symbols using menu item selection.
bool restoreGeometry(QWidget *widget, const QString &keyName)
Restore the wigget geometry from settings.
QgsGradientColorRamp * clone() const override
Creates a clone of the color ramp.
bool addSymbol(int symbolType=-1)
add a new symbol to style
int colors() const
Returns the number of colors in the ramp.
Constrained random color ramp, which returns random colors based on preset parameters.
void filterSymbols(const QString &filter)
Sets the filter string to filter symbols by.
QString tag(int id) const
Returns the tag name for the given id.
Q_DECL_DEPRECATED bool removeColorRamp() SIP_DEPRECATED
void exportItemsSVG()
Triggers the dialog to export selected items as SVG files.
QStringList symbolNames()
Returns a list of names of symbols.
bool removeFavorite(StyleEntity type, const QString &name)
Removes the specified symbol from favorites.
QgsGradientColorRamp ramp
QgsPresetSchemeColorRamp * clone() const override
Creates a clone of the color ramp.
bool remove(StyleEntity type, int id)
Removes the specified entity from the db.
void groupsModified()
Emitted every time a tag or smartgroup has been added, removed, or renamed.
void enableItemsForGroupingMode(bool)
Enables or disables the groupTree items for grouping mode.
void editSmartgroupAction()
Triggers the dialog for editing the selected smart group.
void exportSelectedItemsImages(const QString &dir, const QString &format, QSize size)
Triggers the dialog to export selected items as images of the specified format and size...
int addTag(const QString &tagName)
Adds a new tag and returns the tag's id.
Q_DECL_DEPRECATED void populateColorRamps(const QStringList &colorRamps, bool checkable=false) SIP_DEPRECATED
Populates the list view with color ramps of the current type with the given names.
void symbolSelected(const QModelIndex &)
Perform symbol specific tasks when selected.
QString smartgroupOperator(int id)
Returns the operator for the smartgroup clumsy implementation TODO create a class for smartgroups...
void grouptreeContextMenu(QPoint)
Context menu for the groupTree.
static QString addColorRampStatic(QWidget *parent, QgsStyle *style, QString RampType=QString())
Opens the add color ramp dialog, returning the new color ramp's name if the ramp has been added...
void removeFavoriteSelectedSymbols()
Remove selected symbols from favorites.
Export existing symbols mode.
A scheme based color ramp consisting of a list of predefined colors.
QSize iconSize(bool dockableToolbar)
Returns the user-preferred size of a window's toolbar icons.
A QSortFilterProxyModel subclass for showing filtered symbol and color ramps entries from a QgsStyle ...
QgsGradientColorRamp * cloneGradientRamp() const
QgsSmartConditionMap smartgroup(int id)
Returns the QgsSmartConditionMap for the given id.
QStringList colorRampNames()
Returns a list of names of color ramps.
QgsLimitedRandomColorRamp * clone() const override
Creates a clone of the color ramp.
void enableSymbolInputs(bool)
Enables or disbables the symbol specific inputs.
Q_DECL_DEPRECATED void populateSymbols(const QStringList &symbolNames, bool checkable=false) SIP_DEPRECATED
Populates the list view with symbols of the current type with the given names.
void setFavoritesGroupVisible(bool show)
Sets whether the favorites group should be shown.
int tagId(const QString &tag)
Returns the DB id for the given tag name.
QString schemeName() const
Returns the name of the color brewer color scheme.
void groupRenamed(QStandardItem *item)
Triggered when a group item is renamed.
void addFavoriteSelectedSymbols()
Add selected symbols to favorites.
bool addSymbol(const QString &name, QgsSymbol *symbol, bool update=false)
Adds a symbol to style and takes symbol's ownership.
QStringList tags() const
Returns a list of all tags in the style database.
int addSmartgroup(const QString &name, const QString &op, const QgsSmartConditionMap &conditions)
Adds a new smartgroup to the database and returns the id.
void setValue(const QString &key, const QVariant &value, QgsSettings::Section section=QgsSettings::NoSection)
Sets the value of setting key to value.
void setOperator(const QString &)
sets the operator AND/OR
QgsCptCityColorRamp * clone() const override
Creates a clone of the color ramp.
void activate()
Raises, unminimizes and activates this window.
QgsPresetSchemeColorRamp ramp
Q_DECL_DEPRECATED void setSymbolsChecked(const QStringList &) SIP_DEPRECATED
void removeGroup()
Removes the selected tag or smartgroup.
static void openHelp(const QString &key)
Opens help topic for the given help key using default system web browser.
void listitemsContextMenu(QPoint)
Context menu for the listItems ( symbols list )
Color ramp utilising "Color Brewer" preset color schemes.
bool isFavorite() const
returns whether the favorite element is checked
int addTag()
Triggers the dialog to add a new tag.
void setSmartgroupName(const QString &)
sets the smart group Name
void exportItemsPNG()
Triggers the dialog to export selected items as PNG files.
A fill symbol type, for rendering Polygon and MultiPolygon geometries.
void showHelp()
Opens the associated help.
QgsSymbol * symbol(const QString &name)
Returns a NEW copy of symbol.
void addItem()
Triggers the dialog for adding a new item, based on the currently selected item type tab...
void exportItems()
Triggers the dialog to export items.
bool saveSymbol(const QString &name, QgsSymbol *symbol, bool favorite, const QStringList &tags)
Adds the symbol to the DB with the tags.
void onClose()
Closes the dialog.
bool removeSymbol(const QString &name)
Removes symbol from style (and delete it)
A dialog which allows users to modify the properties of a QgsCptCityColorRamp.
Style entity type, see QgsStyle::StyleEntity.
QgsColorBrewerColorRamp ramp
bool addFavorite(StyleEntity type, const QString &name)
Adds the specified symbol to favorites.
Gradient color ramp, which smoothly interpolates between two colors and also supports optional extra ...
QgsLimitedRandomColorRamp ramp
void setConditionMap(const QgsSmartConditionMap &)
sets up the GUI for the given conditionmap
QString variantName() const
bool detagSymbol(StyleEntity type, const QString &symbol, const QStringList &tags)
Detags the symbol with the given list.
QStringList symbolsOfFavorite(StyleEntity type) const
Returns the symbol names which are flagged as favorite.
QMultiMap< QString, QString > QgsSmartConditionMap
A multimap to hold the smart group conditions as constraint and parameter pairs.
bool saveAsGradientRamp() const
Returns true if the ramp should be converted to a QgsGradientColorRamp.
void removeItem()
Removes the current selected item.
QgsSymbolGroupMap smartgroupsListMap()
Returns the smart groups map with id as key and name as value.
Q_DECL_DEPRECATED bool removeSymbol() SIP_DEPRECATED
void detagSelectedSymbols()
Remove all tags from selected symbols.
Symbol type (for symbol entities)
QString conditionOperator()
returns the AND/OR condition
void enableGroupInputs(bool)
Enables or disables the groupTree specific inputs.
void pushCritical(const QString &title, const QString &message)
Pushes a critical warning with default timeout to the message bar.