QGIS API Documentation  2.15.0-Master (af20121)
qgsrasterformatsaveoptionswidget.cpp
Go to the documentation of this file.
1 /***************************************************************************
2  qgsrasterformatsaveoptionswidget.cpp
3  -------------------
4  begin : July 2012
5  copyright : (C) 2012 by Etienne Tourigny
6  email : etourigny dot dev at gmail dot com
7  ***************************************************************************/
8 
9 /***************************************************************************
10  * *
11  * This program is free software; you can redistribute it and/or modify *
12  * it under the terms of the GNU General Public License as published by *
13  * the Free Software Foundation; either version 2 of the License, or *
14  * (at your option) any later version. *
15  * *
16  ***************************************************************************/
17 
19 #include "qgslogger.h"
20 #include "qgsdialog.h"
21 #include "qgsrasterlayer.h"
22 #include "qgsproviderregistry.h"
23 
24 #include <QSettings>
25 #include <QInputDialog>
26 #include <QMessageBox>
27 #include <QTextEdit>
28 #include <QMouseEvent>
29 #include <QMenu>
30 
31 
32 QMap< QString, QStringList > QgsRasterFormatSaveOptionsWidget::mBuiltinProfiles;
33 
35  QgsRasterFormatSaveOptionsWidget::Type type, const QString& provider )
36  : QWidget( parent )
37  , mFormat( format )
38  , mProvider( provider )
39  , mRasterLayer( nullptr )
40  , mRasterFileName( QString() )
41  , mPyramids( false )
42  , mPyramidsFormat( QgsRaster::PyramidsGTiff )
43 
44 {
45  setupUi( this );
46 
47  setType( type );
48 
49  if ( mBuiltinProfiles.isEmpty() )
50  {
51  // key=profileKey values=format,profileName,options
52  mBuiltinProfiles[ "z_adefault" ] = ( QStringList() << "" << tr( "Default" ) << "" );
53 
54  // these GTiff profiles are based on Tim's benchmarks at
55  // http://linfiniti.com/2011/05/gdal-efficiency-of-various-compression-algorithms/
56  // big: no compression | medium: reasonable size/speed tradeoff | small: smallest size
57  mBuiltinProfiles[ "z_gtiff_1big" ] =
58  ( QStringList() << "GTiff" << tr( "No compression" )
59  << "COMPRESS=NONE BIGTIFF=IF_NEEDED" );
60  mBuiltinProfiles[ "z_gtiff_2medium" ] =
61  ( QStringList() << "GTiff" << tr( "Low compression" )
62  << "COMPRESS=PACKBITS" );
63  mBuiltinProfiles[ "z_gtiff_3small" ] =
64  ( QStringList() << "GTiff" << tr( "High compression" )
65  << "COMPRESS=DEFLATE PREDICTOR=2 ZLEVEL=9" );
66  mBuiltinProfiles[ "z_gtiff_4jpeg" ] =
67  ( QStringList() << "GTiff" << tr( "JPEG compression" )
68  << "COMPRESS=JPEG JPEG_QUALITY=75" );
69 
70  // overview compression schemes for GTiff format, see
71  // http://www.gdal.org/gdaladdo.html and http://www.gdal.org/frmt_gtiff.html
72  // TODO - should we offer GDAL_TIFF_OVR_BLOCKSIZE option here or in QgsRasterPyramidsOptionsWidget ?
73  mBuiltinProfiles[ "z__pyramids_gtiff_1big" ] =
74  ( QStringList() << "_pyramids" << tr( "No compression" )
75  << "COMPRESS_OVERVIEW=NONE BIGTIFF_OVERVIEW=IF_NEEDED" );
76  mBuiltinProfiles[ "z__pyramids_gtiff_2medium" ] =
77  ( QStringList() << "_pyramids" << tr( "Low compression" )
78  << "COMPRESS_OVERVIEW=PACKBITS" );
79  mBuiltinProfiles[ "z__pyramids_gtiff_3small" ] =
80  ( QStringList() << "_pyramids" << tr( "High compression" )
81  << "COMPRESS_OVERVIEW=DEFLATE PREDICTOR_OVERVIEW=2 ZLEVEL=9" ); // how to set zlevel?
82  mBuiltinProfiles[ "z__pyramids_gtiff_4jpeg" ] =
83  ( QStringList() << "_pyramids" << tr( "JPEG compression" )
84  << "JPEG_QUALITY_OVERVIEW=75 COMPRESS_OVERVIEW=JPEG PHOTOMETRIC_OVERVIEW=YCBCR INTERLEAVE_OVERVIEW=PIXEL" );
85  }
86 
87  connect( mProfileComboBox, SIGNAL( currentIndexChanged( const QString & ) ),
88  this, SLOT( updateOptions() ) );
89  connect( mOptionsTable, SIGNAL( cellChanged( int, int ) ), this, SLOT( optionsTableChanged() ) );
90  connect( mOptionsHelpButton, SIGNAL( clicked() ), this, SLOT( helpOptions() ) );
91  connect( mOptionsValidateButton, SIGNAL( clicked() ), this, SLOT( validateOptions() ) );
92 
93  // create eventFilter to map right click to swapOptionsUI()
94  // mOptionsLabel->installEventFilter( this );
95  mOptionsLineEdit->installEventFilter( this );
96  mOptionsStackedWidget->installEventFilter( this );
97 
98  updateControls();
100 
101  QgsDebugMsg( "done" );
102 }
103 
105 {
106 }
107 
109 {
110  mFormat = format;
111  updateControls();
112  updateProfiles();
113 }
114 
116 {
117  mProvider = provider;
118  updateControls();
119 }
120 
121 // show/hide widgets - we need this function if widget is used in creator
123 {
124  QList< QWidget* > widgets = this->findChildren<QWidget *>();
125  if (( type == Table ) || ( type == LineEdit ) )
126  {
127  // hide all controls, except stacked widget
128  Q_FOREACH ( QWidget* widget, widgets )
129  widget->setVisible( false );
130  mOptionsStackedWidget->setVisible( true );
131  Q_FOREACH ( QWidget* widget, mOptionsStackedWidget->findChildren<QWidget *>() )
132  widget->setVisible( true );
133 
134  // show relevant page
135  if ( type == Table )
136  swapOptionsUI( 0 );
137  else if ( type == LineEdit )
138  swapOptionsUI( 1 );
139  }
140  else
141  {
142  // show all widgets, except profile buttons (unless Full)
143  Q_FOREACH ( QWidget* widget, widgets )
144  widget->setVisible( true );
145  if ( type != Full )
146  mProfileButtons->setVisible( false );
147 
148  // show elevant page
149  if ( type == ProfileLineEdit )
150  swapOptionsUI( 1 );
151  }
152 }
153 
155 {
156  // build profiles list = user + builtin(last)
157  QString format = mPyramids ? "_pyramids" : mFormat;
158  QStringList profileKeys = profiles();
159  QMapIterator<QString, QStringList> it( mBuiltinProfiles );
160  while ( it.hasNext() )
161  {
162  it.next();
163  QString profileKey = it.key();
164  if ( ! profileKeys.contains( profileKey ) && !it.value().isEmpty() )
165  {
166  // insert key if is for all formats or this format (GTiff)
167  if ( it.value()[0] == "" || it.value()[0] == format )
168  {
169  profileKeys.insert( 0, profileKey );
170  }
171  }
172  }
173  qSort( profileKeys );
174 
175  // populate mOptionsMap and mProfileComboBox
176  mOptionsMap.clear();
177  mProfileComboBox->blockSignals( true );
178  mProfileComboBox->clear();
179  Q_FOREACH ( const QString& profileKey, profileKeys )
180  {
181  QString profileName, profileOptions;
182  profileOptions = createOptions( profileKey );
183  if ( mBuiltinProfiles.contains( profileKey ) )
184  {
185  profileName = mBuiltinProfiles[ profileKey ][ 1 ];
186  if ( profileOptions.isEmpty() )
187  profileOptions = mBuiltinProfiles[ profileKey ][ 2 ];
188  }
189  else
190  {
191  profileName = profileKey;
192  }
193  mOptionsMap[ profileKey ] = profileOptions;
194  mProfileComboBox->addItem( profileName, profileKey );
195  }
196 
197  // update UI
198  mProfileComboBox->blockSignals( false );
199  // mProfileComboBox->setCurrentIndex( 0 );
200  QSettings mySettings;
201  mProfileComboBox->setCurrentIndex( mProfileComboBox->findData( mySettings.value(
202  mProvider + "/driverOptions/" + format.toLower() + "/defaultProfile",
203  "z_adefault" ) ) );
204  updateOptions();
205 }
206 
207 void QgsRasterFormatSaveOptionsWidget::updateOptions()
208 {
209  QString myOptions = mOptionsMap.value( currentProfileKey() );
210  QStringList myOptionsList = myOptions.trimmed().split( ' ', QString::SkipEmptyParts );
211 
212  if ( mOptionsStackedWidget->currentIndex() == 0 )
213  {
214  mOptionsTable->setRowCount( 0 );
215  for ( int i = 0; i < myOptionsList.count(); i++ )
216  {
217  QStringList key_value = myOptionsList[i].split( '=' );
218  if ( key_value.count() == 2 )
219  {
220  mOptionsTable->insertRow( i );
221  mOptionsTable->setItem( i, 0, new QTableWidgetItem( key_value[0] ) );
222  mOptionsTable->setItem( i, 1, new QTableWidgetItem( key_value[1] ) );
223  }
224  }
225  }
226  else
227  {
228  mOptionsLineEdit->setText( myOptions );
229  mOptionsLineEdit->setCursorPosition( 0 );
230  }
231 
232  emit optionsChanged();
233 }
234 
236 {
237  setCreateOptions();
238 }
239 
240 // typedefs for gdal provider function pointers
241 typedef QString validateCreationOptionsFormat_t( const QStringList& createOptions, QString format );
243 
245 {
246  QString message;
247 
248  if ( mProvider == "gdal" && mFormat != "" && ! mPyramids )
249  {
250  // get helpCreationOptionsFormat() function ptr for provider
251  QLibrary *library = QgsProviderRegistry::instance()->providerLibrary( mProvider );
252  if ( library )
253  {
254  helpCreationOptionsFormat_t * helpCreationOptionsFormat =
255  ( helpCreationOptionsFormat_t * ) cast_to_fptr( library->resolve( "helpCreationOptionsFormat" ) );
256  if ( helpCreationOptionsFormat )
257  {
258  message = helpCreationOptionsFormat( mFormat );
259  }
260  else
261  {
262  message = library->fileName() + " does not have helpCreationOptionsFormat";
263  }
264  }
265  else
266  message = QString( "cannot load provider library %1" ).arg( mProvider );
267 
268 
269  if ( message.isEmpty() )
270  message = tr( "Cannot get create options for driver %1" ).arg( mFormat );
271  }
272  else if ( mProvider == "gdal" && mPyramids )
273  {
274  message = tr( "For details on pyramids options please see the following pages" );
275  message += "\n\nhttp://www.gdal.org/gdaladdo.html\n\nhttp://www.gdal.org/frmt_gtiff.html";
276  }
277  else
278  message = tr( "No help available" );
279 
280  // show simple non-modal dialog - should we make the basic xml prettier?
281  QgsDialog *dlg = new QgsDialog( this );
282  QTextEdit *textEdit = new QTextEdit( dlg );
283  textEdit->setReadOnly( true );
284  // message = tr( "Create Options:\n\n%1" ).arg( message );
285  textEdit->setText( message );
286  dlg->layout()->addWidget( textEdit );
287  dlg->resize( 600, 400 );
288 #ifdef Q_OS_MAC
289  dlg->exec(); //modal
290 #else
291  dlg->show(); //non modal
292 #endif
293 }
294 
296 {
297  QStringList createOptions = options();
298  QString message;
299 
300  QgsDebugMsg( QString( "layer: [%1] file: [%2] format: [%3]" ).arg( mRasterLayer ? mRasterLayer->id() : "none", mRasterFileName, mFormat ) );
301  // if no rasterLayer is defined, but we have a raster fileName, then create a temp. rasterLayer to validate options
302  // ideally we should keep it for future access, but this is trickier
303  QgsRasterLayer* rasterLayer = mRasterLayer;
304  bool tmpLayer = false;
305  if ( !( mRasterLayer && rasterLayer->dataProvider() ) && ! mRasterFileName.isNull() )
306  {
307  // temporarily override /Projections/defaultBehaviour to avoid dialog prompt
308  // this is taken from qgsbrowserdockwidget.cpp
309  // TODO - integrate this into qgis core
310  QSettings settings;
311  QString defaultProjectionOption = settings.value( "/Projections/defaultBehaviour", "prompt" ).toString();
312  if ( settings.value( "/Projections/defaultBehaviour", "prompt" ).toString() == "prompt" )
313  {
314  settings.setValue( "/Projections/defaultBehaviour", "useProject" );
315  }
316  tmpLayer = true;
317  rasterLayer = new QgsRasterLayer( mRasterFileName, QFileInfo( mRasterFileName ).baseName(), QString( "gdal" ) );
318  // restore /Projections/defaultBehaviour
319  if ( defaultProjectionOption == "prompt" )
320  {
321  settings.setValue( "/Projections/defaultBehaviour", defaultProjectionOption );
322  }
323  }
324 
325  if ( mProvider == "gdal" && mPyramids )
326  {
327  if ( rasterLayer && rasterLayer->dataProvider() )
328  {
329  QgsDebugMsg( "calling validate pyramids on layer's data provider" );
330  message = rasterLayer->dataProvider()->validatePyramidsConfigOptions( mPyramidsFormat, createOptions, mFormat );
331  }
332  else
333  {
334  message = tr( "cannot validate pyramid options" );
335  }
336  }
337  else if ( !createOptions.isEmpty() && mProvider == "gdal" && mFormat != "" )
338  {
339  if ( rasterLayer && rasterLayer->dataProvider() )
340  {
341  QgsDebugMsg( "calling validate on layer's data provider" );
342  message = rasterLayer->dataProvider()->validateCreationOptions( createOptions, mFormat );
343  }
344  else
345  {
346  // get validateCreationOptionsFormat() function ptr for provider
347  QLibrary *library = QgsProviderRegistry::instance()->providerLibrary( mProvider );
348  if ( library )
349  {
350  validateCreationOptionsFormat_t * validateCreationOptionsFormat =
351  ( validateCreationOptionsFormat_t * ) cast_to_fptr( library->resolve( "validateCreationOptionsFormat" ) );
352  if ( validateCreationOptionsFormat )
353  {
354  message = validateCreationOptionsFormat( createOptions, mFormat );
355  }
356  else
357  {
358  message = library->fileName() + " does not have validateCreationOptionsFormat";
359  }
360  }
361  else
362  message = QString( "cannot load provider library %1" ).arg( mProvider );
363  }
364  }
365  else if ( ! createOptions.isEmpty() )
366  {
367  QMessageBox::information( this, "", tr( "Cannot validate creation options" ), QMessageBox::Close );
368  if ( tmpLayer )
369  delete rasterLayer;
370  return QString();
371  }
372 
373  if ( gui )
374  {
375  if ( message.isNull() )
376  {
377  if ( reportOK )
378  QMessageBox::information( this, "", tr( "Valid" ), QMessageBox::Close );
379  }
380  else
381  {
382  QMessageBox::warning( this, "", tr( "Invalid %1:\n\n%2\n\nClick on help button to get valid creation options for this format." ).arg( mPyramids ? tr( "pyramid creation option" ) : tr( "creation option" ), message ), QMessageBox::Close );
383  }
384  }
385 
386  if ( tmpLayer )
387  delete rasterLayer;
388 
389  return message;
390 }
391 
392 void QgsRasterFormatSaveOptionsWidget::optionsTableChanged()
393 {
394  QTableWidgetItem *key, *value;
396  for ( int i = 0 ; i < mOptionsTable->rowCount(); i++ )
397  {
398  key = mOptionsTable->item( i, 0 );
399  if ( ! key || key->text().isEmpty() )
400  continue;
401  value = mOptionsTable->item( i, 1 );
402  if ( ! value || value->text().isEmpty() )
403  continue;
404  options += key->text() + '=' + value->text() + ' ';
405  }
406  options = options.trimmed();
407  mOptionsMap[ currentProfileKey()] = options;
408  mOptionsLineEdit->setText( options );
409  mOptionsLineEdit->setCursorPosition( 0 );
410 }
411 
412 void QgsRasterFormatSaveOptionsWidget::on_mOptionsLineEdit_editingFinished()
413 {
414  mOptionsMap[ currentProfileKey()] = mOptionsLineEdit->text().trimmed();
415 }
416 
417 void QgsRasterFormatSaveOptionsWidget::on_mProfileNewButton_clicked()
418 {
419  QString profileName = QInputDialog::getText( this, "", tr( "Profile name:" ) );
420  if ( ! profileName.isEmpty() )
421  {
422  profileName = profileName.trimmed();
423  mOptionsMap[ profileName ] = "";
424  mProfileComboBox->addItem( profileName, profileName );
425  mProfileComboBox->setCurrentIndex( mProfileComboBox->count() - 1 );
426  }
427 }
428 
429 void QgsRasterFormatSaveOptionsWidget::on_mProfileDeleteButton_clicked()
430 {
431  int index = mProfileComboBox->currentIndex();
432  QString profileKey = currentProfileKey();
433  if ( index != -1 && ! mBuiltinProfiles.contains( profileKey ) )
434  {
435  mOptionsMap.remove( profileKey );
436  mProfileComboBox->removeItem( index );
437  }
438 }
439 
440 void QgsRasterFormatSaveOptionsWidget::on_mProfileResetButton_clicked()
441 {
442  QString profileKey = currentProfileKey();
443  if ( mBuiltinProfiles.contains( profileKey ) )
444  {
445  mOptionsMap[ profileKey ] = mBuiltinProfiles[ profileKey ][ 2 ];
446  }
447  else
448  {
449  mOptionsMap[ profileKey ] = "";
450  }
451  mOptionsLineEdit->setText( mOptionsMap.value( currentProfileKey() ) );
452  mOptionsLineEdit->setCursorPosition( 0 );
453  updateOptions();
454 }
455 
456 void QgsRasterFormatSaveOptionsWidget::optionsTableEnableDeleteButton()
457 {
458  mOptionsDeleteButton->setEnabled( mOptionsTable->currentRow() >= 0 );
459 }
460 
461 void QgsRasterFormatSaveOptionsWidget::on_mOptionsAddButton_clicked()
462 {
463  mOptionsTable->insertRow( mOptionsTable->rowCount() );
464  // select the added row
465  int newRow = mOptionsTable->rowCount() - 1;
466  QTableWidgetItem* item = new QTableWidgetItem();
467  mOptionsTable->setItem( newRow, 0, item );
468  mOptionsTable->setCurrentItem( item );
469 }
470 
471 void QgsRasterFormatSaveOptionsWidget::on_mOptionsDeleteButton_clicked()
472 {
473  if ( mOptionsTable->currentRow() >= 0 )
474  {
475  mOptionsTable->removeRow( mOptionsTable->currentRow() );
476  // select the previous row or the next one if there is no previous row
477  QTableWidgetItem* item = mOptionsTable->item( mOptionsTable->currentRow(), 0 );
478  mOptionsTable->setCurrentItem( item );
479  optionsTableChanged();
480  }
481 }
482 
483 
484 QString QgsRasterFormatSaveOptionsWidget::settingsKey( QString profileName ) const
485 {
486  if ( profileName != "" )
487  profileName = "/profile_" + profileName;
488  else
489  profileName = "/profile_default" + profileName;
490  return mProvider + "/driverOptions/" + mFormat.toLower() + profileName + "/create";
491 }
492 
493 QString QgsRasterFormatSaveOptionsWidget::currentProfileKey() const
494 {
495  return mProfileComboBox->itemData( mProfileComboBox->currentIndex() ).toString();
496 }
497 
499 {
500  return mOptionsMap.value( currentProfileKey() ).trimmed().split( ' ', QString::SkipEmptyParts );
501 }
502 
503 QString QgsRasterFormatSaveOptionsWidget::createOptions( const QString& profileName ) const
504 {
505  QSettings mySettings;
506  return mySettings.value( settingsKey( profileName ), "" ).toString();
507 }
508 
509 void QgsRasterFormatSaveOptionsWidget::deleteCreateOptions( const QString& profileName )
510 {
511  QSettings mySettings;
512  mySettings.remove( settingsKey( profileName ) );
513 }
514 
515 void QgsRasterFormatSaveOptionsWidget::setCreateOptions()
516 {
517  QSettings mySettings;
518  QString myProfiles;
520  while ( i != mOptionsMap.constEnd() )
521  {
522  setCreateOptions( i.key(), i.value() );
523  myProfiles += i.key() + QLatin1String( " " );
524  ++i;
525  }
526  mySettings.setValue( mProvider + "/driverOptions/" + mFormat.toLower() + "/profiles",
527  myProfiles.trimmed() );
528  mySettings.setValue( mProvider + "/driverOptions/" + mFormat.toLower() + "/defaultProfile",
529  currentProfileKey().trimmed() );
530 }
531 
532 void QgsRasterFormatSaveOptionsWidget::setCreateOptions( const QString& profileName, const QString& options )
533 {
534  QSettings mySettings;
535  mySettings.setValue( settingsKey( profileName ), options.trimmed() );
536 }
537 
538 void QgsRasterFormatSaveOptionsWidget::setCreateOptions( const QString& profileName, const QStringList& list )
539 {
540  setCreateOptions( profileName, list.join( " " ) );
541 }
542 
543 QStringList QgsRasterFormatSaveOptionsWidget::profiles() const
544 {
545  QSettings mySettings;
546  return mySettings.value( mProvider + "/driverOptions/" + mFormat.toLower() + "/profiles", "" ).toString().trimmed().split( ' ', QString::SkipEmptyParts );
547 }
548 
549 void QgsRasterFormatSaveOptionsWidget::swapOptionsUI( int newIndex )
550 {
551  // set new page
552  int oldIndex;
553  if ( newIndex == -1 )
554  {
555  oldIndex = mOptionsStackedWidget->currentIndex();
556  newIndex = ( oldIndex + 1 ) % 2;
557  }
558  else
559  {
560  oldIndex = ( newIndex + 1 ) % 2;
561  }
562 
563  // resize pages to minimum - this works well with gdaltools merge ui, but not raster save as...
564  mOptionsStackedWidget->setCurrentIndex( newIndex );
565  mOptionsStackedWidget->widget( newIndex )->setSizePolicy(
566  QSizePolicy( QSizePolicy::Preferred, QSizePolicy::Preferred ) );
567  mOptionsStackedWidget->widget( oldIndex )->setSizePolicy(
568  QSizePolicy( QSizePolicy::Ignored, QSizePolicy::Ignored ) );
569  layout()->activate();
570 
571  updateOptions();
572 }
573 
574 void QgsRasterFormatSaveOptionsWidget::updateControls()
575 {
576  bool valid = mProvider == "gdal" && mFormat != "";
577  mOptionsValidateButton->setEnabled( valid );
578  mOptionsHelpButton->setEnabled( valid );
579 }
580 
581 // map options label left mouse click to optionsToggle()
582 bool QgsRasterFormatSaveOptionsWidget::eventFilter( QObject *obj, QEvent *event )
583 {
584  if ( event->type() == QEvent::MouseButtonPress )
585  {
586  QMouseEvent *mouseEvent = static_cast<QMouseEvent *>( event );
587  if ( mouseEvent && ( mouseEvent->button() == Qt::RightButton ) )
588  {
589  QMenu* menu = nullptr;
590  QString text;
591  if ( mOptionsStackedWidget->currentIndex() == 0 )
592  text = tr( "Use simple interface" );
593  else
594  text = tr( "Use table interface" );
595  if ( obj->objectName() == "mOptionsLineEdit" )
596  {
597  menu = mOptionsLineEdit->createStandardContextMenu();
598  menu->addSeparator();
599  }
600  else
601  menu = new QMenu( this );
602  QAction* action = new QAction( text, menu );
603  menu->addAction( action );
604  connect( action, SIGNAL( triggered() ), this, SLOT( swapOptionsUI() ) );
605  menu->exec( mouseEvent->globalPos() );
606  delete menu;
607  return true;
608  }
609  }
610  // standard event processing
611  return QObject::eventFilter( obj, event );
612 }
613 
615 {
616  Q_UNUSED( event );
617  mOptionsTable->horizontalHeader()->resizeSection( 0, mOptionsTable->width() - 115 );
618  QgsDebugMsg( "done" );
619 }
620 
QLayout * layout() const
static unsigned index
static QgsProviderRegistry * instance(const QString &pluginPath=QString::null)
Means of accessing canonical single instance.
Type type() const
void setupUi(QWidget *widget)
QgsRasterFormatSaveOptionsWidget(QWidget *parent=nullptr, const QString &format="GTiff", QgsRasterFormatSaveOptionsWidget::Type type=Default, const QString &provider="gdal")
bool contains(const Key &key) const
QString helpCreationOptionsFormat_t(QString format)
virtual QString validatePyramidsConfigOptions(QgsRaster::RasterPyramidsFormat pyramidsFormat, const QStringList &theConfigOptions, const QString &fileFormat)
Validates pyramid creation options for a specific dataset and destination format. ...
#define QgsDebugMsg(str)
Definition: qgslogger.h:33
This class provides qgis with the ability to render raster datasets onto the mapcanvas.
QStringList split(const QString &sep, SplitBehavior behavior, Qt::CaseSensitivity cs) const
const_iterator constBegin() const
void addAction(QAction *action)
bool contains(const QString &str, Qt::CaseSensitivity cs) const
virtual void setVisible(bool visible)
A generic dialog with layout and button box.
Definition: qgsdialog.h:30
int exec()
QString join(const QString &separator) const
void clear()
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)
bool isNull() const
QList< T > findChildren(const QString &name) const
void setValue(const QString &key, const QVariant &value)
void resize(int w, int h)
QString validateCreationOptionsFormat_t(const QStringList &createOptions, QString format)
void addWidget(QWidget *widget, int stretch, QFlags< Qt::AlignmentFlag > alignment)
int count(const T &value) const
const QPoint & globalPos() const
Qt::MouseButton button() const
QString validateOptions(bool gui=true, bool reportOk=true)
bool isEmpty() const
bool isEmpty() const
QString trimmed() const
const_iterator constEnd() const
QString id() const
Get this layer&#39;s unique ID, this ID is used to access this layer from map layer registry.
virtual bool eventFilter(QObject *watched, QEvent *event)
QAction * addSeparator()
const Key & key() const
const T & value() const
QAction * exec()
QString getText(QWidget *parent, const QString &title, const QString &label, QLineEdit::EchoMode mode, const QString &text, bool *ok, QFlags< Qt::WindowType > flags, QFlags< Qt::InputMethodHint > inputMethodHints)
QString toLower() const
void remove(const QString &key)
QString text() const
QLibrary * providerLibrary(const QString &providerKey) const
const Key key(const T &value) const
Raster namespace.
Definition: qgsraster.h:28
QVariant value(const QString &key, const QVariant &defaultValue) const
bool activate()
void * resolve(const char *symbol)
virtual void showEvent(QShowEvent *event) override
void insert(int i, const T &value)
QVBoxLayout * layout()
Returns the central layout. Widgets added to it must have this dialog as parent.
Definition: qgsdialog.h:40
QStringList split(const QString &sep, const QString &str, bool allowEmptyEntries)
void setType(QgsRasterFormatSaveOptionsWidget::Type type=Default)
StandardButton warning(QWidget *parent, const QString &title, const QString &text, QFlags< QMessageBox::StandardButton > buttons, StandardButton defaultButton)
virtual QString validateCreationOptions(const QStringList &createOptions, const QString &format)
Validates creation options for a specific dataset and destination format.
void(*)() cast_to_fptr(void *p)
Definition: qgis.h:272
QgsRasterDataProvider * dataProvider()
Returns the data provider.
void show()
bool isEmpty() const
void setReadOnly(bool ro)
bool connect(const QObject *sender, const char *signal, const QObject *receiver, const char *method, Qt::ConnectionType type)
void setText(const QString &text)
QString arg(qlonglong a, int fieldWidth, int base, const QChar &fillChar) const
QString toString() const
virtual bool event(QEvent *event)
bool hasNext() const
const T value(const Key &key) const
int remove(const Key &key)