Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
skip malformed key-values pairs
add options example in docs
  • Loading branch information
alexbruy committed Jan 7, 2017
1 parent d718eb0 commit 85d4093
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 6 deletions.
3 changes: 2 additions & 1 deletion python/gui/qgsrasterformatsaveoptionswidget.sip
Expand Up @@ -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
*/
Expand Down
11 changes: 7 additions & 4 deletions src/gui/qgsrasterformatsaveoptionswidget.cpp
Expand Up @@ -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();
Expand Down
3 changes: 2 additions & 1 deletion src/gui/qgsrasterformatsaveoptionswidget.h
Expand Up @@ -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
*/
Expand Down

0 comments on commit 85d4093

Please sign in to comment.