QGIS API Documentation  2.18.21-Las Palmas (9fba24a)
qgsstylev2exportimportdialog.cpp
Go to the documentation of this file.
1 /***************************************************************************
2  qgsstylev2exportimportdialog.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_qgsstylev2exportimportdialogbase.h"
19 
20 #include "qgsstylev2.h"
21 #include "qgssymbolv2.h"
22 #include "qgssymbollayerv2utils.h"
23 #include "qgsvectorcolorrampv2.h"
24 #include "qgslogger.h"
25 
26 #include <QInputDialog>
27 #include <QCloseEvent>
28 #include <QFileDialog>
29 #include <QMessageBox>
30 #include <QPushButton>
31 #include <QStandardItemModel>
32 
33 
35  : QDialog( parent )
36  , mDialogMode( mode )
37  , mQgisStyle( style )
38 {
39  setupUi( this );
40 
41  // additional buttons
42  QPushButton *pb;
43  pb = new QPushButton( tr( "Select all" ) );
44  buttonBox->addButton( pb, QDialogButtonBox::ActionRole );
45  connect( pb, SIGNAL( clicked() ), this, SLOT( selectAll() ) );
46 
47  pb = new QPushButton( tr( "Clear selection" ) );
48  buttonBox->addButton( pb, QDialogButtonBox::ActionRole );
49  connect( pb, SIGNAL( clicked() ), this, SLOT( clearSelection() ) );
50 
51  QStandardItemModel* model = new QStandardItemModel( listItems );
52 
53  listItems->setModel( model );
54  connect( listItems->selectionModel(), SIGNAL( selectionChanged( const QItemSelection&, const QItemSelection& ) ),
55  this, SLOT( selectionChanged( const QItemSelection&, const QItemSelection& ) ) );
56 
57  mTempStyle = new QgsStyleV2();
58  // TODO validate
59  mFileName = "";
60  mProgressDlg = nullptr;
61  mGroupSelectionDlg = nullptr;
62  mTempFile = nullptr;
63  mNetManager = new QNetworkAccessManager( this );
64  mNetReply = nullptr;
65 
66  if ( mDialogMode == Import )
67  {
68  setWindowTitle( tr( "Import symbol(s)" ) );
69  // populate the import types
70  importTypeCombo->addItem( tr( "file specified below" ), QVariant( "file" ) );
71  // importTypeCombo->addItem( "official QGIS repo online", QVariant( "official" ) );
72  importTypeCombo->addItem( tr( "URL specified below" ), QVariant( "url" ) );
73  connect( importTypeCombo, SIGNAL( currentIndexChanged( int ) ), this, SLOT( importTypeChanged( int ) ) );
74 
75  QStringList groups = mQgisStyle->groupNames();
76  groupCombo->addItem( "imported", QVariant( "new" ) );
77  Q_FOREACH ( const QString& gName, groups )
78  {
79  groupCombo->addItem( gName );
80  }
81 
82  btnBrowse->setText( "Browse" );
83  connect( btnBrowse, SIGNAL( clicked() ), this, SLOT( browse() ) );
84 
85  label->setText( tr( "Select symbols to import" ) );
86  buttonBox->button( QDialogButtonBox::Ok )->setText( tr( "Import" ) );
87  }
88  else
89  {
90  setWindowTitle( tr( "Export symbol(s)" ) );
91  // hide import specific controls when exporting
92  btnBrowse->setHidden( true );
93  fromLabel->setHidden( true );
94  importTypeCombo->setHidden( true );
95  locationLabel->setHidden( true );
96  locationLineEdit->setHidden( true );
97 
98  pb = new QPushButton( tr( "Select by group" ) );
99  buttonBox->addButton( pb, QDialogButtonBox::ActionRole );
100  connect( pb, SIGNAL( clicked() ), this, SLOT( selectByGroup() ) );
101  groupLabel->setHidden( true );
102  groupCombo->setHidden( true );
103 
104  buttonBox->button( QDialogButtonBox::Ok )->setText( tr( "Export" ) );
105  if ( !populateStyles( mQgisStyle ) )
106  {
107  QApplication::postEvent( this, new QCloseEvent() );
108  }
109 
110  }
111  // use Ok button for starting import and export operations
112  disconnect( buttonBox, SIGNAL( accepted() ), this, SLOT( accept() ) );
113  connect( buttonBox, SIGNAL( accepted() ), this, SLOT( doExportImport() ) );
114  buttonBox->button( QDialogButtonBox::Ok )->setEnabled( false );
115 }
116 
118 {
119  QModelIndexList selection = listItems->selectionModel()->selectedIndexes();
120  if ( selection.isEmpty() )
121  {
122  QMessageBox::warning( this, tr( "Export/import error" ),
123  tr( "You should select at least one symbol/color ramp." ) );
124  return;
125  }
126 
127  if ( mDialogMode == Export )
128  {
129  QString fileName = QFileDialog::getSaveFileName( this, tr( "Save styles" ), QDir::homePath(),
130  tr( "XML files (*.xml *.XML)" ) );
131  if ( fileName.isEmpty() )
132  {
133  return;
134  }
135 
136  // ensure the user never ommited the extension from the file name
137  if ( !fileName.endsWith( ".xml", Qt::CaseInsensitive ) )
138  {
139  fileName += ".xml";
140  }
141 
142  mFileName = fileName;
143 
144  moveStyles( &selection, mQgisStyle, mTempStyle );
145  if ( !mTempStyle->exportXML( mFileName ) )
146  {
147  QMessageBox::warning( this, tr( "Export/import error" ),
148  tr( "Error when saving selected symbols to file:\n%1" )
149  .arg( mTempStyle->errorString() ) );
150  return;
151  }
152  }
153  else // import
154  {
155  moveStyles( &selection, mTempStyle, mQgisStyle );
156 
157  // clear model
158  QStandardItemModel* model = qobject_cast<QStandardItemModel*>( listItems->model() );
159  model->clear();
160  accept();
161  }
162 
163  mFileName = "";
164  mTempStyle->clear();
165 }
166 
167 bool QgsStyleV2ExportImportDialog::populateStyles( QgsStyleV2* style )
168 {
169  // load symbols and color ramps from file
170  if ( mDialogMode == Import )
171  {
172  // NOTE mTempStyle is style here
173  if ( !style->importXML( mFileName ) )
174  {
175  QMessageBox::warning( this, tr( "Import error" ),
176  tr( "An error occurred during import:\n%1" ).arg( style->errorString() ) );
177  return false;
178  }
179  }
180 
181  QStandardItemModel* model = qobject_cast<QStandardItemModel*>( listItems->model() );
182  model->clear();
183 
184  // populate symbols
185  QStringList styleNames = style->symbolNames();
186  QString name;
187 
188  for ( int i = 0; i < styleNames.count(); ++i )
189  {
190  name = styleNames[i];
191  QgsSymbolV2* symbol = style->symbol( name );
192  QStandardItem* item = new QStandardItem( name );
193  QIcon icon = QgsSymbolLayerV2Utils::symbolPreviewIcon( symbol, listItems->iconSize() );
194  item->setIcon( icon );
195  model->appendRow( item );
196  delete symbol;
197  }
198 
199  // and color ramps
200  styleNames = style->colorRampNames();
201 
202  for ( int i = 0; i < styleNames.count(); ++i )
203  {
204  name = styleNames[i];
205  QgsVectorColorRampV2* ramp = style->colorRamp( name );
206 
207  QStandardItem* item = new QStandardItem( name );
208  QIcon icon = QgsSymbolLayerV2Utils::colorRampPreviewIcon( ramp, listItems->iconSize() );
209  item->setIcon( icon );
210  model->appendRow( item );
211  delete ramp;
212  }
213  return true;
214 }
215 
216 void QgsStyleV2ExportImportDialog::moveStyles( QModelIndexList* selection, QgsStyleV2* src, QgsStyleV2* dst )
217 {
218  QString symbolName;
219  QgsSymbolV2* symbol;
220  QgsVectorColorRampV2 *ramp = nullptr;
222  bool isSymbol = true;
223  bool prompt = true;
224  bool overwrite = true;
225  int groupid = 0;
226 
227  // get the groupid when going for import
228  if ( mDialogMode == Import )
229  {
230  // get the name the user entered
231  QString name = groupCombo->currentText();
232  if ( name.isEmpty() )
233  {
234  // import to "ungrouped"
235  groupid = 0;
236  }
237  else if ( dst->groupNames().contains( name ) )
238  {
239  groupid = dst->groupId( name );
240  }
241  else
242  {
243  groupid = dst->addGroup( name );
244  }
245  }
246 
247  for ( int i = 0; i < selection->size(); ++i )
248  {
249  index = selection->at( i );
250  symbolName = index.model()->data( index, 0 ).toString();
251  symbol = src->symbol( symbolName );
252  if ( !symbol )
253  {
254  isSymbol = false;
255  ramp = src->colorRamp( symbolName );
256  }
257 
258  if ( isSymbol )
259  {
260  if ( dst->symbolNames().contains( symbolName ) && prompt )
261  {
262  int res = QMessageBox::warning( this, tr( "Duplicate names" ),
263  tr( "Symbol with name '%1' already exists.\nOverwrite?" )
264  .arg( symbolName ),
265  QMessageBox::Yes | QMessageBox::YesToAll | QMessageBox::No | QMessageBox::NoToAll | QMessageBox::Cancel );
266  switch ( res )
267  {
268  case QMessageBox::Cancel:
269  return;
270  case QMessageBox::No:
271  continue;
272  case QMessageBox::Yes:
273  dst->addSymbol( symbolName, symbol );
274  if ( mDialogMode == Import )
275  dst->saveSymbol( symbolName, symbol, groupid, QStringList() );
276  continue;
277  case QMessageBox::YesToAll:
278  prompt = false;
279  overwrite = true;
280  break;
281  case QMessageBox::NoToAll:
282  prompt = false;
283  overwrite = false;
284  break;
285  }
286  }
287 
288  if ( dst->symbolNames().contains( symbolName ) && overwrite )
289  {
290  dst->addSymbol( symbolName, symbol );
291  if ( mDialogMode == Import )
292  dst->saveSymbol( symbolName, symbol, groupid, QStringList() );
293  }
294  else if ( dst->symbolNames().contains( symbolName ) && !overwrite )
295  {
296  continue;
297  }
298  else
299  {
300  dst->addSymbol( symbolName, symbol );
301  if ( mDialogMode == Import )
302  dst->saveSymbol( symbolName, symbol, groupid, QStringList() );
303  }
304  }
305  else
306  {
307  if ( dst->colorRampNames().contains( symbolName ) && prompt )
308  {
309  int res = QMessageBox::warning( this, tr( "Duplicate names" ),
310  tr( "Color ramp with name '%1' already exists.\nOverwrite?" )
311  .arg( symbolName ),
312  QMessageBox::Yes | QMessageBox::YesToAll | QMessageBox::No | QMessageBox::NoToAll | QMessageBox::Cancel );
313  switch ( res )
314  {
315  case QMessageBox::Cancel:
316  return;
317  case QMessageBox::No:
318  continue;
319  case QMessageBox::Yes:
320  dst->addColorRamp( symbolName, ramp );
321  if ( mDialogMode == Import )
322  dst->saveColorRamp( symbolName, ramp, groupid, QStringList() );
323  continue;
324  case QMessageBox::YesToAll:
325  prompt = false;
326  overwrite = true;
327  break;
328  case QMessageBox::NoToAll:
329  prompt = false;
330  overwrite = false;
331  break;
332  }
333  }
334 
335  if ( dst->colorRampNames().contains( symbolName ) && overwrite )
336  {
337  dst->addColorRamp( symbolName, ramp );
338  if ( mDialogMode == Import )
339  dst->saveColorRamp( symbolName, ramp, groupid, QStringList() );
340  }
341  else if ( dst->colorRampNames().contains( symbolName ) && !overwrite )
342  {
343  continue;
344  }
345  else
346  {
347  dst->addColorRamp( symbolName, ramp );
348  if ( mDialogMode == Import )
349  dst->saveColorRamp( symbolName, ramp, groupid, QStringList() );
350  }
351  }
352  }
353 }
354 
356 {
357  delete mTempFile;
358  delete mTempStyle;
359  delete mGroupSelectionDlg;
360 }
361 
363 {
364  listItems->selectAll();
365 }
366 
368 {
369  listItems->clearSelection();
370 }
371 
373 {
374  Q_FOREACH ( const QString &symbolName, symbolNames )
375  {
376  QModelIndexList indexes = listItems->model()->match( listItems->model()->index( 0, 0 ), Qt::DisplayRole, symbolName , 1, Qt::MatchFixedString | Qt::MatchCaseSensitive );
377  Q_FOREACH ( const QModelIndex &index, indexes )
378  {
379  listItems->selectionModel()->select( index, QItemSelectionModel::Select );
380  }
381  }
382 }
383 
385 {
386  Q_FOREACH ( const QString &symbolName, symbolNames )
387  {
388  QModelIndexList indexes = listItems->model()->match( listItems->model()->index( 0, 0 ), Qt::DisplayRole, symbolName , 1, Qt::MatchFixedString | Qt::MatchCaseSensitive );
389  Q_FOREACH ( const QModelIndex &index, indexes )
390  {
391  QItemSelection deselection( index, index );
392  listItems->selectionModel()->select( deselection, QItemSelectionModel::Deselect );
393  }
394  }
395 }
396 
398 {
399  QStringList symbolNames = mQgisStyle->symbolsOfGroup( QgsStyleV2::SymbolEntity, mQgisStyle->groupId( groupName ) );
400  selectSymbols( symbolNames );
401  symbolNames = mQgisStyle->symbolsOfGroup( QgsStyleV2::ColorrampEntity, mQgisStyle->groupId( groupName ) );
402  selectSymbols( symbolNames );
403 }
404 
405 
407 {
408  QStringList symbolNames = mQgisStyle->symbolsOfGroup( QgsStyleV2::SymbolEntity, mQgisStyle->groupId( groupName ) );
409  deselectSymbols( symbolNames );
410  symbolNames = mQgisStyle->symbolsOfGroup( QgsStyleV2::ColorrampEntity, mQgisStyle->groupId( groupName ) );
411  deselectSymbols( symbolNames );
412 }
413 
415 {
416  QStringList symbolNames = mQgisStyle->symbolsOfSmartgroup( QgsStyleV2::SymbolEntity, mQgisStyle->smartgroupId( groupName ) );
417  selectSymbols( symbolNames );
418  symbolNames = mQgisStyle->symbolsOfSmartgroup( QgsStyleV2::ColorrampEntity, mQgisStyle->smartgroupId( groupName ) );
419  selectSymbols( symbolNames );
420 }
421 
423 {
424  QStringList symbolNames = mQgisStyle->symbolsOfSmartgroup( QgsStyleV2::SymbolEntity, mQgisStyle->smartgroupId( groupName ) );
425  deselectSymbols( symbolNames );
426  symbolNames = mQgisStyle->symbolsOfSmartgroup( QgsStyleV2::ColorrampEntity, mQgisStyle->smartgroupId( groupName ) );
427  deselectSymbols( symbolNames );
428 }
429 
431 {
432  if ( ! mGroupSelectionDlg )
433  {
434  mGroupSelectionDlg = new QgsStyleV2GroupSelectionDialog( mQgisStyle, this );
435  mGroupSelectionDlg->setWindowTitle( tr( "Select symbols by group" ) );
436  connect( mGroupSelectionDlg, SIGNAL( groupSelected( const QString ) ), this, SLOT( selectGroup( const QString ) ) );
437  connect( mGroupSelectionDlg, SIGNAL( groupDeselected( const QString ) ), this, SLOT( deselectGroup( const QString ) ) );
438  connect( mGroupSelectionDlg, SIGNAL( allSelected() ), this, SLOT( selectAll() ) );
439  connect( mGroupSelectionDlg, SIGNAL( allDeselected() ), this, SLOT( clearSelection() ) );
440  connect( mGroupSelectionDlg, SIGNAL( smartgroupSelected( const QString ) ), this, SLOT( selectSmartgroup( const QString ) ) );
441  connect( mGroupSelectionDlg, SIGNAL( smartgroupDeselected( const QString ) ), this, SLOT( deselectSmartgroup( const QString ) ) );
442  }
443  mGroupSelectionDlg->show();
444  mGroupSelectionDlg->raise();
445  mGroupSelectionDlg->activateWindow();
446 }
447 
449 {
450  QString type = importTypeCombo->itemData( index ).toString();
451 
452  locationLineEdit->setText( "" );
453 
454  if ( type == "file" )
455  {
456  locationLineEdit->setEnabled( true );
457  btnBrowse->setText( "Browse" );
458  }
459  else if ( type == "official" )
460  {
461  btnBrowse->setText( "Fetch Symbols" );
462  locationLineEdit->setEnabled( false );
463  }
464  else
465  {
466  btnBrowse->setText( "Fetch Symbols" );
467  locationLineEdit->setEnabled( true );
468  }
469 }
470 
472 {
473  QString type = importTypeCombo->itemData( importTypeCombo->currentIndex() ).toString();
474 
475  if ( type == "file" )
476  {
477  mFileName = QFileDialog::getOpenFileName( this, tr( "Load styles" ), QDir::homePath(),
478  tr( "XML files (*.xml *XML)" ) );
479  if ( mFileName.isEmpty() )
480  {
481  return;
482  }
483  QFileInfo pathInfo( mFileName );
484  QString groupName = pathInfo.fileName().remove( ".xml" );
485  groupCombo->setItemText( 0, groupName );
486  locationLineEdit->setText( mFileName );
487  populateStyles( mTempStyle );
488  }
489  else if ( type == "official" )
490  {
491  // TODO set URL
492  // downloadStyleXML( QUrl( "http://...." ) );
493  }
494  else
495  {
496  downloadStyleXML( QUrl( locationLineEdit->text() ) );
497  }
498 }
499 
500 void QgsStyleV2ExportImportDialog::downloadStyleXML( const QUrl& url )
501 {
502  // XXX Try to move this code to some core Network interface,
503  // HTTP downloading is a generic functionality that might be used elsewhere
504 
505  mTempFile = new QTemporaryFile();
506  if ( mTempFile->open() )
507  {
508  mFileName = mTempFile->fileName();
509 
510  if ( mProgressDlg )
511  {
512  QProgressDialog *dummy = mProgressDlg;
513  mProgressDlg = nullptr;
514  delete dummy;
515  }
516  mProgressDlg = new QProgressDialog();
517  mProgressDlg->setLabelText( tr( "Downloading style ... " ) );
518  mProgressDlg->setAutoClose( true );
519 
520  connect( mProgressDlg, SIGNAL( canceled() ), this, SLOT( downloadCanceled() ) );
521 
522  // open the network connection and connect the respective slots
523  if ( mNetReply )
524  {
525  QNetworkReply *dummyReply = mNetReply;
526  mNetReply = nullptr;
527  delete dummyReply;
528  }
529  mNetReply = mNetManager->get( QNetworkRequest( url ) );
530 
531  connect( mNetReply, SIGNAL( finished() ), this, SLOT( httpFinished() ) );
532  connect( mNetReply, SIGNAL( readyRead() ), this, SLOT( fileReadyRead() ) );
533  connect( mNetReply, SIGNAL( downloadProgress( qint64, qint64 ) ), this, SLOT( updateProgress( qint64, qint64 ) ) );
534  }
535 }
536 
537 void QgsStyleV2ExportImportDialog::httpFinished()
538 {
539  if ( mNetReply->error() )
540  {
541  mTempFile->remove();
542  mFileName = "";
543  mProgressDlg->hide();
544  QMessageBox::information( this, tr( "HTTP Error!" ),
545  tr( "Download failed: %1." ).arg( mNetReply->errorString() ) );
546  return;
547  }
548  else
549  {
550  mTempFile->flush();
551  mTempFile->close();
552  populateStyles( mTempStyle );
553  }
554 }
555 
556 void QgsStyleV2ExportImportDialog::fileReadyRead()
557 {
558  mTempFile->write( mNetReply->readAll() );
559 }
560 
561 void QgsStyleV2ExportImportDialog::updateProgress( qint64 bytesRead, qint64 bytesTotal )
562 {
563  mProgressDlg->setMaximum( bytesTotal );
564  mProgressDlg->setValue( bytesRead );
565 }
566 
567 void QgsStyleV2ExportImportDialog::downloadCanceled()
568 {
569  mNetReply->abort();
570  mTempFile->remove();
571  mFileName = "";
572 }
573 
574 void QgsStyleV2ExportImportDialog::selectionChanged( const QItemSelection & selected, const QItemSelection & deselected )
575 {
576  Q_UNUSED( selected );
577  Q_UNUSED( deselected );
578  bool nothingSelected = listItems->selectionModel()->selectedIndexes().empty();
579  buttonBox->button( QDialogButtonBox::Ok )->setDisabled( nothingSelected );
580 }
bool flush()
static unsigned index
bool saveColorRamp(const QString &name, QgsVectorColorRampV2 *ramp, int groupid, const QStringList &tags)
add the colorramp to the DB
Definition: qgsstylev2.cpp:210
QgsVectorColorRampV2 * colorRamp(const QString &name)
return a NEW copy of color ramp
Definition: qgsstylev2.cpp:257
void setupUi(QWidget *widget)
void setIcon(const QIcon &icon)
void selectByGroup()
selectByGroup open select by group dialog
void deselectSymbols(const QStringList &symbolNames)
deselectSymbols deselect symbols by name
static QIcon colorRampPreviewIcon(QgsVectorColorRampV2 *ramp, QSize size)
bool importXML(const QString &filename)
Imports the symbols and colorramps into the default style database from the given XML file...
void setMaximum(int maximum)
bool addSymbol(const QString &name, QgsSymbolV2 *symbol, bool update=false)
add symbol to style. takes symbol&#39;s ownership
Definition: qgsstylev2.cpp:81
bool remove()
QString errorString() const
int groupId(const QString &group)
return the DB id for the given group name
QStyle * style() const
void setLabelText(const QString &text)
QStringList symbolsOfGroup(StyleEntity type, int groupid)
returns the symbolnames of a given groupid
Definition: qgsstylev2.cpp:538
void deselectGroup(const QString &groupName)
Deselect the symbols belonging to the given group.
bool contains(const QString &str, Qt::CaseSensitivity cs) const
void selectSymbols(const QStringList &symbolNames)
selectSymbols select symbols by name
bool exportXML(const QString &filename)
Exports the style as a XML file.
void accepted()
void selectAll()
selectAll selects all symbols
bool addColorRamp(const QString &name, QgsVectorColorRampV2 *colorRamp, bool update=false)
add color ramp to style. takes ramp&#39;s ownership
Definition: qgsstylev2.cpp:186
const QPixmap * icon() const
QString & remove(int position, int n)
void clearSelection()
clearSelection deselects all symbols
bool disconnect(const QObject *sender, const char *signal, const QObject *receiver, const char *method)
QString homePath()
QStringList colorRampNames()
return a list of names of color ramps
Definition: qgsstylev2.cpp:273
QString tr(const char *sourceText, const char *disambiguation, int n)
StandardButton information(QWidget *parent, const QString &title, const QString &text, QFlags< QMessageBox::StandardButton > buttons, StandardButton defaultButton)
void finished(int result)
const char * name() const
void setValue(int progress)
QgsStyleV2ExportImportDialog(QgsStyleV2 *style, QWidget *parent=nullptr, Mode mode=Export)
static QIcon symbolPreviewIcon(QgsSymbolV2 *symbol, QSize size)
int count(const T &value) const
bool saveSymbol(const QString &name, QgsSymbolV2 *symbol, int groupid, const QStringList &tags)
add the symbol to the DB with the tags
Definition: qgsstylev2.cpp:105
QString fileName() const
void raise()
bool isEmpty() const
QByteArray readAll()
bool endsWith(const QString &s, Qt::CaseSensitivity cs) const
void setAutoClose(bool close)
QStringList symbolsOfSmartgroup(StyleEntity type, int id)
returns the symbols for the smartgroup
void deselectSmartgroup(const QString &groupName)
deselectSmartgroup deselects all symbols from a smart group
virtual QVariant data(const QModelIndex &index, int role) const=0
void hide()
void selectSmartgroup(const QString &groupName)
selectSmartgroup selects all symbols from a smart group
QStringList symbolNames()
return a list of names of symbols
Definition: qgsstylev2.cpp:180
virtual void accept()
virtual void abort()=0
QgsSymbolV2 * symbol(const QString &name)
return a NEW copy of symbol
Definition: qgsstylev2.cpp:164
virtual void close()
QString fileName() const
void clear()
remove all contents of the style
Definition: qgsstylev2.cpp:70
const QAbstractItemModel * model() const
void activateWindow()
void setWindowTitle(const QString &)
QString getSaveFileName(QWidget *parent, const QString &caption, const QString &dir, const QString &filter, QString *selectedFilter, QFlags< QFileDialog::Option > options)
qint64 write(const char *data, qint64 maxSize)
NetworkError error() const
StandardButton warning(QWidget *parent, const QString &title, const QString &text, QFlags< QMessageBox::StandardButton > buttons, StandardButton defaultButton)
void show()
QNetworkReply * get(const QNetworkRequest &request)
QString getOpenFileName(QWidget *parent, const QString &caption, const QString &dir, const QString &filter, QString *selectedFilter, QFlags< QFileDialog::Option > options)
int smartgroupId(const QString &smartgroup)
return the DB id for the given smartgroup name
void postEvent(QObject *receiver, QEvent *event)
bool connect(const QObject *sender, const char *signal, const QObject *receiver, const char *method, Qt::ConnectionType type)
void selectGroup(const QString &groupName)
Select the symbols belonging to the given group.
Abstract base class for color ramps.
QString toString() const
QString errorString()
return last error from load/save operation
Definition: qgsstylev2.h:288
void appendRow(const QList< QStandardItem * > &items)
QStringList groupNames()
return the all the groups in the style
Definition: qgsstylev2.cpp:463
int addGroup(const QString &groupName, int parent=0)
adds a new group and returns the group&#39;s id
Definition: qgsstylev2.cpp:624