QGIS API Documentation  3.0.2-Girona (307d082)
qgsstyleexportimportdialog.cpp
Go to the documentation of this file.
1 /***************************************************************************
2  qgsstyleexportimportdialog.cpp
3  ---------------------
4  begin : Jan 2011
5  copyright : (C) 2011 by Alexander Bruy
6  email : alexander dot bruy at gmail dot com
7 
8  ***************************************************************************
9  * *
10  * This program is free software; you can redistribute it and/or modify *
11  * it under the terms of the GNU General Public License as published by *
12  * the Free Software Foundation; either version 2 of the License, or *
13  * (at your option) any later version. *
14  * *
15  ***************************************************************************/
16 
18 #include "ui_qgsstyleexportimportdialogbase.h"
19 
20 #include "qgsstyle.h"
21 #include "qgssymbol.h"
22 #include "qgssymbollayerutils.h"
23 #include "qgscolorramp.h"
24 #include "qgslogger.h"
26 
27 #include <QInputDialog>
28 #include <QCloseEvent>
29 #include <QFileDialog>
30 #include <QMessageBox>
31 #include <QPushButton>
32 #include <QStandardItemModel>
33 
34 
36  : QDialog( parent )
37  , mDialogMode( mode )
38  , mStyle( style )
39 {
40  setupUi( this );
41 
42  // additional buttons
43  QPushButton *pb = nullptr;
44  pb = new QPushButton( tr( "Select all" ) );
45  buttonBox->addButton( pb, QDialogButtonBox::ActionRole );
46  connect( pb, &QAbstractButton::clicked, this, &QgsStyleExportImportDialog::selectAll );
47 
48  pb = new QPushButton( tr( "Clear selection" ) );
49  buttonBox->addButton( pb, QDialogButtonBox::ActionRole );
50  connect( pb, &QAbstractButton::clicked, this, &QgsStyleExportImportDialog::clearSelection );
51 
52  QStandardItemModel *model = new QStandardItemModel( listItems );
53  listItems->setModel( model );
54  connect( listItems->selectionModel(), &QItemSelectionModel::selectionChanged,
55  this, &QgsStyleExportImportDialog::selectionChanged );
56 
57  mTempStyle = new QgsStyle();
58  mTempStyle->createMemoryDatabase();
59 
60  // TODO validate
61  mProgressDlg = nullptr;
62  mGroupSelectionDlg = nullptr;
63  mTempFile = nullptr;
64  mNetManager = new QNetworkAccessManager( this );
65  mNetReply = nullptr;
66 
67  if ( mDialogMode == Import )
68  {
69  setWindowTitle( tr( "Import Symbol(s)" ) );
70  // populate the import types
71  importTypeCombo->addItem( tr( "file specified below" ), QVariant( "file" ) );
72  // importTypeCombo->addItem( "official QGIS repo online", QVariant( "official" ) );
73  importTypeCombo->addItem( tr( "URL specified below" ), QVariant( "url" ) );
74  connect( importTypeCombo, static_cast<void ( QComboBox::* )( int )>( &QComboBox::currentIndexChanged ), this, &QgsStyleExportImportDialog::importTypeChanged );
75 
76  mSymbolTags->setText( QStringLiteral( "imported" ) );
77 
78  btnBrowse->setText( QStringLiteral( "Browse" ) );
79  connect( btnBrowse, &QAbstractButton::clicked, this, &QgsStyleExportImportDialog::browse );
80 
81  label->setText( tr( "Select symbols to import" ) );
82  buttonBox->button( QDialogButtonBox::Ok )->setText( tr( "Import" ) );
83  }
84  else
85  {
86  setWindowTitle( tr( "Export Symbol(s)" ) );
87  // hide import specific controls when exporting
88  btnBrowse->setHidden( true );
89  fromLabel->setHidden( true );
90  importTypeCombo->setHidden( true );
91  locationLabel->setHidden( true );
92  locationLineEdit->setHidden( true );
93 
94  mFavorite->setHidden( true );
95  mIgnoreXMLTags->setHidden( true );
96 
97  pb = new QPushButton( tr( "Select by group" ) );
98  buttonBox->addButton( pb, QDialogButtonBox::ActionRole );
99  connect( pb, &QAbstractButton::clicked, this, &QgsStyleExportImportDialog::selectByGroup );
100  tagLabel->setHidden( true );
101  mSymbolTags->setHidden( true );
102  tagHintLabel->setHidden( true );
103 
104  buttonBox->button( QDialogButtonBox::Ok )->setText( tr( "Export" ) );
105  if ( !populateStyles( mStyle ) )
106  {
107  QApplication::postEvent( this, new QCloseEvent() );
108  }
109 
110  }
111  // use Ok button for starting import and export operations
112  disconnect( buttonBox, &QDialogButtonBox::accepted, this, &QDialog::accept );
113  connect( buttonBox, &QDialogButtonBox::accepted, this, &QgsStyleExportImportDialog::doExportImport );
114  buttonBox->button( QDialogButtonBox::Ok )->setEnabled( false );
115 
116  connect( buttonBox, &QDialogButtonBox::helpRequested, this, &QgsStyleExportImportDialog::showHelp );
117 }
118 
120 {
121  QModelIndexList selection = listItems->selectionModel()->selectedIndexes();
122  if ( selection.isEmpty() )
123  {
124  QMessageBox::warning( this, tr( "Export/import Symbols or Color Ramps" ),
125  tr( "You should select at least one symbol/color ramp." ) );
126  return;
127  }
128 
129  if ( mDialogMode == Export )
130  {
131  QString fileName = QFileDialog::getSaveFileName( this, tr( "Save Styles" ), QDir::homePath(),
132  tr( "XML files (*.xml *.XML)" ) );
133  if ( fileName.isEmpty() )
134  {
135  return;
136  }
137 
138  // ensure the user never omitted the extension from the file name
139  if ( !fileName.endsWith( QLatin1String( ".xml" ), Qt::CaseInsensitive ) )
140  {
141  fileName += QLatin1String( ".xml" );
142  }
143 
144  mFileName = fileName;
145 
146  moveStyles( &selection, mStyle, mTempStyle );
147  if ( !mTempStyle->exportXml( mFileName ) )
148  {
149  QMessageBox::warning( this, tr( "Export Symbols" ),
150  tr( "Error when saving selected symbols to file:\n%1" )
151  .arg( mTempStyle->errorString() ) );
152  return;
153  }
154  else
155  {
156  QMessageBox::information( this, tr( "Export Symbols" ),
157  tr( "The selected symbols were successfully exported to file:\n%1" )
158  .arg( mFileName ) );
159  }
160  }
161  else // import
162  {
163  moveStyles( &selection, mTempStyle, mStyle );
164 
165  // clear model
166  QStandardItemModel *model = qobject_cast<QStandardItemModel *>( listItems->model() );
167  model->clear();
168  accept();
169  }
170 
171  mFileName.clear();
172  mTempStyle->clear();
173 }
174 
175 bool QgsStyleExportImportDialog::populateStyles( QgsStyle *style )
176 {
177  // load symbols and color ramps from file
178  if ( mDialogMode == Import )
179  {
180  // NOTE mTempStyle is style here
181  if ( !style->importXml( mFileName ) )
182  {
183  QMessageBox::warning( this, tr( "Import Symbols or Color Ramps" ),
184  tr( "An error occurred during import:\n%1" ).arg( style->errorString() ) );
185  return false;
186  }
187  }
188 
189  QStandardItemModel *model = qobject_cast<QStandardItemModel *>( listItems->model() );
190  model->clear();
191 
192  // populate symbols
193  QStringList styleNames = style->symbolNames();
194  QString name;
195 
196  for ( int i = 0; i < styleNames.count(); ++i )
197  {
198  name = styleNames[i];
199  QStringList tags = style->tagsOfSymbol( QgsStyle::SymbolEntity, name );
200  QgsSymbol *symbol = style->symbol( name );
201  QStandardItem *item = new QStandardItem( name );
202  QIcon icon = QgsSymbolLayerUtils::symbolPreviewIcon( symbol, listItems->iconSize(), 15 );
203  item->setIcon( icon );
204  item->setToolTip( QStringLiteral( "<b>%1</b><br><i>%2</i>" ).arg( name, tags.count() > 0 ? tags.join( QStringLiteral( ", " ) ) : tr( "Not tagged" ) ) );
205  // Set font to 10points to show reasonable text
206  QFont itemFont = item->font();
207  itemFont.setPointSize( 10 );
208  item->setFont( itemFont );
209  model->appendRow( item );
210  delete symbol;
211  }
212 
213  // and color ramps
214  styleNames = style->colorRampNames();
215 
216  for ( int i = 0; i < styleNames.count(); ++i )
217  {
218  name = styleNames[i];
219  std::unique_ptr< QgsColorRamp > ramp( style->colorRamp( name ) );
220 
221  QStandardItem *item = new QStandardItem( name );
222  QIcon icon = QgsSymbolLayerUtils::colorRampPreviewIcon( ramp.get(), listItems->iconSize(), 15 );
223  item->setIcon( icon );
224  model->appendRow( item );
225  }
226  return true;
227 }
228 
229 void QgsStyleExportImportDialog::moveStyles( QModelIndexList *selection, QgsStyle *src, QgsStyle *dst )
230 {
231  QString symbolName;
232  QgsSymbol *symbol = nullptr;
233  QStringList symbolTags;
234  bool symbolFavorite;
235  QgsColorRamp *ramp = nullptr;
236  QModelIndex index;
237  bool isSymbol = true;
238  bool prompt = true;
239  bool overwrite = true;
240 
241  QStringList importTags = mSymbolTags->text().split( ',' );
242 
243  QStringList favoriteSymbols = src->symbolsOfFavorite( QgsStyle::SymbolEntity );
244  QStringList favoriteColorramps = src->symbolsOfFavorite( QgsStyle::ColorrampEntity );
245 
246  for ( int i = 0; i < selection->size(); ++i )
247  {
248  index = selection->at( i );
249  symbolName = index.model()->data( index, 0 ).toString();
250  symbol = src->symbol( symbolName );
251 
252  if ( !mIgnoreXMLTags->isChecked() )
253  {
254  symbolTags = src->tagsOfSymbol( !symbol ? QgsStyle::ColorrampEntity : QgsStyle::SymbolEntity, symbolName );
255  }
256  else
257  {
258  symbolTags.clear();
259  }
260 
261  if ( mDialogMode == Import )
262  {
263  symbolTags << importTags;
264  symbolFavorite = mFavorite->isChecked();
265  }
266  else
267  {
268  symbolFavorite = !symbol ? favoriteColorramps.contains( symbolName ) : favoriteSymbols.contains( symbolName );
269  }
270 
271  if ( !symbol )
272  {
273  isSymbol = false;
274  ramp = src->colorRamp( symbolName );
275  }
276 
277  if ( isSymbol )
278  {
279  if ( dst->symbolNames().contains( symbolName ) && prompt )
280  {
281  int res = QMessageBox::warning( this, tr( "Export/import Symbols" ),
282  tr( "Symbol with name '%1' already exists.\nOverwrite?" )
283  .arg( symbolName ),
284  QMessageBox::Yes | QMessageBox::YesToAll | QMessageBox::No | QMessageBox::NoToAll | QMessageBox::Cancel );
285  switch ( res )
286  {
287  case QMessageBox::Cancel:
288  return;
289  case QMessageBox::No:
290  continue;
291  case QMessageBox::Yes:
292  dst->addSymbol( symbolName, symbol );
293  dst->saveSymbol( symbolName, symbol, symbolFavorite, symbolTags );
294  continue;
295  case QMessageBox::YesToAll:
296  prompt = false;
297  overwrite = true;
298  break;
299  case QMessageBox::NoToAll:
300  prompt = false;
301  overwrite = false;
302  break;
303  }
304  }
305 
306  if ( dst->symbolNames().contains( symbolName ) && overwrite )
307  {
308  dst->addSymbol( symbolName, symbol );
309  dst->saveSymbol( symbolName, symbol, symbolFavorite, symbolTags );
310  }
311  else if ( dst->symbolNames().contains( symbolName ) && !overwrite )
312  {
313  continue;
314  }
315  else
316  {
317  dst->addSymbol( symbolName, symbol );
318  dst->saveSymbol( symbolName, symbol, symbolFavorite, symbolTags );
319  }
320  }
321  else
322  {
323  if ( dst->colorRampNames().contains( symbolName ) && prompt )
324  {
325  int res = QMessageBox::warning( this, tr( "Export/import Color Ramps" ),
326  tr( "Color ramp with name '%1' already exists.\nOverwrite?" )
327  .arg( symbolName ),
328  QMessageBox::Yes | QMessageBox::YesToAll | QMessageBox::No | QMessageBox::NoToAll | QMessageBox::Cancel );
329  switch ( res )
330  {
331  case QMessageBox::Cancel:
332  return;
333  case QMessageBox::No:
334  continue;
335  case QMessageBox::Yes:
336  dst->addColorRamp( symbolName, ramp );
337  dst->saveColorRamp( symbolName, ramp, symbolFavorite, symbolTags );
338  continue;
339  case QMessageBox::YesToAll:
340  prompt = false;
341  overwrite = true;
342  break;
343  case QMessageBox::NoToAll:
344  prompt = false;
345  overwrite = false;
346  break;
347  }
348  }
349 
350  if ( dst->colorRampNames().contains( symbolName ) && overwrite )
351  {
352  dst->addColorRamp( symbolName, ramp );
353  dst->saveColorRamp( symbolName, ramp, symbolFavorite, symbolTags );
354  }
355  else if ( dst->colorRampNames().contains( symbolName ) && !overwrite )
356  {
357  continue;
358  }
359  else
360  {
361  dst->addColorRamp( symbolName, ramp );
362  dst->saveColorRamp( symbolName, ramp, symbolFavorite, symbolTags );
363  }
364  }
365  }
366 }
367 
369 {
370  delete mTempFile;
371  delete mTempStyle;
372  delete mGroupSelectionDlg;
373 }
374 
376 {
377  listItems->selectAll();
378 }
379 
381 {
382  listItems->clearSelection();
383 }
384 
385 void QgsStyleExportImportDialog::selectSymbols( const QStringList &symbolNames )
386 {
387  Q_FOREACH ( const QString &symbolName, symbolNames )
388  {
389  QModelIndexList indexes = listItems->model()->match( listItems->model()->index( 0, 0 ), Qt::DisplayRole, symbolName, 1, Qt::MatchFixedString | Qt::MatchCaseSensitive );
390  Q_FOREACH ( const QModelIndex &index, indexes )
391  {
392  listItems->selectionModel()->select( index, QItemSelectionModel::Select );
393  }
394  }
395 }
396 
397 void QgsStyleExportImportDialog::deselectSymbols( const QStringList &symbolNames )
398 {
399  Q_FOREACH ( const QString &symbolName, symbolNames )
400  {
401  QModelIndexList indexes = listItems->model()->match( listItems->model()->index( 0, 0 ), Qt::DisplayRole, symbolName, 1, Qt::MatchFixedString | Qt::MatchCaseSensitive );
402  Q_FOREACH ( const QModelIndex &index, indexes )
403  {
404  QItemSelection deselection( index, index );
405  listItems->selectionModel()->select( deselection, QItemSelectionModel::Deselect );
406  }
407  }
408 }
409 
410 void QgsStyleExportImportDialog::selectTag( const QString &tagName )
411 {
412  QStringList symbolNames = mStyle->symbolsWithTag( QgsStyle::SymbolEntity, mStyle->tagId( tagName ) );
413  selectSymbols( symbolNames );
414 }
415 
416 void QgsStyleExportImportDialog::deselectTag( const QString &tagName )
417 {
418  QStringList symbolNames = mStyle->symbolsWithTag( QgsStyle::SymbolEntity, mStyle->tagId( tagName ) );
419  deselectSymbols( symbolNames );
420 }
421 
422 void QgsStyleExportImportDialog::selectSmartgroup( const QString &groupName )
423 {
424  QStringList symbolNames = mStyle->symbolsOfSmartgroup( QgsStyle::SymbolEntity, mStyle->smartgroupId( groupName ) );
425  selectSymbols( symbolNames );
426  symbolNames = mStyle->symbolsOfSmartgroup( QgsStyle::ColorrampEntity, mStyle->smartgroupId( groupName ) );
427  selectSymbols( symbolNames );
428 }
429 
430 void QgsStyleExportImportDialog::deselectSmartgroup( const QString &groupName )
431 {
432  QStringList symbolNames = mStyle->symbolsOfSmartgroup( QgsStyle::SymbolEntity, mStyle->smartgroupId( groupName ) );
433  deselectSymbols( symbolNames );
434  symbolNames = mStyle->symbolsOfSmartgroup( QgsStyle::ColorrampEntity, mStyle->smartgroupId( groupName ) );
435  deselectSymbols( symbolNames );
436 }
437 
439 {
440  if ( ! mGroupSelectionDlg )
441  {
442  mGroupSelectionDlg = new QgsStyleGroupSelectionDialog( mStyle, this );
443  mGroupSelectionDlg->setWindowTitle( tr( "Select Symbols by Group" ) );
450  }
451  mGroupSelectionDlg->show();
452  mGroupSelectionDlg->raise();
453  mGroupSelectionDlg->activateWindow();
454 }
455 
457 {
458  QString type = importTypeCombo->itemData( index ).toString();
459 
460  locationLineEdit->clear();
461 
462  if ( type == QLatin1String( "file" ) )
463  {
464  locationLineEdit->setEnabled( true );
465  btnBrowse->setText( QStringLiteral( "Browse" ) );
466  }
467  else if ( type == QLatin1String( "official" ) )
468  {
469  btnBrowse->setText( QStringLiteral( "Fetch Symbols" ) );
470  locationLineEdit->setEnabled( false );
471  }
472  else
473  {
474  btnBrowse->setText( QStringLiteral( "Fetch Symbols" ) );
475  locationLineEdit->setEnabled( true );
476  }
477 }
478 
480 {
481  QString type = importTypeCombo->currentData().toString();
482 
483  if ( type == QLatin1String( "file" ) )
484  {
485  mFileName = QFileDialog::getOpenFileName( this, tr( "Load Styles" ), QDir::homePath(),
486  tr( "XML files (*.xml *XML)" ) );
487  if ( mFileName.isEmpty() )
488  {
489  return;
490  }
491  QFileInfo pathInfo( mFileName );
492  QString tag = pathInfo.fileName().remove( QStringLiteral( ".xml" ) );
493  mSymbolTags->setText( tag );
494  locationLineEdit->setText( mFileName );
495  populateStyles( mTempStyle );
496  }
497  else if ( type == QLatin1String( "official" ) )
498  {
499  // TODO set URL
500  // downloadStyleXML( QUrl( "http://...." ) );
501  }
502  else
503  {
504  downloadStyleXml( QUrl( locationLineEdit->text() ) );
505  }
506 }
507 
508 void QgsStyleExportImportDialog::downloadStyleXml( const QUrl &url )
509 {
510  // XXX Try to move this code to some core Network interface,
511  // HTTP downloading is a generic functionality that might be used elsewhere
512 
513  mTempFile = new QTemporaryFile();
514  if ( mTempFile->open() )
515  {
516  mFileName = mTempFile->fileName();
517 
518  if ( mProgressDlg )
519  {
520  QProgressDialog *dummy = mProgressDlg;
521  mProgressDlg = nullptr;
522  delete dummy;
523  }
524  mProgressDlg = new QProgressDialog();
525  mProgressDlg->setLabelText( tr( "Downloading style…" ) );
526  mProgressDlg->setAutoClose( true );
527 
528  connect( mProgressDlg, &QProgressDialog::canceled, this, &QgsStyleExportImportDialog::downloadCanceled );
529 
530  // open the network connection and connect the respective slots
531  if ( mNetReply )
532  {
533  QNetworkReply *dummyReply = mNetReply;
534  mNetReply = nullptr;
535  delete dummyReply;
536  }
537  mNetReply = mNetManager->get( QNetworkRequest( url ) );
538 
539  connect( mNetReply, &QNetworkReply::finished, this, &QgsStyleExportImportDialog::httpFinished );
540  connect( mNetReply, &QIODevice::readyRead, this, &QgsStyleExportImportDialog::fileReadyRead );
541  connect( mNetReply, &QNetworkReply::downloadProgress, this, &QgsStyleExportImportDialog::updateProgress );
542  }
543 }
544 
545 void QgsStyleExportImportDialog::httpFinished()
546 {
547  if ( mNetReply->error() )
548  {
549  mTempFile->remove();
550  mFileName.clear();
551  mProgressDlg->hide();
552  QMessageBox::information( this, tr( "Import from URL" ),
553  tr( "HTTP Error! Download failed: %1." ).arg( mNetReply->errorString() ) );
554  return;
555  }
556  else
557  {
558  mTempFile->flush();
559  mTempFile->close();
560  populateStyles( mTempStyle );
561  }
562 }
563 
564 void QgsStyleExportImportDialog::fileReadyRead()
565 {
566  mTempFile->write( mNetReply->readAll() );
567 }
568 
569 void QgsStyleExportImportDialog::updateProgress( qint64 bytesRead, qint64 bytesTotal )
570 {
571  mProgressDlg->setMaximum( bytesTotal );
572  mProgressDlg->setValue( bytesRead );
573 }
574 
575 void QgsStyleExportImportDialog::downloadCanceled()
576 {
577  mNetReply->abort();
578  mTempFile->remove();
579  mFileName.clear();
580 }
581 
582 void QgsStyleExportImportDialog::selectionChanged( const QItemSelection &selected, const QItemSelection &deselected )
583 {
584  Q_UNUSED( selected );
585  Q_UNUSED( deselected );
586  bool nothingSelected = listItems->selectionModel()->selectedIndexes().empty();
587  buttonBox->button( QDialogButtonBox::Ok )->setDisabled( nothingSelected );
588 }
589 
590 void QgsStyleExportImportDialog::showHelp()
591 {
592  QgsHelp::openHelp( QStringLiteral( "working_with_vector/style_library.html#share-symbols" ) );
593 }
bool exportXml(const QString &filename)
Exports the style as a XML file.
Definition: qgsstyle.cpp:1396
void clear()
Removes all contents of the style.
Definition: qgsstyle.cpp:72
void selectByGroup()
selectByGroup open select by group dialog
void deselectSmartgroup(const QString &groupName)
deselectSmartgroup deselects all symbols from a smart group
bool addColorRamp(const QString &name, QgsColorRamp *colorRamp, bool update=false)
Adds a color ramp to the style.
Definition: qgsstyle.cpp:186
QgsStyleExportImportDialog(QgsStyle *style, QWidget *parent=nullptr, Mode mode=Export)
QStringList symbolsWithTag(StyleEntity type, int tagid) const
Returns the symbol names with which have the given tag.
Definition: qgsstyle.cpp:556
QStringList tagsOfSymbol(StyleEntity type, const QString &symbol)
Returns the tags associated with the symbol.
Definition: qgsstyle.cpp:998
Abstract base class for color ramps.
Definition: qgscolorramp.h:31
bool saveColorRamp(const QString &name, QgsColorRamp *ramp, bool favorite, const QStringList &tags)
Adds the colorramp to the DB.
Definition: qgsstyle.cpp:210
void tagSelected(const QString &tagName)
tag with tagName has been selected
void clearSelection()
clearSelection deselects all symbols
void smartgroupSelected(const QString &groupName)
smartgroup with groupName has been selected
QgsColorRamp * colorRamp(const QString &name) const
Returns a new copy of the specified color ramp.
Definition: qgsstyle.cpp:257
void selectSmartgroup(const QString &groupName)
selectSmartgroup selects all symbols from a smart group
void allDeselected()
all deselected
static QIcon symbolPreviewIcon(QgsSymbol *symbol, QSize size, int padding=0)
Returns an icon preview for a color ramp.
bool importXml(const QString &filename)
Imports the symbols and colorramps into the default style database from the given XML file...
Definition: qgsstyle.cpp:1468
void deselectSymbols(const QStringList &symbolNames)
deselectSymbols deselect symbols by name
QStringList symbolNames()
Returns a list of names of symbols.
Definition: qgsstyle.cpp:180
static QIcon colorRampPreviewIcon(QgsColorRamp *ramp, QSize size, int padding=0)
Returns an icon preview for a color ramp.
void allSelected()
all selected
QStringList colorRampNames()
Returns a list of names of color ramps.
Definition: qgsstyle.cpp:273
QStringList symbolsOfSmartgroup(StyleEntity type, int id)
Returns the symbols for the smartgroup.
Definition: qgsstyle.cpp:1230
int smartgroupId(const QString &smartgroup)
Returns the DB id for the given smartgroup name.
Definition: qgsstyle.cpp:1132
int tagId(const QString &tag)
Returns the DB id for the given tag name.
Definition: qgsstyle.cpp:1127
bool addSymbol(const QString &name, QgsSymbol *symbol, bool update=false)
Adds a symbol to style and takes symbol&#39;s ownership.
Definition: qgsstyle.cpp:81
void selectTag(const QString &tagName)
Select the symbols belonging to the given tag.
static void openHelp(const QString &key)
Opens help topic for the given help key using default system web browser.
Definition: qgshelp.cpp:35
void selectSymbols(const QStringList &symbolNames)
selectSymbols select symbols by name
void deselectTag(const QString &tagName)
Deselect the symbols belonging to the given tag.
QString errorString()
Returns last error from load/save operation.
Definition: qgsstyle.h:353
void selectAll()
selectAll selects all symbols
QgsSymbol * symbol(const QString &name)
Returns a NEW copy of symbol.
Definition: qgsstyle.cpp:164
void smartgroupDeselected(const QString &groupName)
smart group with groupName has been deselected
bool saveSymbol(const QString &name, QgsSymbol *symbol, bool favorite, const QStringList &tags)
Adds the symbol to the DB with the tags.
Definition: qgsstyle.cpp:105
QStringList symbolsOfFavorite(StyleEntity type) const
Returns the symbol names which are flagged as favorite.
Definition: qgsstyle.cpp:520
void tagDeselected(const QString &tagName)
tag with tagName has been deselected