QGIS API Documentation  3.14.0-Pi (9f7028fd23)
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 "qgsapplication.h"
21 #include "qgsstyle.h"
22 #include "qgssymbol.h"
23 #include "qgssymbollayerutils.h"
24 #include "qgscolorramp.h"
25 #include "qgslogger.h"
28 #include "qgsguiutils.h"
29 #include "qgssettings.h"
30 #include "qgsgui.h"
31 #include "qgsstylemodel.h"
32 #include "qgsstylemanagerdialog.h"
33 
34 #include <QInputDialog>
35 #include <QCloseEvent>
36 #include <QFileDialog>
37 #include <QMessageBox>
38 #include <QNetworkReply>
39 #include <QProgressDialog>
40 #include <QPushButton>
41 #include <QStandardItemModel>
42 
43 
45  : QDialog( parent )
46  , mDialogMode( mode )
47  , mStyle( style )
48 {
49  setupUi( this );
51 
52  // additional buttons
53  QPushButton *pb = nullptr;
54  pb = new QPushButton( tr( "Select All" ) );
55  buttonBox->addButton( pb, QDialogButtonBox::ActionRole );
56  connect( pb, &QAbstractButton::clicked, this, &QgsStyleExportImportDialog::selectAll );
57 
58  pb = new QPushButton( tr( "Clear Selection" ) );
59  buttonBox->addButton( pb, QDialogButtonBox::ActionRole );
60  connect( pb, &QAbstractButton::clicked, this, &QgsStyleExportImportDialog::clearSelection );
61 
62  mTempStyle = qgis::make_unique< QgsStyle >();
63  mTempStyle->createMemoryDatabase();
64 
65  // TODO validate
66  mGroupSelectionDlg = nullptr;
67  mTempFile = nullptr;
68 
69  QgsStyle *dialogStyle = nullptr;
70  if ( mDialogMode == Import )
71  {
72  setWindowTitle( tr( "Import Item(s)" ) );
73  // populate the import types
74  importTypeCombo->addItem( tr( "File" ), ImportSource::File );
75  // importTypeCombo->addItem( "official QGIS repo online", ImportSource::Official );
76  importTypeCombo->addItem( tr( "URL" ), ImportSource::Url );
77  connect( importTypeCombo, static_cast<void ( QComboBox::* )( int )>( &QComboBox::currentIndexChanged ), this, &QgsStyleExportImportDialog::importTypeChanged );
78  importTypeChanged( 0 );
79 
80  mSymbolTags->setText( QStringLiteral( "imported" ) );
81 
82  connect( mButtonFetch, &QAbstractButton::clicked, this, &QgsStyleExportImportDialog::fetch );
83 
84  mImportFileWidget->setStorageMode( QgsFileWidget::GetFile );
85  mImportFileWidget->setDialogTitle( tr( "Load Styles" ) );
86  mImportFileWidget->setFilter( tr( "XML files (*.xml *.XML)" ) );
87 
88  QgsSettings settings;
89  mImportFileWidget->setDefaultRoot( settings.value( QStringLiteral( "StyleManager/lastImportDir" ), QDir::homePath(), QgsSettings::Gui ).toString() );
90  connect( mImportFileWidget, &QgsFileWidget::fileChanged, this, &QgsStyleExportImportDialog::importFileChanged );
91 
92  label->setText( tr( "Select items to import" ) );
93  buttonBox->button( QDialogButtonBox::Ok )->setText( tr( "Import" ) );
94 
95  dialogStyle = mTempStyle.get();
96  }
97  else
98  {
99  setWindowTitle( tr( "Export Item(s)" ) );
100  // hide import specific controls when exporting
101  mLocationStackedEdit->setHidden( true );
102  fromLabel->setHidden( true );
103  importTypeCombo->setHidden( true );
104  mLocationLabel->setHidden( true );
105 
106  mFavorite->setHidden( true );
107  mIgnoreXMLTags->setHidden( true );
108 
109  pb = new QPushButton( tr( "Select by Group…" ) );
110  buttonBox->addButton( pb, QDialogButtonBox::ActionRole );
111  connect( pb, &QAbstractButton::clicked, this, &QgsStyleExportImportDialog::selectByGroup );
112  tagLabel->setHidden( true );
113  mSymbolTags->setHidden( true );
114  tagHintLabel->setHidden( true );
115 
116  buttonBox->button( QDialogButtonBox::Ok )->setText( tr( "Export" ) );
117 
118  dialogStyle = mStyle;
119  }
120 
121 #if QT_VERSION < QT_VERSION_CHECK(5, 11, 0)
122  double iconSize = Qgis::UI_SCALE_FACTOR * fontMetrics().width( 'X' ) * 10;
123 #else
124  double iconSize = Qgis::UI_SCALE_FACTOR * fontMetrics().horizontalAdvance( 'X' ) * 10;
125 #endif
126  listItems->setIconSize( QSize( static_cast< int >( iconSize ), static_cast< int >( iconSize * 0.9 ) ) ); // ~100, 90 on low dpi
127 
128  mModel = new QgsStyleProxyModel( dialogStyle, this );
129 
130  mModel->addDesiredIconSize( listItems->iconSize() );
131 
132  listItems->setModel( mModel );
133 
134  connect( listItems->selectionModel(), &QItemSelectionModel::selectionChanged,
135  this, &QgsStyleExportImportDialog::selectionChanged );
136 
137  // use Ok button for starting import and export operations
138  disconnect( buttonBox, &QDialogButtonBox::accepted, this, &QDialog::accept );
139  connect( buttonBox, &QDialogButtonBox::accepted, this, &QgsStyleExportImportDialog::doExportImport );
140  buttonBox->button( QDialogButtonBox::Ok )->setEnabled( false );
141 
142  connect( buttonBox, &QDialogButtonBox::helpRequested, this, &QgsStyleExportImportDialog::showHelp );
143 }
144 
146 {
147  QModelIndexList selection = listItems->selectionModel()->selectedIndexes();
148  if ( selection.isEmpty() )
149  {
150  QMessageBox::warning( this, tr( "Export/import Item(s)" ),
151  tr( "You should select at least one symbol/color ramp." ) );
152  return;
153  }
154 
155  if ( mDialogMode == Export )
156  {
157  QString fileName = QFileDialog::getSaveFileName( this, tr( "Save Styles" ), QDir::homePath(),
158  tr( "XML files (*.xml *.XML)" ) );
159  if ( fileName.isEmpty() )
160  {
161  return;
162  }
163 
164  // ensure the user never omitted the extension from the file name
165  if ( !fileName.endsWith( QLatin1String( ".xml" ), Qt::CaseInsensitive ) )
166  {
167  fileName += QLatin1String( ".xml" );
168  }
169 
170  mFileName = fileName;
171 
172  mCursorOverride = qgis::make_unique< QgsTemporaryCursorOverride >( Qt::WaitCursor );
173  moveStyles( &selection, mStyle, mTempStyle.get() );
174  if ( !mTempStyle->exportXml( mFileName ) )
175  {
176  mCursorOverride.reset();
177  QMessageBox::warning( this, tr( "Export Symbols" ),
178  tr( "Error when saving selected symbols to file:\n%1" )
179  .arg( mTempStyle->errorString() ) );
180  return;
181  }
182  else
183  {
184  mCursorOverride.reset();
185  QMessageBox::information( this, tr( "Export Symbols" ),
186  tr( "The selected symbols were successfully exported to file:\n%1" )
187  .arg( mFileName ) );
188  }
189  }
190  else // import
191  {
192  mCursorOverride = qgis::make_unique< QgsTemporaryCursorOverride >( Qt::WaitCursor );
193  moveStyles( &selection, mTempStyle.get(), mStyle );
194 
195  accept();
196  mCursorOverride.reset();
197  }
198 
199  mFileName.clear();
200  mTempStyle->clear();
201 }
202 
203 bool QgsStyleExportImportDialog::populateStyles()
204 {
205  QgsTemporaryCursorOverride override( Qt::WaitCursor );
206 
207  // load symbols and color ramps from file
208  // NOTE mTempStyle is style here
209  mTempStyle->clear();
210  if ( !mTempStyle->importXml( mFileName ) )
211  {
212  override.release();
213  QMessageBox::warning( this, tr( "Import Symbols or Color Ramps" ),
214  tr( "An error occurred during import:\n%1" ).arg( mTempStyle->errorString() ) );
215  return false;
216  }
217  return true;
218 }
219 
220 void QgsStyleExportImportDialog::moveStyles( QModelIndexList *selection, QgsStyle *src, QgsStyle *dst )
221 {
222  QList< QgsStyleManagerDialog::ItemDetails > items;
223  items.reserve( selection->size() );
224  for ( int i = 0; i < selection->size(); ++i )
225  {
226  QModelIndex index = selection->at( i );
227 
228  QgsStyleManagerDialog::ItemDetails details;
229  details.entityType = static_cast< QgsStyle::StyleEntity >( mModel->data( index, QgsStyleModel::TypeRole ).toInt() );
230  if ( details.entityType == QgsStyle::SymbolEntity )
231  details.symbolType = static_cast< QgsSymbol::SymbolType >( mModel->data( index, QgsStyleModel::SymbolTypeRole ).toInt() );
232  details.name = mModel->data( mModel->index( index.row(), QgsStyleModel::Name, index.parent() ), Qt::DisplayRole ).toString();
233 
234  items << details;
235  }
236  QgsStyleManagerDialog::copyItems( items, src, dst, this, mCursorOverride, mDialogMode == Import,
237  mSymbolTags->text().split( ',' ), mFavorite->isChecked(), mIgnoreXMLTags->isChecked() );
238 }
239 
241 {
242  delete mTempFile;
243  delete mGroupSelectionDlg;
244 }
245 
247 {
248  mImportFileWidget->setFilePath( path );
249 }
250 
252 {
253  listItems->selectAll();
254 }
255 
257 {
258  listItems->clearSelection();
259 }
260 
262 {
263  QStringList symbolNames = mStyle->symbolsOfFavorite( QgsStyle::SymbolEntity );
264  selectSymbols( symbolNames );
265 }
266 
268 {
269  QStringList symbolNames = mStyle->symbolsOfFavorite( QgsStyle::SymbolEntity );
270  deselectSymbols( symbolNames );
271 }
272 
273 void QgsStyleExportImportDialog::selectSymbols( const QStringList &symbolNames )
274 {
275  const auto constSymbolNames = symbolNames;
276  for ( const QString &symbolName : constSymbolNames )
277  {
278  QModelIndexList indexes = listItems->model()->match( listItems->model()->index( 0, QgsStyleModel::Name ), Qt::DisplayRole, symbolName, 1, Qt::MatchFixedString | Qt::MatchCaseSensitive );
279  const auto constIndexes = indexes;
280  for ( const QModelIndex &index : constIndexes )
281  {
282  listItems->selectionModel()->select( index, QItemSelectionModel::Select );
283  }
284  }
285 }
286 
287 void QgsStyleExportImportDialog::deselectSymbols( const QStringList &symbolNames )
288 {
289  const auto constSymbolNames = symbolNames;
290  for ( const QString &symbolName : constSymbolNames )
291  {
292  QModelIndexList indexes = listItems->model()->match( listItems->model()->index( 0, QgsStyleModel::Name ), Qt::DisplayRole, symbolName, 1, Qt::MatchFixedString | Qt::MatchCaseSensitive );
293  const auto constIndexes = indexes;
294  for ( const QModelIndex &index : constIndexes )
295  {
296  QItemSelection deselection( index, index );
297  listItems->selectionModel()->select( deselection, QItemSelectionModel::Deselect );
298  }
299  }
300 }
301 
302 void QgsStyleExportImportDialog::selectTag( const QString &tagName )
303 {
304  QStringList symbolNames = mStyle->symbolsWithTag( QgsStyle::SymbolEntity, mStyle->tagId( tagName ) );
305  selectSymbols( symbolNames );
306 }
307 
308 void QgsStyleExportImportDialog::deselectTag( const QString &tagName )
309 {
310  QStringList symbolNames = mStyle->symbolsWithTag( QgsStyle::SymbolEntity, mStyle->tagId( tagName ) );
311  deselectSymbols( symbolNames );
312 }
313 
314 void QgsStyleExportImportDialog::selectSmartgroup( const QString &groupName )
315 {
316  QStringList symbolNames = mStyle->symbolsOfSmartgroup( QgsStyle::SymbolEntity, mStyle->smartgroupId( groupName ) );
317  selectSymbols( symbolNames );
318  symbolNames = mStyle->symbolsOfSmartgroup( QgsStyle::ColorrampEntity, mStyle->smartgroupId( groupName ) );
319  selectSymbols( symbolNames );
320  symbolNames = mStyle->symbolsOfSmartgroup( QgsStyle::TextFormatEntity, mStyle->smartgroupId( groupName ) );
321  selectSymbols( symbolNames );
322 }
323 
324 void QgsStyleExportImportDialog::deselectSmartgroup( const QString &groupName )
325 {
326  QStringList symbolNames = mStyle->symbolsOfSmartgroup( QgsStyle::SymbolEntity, mStyle->smartgroupId( groupName ) );
327  deselectSymbols( symbolNames );
328  symbolNames = mStyle->symbolsOfSmartgroup( QgsStyle::ColorrampEntity, mStyle->smartgroupId( groupName ) );
329  deselectSymbols( symbolNames );
330  symbolNames = mStyle->symbolsOfSmartgroup( QgsStyle::TextFormatEntity, mStyle->smartgroupId( groupName ) );
331  deselectSymbols( symbolNames );
332 }
333 
335 {
336  if ( ! mGroupSelectionDlg )
337  {
338  mGroupSelectionDlg = new QgsStyleGroupSelectionDialog( mStyle, this );
339  mGroupSelectionDlg->setWindowTitle( tr( "Select Item(s) by Group" ) );
348  }
349  mGroupSelectionDlg->show();
350  mGroupSelectionDlg->raise();
351  mGroupSelectionDlg->activateWindow();
352 }
353 
355 {
356  ImportSource source = static_cast< ImportSource >( importTypeCombo->itemData( index ).toInt() );
357 
358  switch ( source )
359  {
360  case ImportSource::File:
361  {
362  mLocationStackedEdit->setCurrentIndex( 0 );
363  mLocationLabel->setText( tr( "File" ) );
364  break;
365  }
366 #if 0
367  case ImportSource::Official:
368  {
369  btnBrowse->setText( QStringLiteral( "Fetch Items" ) );
370  locationLineEdit->setEnabled( false );
371  break;
372  }
373 #endif
374  case ImportSource::Url:
375  {
376  mLocationStackedEdit->setCurrentIndex( 1 );
377  mLocationLabel->setText( tr( "URL" ) );
378  break;
379  }
380  }
381 }
382 
383 void QgsStyleExportImportDialog::fetch()
384 {
385  downloadStyleXml( QUrl( mUrlLineEdit->text() ) );
386 }
387 
388 void QgsStyleExportImportDialog::importFileChanged( const QString &path )
389 {
390  if ( path.isEmpty() )
391  return;
392 
393  mFileName = path;
394  QFileInfo pathInfo( mFileName );
395  QString tag = pathInfo.fileName().remove( QStringLiteral( ".xml" ) );
396  mSymbolTags->setText( tag );
397  if ( QFileInfo::exists( mFileName ) )
398  {
399  mTempStyle->clear();
400  populateStyles();
401  mImportFileWidget->setDefaultRoot( pathInfo.absolutePath() );
402  QgsSettings settings;
403  settings.setValue( QStringLiteral( "StyleManager/lastImportDir" ), pathInfo.absolutePath(), QgsSettings::Gui );
404  }
405 }
406 
407 void QgsStyleExportImportDialog::downloadStyleXml( const QUrl &url )
408 {
409  mTempFile = new QTemporaryFile();
410  if ( mTempFile->open() )
411  {
412  mFileName = mTempFile->fileName();
413 
414  QProgressDialog *progressDlg = new QProgressDialog( this );
415  progressDlg->setLabelText( tr( "Downloading style…" ) );
416  progressDlg->setAutoClose( true );
417  progressDlg->show();
418 
420  fetcher->setDescription( tr( "Downloading style" ) );
421  connect( progressDlg, &QProgressDialog::canceled, fetcher, &QgsNetworkContentFetcherTask::cancel );
422  connect( fetcher, &QgsNetworkContentFetcherTask::progressChanged, progressDlg, &QProgressDialog::setValue );
423  connect( fetcher, &QgsNetworkContentFetcherTask::fetched, this, [this, fetcher, progressDlg]
424  {
425  QNetworkReply *reply = fetcher->reply();
426  if ( !reply || reply->error() != QNetworkReply::NoError )
427  {
428  mTempFile->remove();
429  mFileName.clear();
430  if ( reply )
431  QMessageBox::information( this, tr( "Import from URL" ),
432  tr( "HTTP Error! Download failed: %1." ).arg( reply->errorString() ) );
433  }
434  else
435  {
436  mTempFile->write( reply->readAll() );
437  mTempFile->flush();
438  mTempFile->close();
439  populateStyles();
440  }
441  progressDlg->deleteLater();
442  } );
443 
444  QgsApplication::taskManager()->addTask( fetcher );
445  }
446 }
447 
448 void QgsStyleExportImportDialog::selectionChanged( const QItemSelection &selected, const QItemSelection &deselected )
449 {
450  Q_UNUSED( selected )
451  Q_UNUSED( deselected )
452  bool nothingSelected = listItems->selectionModel()->selectedIndexes().empty();
453  buttonBox->button( QDialogButtonBox::Ok )->setDisabled( nothingSelected );
454 }
455 
456 void QgsStyleExportImportDialog::showHelp()
457 {
458  QgsHelp::openHelp( QStringLiteral( "style_library/style_manager.html#sharing-style-items" ) );
459 }
QgsFileWidget::fileChanged
void fileChanged(const QString &path)
Emitted whenever the current file or directory path is changed.
QgsStyleGroupSelectionDialog::favoritesDeselected
void favoritesDeselected()
Favorites has been deselected.
QgsStyle::ColorrampEntity
@ ColorrampEntity
Color ramps.
Definition: qgsstyle.h:182
QgsStyleGroupSelectionDialog::allDeselected
void allDeselected()
all deselected
QgsSettings::value
QVariant value(const QString &key, const QVariant &defaultValue=QVariant(), Section section=NoSection) const
Returns the value for setting key.
Definition: qgssettings.cpp:174
QgsStyleExportImportDialog::~QgsStyleExportImportDialog
~QgsStyleExportImportDialog() override
Definition: qgsstyleexportimportdialog.cpp:240
QgsStyleExportImportDialog::deselectSmartgroup
void deselectSmartgroup(const QString &groupName)
deselectSmartgroup deselects all symbols from a smart group
Definition: qgsstyleexportimportdialog.cpp:324
qgsstylemanagerdialog.h
QgsTask::setDescription
void setDescription(const QString &description)
Sets the task's description.
Definition: qgstaskmanager.cpp:51
QgsStyle::symbolsOfFavorite
QStringList symbolsOfFavorite(StyleEntity type) const
Returns the symbol names which are flagged as favorite.
Definition: qgsstyle.cpp:1085
qgsgui.h
QgsNetworkContentFetcherTask::fetched
void fetched()
Emitted when the network content has been fetched, regardless of whether the fetch was successful or ...
QgsStyleGroupSelectionDialog::favoritesSelected
void favoritesSelected()
Favorites has need selected.
qgssymbollayerutils.h
QgsNetworkContentFetcherTask::reply
QNetworkReply * reply()
Returns the network reply.
Definition: qgsnetworkcontentfetchertask.cpp:72
QgsStyleExportImportDialog::selectFavorites
void selectFavorites()
Selects favorite symbols.
Definition: qgsstyleexportimportdialog.cpp:261
QgsFileWidget::GetFile
@ GetFile
Select a single file.
Definition: qgsfilewidget.h:66
QgsNetworkContentFetcherTask
Handles HTTP network content fetching in a background task.
Definition: qgsnetworkcontentfetchertask.h:47
QgsStyleGroupSelectionDialog::allSelected
void allSelected()
all selected
QgsTask::progressChanged
void progressChanged(double progress)
Will be emitted by task when its progress changes.
QgsStyleExportImportDialog::selectTag
void selectTag(const QString &tagName)
Select the symbols belonging to the given tag.
Definition: qgsstyleexportimportdialog.cpp:302
QgsSettings
Definition: qgssettings.h:61
qgsnetworkcontentfetchertask.h
QgsStyleExportImportDialog::setImportFilePath
void setImportFilePath(const QString &path)
Sets the initial path to use for importing files, when the dialog is in a Import mode.
Definition: qgsstyleexportimportdialog.cpp:246
QgsStyleExportImportDialog::clearSelection
void clearSelection()
clearSelection deselects all symbols
Definition: qgsstyleexportimportdialog.cpp:256
QgsStyleGroupSelectionDialog
Definition: qgsstylegroupselectiondialog.h:32
QgsNetworkContentFetcherTask::cancel
void cancel() override
Notifies the task that it should terminate.
Definition: qgsnetworkcontentfetchertask.cpp:64
QgsStyleExportImportDialog::selectSymbols
void selectSymbols(const QStringList &symbolNames)
selectSymbols select symbols by name
Definition: qgsstyleexportimportdialog.cpp:273
QgsStyle::SymbolEntity
@ SymbolEntity
Symbols.
Definition: qgsstyle.h:180
QgsGuiUtils::iconSize
QSize iconSize(bool dockableToolbar)
Returns the user-preferred size of a window's toolbar icons.
Definition: qgsguiutils.cpp:264
QgsStyleExportImportDialog::selectAll
void selectAll()
selectAll selects all symbols
Definition: qgsstyleexportimportdialog.cpp:251
QgsTaskManager::addTask
long addTask(QgsTask *task, int priority=0)
Adds a task to the manager.
Definition: qgstaskmanager.cpp:416
QgsStyleExportImportDialog::deselectFavorites
void deselectFavorites()
Deselects favorite symbols.
Definition: qgsstyleexportimportdialog.cpp:267
QgsStyleExportImportDialog::selectSmartgroup
void selectSmartgroup(const QString &groupName)
selectSmartgroup selects all symbols from a smart group
Definition: qgsstyleexportimportdialog.cpp:314
QgsStyleGroupSelectionDialog::tagDeselected
void tagDeselected(const QString &tagName)
tag with tagName has been deselected
qgsapplication.h
qgsstylegroupselectiondialog.h
QgsStyleModel::TypeRole
@ TypeRole
Style entity type, see QgsStyle::StyleEntity.
Definition: qgsstylemodel.h:61
QgsGui::enableAutoGeometryRestore
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...
Definition: qgsgui.cpp:133
QgsStyleExportImportDialog::selectByGroup
void selectByGroup()
selectByGroup open select by group dialog
Definition: qgsstyleexportimportdialog.cpp:334
QgsStyle::symbolsOfSmartgroup
QStringList symbolsOfSmartgroup(StyleEntity type, int id)
Returns the symbols for the smartgroup.
Definition: qgsstyle.cpp:2124
QgsStyleExportImportDialog::importTypeChanged
void importTypeChanged(int)
Definition: qgsstyleexportimportdialog.cpp:354
QgsStyleExportImportDialog::doExportImport
void doExportImport()
Definition: qgsstyleexportimportdialog.cpp:145
QgsStyleGroupSelectionDialog::tagSelected
void tagSelected(const QString &tagName)
tag with tagName has been selected
qgscolorramp.h
QgsStyleExportImportDialog::Import
@ Import
Import xml file mode.
Definition: qgsstyleexportimportdialog.h:50
QgsApplication::taskManager
static QgsTaskManager * taskManager()
Returns the application's task manager, used for managing application wide background task handling.
Definition: qgsapplication.cpp:2084
QgsStyleGroupSelectionDialog::smartgroupDeselected
void smartgroupDeselected(const QString &groupName)
smart group with groupName has been deselected
Qgis::UI_SCALE_FACTOR
static const double UI_SCALE_FACTOR
UI scaling factor.
Definition: qgis.h:195
qgsstylemodel.h
QgsSettings::setValue
void setValue(const QString &key, const QVariant &value, QgsSettings::Section section=QgsSettings::NoSection)
Sets the value of setting key to value.
Definition: qgssettings.cpp:289
qgsstyle.h
qgsstyleexportimportdialog.h
QgsStyleModel::SymbolTypeRole
@ SymbolTypeRole
Symbol type (for symbol or legend patch shape entities)
Definition: qgsstylemodel.h:63
QgsStyleExportImportDialog::Mode
Mode
Dialog modes.
Definition: qgsstyleexportimportdialog.h:47
QgsStyleExportImportDialog::deselectTag
void deselectTag(const QString &tagName)
Deselect the symbols belonging to the given tag.
Definition: qgsstyleexportimportdialog.cpp:308
QgsStyle::smartgroupId
int smartgroupId(const QString &smartgroup)
Returns the database id for the given smartgroup name.
Definition: qgsstyle.cpp:1990
QgsStyleExportImportDialog::Export
@ Export
Export existing symbols mode.
Definition: qgsstyleexportimportdialog.h:49
QgsStyle
Definition: qgsstyle.h:159
QgsStyle::TextFormatEntity
@ TextFormatEntity
Text formats.
Definition: qgsstyle.h:184
QgsHelp::openHelp
static void openHelp(const QString &key)
Opens help topic for the given help key using default system web browser.
Definition: qgshelp.cpp:36
QgsStyleExportImportDialog::QgsStyleExportImportDialog
QgsStyleExportImportDialog(QgsStyle *style, QWidget *parent=nullptr, Mode mode=Export)
Constructor for QgsStyleExportImportDialog, with the specified parent widget.
Definition: qgsstyleexportimportdialog.cpp:44
QgsStyleProxyModel::addDesiredIconSize
void addDesiredIconSize(QSize size)
Adds an additional icon size to generate for Qt::DecorationRole data.
Definition: qgsstylemodel.cpp:761
qgssettings.h
QgsStyleExportImportDialog::deselectSymbols
void deselectSymbols(const QStringList &symbolNames)
deselectSymbols deselect symbols by name
Definition: qgsstyleexportimportdialog.cpp:287
QgsSymbol::SymbolType
SymbolType
Type of the symbol.
Definition: qgssymbol.h:85
qgslogger.h
qgsguiutils.h
QgsStyle::symbolsWithTag
QStringList symbolsWithTag(StyleEntity type, int tagid) const
Returns the symbol names with which have the given tag.
Definition: qgsstyle.cpp:1119
QgsStyleProxyModel
Definition: qgsstylemodel.h:137
qgssymbol.h
QgsTemporaryCursorOverride
Temporarily sets a cursor override for the QApplication for the lifetime of the object.
Definition: qgsguiutils.h:203
QgsSettings::Gui
@ Gui
Definition: qgssettings.h:71
QgsStyle::tagId
int tagId(const QString &tag)
Returns the database id for the given tag name.
Definition: qgsstyle.cpp:1985
QgsStyleGroupSelectionDialog::smartgroupSelected
void smartgroupSelected(const QString &groupName)
smartgroup with groupName has been selected
QgsStyleModel::Name
@ Name
Name column.
Definition: qgsstylemodel.h:54
QgsStyle::StyleEntity
StyleEntity
Enum for Entities involved in a style.
Definition: qgsstyle.h:178