31 #include "qgssettings.h"
47 #include <QFileDialog>
48 #include <QInputDialog>
49 #include <QMessageBox>
50 #include <QPushButton>
51 #include <QStandardItemModel>
54 #include <QDesktopServices>
65 QgsCheckableStyleModel::QgsCheckableStyleModel(
QgsStyleModel *sourceModel, QObject *parent,
bool readOnly )
67 , mStyle( sourceModel->style() )
68 , mReadOnly( readOnly )
73 QgsCheckableStyleModel::QgsCheckableStyleModel(
QgsStyle *style, QObject *parent,
bool readOnly )
76 , mReadOnly( readOnly )
80 void QgsCheckableStyleModel::setCheckable(
bool checkable )
82 if ( checkable == mCheckable )
85 mCheckable = checkable;
86 emit dataChanged( index( 0, 0 ), index( rowCount() - 1, 0 ), QVector< int >() << Qt::CheckStateRole );
89 void QgsCheckableStyleModel::setCheckTag(
const QString &tag )
91 if ( tag == mCheckTag )
95 emit dataChanged( index( 0, 0 ), index( rowCount() - 1, 0 ), QVector< int >() << Qt::CheckStateRole );
98 Qt::ItemFlags QgsCheckableStyleModel::flags(
const QModelIndex &index )
const
100 Qt::ItemFlags f = QgsStyleProxyModel::flags( index );
101 if ( !mReadOnly && mCheckable && index.column() == 0 )
102 f |= Qt::ItemIsUserCheckable;
105 f &= ~Qt::ItemIsEditable;
110 QVariant QgsCheckableStyleModel::data(
const QModelIndex &index,
int role )
const
117 QFont f = QgsStyleProxyModel::data( index, role ).value< QFont >();
122 case Qt::CheckStateRole:
124 if ( !mCheckable || index.column() != 0 )
128 return tags.contains( mCheckTag ) ? Qt::Checked : Qt::Unchecked;
135 return QgsStyleProxyModel::data( index, role );
138 bool QgsCheckableStyleModel::setData(
const QModelIndex &i,
const QVariant &value,
int role )
140 if ( i.row() < 0 || i.row() >= rowCount( QModelIndex() ) ||
141 ( role != Qt::EditRole && role != Qt::CheckStateRole ) )
147 if ( role == Qt::CheckStateRole )
149 if ( !mCheckable || mCheckTag.isEmpty() )
152 const QString name = data( index( i.row(),
QgsStyleModel::Name ), Qt::DisplayRole ).toString();
155 if ( value.toInt() == Qt::Checked )
156 return mStyle->tagSymbol( entity, name, QStringList() << mCheckTag );
158 return mStyle->detagSymbol( entity, name, QStringList() << mCheckTag );
160 return QgsStyleProxyModel::setData( i, value, role );
171 : QDialog( parent, flags )
173 , mReadOnly( readOnly )
177 connect( tabItemType, &QTabWidget::currentChanged,
this, &QgsStyleManagerDialog::tabItemType_currentChanged );
181 QPushButton *downloadButton = buttonBox->addButton( tr(
"Browse Online Styles" ), QDialogButtonBox::ResetRole );
182 downloadButton->setToolTip( tr(
"Download new styles from the online QGIS style repository" ) );
184 connect( downloadButton, &QPushButton::clicked,
this, [ = ]
186 QDesktopServices::openUrl( QUrl( QStringLiteral(
"https://plugins.qgis.org/styles" ) ) );
190 mMessageBar->setSizePolicy( QSizePolicy::Minimum, QSizePolicy::Fixed );
191 mVerticalLayout->insertWidget( 0, mMessageBar );
194 setWindowModality( Qt::WindowModal );
197 QgsSettings settings;
199 mSplitter->setSizes( QList<int>() << 170 << 540 );
200 mSplitter->restoreState( settings.value( QStringLiteral(
"Windows/StyleV2Manager/splitter" ) ).toByteArray() );
202 tabItemType->setDocumentMode(
true );
203 searchBox->setShowSearchIcon(
true );
204 searchBox->setPlaceholderText( tr(
"Filter symbols…" ) );
208 connect( btnEditItem, &QPushButton::clicked,
this, [ = ](
bool ) {
editItem(); }
210 connect( actnEditItem, &QAction::triggered,
this, [ = ](
bool ) {
editItem(); }
215 connect( btnAddItem, &QPushButton::clicked,
this, [ = ](
bool ) {
addItem(); }
218 connect( btnRemoveItem, &QPushButton::clicked,
this, [ = ](
bool ) {
removeItem(); }
220 connect( actnRemoveItem, &QAction::triggered,
this, [ = ](
bool ) {
removeItem(); }
225 btnAddTag->setEnabled(
false );
226 btnAddSmartgroup->setEnabled(
false );
229 QMenu *shareMenu =
new QMenu( tr(
"Share Menu" ),
this );
230 QAction *exportAction =
new QAction( tr(
"Export Item(s)…" ),
this );
232 shareMenu->addAction( exportAction );
235 QAction *importAction =
new QAction( tr(
"Import Item(s)…" ),
this );
237 shareMenu->addAction( importAction );
242 mActionCopyToDefault =
new QAction( tr(
"Copy Selection to Default Style…" ),
this );
243 shareMenu->addAction( mActionCopyToDefault );
244 connect( mActionCopyToDefault, &QAction::triggered,
this, &QgsStyleManagerDialog::copyItemsToDefault );
245 connect( mCopyToDefaultButton, &QPushButton::clicked,
this, &QgsStyleManagerDialog::copyItemsToDefault );
249 mCopyToDefaultButton->hide();
252 mActionCopyItem =
new QAction( tr(
"Copy Item" ),
this );
253 connect( mActionCopyItem, &QAction::triggered,
this, &QgsStyleManagerDialog::copyItem );
254 mActionPasteItem =
new QAction( tr(
"Paste Item…" ),
this );
255 connect( mActionPasteItem, &QAction::triggered,
this, &QgsStyleManagerDialog::pasteItem );
257 shareMenu->addSeparator();
258 shareMenu->addAction( actnExportAsPNG );
259 shareMenu->addAction( actnExportAsSVG );
264 btnShare->setMenu( shareMenu );
267 listItems->setIconSize( QSize(
static_cast< int >(
iconSize ),
static_cast< int >(
iconSize * 0.9 ) ) );
269 mSymbolTreeView->setIconSize( QSize(
static_cast< int >( treeIconSize ),
static_cast< int >( treeIconSize ) ) );
272 :
new QgsCheckableStyleModel( mStyle,
this, mReadOnly );
273 mModel->addDesiredIconSize( listItems->iconSize() );
274 mModel->addDesiredIconSize( mSymbolTreeView->iconSize() );
275 listItems->setModel( mModel );
276 mSymbolTreeView->setModel( mModel );
278 listItems->setSelectionBehavior( QAbstractItemView::SelectRows );
279 listItems->setSelectionMode( QAbstractItemView::ExtendedSelection );
280 mSymbolTreeView->setSelectionModel( listItems->selectionModel() );
281 mSymbolTreeView->setSelectionMode( listItems->selectionMode() );
283 connect( listItems->selectionModel(), &QItemSelectionModel::currentChanged,
285 connect( listItems->selectionModel(), &QItemSelectionModel::selectionChanged,
288 QStandardItemModel *groupModel =
new QStandardItemModel( groupTree );
289 groupTree->setModel( groupModel );
290 groupTree->setHeaderHidden(
true );
292 groupTree->setCurrentIndex( groupTree->model()->index( 0, 0 ) );
294 connect( groupTree->selectionModel(), &QItemSelectionModel::currentChanged,
298 connect( groupModel, &QStandardItemModel::itemChanged,
304 QMenu *groupMenu =
new QMenu( tr(
"Group Actions" ),
this );
306 groupMenu->addAction( actnTagSymbols );
308 actnFinishTagging->setVisible(
false );
309 groupMenu->addAction( actnFinishTagging );
310 groupMenu->addAction( actnEditSmartGroup );
311 btnManageGroups->setMenu( groupMenu );
315 btnManageGroups->setEnabled(
false );
321 groupTree->setContextMenuPolicy( Qt::CustomContextMenu );
322 connect( groupTree, &QWidget::customContextMenuRequested,
326 listItems->setContextMenuPolicy( Qt::CustomContextMenu );
327 connect( listItems, &QWidget::customContextMenuRequested,
329 mSymbolTreeView->setContextMenuPolicy( Qt::CustomContextMenu );
330 connect( mSymbolTreeView, &QWidget::customContextMenuRequested,
335 mMenuBtnAddItemAll =
new QMenu(
this );
336 mMenuBtnAddItemColorRamp =
new QMenu(
this );
337 mMenuBtnAddItemLabelSettings =
new QMenu(
this );
338 mMenuBtnAddItemLegendPatchShape =
new QMenu(
this );
339 mMenuBtnAddItemSymbol3D =
new QMenu(
this );
343 mMenuBtnAddItemAll->addAction( item );
346 mMenuBtnAddItemAll->addAction( item );
349 mMenuBtnAddItemAll->addAction( item );
350 mMenuBtnAddItemAll->addSeparator();
353 for (
const QPair< QString, QString > &rampType : rampTypes )
355 item =
new QAction(
QgsApplication::getThemeIcon( QStringLiteral(
"styleicons/color.svg" ) ), tr(
"%1…" ).arg( rampType.second ),
this );
356 connect( item, &QAction::triggered,
this, [ = ](
bool ) {
addColorRamp( rampType.first ); } );
357 mMenuBtnAddItemAll->addAction( item );
358 mMenuBtnAddItemColorRamp->addAction( item );
360 mMenuBtnAddItemAll->addSeparator();
362 connect( item, &QAction::triggered,
this, [ = ](
bool ) { addTextFormat(); } );
363 mMenuBtnAddItemAll->addAction( item );
364 mMenuBtnAddItemAll->addSeparator();
367 mMenuBtnAddItemAll->addAction( item );
368 mMenuBtnAddItemLabelSettings->addAction( item );
371 mMenuBtnAddItemAll->addAction( item );
372 mMenuBtnAddItemLabelSettings->addAction( item );
375 mMenuBtnAddItemAll->addAction( item );
376 mMenuBtnAddItemLabelSettings->addAction( item );
378 mMenuBtnAddItemAll->addSeparator();
381 mMenuBtnAddItemAll->addAction( item );
382 mMenuBtnAddItemLegendPatchShape->addAction( item );
384 connect( item, &QAction::triggered,
this, [ = ](
bool ) { addLegendPatchShape(
Qgis::SymbolType::Line ); } );
385 mMenuBtnAddItemAll->addAction( item );
386 mMenuBtnAddItemLegendPatchShape->addAction( item );
388 connect( item, &QAction::triggered,
this, [ = ](
bool ) { addLegendPatchShape(
Qgis::SymbolType::Fill ); } );
389 mMenuBtnAddItemAll->addAction( item );
390 mMenuBtnAddItemLegendPatchShape->addAction( item );
392 mMenuBtnAddItemAll->addSeparator();
394 connect( item, &QAction::triggered,
this, [ = ](
bool ) { addSymbol3D( QStringLiteral(
"point" ) ); } );
395 mMenuBtnAddItemAll->addAction( item );
396 mMenuBtnAddItemSymbol3D->addAction( item );
398 connect( item, &QAction::triggered,
this, [ = ](
bool ) { addSymbol3D( QStringLiteral(
"line" ) ); } );
399 mMenuBtnAddItemAll->addAction( item );
400 mMenuBtnAddItemSymbol3D->addAction( item );
402 connect( item, &QAction::triggered,
this, [ = ](
bool ) { addSymbol3D( QStringLiteral(
"polygon" ) ); } );
403 mMenuBtnAddItemAll->addAction( item );
404 mMenuBtnAddItemSymbol3D->addAction( item );
408 mGroupMenu =
new QMenu(
this );
409 mGroupListMenu =
new QMenu( mGroupMenu );
410 mGroupListMenu->setTitle( tr(
"Add to Tag" ) );
411 mGroupListMenu->setEnabled(
false );
415 mGroupMenu->addAction( actnAddFavorite );
417 mGroupMenu->addAction( actnRemoveFavorite );
418 mGroupMenu->addSeparator()->setParent(
this );
419 mGroupMenu->addMenu( mGroupListMenu );
420 actnDetag->setData( 0 );
422 mGroupMenu->addAction( actnDetag );
423 mGroupMenu->addSeparator()->setParent(
this );
424 mGroupMenu->addAction( actnRemoveItem );
425 mGroupMenu->addAction( actnEditItem );
426 mGroupMenu->addAction( mActionCopyItem );
427 mGroupMenu->addAction( mActionPasteItem );
428 mGroupMenu->addSeparator()->setParent(
this );
432 btnAddItem->setVisible(
false );
433 btnRemoveItem->setVisible(
false );
434 btnEditItem->setVisible(
false );
435 btnAddSmartgroup->setVisible(
false );
436 btnAddTag->setVisible(
false );
437 btnManageGroups->setVisible(
false );
439 mGroupMenu->addAction( mActionCopyItem );
441 if ( mActionCopyToDefault )
443 mGroupMenu->addAction( mActionCopyToDefault );
445 mGroupMenu->addAction( actnExportAsPNG );
446 mGroupMenu->addAction( actnExportAsSVG );
449 mGroupTreeContextMenu =
new QMenu(
this );
453 mGroupTreeContextMenu->addAction( actnEditSmartGroup );
454 connect( actnAddTag, &QAction::triggered,
this, [ = ](
bool ) {
addTag(); }
456 mGroupTreeContextMenu->addAction( actnAddTag );
457 connect( actnAddSmartgroup, &QAction::triggered,
this, [ = ](
bool ) {
addSmartgroup(); }
459 mGroupTreeContextMenu->addAction( actnAddSmartgroup );
461 mGroupTreeContextMenu->addAction( actnRemoveGroup );
464 tabItemType_currentChanged( 0 );
469 connect( mButtonIconView, &QToolButton::toggled,
this, [ = ](
bool active )
473 mSymbolViewStackedWidget->setCurrentIndex( 0 );
475 QgsSettings().setValue( QStringLiteral(
"Windows/StyleV2Manager/lastIconView" ), 0, QgsSettings::Gui );
478 connect( mButtonListView, &QToolButton::toggled,
this, [ = ](
bool active )
482 QgsSettings().setValue( QStringLiteral(
"Windows/StyleV2Manager/lastIconView" ), 1, QgsSettings::Gui );
483 mSymbolViewStackedWidget->setCurrentIndex( 1 );
487 const int currentView = settings.value( QStringLiteral(
"Windows/StyleV2Manager/lastIconView" ), 0, QgsSettings::Gui ).toInt();
488 if ( currentView == 0 )
489 mButtonIconView->setChecked(
true );
491 mButtonListView->setChecked(
true );
493 mSymbolTreeView->header()->restoreState( settings.value( QStringLiteral(
"Windows/StyleV2Manager/treeState" ), QByteArray(), QgsSettings::Gui ).toByteArray() );
494 connect( mSymbolTreeView->header(), &QHeaderView::sectionResized,
this, [
this]
497 QgsSettings().setValue( QStringLiteral(
"Windows/StyleV2Manager/treeState" ), mSymbolTreeView->header()->saveState(), QgsSettings::Gui );
506 if ( mModified && !mReadOnly )
511 QgsSettings settings;
512 settings.setValue( QStringLiteral(
"Windows/StyleV2Manager/splitter" ), mSplitter->saveState() );
519 void QgsStyleManagerDialog::tabItemType_currentChanged(
int )
528 searchBox->setPlaceholderText( isSymbol ? tr(
"Filter symbols…" ) :
529 isColorRamp ? tr(
"Filter color ramps…" ) :
530 isTextFormat ? tr(
"Filter text symbols…" ) :
531 isLabelSettings ? tr(
"Filter label settings…" ) :
532 isLegendPatchShape ? tr(
"Filter legend patch shapes…" ) : tr(
"Filter 3D symbols…" ) );
534 if ( !mReadOnly && isColorRamp )
536 btnAddItem->setMenu( mMenuBtnAddItemColorRamp );
538 else if ( !mReadOnly && isLegendPatchShape )
540 btnAddItem->setMenu( mMenuBtnAddItemLegendPatchShape );
542 else if ( !mReadOnly && isSymbol3D )
544 btnAddItem->setMenu( mMenuBtnAddItemSymbol3D );
546 else if ( !mReadOnly && isLabelSettings )
548 btnAddItem->setMenu( mMenuBtnAddItemLabelSettings );
550 else if ( !mReadOnly && !isSymbol && !isColorRamp )
552 btnAddItem->setMenu(
nullptr );
554 else if ( !mReadOnly && tabItemType->currentIndex() == 0 )
556 btnAddItem->setMenu( mMenuBtnAddItemAll );
560 btnAddItem->setMenu(
nullptr );
563 actnExportAsPNG->setVisible( isSymbol );
564 actnExportAsSVG->setVisible( isSymbol );
567 mModel->setEntityFilterEnabled( !allTypesSelected() );
568 mModel->setSymbolTypeFilterEnabled( isSymbol && !allTypesSelected() );
569 if ( isSymbol && !allTypesSelected() )
575 void QgsStyleManagerDialog::copyItemsToDefault()
577 const QList< ItemDetails > items = selectedItems();
578 if ( !items.empty() )
582 if ( !mBaseName.isEmpty() )
583 options.append( mBaseName );
586 defaultTags.sort( Qt::CaseInsensitive );
587 options.append( defaultTags );
588 const QString tags = QInputDialog::getItem(
this, tr(
"Import Items" ),
589 tr(
"Additional tags to add (comma separated)" ), options, mBaseName.isEmpty() ? -1 : 0,
true, &ok );
593 #if QT_VERSION < QT_VERSION_CHECK(5, 15, 0)
594 const QStringList parts = tags.split(
',', QString::SkipEmptyParts );
596 const QStringList parts = tags.split(
',', Qt::SkipEmptyParts );
598 QStringList additionalTags;
599 additionalTags.reserve( parts.count() );
600 for (
const QString &tag : parts )
601 additionalTags << tag.trimmed();
603 auto cursorOverride = std::make_unique< QgsTemporaryCursorOverride >( Qt::WaitCursor );
604 const int count = copyItems( items, mStyle,
QgsStyle::defaultStyle(),
this, cursorOverride,
true, additionalTags,
false,
false );
605 cursorOverride.reset();
608 mMessageBar->
pushSuccess( tr(
"Import Items" ), count > 1 ? tr(
"Successfully imported %1 items." ).arg( count ) : tr(
"Successfully imported item." ) );
613 void QgsStyleManagerDialog::copyItem()
615 const QList< ItemDetails > items = selectedItems();
619 ItemDetails details = items.at( 0 );
620 switch ( details.entityType )
624 std::unique_ptr< QgsSymbol > symbol( mStyle->
symbol( details.name ) );
634 QApplication::clipboard()->setMimeData( format.toMimeData() );
641 QApplication::clipboard()->setMimeData( format.toMimeData() );
655 void QgsStyleManagerDialog::pasteItem()
657 const QString defaultTag = groupTree->currentIndex().isValid() ? groupTree->currentIndex().data().toString() : QString();
662 saveDlg.setWindowTitle( tr(
"Paste Symbol" ) );
663 saveDlg.setDefaultTags( defaultTag );
664 if ( !saveDlg.exec() || saveDlg.name().isEmpty() )
667 if ( mStyle->
symbolNames().contains( saveDlg.name() ) )
669 int res = QMessageBox::warning(
this, tr(
"Paste Symbol" ),
670 tr(
"A symbol with the name '%1' already exists. Overwrite?" )
671 .arg( saveDlg.name() ),
672 QMessageBox::Yes | QMessageBox::No );
673 if ( res != QMessageBox::Yes )
680 QStringList symbolTags = saveDlg.tags().split(
',' );
682 mStyle->
addSymbol( saveDlg.name(), tempSymbol.release() );
684 mStyle->
saveSymbol( saveDlg.name(), newSymbol, saveDlg.isFavorite(), symbolTags );
693 saveDlg.setDefaultTags( defaultTag );
694 saveDlg.setWindowTitle( tr(
"Paste Text Format" ) );
695 if ( !saveDlg.exec() || saveDlg.name().isEmpty() )
700 int res = QMessageBox::warning(
this, tr(
"Paste Text Format" ),
701 tr(
"A format with the name '%1' already exists. Overwrite?" )
702 .arg( saveDlg.name() ),
703 QMessageBox::Yes | QMessageBox::No );
704 if ( res != QMessageBox::Yes )
711 QStringList symbolTags = saveDlg.tags().split(
',' );
714 mStyle->
saveTextFormat( saveDlg.name(), format, saveDlg.isFavorite(), symbolTags );
719 int QgsStyleManagerDialog::selectedItemType()
721 QModelIndex index = listItems->selectionModel()->currentIndex();
722 if ( !index.isValid() )
740 bool QgsStyleManagerDialog::allTypesSelected()
const
742 return tabItemType->currentIndex() == 0;
745 QList< QgsStyleManagerDialog::ItemDetails > QgsStyleManagerDialog::selectedItems()
747 QList<QgsStyleManagerDialog::ItemDetails > res;
748 QModelIndexList indices = listItems->selectionModel()->selectedRows();
749 for (
const QModelIndex &index : indices )
751 if ( !index.isValid() )
758 details.name = mModel->data( mModel->index( index.row(),
QgsStyleModel::Name, index.parent() ), Qt::DisplayRole ).toString();
765 int QgsStyleManagerDialog::copyItems(
const QList<QgsStyleManagerDialog::ItemDetails> &items,
QgsStyle *src,
QgsStyle *dst, QWidget *parentWidget,
766 std::unique_ptr< QgsTemporaryCursorOverride > &cursorOverride,
bool isImport,
const QStringList &importTags,
bool addToFavorites,
bool ignoreSourceTags )
769 bool overwriteAll =
true;
779 for (
auto &details : items )
781 QStringList symbolTags;
782 if ( !ignoreSourceTags )
784 symbolTags = src->
tagsOfSymbol( details.entityType, details.name );
787 bool addItemToFavorites =
false;
790 symbolTags << importTags;
791 addItemToFavorites = addToFavorites;
794 switch ( details.entityType )
798 std::unique_ptr< QgsSymbol > symbol( src->
symbol( details.name ) );
802 const bool hasDuplicateName = dst->
symbolNames().contains( details.name );
803 bool overwriteThis =
false;
805 addItemToFavorites = favoriteSymbols.contains( details.name );
807 if ( hasDuplicateName && prompt )
809 cursorOverride.reset();
810 int res = QMessageBox::warning( parentWidget, isImport ? tr(
"Import Symbol" ) : tr(
"Export Symbol" ),
811 tr(
"A symbol with the name “%1” already exists.\nOverwrite?" )
812 .arg( details.name ),
813 QMessageBox::Yes | QMessageBox::YesToAll | QMessageBox::No | QMessageBox::NoToAll | QMessageBox::Cancel );
814 cursorOverride = std::make_unique< QgsTemporaryCursorOverride >( Qt::WaitCursor );
817 case QMessageBox::Cancel:
820 case QMessageBox::No:
823 case QMessageBox::Yes:
824 overwriteThis =
true;
827 case QMessageBox::YesToAll:
832 case QMessageBox::NoToAll:
834 overwriteAll =
false;
839 if ( !hasDuplicateName || overwriteAll || overwriteThis )
842 dst->
addSymbol( details.name, symbol.release() );
843 dst->
saveSymbol( details.name, newSymbol, addItemToFavorites, symbolTags );
851 std::unique_ptr< QgsColorRamp > ramp( src->
colorRamp( details.name ) );
855 const bool hasDuplicateName = dst->
colorRampNames().contains( details.name );
856 bool overwriteThis =
false;
858 addItemToFavorites = favoriteColorramps.contains( details.name );
860 if ( hasDuplicateName && prompt )
862 cursorOverride.reset();
863 int res = QMessageBox::warning( parentWidget, isImport ? tr(
"Import Color Ramp" ) : tr(
"Export Color Ramp" ),
864 tr(
"A color ramp with the name “%1” already exists.\nOverwrite?" )
865 .arg( details.name ),
866 QMessageBox::Yes | QMessageBox::YesToAll | QMessageBox::No | QMessageBox::NoToAll | QMessageBox::Cancel );
867 cursorOverride = std::make_unique< QgsTemporaryCursorOverride >( Qt::WaitCursor );
870 case QMessageBox::Cancel:
873 case QMessageBox::No:
876 case QMessageBox::Yes:
877 overwriteThis =
true;
880 case QMessageBox::YesToAll:
885 case QMessageBox::NoToAll:
887 overwriteAll =
false;
892 if ( !hasDuplicateName || overwriteAll || overwriteThis )
896 dst->
saveColorRamp( details.name, newRamp, addItemToFavorites, symbolTags );
906 const bool hasDuplicateName = dst->
textFormatNames().contains( details.name );
907 bool overwriteThis =
false;
909 addItemToFavorites = favoriteTextFormats.contains( details.name );
911 if ( hasDuplicateName && prompt )
913 cursorOverride.reset();
914 int res = QMessageBox::warning( parentWidget, isImport ? tr(
"Import Text Format" ) : tr(
"Export Text Format" ),
915 tr(
"A text format with the name “%1” already exists.\nOverwrite?" )
916 .arg( details.name ),
917 QMessageBox::Yes | QMessageBox::YesToAll | QMessageBox::No | QMessageBox::NoToAll | QMessageBox::Cancel );
918 cursorOverride = std::make_unique< QgsTemporaryCursorOverride >( Qt::WaitCursor );
921 case QMessageBox::Cancel:
924 case QMessageBox::No:
927 case QMessageBox::Yes:
928 overwriteThis =
true;
931 case QMessageBox::YesToAll:
936 case QMessageBox::NoToAll:
938 overwriteAll =
false;
943 if ( !hasDuplicateName || overwriteAll || overwriteThis )
946 dst->
saveTextFormat( details.name, format, addItemToFavorites, symbolTags );
957 bool overwriteThis =
false;
959 addItemToFavorites = favoriteLabelSettings.contains( details.name );
961 if ( hasDuplicateName && prompt )
963 cursorOverride.reset();
964 int res = QMessageBox::warning( parentWidget, isImport ? tr(
"Import Label Settings" ) : tr(
"Export Label Settings" ),
965 tr(
"Label settings with the name “%1” already exist.\nOverwrite?" )
966 .arg( details.name ),
967 QMessageBox::Yes | QMessageBox::YesToAll | QMessageBox::No | QMessageBox::NoToAll | QMessageBox::Cancel );
968 cursorOverride = std::make_unique< QgsTemporaryCursorOverride >( Qt::WaitCursor );
971 case QMessageBox::Cancel:
974 case QMessageBox::No:
977 case QMessageBox::Yes:
978 overwriteThis =
true;
981 case QMessageBox::YesToAll:
986 case QMessageBox::NoToAll:
988 overwriteAll =
false;
993 if ( !hasDuplicateName || overwriteAll || overwriteThis )
996 dst->
saveLabelSettings( details.name, settings, addItemToFavorites, symbolTags );
1007 bool overwriteThis =
false;
1009 addItemToFavorites = favoriteLegendPatchShapes.contains( details.name );
1011 if ( hasDuplicateName && prompt )
1013 cursorOverride.reset();
1014 int res = QMessageBox::warning( parentWidget, isImport ? tr(
"Import Legend Patch Shape" ) : tr(
"Export Legend Patch Shape" ),
1015 tr(
"Legend patch shape with the name “%1” already exist.\nOverwrite?" )
1016 .arg( details.name ),
1017 QMessageBox::Yes | QMessageBox::YesToAll | QMessageBox::No | QMessageBox::NoToAll | QMessageBox::Cancel );
1018 cursorOverride = std::make_unique< QgsTemporaryCursorOverride >( Qt::WaitCursor );
1021 case QMessageBox::Cancel:
1024 case QMessageBox::No:
1027 case QMessageBox::Yes:
1028 overwriteThis =
true;
1031 case QMessageBox::YesToAll:
1033 overwriteAll =
true;
1036 case QMessageBox::NoToAll:
1038 overwriteAll =
false;
1043 if ( !hasDuplicateName || overwriteAll || overwriteThis )
1054 std::unique_ptr< QgsAbstract3DSymbol > symbol( src->
symbol3D( details.name ) );
1058 const bool hasDuplicateName = dst->
symbol3DNames().contains( details.name );
1059 bool overwriteThis =
false;
1061 addItemToFavorites = favorite3dSymbols.contains( details.name );
1063 if ( hasDuplicateName && prompt )
1065 cursorOverride.reset();
1066 int res = QMessageBox::warning( parentWidget, isImport ? tr(
"Import 3D Symbol" ) : tr(
"Export 3D Symbol" ),
1067 tr(
"A 3D symbol with the name “%1” already exists.\nOverwrite?" )
1068 .arg( details.name ),
1069 QMessageBox::Yes | QMessageBox::YesToAll | QMessageBox::No | QMessageBox::NoToAll | QMessageBox::Cancel );
1070 cursorOverride = std::make_unique< QgsTemporaryCursorOverride >( Qt::WaitCursor );
1073 case QMessageBox::Cancel:
1076 case QMessageBox::No:
1079 case QMessageBox::Yes:
1080 overwriteThis =
true;
1083 case QMessageBox::YesToAll:
1085 overwriteAll =
true;
1088 case QMessageBox::NoToAll:
1090 overwriteAll =
false;
1095 if ( !hasDuplicateName || overwriteAll || overwriteThis )
1098 dst->
addSymbol3D( details.name, symbol.release() );
1099 dst->
saveSymbol3D( details.name, newSymbol, addItemToFavorites, symbolTags );
1114 bool QgsStyleManagerDialog::addTextFormat()
1118 if ( !formatDlg.exec() )
1120 format = formatDlg.format();
1123 if ( !saveDlg.exec() )
1125 QString name = saveDlg.name();
1128 bool nameInvalid =
true;
1129 while ( nameInvalid )
1132 if ( name.isEmpty() )
1134 QMessageBox::warning(
this, tr(
"Save Text Format" ),
1135 tr(
"Cannot save text format without name. Enter a name." ) );
1139 int res = QMessageBox::warning(
this, tr(
"Save Text Format" ),
1140 tr(
"Text format with name '%1' already exists. Overwrite?" )
1142 QMessageBox::Yes | QMessageBox::No );
1143 if ( res == QMessageBox::Yes )
1146 nameInvalid =
false;
1152 nameInvalid =
false;
1157 name = QInputDialog::getText(
this, tr(
"Text Format Name" ),
1158 tr(
"Please enter a name for new text format:" ),
1159 QLineEdit::Normal, name, &ok );
1167 QStringList symbolTags = saveDlg.tags().split(
',' );
1171 mStyle->
saveTextFormat( name, format, saveDlg.isFavorite(), symbolTags );
1179 groupChanged( groupTree->selectionModel()->currentIndex() );
1192 switch ( tabItemType->currentIndex() )
1217 QModelIndex index = listItems->selectionModel()->currentIndex();
1218 if ( !index.isValid() )
1221 return mModel->data( mModel->index( index.row(),
QgsStyleModel::Name, index.parent() ), Qt::DisplayRole ).toString();
1226 bool changed =
false;
1237 changed = addTextFormat();
1256 Q_ASSERT(
false &&
"not implemented" );
1269 QString name = tr(
"new symbol" );
1274 name = tr(
"new marker" );
1278 name = tr(
"new line" );
1282 name = tr(
"new fill symbol" );
1285 Q_ASSERT(
false &&
"unknown symbol type" );
1295 if ( dlg.exec() == 0 )
1302 if ( !saveDlg.exec() )
1308 name = saveDlg.
name();
1311 bool nameInvalid =
true;
1312 while ( nameInvalid )
1315 if ( name.isEmpty() )
1317 QMessageBox::warning(
this, tr(
"Save Symbol" ),
1318 tr(
"Cannot save symbol without name. Enter a name." ) );
1320 else if ( mStyle->
symbolNames().contains( name ) )
1322 int res = QMessageBox::warning(
this, tr(
"Save Symbol" ),
1323 tr(
"Symbol with name '%1' already exists. Overwrite?" )
1325 QMessageBox::Yes | QMessageBox::No );
1326 if ( res == QMessageBox::Yes )
1329 nameInvalid =
false;
1335 nameInvalid =
false;
1340 name = QInputDialog::getText(
this, tr(
"Symbol Name" ),
1341 tr(
"Please enter a name for new symbol:" ),
1342 QLineEdit::Normal, name, &ok );
1351 QStringList symbolTags = saveDlg.
tags().split(
',' );
1364 QString rampType = type;
1366 if ( rampType.isEmpty() )
1371 QStringList rampTypeNames;
1372 rampTypeNames.reserve( rampTypes.size() );
1373 for (
const QPair< QString, QString > &type : rampTypes )
1374 rampTypeNames << type.second;
1375 const QString selectedRampTypeName = QInputDialog::getItem( parent, tr(
"Color Ramp Type" ),
1376 tr(
"Please select color ramp type:" ), rampTypeNames, 0,
false, &ok );
1377 if ( !ok || selectedRampTypeName.isEmpty() )
1380 rampType = rampTypes.value( rampTypeNames.indexOf( selectedRampTypeName ) ).first;
1383 QString name = tr(
"new ramp" );
1385 std::unique_ptr< QgsColorRamp > ramp;
1394 name = tr(
"new gradient ramp" );
1404 name = tr(
"new random ramp" );
1424 name = tr(
"new preset ramp" );
1448 QgsDebugMsg( QStringLiteral(
"invalid ramp type %1" ).arg( rampType ) );
1453 if ( !saveDlg.exec() )
1458 name = saveDlg.
name();
1461 bool nameInvalid =
true;
1462 while ( nameInvalid )
1465 if ( name.isEmpty() )
1467 QMessageBox::warning( parent, tr(
"Save Color Ramp" ),
1468 tr(
"Cannot save color ramp without name. Enter a name." ) );
1472 int res = QMessageBox::warning( parent, tr(
"Save Color Ramp" ),
1473 tr(
"Color ramp with name '%1' already exists. Overwrite?" )
1475 QMessageBox::Yes | QMessageBox::No );
1476 if ( res == QMessageBox::Yes )
1478 nameInvalid =
false;
1484 nameInvalid =
false;
1489 name = QInputDialog::getText( parent, tr(
"Color Ramp Name" ),
1490 tr(
"Please enter a name for new color ramp:" ),
1491 QLineEdit::Normal, name, &ok );
1499 QStringList colorRampTags = saveDlg.
tags().split(
',' );
1511 mFavoritesGroupVisible = show;
1517 mSmartGroupVisible = show;
1529 setWindowState( windowState() & ~Qt::WindowMinimized );
1537 if ( !rampName.isEmpty() )
1549 if ( selectedItemType() < 3 )
1553 else if ( selectedItemType() == 3 )
1557 else if ( selectedItemType() == 4 )
1561 else if ( selectedItemType() == 5 )
1563 editLabelSettings();
1565 else if ( selectedItemType() == 6 )
1567 editLegendPatchShape();
1569 else if ( selectedItemType() == 7 )
1575 Q_ASSERT(
false &&
"not implemented" );
1582 if ( symbolName.isEmpty() )
1585 std::unique_ptr< QgsSymbol > symbol( mStyle->
symbol( symbolName ) );
1590 dlg.
buttonBox()->button( QDialogButtonBox::Ok )->setEnabled(
false );
1596 mStyle->
addSymbol( symbolName, symbol.release(),
true );
1604 if ( name.isEmpty() )
1607 std::unique_ptr< QgsColorRamp > ramp( mStyle->
colorRamp( name ) );
1614 dlg.
buttonBox()->button( QDialogButtonBox::Ok )->setEnabled(
false );
1627 dlg.
buttonBox()->button( QDialogButtonBox::Ok )->setEnabled(
false );
1640 dlg.
buttonBox()->button( QDialogButtonBox::Ok )->setEnabled(
false );
1653 dlg.
buttonBox()->button( QDialogButtonBox::Ok )->setEnabled(
false );
1666 dlg.
buttonBox()->button( QDialogButtonBox::Ok )->setEnabled(
false );
1683 Q_ASSERT(
false &&
"invalid ramp type" );
1691 bool QgsStyleManagerDialog::editTextFormat()
1694 if ( formatName.isEmpty() )
1702 dlg.buttonBox()->button( QDialogButtonBox::Ok )->setEnabled(
false );
1716 QgsLabelSettingsDialog settingsDlg( settings,
nullptr,
nullptr,
this, type );
1718 settingsDlg.buttonBox()->button( QDialogButtonBox::Ok )->setEnabled(
false );
1720 if ( !settingsDlg.exec() )
1723 settings = settingsDlg.settings();
1727 if ( !saveDlg.exec() )
1729 QString name = saveDlg.name();
1732 bool nameInvalid =
true;
1733 while ( nameInvalid )
1736 if ( name.isEmpty() )
1738 QMessageBox::warning(
this, tr(
"Save Label Settings" ),
1739 tr(
"Cannot save label settings without a name. Enter a name." ) );
1743 int res = QMessageBox::warning(
this, tr(
"Save Label Settings" ),
1744 tr(
"Label settings with the name '%1' already exist. Overwrite?" )
1746 QMessageBox::Yes | QMessageBox::No );
1747 if ( res == QMessageBox::Yes )
1750 nameInvalid =
false;
1756 nameInvalid =
false;
1761 name = QInputDialog::getText(
this, tr(
"Label Settings Name" ),
1762 tr(
"Please enter a name for the new label settings:" ),
1763 QLineEdit::Normal, name, &ok );
1771 QStringList symbolTags = saveDlg.tags().split(
',' );
1781 bool QgsStyleManagerDialog::editLabelSettings()
1784 if ( formatName.isEmpty() )
1791 QgsLabelSettingsDialog dlg( settings,
nullptr,
nullptr,
this, geomType );
1795 settings = dlg.settings();
1809 dialog.buttonBox()->button( QDialogButtonBox::Ok )->setEnabled(
false );
1811 if ( !dialog.exec() )
1814 shape = dialog.shape();
1817 if ( !saveDlg.exec() )
1819 QString name = saveDlg.name();
1822 bool nameInvalid =
true;
1823 while ( nameInvalid )
1826 if ( name.isEmpty() )
1828 QMessageBox::warning(
this, tr(
"Save Legend Patch Shape" ),
1829 tr(
"Cannot save legend patch shapes without a name. Enter a name." ) );
1833 int res = QMessageBox::warning(
this, tr(
"Save Legend Patch Shape" ),
1834 tr(
"A legend patch shape with the name '%1' already exists. Overwrite?" )
1836 QMessageBox::Yes | QMessageBox::No );
1837 if ( res == QMessageBox::Yes )
1840 nameInvalid =
false;
1846 nameInvalid =
false;
1851 name = QInputDialog::getText(
this, tr(
"Legend Patch Shape Name" ),
1852 tr(
"Please enter a name for the new legend patch shape:" ),
1853 QLineEdit::Normal, name, &ok );
1861 QStringList symbolTags = saveDlg.tags().split(
',' );
1871 bool QgsStyleManagerDialog::editLegendPatchShape()
1874 if ( shapeName.isEmpty() )
1886 shape = dlg.shape();
1894 bool QgsStyleManagerDialog::addSymbol3D(
const QString &type )
1902 dialog.buttonBox()->button( QDialogButtonBox::Ok )->setEnabled(
false );
1904 if ( !dialog.exec() )
1907 symbol.reset( dialog.symbol() );
1912 if ( !saveDlg.exec() )
1914 QString name = saveDlg.name();
1917 bool nameInvalid =
true;
1918 while ( nameInvalid )
1921 if ( name.isEmpty() )
1923 QMessageBox::warning(
this, tr(
"Save 3D Symbol" ),
1924 tr(
"Cannot save 3D symbols without a name. Enter a name." ) );
1928 int res = QMessageBox::warning(
this, tr(
"Save 3D Symbol" ),
1929 tr(
"A 3D symbol with the name '%1' already exists. Overwrite?" )
1931 QMessageBox::Yes | QMessageBox::No );
1932 if ( res == QMessageBox::Yes )
1935 nameInvalid =
false;
1941 nameInvalid =
false;
1946 name = QInputDialog::getText(
this, tr(
"3D Symbol Name" ),
1947 tr(
"Please enter a name for the new 3D symbol:" ),
1948 QLineEdit::Normal, name, &ok );
1956 QStringList symbolTags = saveDlg.tags().split(
',' );
1961 mStyle->
saveSymbol3D( name, newSymbol, saveDlg.isFavorite(), symbolTags );
1967 bool QgsStyleManagerDialog::editSymbol3D()
1970 if ( symbolName.isEmpty() )
1973 std::unique_ptr< QgsAbstract3DSymbol > symbol( mStyle->
symbol3D( symbolName ) );
1982 symbol.reset( dlg.symbol() );
1987 mStyle->
addSymbol3D( symbolName, symbol.release(),
true );
1994 const QList< ItemDetails > items = selectedItems();
1996 if ( allTypesSelected() )
1998 if ( QMessageBox::Yes != QMessageBox::question(
this, tr(
"Remove Items" ),
1999 QString( tr(
"Do you really want to remove %n item(s)?",
nullptr, items.count() ) ),
2008 if ( QMessageBox::Yes != QMessageBox::question(
this, tr(
"Remove Symbol" ),
2009 QString( tr(
"Do you really want to remove %n symbol(s)?",
nullptr, items.count() ) ),
2016 if ( QMessageBox::Yes != QMessageBox::question(
this, tr(
"Remove Color Ramp" ),
2017 QString( tr(
"Do you really want to remove %n ramp(s)?",
nullptr, items.count() ) ),
2024 if ( QMessageBox::Yes != QMessageBox::question(
this, tr(
"Remove Text Formats" ),
2025 QString( tr(
"Do you really want to remove %n text format(s)?",
nullptr, items.count() ) ),
2032 if ( QMessageBox::Yes != QMessageBox::question(
this, tr(
"Remove Label Settings" ),
2033 QString( tr(
"Do you really want to remove %n label settings?",
nullptr, items.count() ) ),
2040 if ( QMessageBox::Yes != QMessageBox::question(
this, tr(
"Remove Legend Patch Shapes" ),
2041 QString( tr(
"Do you really want to remove %n legend patch shapes?",
nullptr, items.count() ) ),
2048 if ( QMessageBox::Yes != QMessageBox::question(
this, tr(
"Remove 3D Symbols" ),
2049 QString( tr(
"Do you really want to remove %n 3D symbols?",
nullptr, items.count() ) ),
2058 for (
const ItemDetails &details : items )
2060 if ( details.name.isEmpty() )
2085 QString dir = QFileDialog::getExistingDirectory(
this, tr(
"Export Selected Symbols as PNG" ),
2086 QDir::home().absolutePath(),
2087 QFileDialog::ShowDirsOnly
2088 | QFileDialog::DontResolveSymlinks );
2094 QString dir = QFileDialog::getExistingDirectory(
this, tr(
"Export Selected Symbols as SVG" ),
2095 QDir::home().absolutePath(),
2096 QFileDialog::ShowDirsOnly
2097 | QFileDialog::DontResolveSymlinks );
2104 if ( dir.isEmpty() )
2107 const QList< ItemDetails > items = selectedItems();
2108 for (
const ItemDetails &details : items )
2113 QString path = dir +
'/' + details.name +
'.' + format;
2114 std::unique_ptr< QgsSymbol > sym( mStyle->
symbol( details.name ) );
2116 sym->exportImage( path, format, size );
2136 QFont font = item->font();
2137 font.setBold(
true );
2138 item->setFont( font );
2143 if ( mBlockGroupUpdates )
2146 QStandardItemModel *model = qobject_cast<QStandardItemModel *>( groupTree->model() );
2149 if ( mFavoritesGroupVisible )
2151 QStandardItem *favoriteSymbols =
new QStandardItem( tr(
"Favorites" ) );
2152 favoriteSymbols->setData(
"favorite" );
2153 favoriteSymbols->setEditable(
false );
2155 model->appendRow( favoriteSymbols );
2158 QStandardItem *allSymbols =
new QStandardItem( tr(
"All" ) );
2159 allSymbols->setData(
"all" );
2160 allSymbols->setEditable(
false );
2162 model->appendRow( allSymbols );
2164 QStandardItem *taggroup =
new QStandardItem( QString() );
2165 taggroup->setData(
"tags" );
2166 taggroup->setEditable(
false );
2167 QStringList tags = mStyle->
tags();
2169 for (
const QString &tag : std::as_const( tags ) )
2171 QStandardItem *item =
new QStandardItem( tag );
2172 item->setData( mStyle->
tagId( tag ) );
2173 item->setEditable( !mReadOnly );
2174 taggroup->appendRow( item );
2176 taggroup->setText( tr(
"Tags" ) );
2178 model->appendRow( taggroup );
2180 if ( mSmartGroupVisible )
2182 QStandardItem *smart =
new QStandardItem( tr(
"Smart Groups" ) );
2183 smart->setData(
"smartgroups" );
2184 smart->setEditable(
false );
2187 QgsSymbolGroupMap::const_iterator i = sgMap.constBegin();
2188 while ( i != sgMap.constEnd() )
2190 QStandardItem *item =
new QStandardItem( i.value() );
2191 item->setData( i.key() );
2192 item->setEditable( !mReadOnly );
2193 smart->appendRow( item );
2196 model->appendRow( smart );
2200 int rows = model->rowCount( model->indexFromItem( model->invisibleRootItem() ) );
2201 for (
int i = 0; i < rows; i++ )
2203 groupTree->setExpanded( model->indexFromItem( model->item( i ) ),
true );
2209 QStringList groupSymbols;
2211 const QString category = index.data( Qt::UserRole + 1 ).toString();
2212 if ( mGroupingMode )
2214 mModel->setTagId( -1 );
2215 mModel->setSmartGroupId( -1 );
2216 mModel->setFavoritesOnly(
false );
2217 mModel->setCheckTag( index.data( Qt::DisplayRole ).toString() );
2219 else if ( category == QLatin1String(
"all" ) || category == QLatin1String(
"tags" ) || category == QLatin1String(
"smartgroups" ) )
2222 if ( category == QLatin1String(
"tags" ) )
2224 actnAddTag->setEnabled( !mReadOnly );
2225 actnAddSmartgroup->setEnabled(
false );
2227 else if ( category == QLatin1String(
"smartgroups" ) )
2229 actnAddTag->setEnabled(
false );
2230 actnAddSmartgroup->setEnabled( !mReadOnly );
2233 mModel->setTagId( -1 );
2234 mModel->setSmartGroupId( -1 );
2235 mModel->setFavoritesOnly(
false );
2237 else if ( category == QLatin1String(
"favorite" ) )
2240 mModel->setTagId( -1 );
2241 mModel->setSmartGroupId( -1 );
2242 mModel->setFavoritesOnly(
true );
2244 else if ( index.parent().data( Qt::UserRole + 1 ) ==
"smartgroups" )
2246 actnRemoveGroup->setEnabled( !mReadOnly );
2247 btnManageGroups->setEnabled( !mReadOnly );
2248 const int groupId = index.data( Qt::UserRole + 1 ).toInt();
2249 mModel->setTagId( -1 );
2250 mModel->setSmartGroupId( groupId );
2251 mModel->setFavoritesOnly(
false );
2256 int tagId = index.data( Qt::UserRole + 1 ).toInt();
2257 mModel->setTagId( tagId );
2258 mModel->setSmartGroupId( -1 );
2259 mModel->setFavoritesOnly(
false );
2262 actnEditSmartGroup->setVisible(
false );
2263 actnAddTag->setVisible(
false );
2264 actnAddSmartgroup->setVisible(
false );
2265 actnRemoveGroup->setVisible(
false );
2266 actnTagSymbols->setVisible(
false );
2267 actnFinishTagging->setVisible(
false );
2269 if ( index.parent().isValid() )
2271 if ( index.parent().data( Qt::UserRole + 1 ).toString() == QLatin1String(
"smartgroups" ) )
2273 actnEditSmartGroup->setVisible( !mGroupingMode && !mReadOnly );
2275 else if ( index.parent().data( Qt::UserRole + 1 ).toString() == QLatin1String(
"tags" ) )
2277 actnAddTag->setVisible( !mGroupingMode && !mReadOnly );
2278 actnTagSymbols->setVisible( !mGroupingMode && !mReadOnly );
2279 actnFinishTagging->setVisible( mGroupingMode && !mReadOnly );
2281 actnRemoveGroup->setVisible( !mReadOnly );
2283 else if ( index.data( Qt::UserRole + 1 ) ==
"smartgroups" )
2285 actnAddSmartgroup->setVisible( !mGroupingMode && !mReadOnly );
2287 else if ( index.data( Qt::UserRole + 1 ) ==
"tags" )
2289 actnAddTag->setVisible( !mGroupingMode && !mReadOnly );
2295 QStandardItemModel *model = qobject_cast<QStandardItemModel *>( groupTree->model() );
2297 for (
int i = 0; i < groupTree->model()->rowCount(); i++ )
2299 index = groupTree->model()->index( i, 0 );
2300 QString data = index.data( Qt::UserRole + 1 ).toString();
2301 if ( data == QLatin1String(
"tags" ) )
2310 itemName = QInputDialog::getText(
this, tr(
"Add Tag" ),
2311 tr(
"Please enter name for the new tag:" ), QLineEdit::Normal, tr(
"New tag" ), &ok ).trimmed();
2312 if ( !ok || itemName.isEmpty() )
2315 int check = mStyle->
tagId( itemName );
2318 mMessageBar->
pushCritical( tr(
"Add Tag" ), tr(
"The tag “%1” already exists." ).arg( itemName ) );
2324 mBlockGroupUpdates++;
2325 id = mStyle->
addTag( itemName );
2326 mBlockGroupUpdates--;
2330 mMessageBar->
pushCritical( tr(
"Add Tag" ), tr(
"New tag could not be created — There was a problem with the symbol database." ) );
2334 QStandardItem *parentItem = model->itemFromIndex( index );
2335 QStandardItem *childItem =
new QStandardItem( itemName );
2336 childItem->setData(
id );
2337 parentItem->appendRow( childItem );
2344 QStandardItemModel *model = qobject_cast<QStandardItemModel *>( groupTree->model() );
2346 for (
int i = 0; i < groupTree->model()->rowCount(); i++ )
2348 index = groupTree->model()->index( i, 0 );
2349 QString data = index.data( Qt::UserRole + 1 ).toString();
2350 if ( data == QLatin1String(
"smartgroups" ) )
2359 if ( dlg.exec() == QDialog::Rejected )
2364 mBlockGroupUpdates++;
2366 mBlockGroupUpdates--;
2372 QStandardItem *parentItem = model->itemFromIndex( index );
2373 QStandardItem *childItem =
new QStandardItem( itemName );
2374 childItem->setData(
id );
2375 parentItem->appendRow( childItem );
2382 QStandardItemModel *model = qobject_cast<QStandardItemModel *>( groupTree->model() );
2383 QModelIndex index = groupTree->currentIndex();
2386 QString data = index.data( Qt::UserRole + 1 ).toString();
2387 if ( data == QLatin1String(
"all" ) || data == QLatin1String(
"favorite" ) || data == QLatin1String(
"tags" ) || index.data() ==
"smartgroups" )
2390 int err = QMessageBox::critical(
this, tr(
"Remove Group" ),
2391 tr(
"Invalid selection. Cannot delete system defined categories.\n"
2392 "Kindly select a group or smart group you might want to delete." ) );
2397 QStandardItem *parentItem = model->itemFromIndex( index.parent() );
2401 mBlockGroupUpdates++;
2403 if ( parentItem->data( Qt::UserRole + 1 ).toString() == QLatin1String(
"smartgroups" ) )
2412 mBlockGroupUpdates--;
2413 parentItem->removeRow( index.row() );
2418 QgsDebugMsg( QStringLiteral(
"Symbol group edited: data=%1 text=%2" ).arg( item->data( Qt::UserRole + 1 ).toString(), item->text() ) );
2419 int id = item->data( Qt::UserRole + 1 ).toInt();
2420 QString name = item->text();
2421 mBlockGroupUpdates++;
2422 if ( item->parent()->data( Qt::UserRole + 1 ) ==
"smartgroups" )
2430 mBlockGroupUpdates--;
2435 QStandardItemModel *treeModel = qobject_cast<QStandardItemModel *>( groupTree->model() );
2437 if ( mGroupingMode )
2439 mGroupingMode =
false;
2440 mModel->setCheckable(
false );
2441 actnTagSymbols->setVisible(
true );
2442 actnFinishTagging->setVisible(
false );
2450 connect( treeModel, &QStandardItemModel::itemChanged,
2454 listItems->setSelectionMode( QAbstractItemView::ExtendedSelection );
2455 mSymbolTreeView->setSelectionMode( QAbstractItemView::ExtendedSelection );
2459 bool validGroup =
false;
2461 QModelIndex present = groupTree->currentIndex();
2462 while ( present.parent().isValid() )
2464 if ( present.parent().data() ==
"Tags" )
2469 present = present.parent();
2474 mGroupingMode =
true;
2476 actnTagSymbols->setVisible(
false );
2477 actnFinishTagging->setVisible(
true );
2479 disconnect( treeModel, &QStandardItemModel::itemChanged,
2485 btnManageGroups->setEnabled(
true );
2487 mModel->setCheckable(
true );
2490 listItems->setSelectionMode( QAbstractItemView::NoSelection );
2491 mSymbolTreeView->setSelectionMode( QAbstractItemView::NoSelection );
2505 mModel->setFilterString( qword );
2510 actnEditItem->setEnabled( index.isValid() && !mGroupingMode && !mReadOnly );
2515 Q_UNUSED( selected )
2516 Q_UNUSED( deselected )
2517 bool nothingSelected = listItems->selectionModel()->selectedIndexes().empty();
2518 actnRemoveItem->setDisabled( nothingSelected || mReadOnly );
2519 actnAddFavorite->setDisabled( nothingSelected || mReadOnly );
2520 actnRemoveFavorite->setDisabled( nothingSelected || mReadOnly );
2521 mGroupListMenu->setDisabled( nothingSelected || mReadOnly );
2522 actnDetag->setDisabled( nothingSelected || mReadOnly );
2523 actnExportAsPNG->setDisabled( nothingSelected );
2524 actnExportAsSVG->setDisabled( nothingSelected );
2525 if ( mActionCopyToDefault )
2526 mActionCopyToDefault->setDisabled( nothingSelected );
2527 mCopyToDefaultButton->setDisabled( nothingSelected );
2528 actnEditItem->setDisabled( nothingSelected || mReadOnly );
2533 groupTree->setEnabled( enable );
2534 btnAddTag->setEnabled( enable && !mReadOnly );
2535 btnAddSmartgroup->setEnabled( enable && !mReadOnly );
2536 actnAddTag->setEnabled( enable && !mReadOnly );
2537 actnAddSmartgroup->setEnabled( enable && !mReadOnly );
2538 actnRemoveGroup->setEnabled( enable && !mReadOnly );
2539 btnManageGroups->setEnabled( !mReadOnly && ( enable || mGroupingMode ) );
2540 searchBox->setEnabled( enable );
2545 actnRemoveGroup->setEnabled( enable && !mReadOnly );
2546 btnManageGroups->setEnabled( !mReadOnly && ( enable || mGroupingMode ) );
2551 QStandardItemModel *treeModel = qobject_cast<QStandardItemModel *>( groupTree->model() );
2552 for (
int i = 0; i < treeModel->rowCount(); i++ )
2554 treeModel->item( i )->setEnabled( enable );
2556 if ( treeModel->item( i )->data() ==
"smartgroups" )
2558 for (
int j = 0; j < treeModel->item( i )->rowCount(); j++ )
2560 treeModel->item( i )->child( j )->setEnabled( enable );
2567 for (
int i = 0; i < symbolBtnsLayout->count(); i++ )
2569 QWidget *w = symbolBtnsLayout->itemAt( i )->widget();
2571 w->setEnabled( enable );
2575 actnRemoveItem->setEnabled( enable );
2576 actnEditItem->setEnabled( enable );
2577 mActionCopyItem->setEnabled( enable );
2578 mActionPasteItem->setEnabled( enable );
2583 QPoint globalPos = groupTree->viewport()->mapToGlobal( point );
2585 QModelIndex index = groupTree->indexAt( point );
2586 if ( index.isValid() && !mGroupingMode )
2587 mGroupTreeContextMenu->popup( globalPos );
2592 QPoint globalPos = mSymbolViewStackedWidget->currentIndex() == 0
2593 ? listItems->viewport()->mapToGlobal( point )
2594 : mSymbolTreeView->viewport()->mapToGlobal( point );
2597 mGroupListMenu->clear();
2599 const QModelIndexList indices = listItems->selectionModel()->selectedRows();
2603 const QStringList currentTags = indices.count() == 1 ? indices.at( 0 ).data(
QgsStyleModel::TagRole ).toStringList() : QStringList();
2604 QAction *a =
nullptr;
2605 QStringList tags = mStyle->
tags();
2607 for (
const QString &tag : std::as_const( tags ) )
2609 a =
new QAction( tag, mGroupListMenu );
2611 if ( indices.count() == 1 )
2613 a->setCheckable(
true );
2614 a->setChecked( currentTags.contains( tag ) );
2618 mGroupListMenu->addAction( a );
2621 if ( tags.count() > 0 )
2623 mGroupListMenu->addSeparator();
2625 a =
new QAction( tr(
"Create New Tag…" ), mGroupListMenu );
2628 mGroupListMenu->addAction( a );
2631 const QList< ItemDetails > items = selectedItems();
2634 bool enablePaste =
false;
2642 mActionPasteItem->setEnabled( enablePaste );
2644 mGroupMenu->popup( globalPos );
2649 const QList< ItemDetails > items = selectedItems();
2650 for (
const ItemDetails &details : items )
2652 mStyle->
addFavorite( details.entityType, details.name );
2658 const QList< ItemDetails > items = selectedItems();
2659 for (
const ItemDetails &details : items )
2667 QAction *selectedItem = qobject_cast<QAction *>( sender() );
2670 const QList< ItemDetails > items = selectedItems();
2680 tag = mStyle->
tag(
id );
2684 tag = selectedItem->data().toString();
2687 for (
const ItemDetails &details : items )
2689 mStyle->
tagSymbol( details.entityType, details.name, QStringList( tag ) );
2696 QAction *selectedItem = qobject_cast<QAction *>( sender() );
2700 const QList< ItemDetails > items = selectedItems();
2701 for (
const ItemDetails &details : items )
2703 mStyle->
detagSymbol( details.entityType, details.name );
2710 QStandardItemModel *treeModel = qobject_cast<QStandardItemModel *>( groupTree->model() );
2713 QModelIndex present = groupTree->currentIndex();
2714 if ( present.parent().data( Qt::UserRole + 1 ) !=
"smartgroups" )
2717 QMessageBox::critical(
this, tr(
"Edit Smart Group" ),
2718 tr(
"You have not selected a Smart Group. Kindly select a Smart Group to edit." ) );
2721 QStandardItem *item = treeModel->itemFromIndex( present );
2729 if ( dlg.exec() == QDialog::Rejected )
2732 mBlockGroupUpdates++;
2735 mBlockGroupUpdates--;
2738 mMessageBar->
pushCritical( tr(
"Edit Smart Group" ), tr(
"There was an error while editing the smart group." ) );
2742 item->setData(
id );
static const double UI_SCALE_FACTOR
UI scaling factor.
A dialog for configuring a 3D symbol.
static QIcon getThemeIcon(const QString &name, const QColor &fillColor=QColor(), const QColor &strokeColor=QColor())
Helper to get a theme icon.
static QgsStyleModel * defaultStyleModel()
Returns a shared QgsStyleModel containing the default style library (see QgsStyle::defaultStyle()).
static Qgs3DSymbolRegistry * symbol3DRegistry()
Returns registry of available 3D symbols.
static QString iconPath(const QString &iconFile)
Returns path to the desired icon file.
A dialog which allows users to modify the properties of a QgsColorBrewerColorRamp.
QgsColorBrewerColorRamp ramp
QDialogButtonBox * buttonBox() const
Returns a reference to the dialog's button box.
Color ramp utilising "Color Brewer" preset color schemes.
QgsColorBrewerColorRamp * clone() const override
Creates a clone of the color ramp.
static QString typeString()
Returns the string identifier for QgsColorBrewerColorRamp.
QString schemeName() const
Returns the name of the color brewer color scheme.
int colors() const
Returns the number of colors in the ramp.
Abstract base class for color ramps.
static QList< QPair< QString, QString > > rampTypes()
Returns a list of available ramp types, where the first value in each item is the QgsColorRamp::type(...
A dialog which allows users to modify the properties of a QgsCptCityColorRamp.
bool saveAsGradientRamp() const
Returns true if the ramp should be converted to a QgsGradientColorRamp.
QDialogButtonBox * buttonBox() const
Returns a reference to the dialog's button box.
QgsCptCityColorRamp * clone() const override
Creates a clone of the color ramp.
static QString typeString()
Returns the string identifier for QgsCptCityColorRamp.
QgsGradientColorRamp * cloneGradientRamp() const
QString schemeName() const
QString variantName() const
A fill symbol type, for rendering Polygon and MultiPolygon geometries.
A dialog which allows users to modify the properties of a QgsGradientColorRamp.
QDialogButtonBox * buttonBox() const
Returns a reference to the dialog's button box.
QgsGradientColorRamp ramp
Gradient color ramp, which smoothly interpolates between two colors and also supports optional extra ...
static QString typeString()
Returns the string identifier for QgsGradientColorRamp.
QgsGradientColorRamp * clone() const override
Creates a clone of the color ramp.
static QgsGui * instance()
Returns a pointer to the singleton instance.
static void enableAutoGeometryRestore(QWidget *widget, const QString &key=QString())
Register the widget to allow its position to be automatically saved and restored when open and closed...
static void openHelp(const QString &key)
Opens help topic for the given help key using default system web browser.
static QIcon iconLine()
Returns an icon representing line geometries.
static QIcon iconPolygon()
Returns an icon representing polygon geometries.
static QIcon iconPoint()
Returns an icon representing point geometries.
A dialog for configuring a custom legend patch shape.
Represents a patch shape for use in map legends.
bool isNull() const
Returns true if the patch shape is a null QgsLegendPatchShape, which indicates that the default legen...
A dialog which allows users to modify the properties of a QgsLimitedRandomColorRamp.
QDialogButtonBox * buttonBox() const
Returns a reference to the dialog's button box.
QgsLimitedRandomColorRamp ramp
Constrained random color ramp, which returns random colors based on preset parameters.
static QString typeString()
Returns the string identifier for QgsLimitedRandomColorRamp.
QgsLimitedRandomColorRamp * clone() const override
Creates a clone of the color ramp.
A line symbol type, for rendering LineString and MultiLineString geometries.
A marker symbol type, for rendering Point and MultiPoint geometries.
A bar for displaying non-blocking messages to the user.
void pushSuccess(const QString &title, const QString &message)
Pushes a success message with default timeout to the message bar.
void pushCritical(const QString &title, const QString &message)
Pushes a critical warning message that must be manually dismissed by the user.
Contains settings for how a map layer will be labeled.
const QgsTextFormat & format() const
Returns the label text formatting settings, e.g., font settings, buffer settings, etc.
QgsWkbTypes::GeometryType layerType
Geometry type of layers associated with these settings.
A dialog which allows users to modify the properties of a QgsPresetSchemeColorRamp.
QDialogButtonBox * buttonBox() const
Returns a reference to the dialog's button box.
QgsPresetSchemeColorRamp ramp
A scheme based color ramp consisting of a list of predefined colors.
static QString typeString()
Returns the string identifier for QgsPresetSchemeColorRamp.
QgsPresetSchemeColorRamp * clone() const override
Creates a clone of the color ramp.
void setConditionMap(const QgsSmartConditionMap &)
sets up the GUI for the given conditionmap
QgsSmartConditionMap conditionMap()
returns the condition map
QString smartgroupName()
returns the value from mNameLineEdit
void setSmartgroupName(const QString &)
sets the smart group Name
void setOperator(const QString &)
sets the operator AND/OR
QString conditionOperator()
returns the AND/OR condition
@ Export
Export existing symbols mode.
@ Import
Import xml file mode.
Q_DECL_DEPRECATED void regrouped(QStandardItem *) SIP_DEPRECATED
void onClose()
Closes the dialog.
void groupRenamed(QStandardItem *item)
Triggered when a group item is renamed.
void addFavoriteSelectedSymbols()
Add selected symbols to favorites.
void selectedSymbolsChanged(const QItemSelection &selected, const QItemSelection &deselected)
Perform tasks when the selected symbols change.
void removeGroup()
Removes the selected tag or smartgroup.
void exportItems()
Triggers the dialog to export items.
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 setFavoritesGroupVisible(bool show)
Sets whether the favorites group should be shown.
void grouptreeContextMenu(QPoint)
Context menu for the groupTree.
void setBold(QStandardItem *)
sets the text of the item with bold font
void filterSymbols(const QString &filter)
Sets the filter string to filter symbols by.
void addItem()
Triggers the dialog for adding a new item, based on the currently selected item type tab.
void tagSymbolsAction()
Toggles the interactive item tagging mode.
void editSmartgroupAction()
Triggers the dialog for editing the selected smart group.
Q_DECL_DEPRECATED void itemChanged(QStandardItem *item) SIP_DEPRECATED
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 showHelp()
Opens the associated help.
Q_DECL_DEPRECATED bool removeColorRamp() SIP_DEPRECATED
void detagSelectedSymbols()
Remove all tags from selected symbols.
Q_DECL_DEPRECATED bool removeSymbol() SIP_DEPRECATED
void enableSymbolInputs(bool)
Enables or disbables the symbol specific inputs.
bool addSymbol(int symbolType=-1)
add a new symbol to style
void populateList()
Refreshes the list of items.
void removeItem()
Removes the current selected item.
void groupChanged(const QModelIndex &)
Triggered when the current group (or tag) is changed.
Q_DECL_DEPRECATED void populateTypes() SIP_DEPRECATED
Populate combo box with known style items (symbols, color ramps).
Q_DECL_DEPRECATED void setSymbolsChecked(const QStringList &) SIP_DEPRECATED
void enableGroupInputs(bool)
Enables or disables the groupTree specific inputs.
int addTag()
Triggers the dialog to add a new tag.
void exportItemsSVG()
Triggers the dialog to export selected items as SVG files.
void populateGroups()
populate the groups
void importItems()
Triggers the dialog to import items.
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 exportItemsPNG()
Triggers the dialog to export selected items as PNG files.
void activate()
Raises, unminimizes and activates this window.
bool addColorRamp(const QString &type=QString())
Triggers adding a new color ramp.
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.
void enableItemsForGroupingMode(bool)
Enables or disables the groupTree items for grouping mode.
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.
void onFinished()
Called when the dialog is going to be closed.
void listitemsContextMenu(QPoint)
Context menu for the listItems ( symbols list )
void setSmartGroupsVisible(bool show)
Sets whether smart groups should be shown.
static QString addColorRampStatic(QWidget *parent, QgsStyle *style, const QString &RampType=QString())
Opens the add color ramp dialog, returning the new color ramp's name if the ramp has been added.
void symbolSelected(const QModelIndex &)
Perform symbol specific tasks when selected.
void editItem()
Triggers the dialog for editing the current item.
void removeFavoriteSelectedSymbols()
Remove selected symbols from favorites.
int addSmartgroup()
Triggers the dialog to add a new smart group.
void tagSelectedSymbols(bool newTag=false)
Tag selected symbols using menu item selection.
QString currentItemName()
A QAbstractItemModel subclass for showing symbol and color ramp entities contained within a QgsStyle ...
@ TypeRole
Style entity type, see QgsStyle::StyleEntity.
@ SymbolTypeRole
Symbol type (for symbol or legend patch shape entities)
@ TagRole
String list of tags.
A QSortFilterProxyModel subclass for showing filtered symbol and color ramps entries from a QgsStyle ...
a dialog for setting properties of a newly saved style.
bool isFavorite() const
Returns true if the favorite is checked for the symbol.
QString name() const
Returns the entered name for the new symbol.
QString tags() const
Returns any tags entered for the new symbol (as a comma separated value list).
bool saveColorRamp(const QString &name, QgsColorRamp *ramp, bool favorite, const QStringList &tags)
Adds the colorramp to the database.
bool detagSymbol(StyleEntity type, const QString &symbol, const QStringList &tags)
Detags the symbol with the given list.
QgsTextFormat textFormat(const QString &name) const
Returns the text format with the specified name.
QgsLegendPatchShape defaultPatch(Qgis::SymbolType type, QSizeF size) const
Returns the default legend patch shape for the given symbol type.
bool remove(StyleEntity type, int id)
Removes the specified entity from the database.
bool removeSymbol(const QString &name)
Removes symbol from style (and delete it)
bool removeLabelSettings(const QString &name)
Removes label settings from the style.
QStringList tags() const
Returns a list of all tags in the style database.
QString tag(int id) const
Returns the tag name for the given id.
QgsSmartConditionMap smartgroup(int id)
Returns the QgsSmartConditionMap for the given id.
QStringList symbol3DNames() const
Returns a list of names of 3d symbols in the style.
bool tagSymbol(StyleEntity type, const QString &symbol, const QStringList &tags)
Tags the symbol with the tags in the list.
bool saveLabelSettings(const QString &name, const QgsPalLayerSettings &settings, bool favorite, const QStringList &tags)
Adds label settings to the database.
void symbolSaved(const QString &name, QgsSymbol *symbol)
Emitted every time a new symbol has been added to the database.
QStringList textFormatNames() const
Returns a list of names of text formats in the style.
bool addColorRamp(const QString &name, QgsColorRamp *colorRamp, bool update=false)
Adds a color ramp to the style.
bool removeTextFormat(const QString &name)
Removes a text format from the style.
QgsSymbol * symbol(const QString &name)
Returns a NEW copy of symbol.
StyleEntity
Enum for Entities involved in a style.
@ LabelSettingsEntity
Label settings.
@ TextFormatEntity
Text formats.
@ SmartgroupEntity
Smart groups.
@ Symbol3DEntity
3D symbol entity (since QGIS 3.14)
@ ColorrampEntity
Color ramps.
@ LegendPatchShapeEntity
Legend patch shape (since QGIS 3.14)
QStringList tagsOfSymbol(StyleEntity type, const QString &symbol)
Returns the tags associated with the symbol.
void groupsModified()
Emitted every time a tag or smartgroup has been added, removed, or renamed.
int addSmartgroup(const QString &name, const QString &op, const QgsSmartConditionMap &conditions)
Adds a new smartgroup to the database and returns the id.
QStringList colorRampNames() const
Returns a list of names of color ramps.
bool addSymbol3D(const QString &name, QgsAbstract3DSymbol *symbol, bool update=false)
Adds a 3d symbol with the specified name to the style.
QStringList legendPatchShapeNames() const
Returns a list of names of legend patch shapes in the style.
static QgsStyle * defaultStyle()
Returns default application-wide style.
bool removeEntityByName(StyleEntity type, const QString &name)
Removes the entry of the specified type with matching name from the database.
int tagId(const QString &tag)
Returns the database id for the given tag name.
bool addLegendPatchShape(const QString &name, const QgsLegendPatchShape &shape, bool update=false)
Adds a legend patch shape with the specified name to the style.
bool saveSymbol(const QString &name, QgsSymbol *symbol, bool favorite, const QStringList &tags)
Adds the symbol to the database with tags.
QgsColorRamp * colorRamp(const QString &name) const
Returns a new copy of the specified color ramp.
QStringList labelSettingsNames() const
Returns a list of names of label settings in the style.
bool save(QString filename=QString())
Saves style into a file (will use current filename if empty string is passed)
bool rename(StyleEntity type, int id, const QString &newName)
Renames the given entity with the specified id.
bool removeFavorite(StyleEntity type, const QString &name)
Removes the specified symbol from favorites.
QgsSymbolGroupMap smartgroupsListMap()
Returns the smart groups map with id as key and name as value.
bool saveLegendPatchShape(const QString &name, const QgsLegendPatchShape &shape, bool favorite, const QStringList &tags)
Adds a legend patch shape to the database.
bool addTextFormat(const QString &name, const QgsTextFormat &format, bool update=false)
Adds a text format with the specified name to the style.
QStringList symbolsOfFavorite(StyleEntity type) const
Returns the symbol names which are flagged as favorite.
bool saveSymbol3D(const QString &name, QgsAbstract3DSymbol *symbol, bool favorite, const QStringList &tags)
Adds a 3d symbol to the database.
QgsPalLayerSettings labelSettings(const QString &name) const
Returns the label settings with the specified name.
QgsAbstract3DSymbol * symbol3D(const QString &name) const
Returns a new copy of the 3D symbol with the specified name.
int addTag(const QString &tagName)
Adds a new tag and returns the tag's id.
bool addSymbol(const QString &name, QgsSymbol *symbol, bool update=false)
Adds a symbol to style and takes symbol's ownership.
QgsLegendPatchShape legendPatchShape(const QString &name) const
Returns the legend patch shape with the specified name.
QStringList symbolNames() const
Returns a list of names of symbols.
bool addFavorite(StyleEntity type, const QString &name)
Adds the specified symbol to favorites.
QString smartgroupOperator(int id)
Returns the operator for the smartgroup.
bool saveTextFormat(const QString &name, const QgsTextFormat &format, bool favorite, const QStringList &tags)
Adds a text format to the database.
bool addLabelSettings(const QString &name, const QgsPalLayerSettings &settings, bool update=false)
Adds label settings with the specified name to the style.
static QgsSymbol * symbolFromMimeData(const QMimeData *data)
Attempts to parse mime data as a symbol.
static QMimeData * symbolToMimeData(const QgsSymbol *symbol)
Creates new mime data from a symbol.
QDialogButtonBox * buttonBox() const
Returns a reference to the dialog's button box.
Abstract base class for all rendered symbols.
Temporarily sets a cursor override for the QApplication for the lifetime of the object.
A simple dialog for customizing text formatting settings.
Container for all settings relating to text rendering.
static QgsTextFormat fromMimeData(const QMimeData *data, bool *ok=nullptr)
Attempts to parse the provided mime data as a QgsTextFormat.
GeometryType
The geometry types are used to group QgsWkbTypes::Type in a coarse way.
QMultiMap< QString, QString > QgsSmartConditionMap
A multimap to hold the smart group conditions as constraint and parameter pairs.
QSize iconSize(bool dockableToolbar)
Returns the user-preferred size of a window's toolbar icons.
QMap< int, QString > QgsSymbolGroupMap