diff --git a/python/gui/qgsrasterformatsaveoptionswidget.sip b/python/gui/qgsrasterformatsaveoptionswidget.sip index 25cad0007bb..dcd372a64db 100644 --- a/python/gui/qgsrasterformatsaveoptionswidget.sip +++ b/python/gui/qgsrasterformatsaveoptionswidget.sip @@ -50,7 +50,8 @@ class QgsRasterFormatSaveOptionsWidget : QWidget QStringList options() const; /** - * Populate widget with user-defined options + * Populate widget with user-defined options. String should contain + * key=value pairs separated by spaces, e.g. "TILED=YES TFW=YES" * @see options() * @note added in QGIS 3.0 */ diff --git a/src/gui/qgsrasterformatsaveoptionswidget.cpp b/src/gui/qgsrasterformatsaveoptionswidget.cpp index 0264e76b63f..4a479a01a81 100644 --- a/src/gui/qgsrasterformatsaveoptionswidget.cpp +++ b/src/gui/qgsrasterformatsaveoptionswidget.cpp @@ -644,10 +644,13 @@ void QgsRasterFormatSaveOptionsWidget::setOptions( const QString& options ) mOptionsTable->insertRow( rowCount ); values = opt.split( '=' ); - QTableWidgetItem* nameItem = new QTableWidgetItem( values.at( 0 ) ); - mOptionsTable->setItem( rowCount, 0, nameItem ); - QTableWidgetItem* valueItem = new QTableWidgetItem( values.at( 1 ) ); - mOptionsTable->setItem( rowCount, 0, valueItem ); + if ( values.count() == 2 ) + { + QTableWidgetItem* nameItem = new QTableWidgetItem( values.at( 0 ) ); + mOptionsTable->setItem( rowCount, 0, nameItem ); + QTableWidgetItem* valueItem = new QTableWidgetItem( values.at( 1 ) ); + mOptionsTable->setItem( rowCount, 0, valueItem ); + } } mOptionsMap[ currentProfileKey()] = options.trimmed(); diff --git a/src/gui/qgsrasterformatsaveoptionswidget.h b/src/gui/qgsrasterformatsaveoptionswidget.h index 3d430b2bef9..f7ed005eed5 100644 --- a/src/gui/qgsrasterformatsaveoptionswidget.h +++ b/src/gui/qgsrasterformatsaveoptionswidget.h @@ -76,7 +76,8 @@ class GUI_EXPORT QgsRasterFormatSaveOptionsWidget: public QWidget, QStringList options() const; /** - * Populate widget with user-defined options + * Populate widget with user-defined options. String should contain + * key=value pairs separated by spaces, e.g. "TILED=YES TFW=YES" * @see options() * @note added in QGIS 3.0 */