mirror of
https://github.com/qgis/QGIS.git
synced 2025-04-14 00:07:35 -04:00
add method to set raster options in QgsRasterFormatOptionsWidget
This commit is contained in:
parent
0513bb357c
commit
60cb517845
@ -21,19 +21,69 @@ class QgsRasterFormatSaveOptionsWidget : QWidget
|
||||
const QString& provider = "gdal" );
|
||||
~QgsRasterFormatSaveOptionsWidget();
|
||||
|
||||
/**
|
||||
* Set output raster format, it is used to determine list
|
||||
* of available options
|
||||
*/
|
||||
void setFormat( const QString& format );
|
||||
|
||||
/**
|
||||
* Set provider key, , it is used to determine list
|
||||
* of available options
|
||||
*/
|
||||
void setProvider( const QString& provider );
|
||||
|
||||
/**
|
||||
* Set output raster layer
|
||||
*/
|
||||
void setRasterLayer( QgsRasterLayer* rasterLayer );
|
||||
|
||||
/**
|
||||
* Set output raster file name
|
||||
*/
|
||||
void setRasterFileName( const QString& file );
|
||||
|
||||
/**
|
||||
* Returns list of selected options
|
||||
* @see setOptions()
|
||||
*/
|
||||
QStringList options() const;
|
||||
|
||||
/**
|
||||
* Populate widget with user-defined options
|
||||
* @see options()
|
||||
* @note added in QGIS 3.0
|
||||
*/
|
||||
void setOptions( const QString& options);
|
||||
|
||||
/**
|
||||
* Set widget look and feel
|
||||
*/
|
||||
void setType( QgsRasterFormatSaveOptionsWidget::Type type = Default );
|
||||
|
||||
/**
|
||||
* Set pyramids format to use
|
||||
*/
|
||||
void setPyramidsFormat( QgsRaster::RasterPyramidsFormat format );
|
||||
|
||||
public slots:
|
||||
|
||||
void apply();
|
||||
|
||||
/**
|
||||
* Opens window with options desctiption for given provider
|
||||
* and output format
|
||||
*/
|
||||
void helpOptions();
|
||||
|
||||
/**
|
||||
* Validates options correctness
|
||||
*/
|
||||
QString validateOptions( bool gui = true, bool reportOk = true );
|
||||
|
||||
/**
|
||||
* Reloads profiles list from QGIS settings
|
||||
*/
|
||||
void updateProfiles();
|
||||
|
||||
private slots:
|
||||
|
@ -631,3 +631,28 @@ void QgsRasterFormatSaveOptionsWidget::showEvent( QShowEvent * event )
|
||||
QgsDebugMsg( "done" );
|
||||
}
|
||||
|
||||
void QgsRasterFormatSaveOptionsWidget::setOptions( const QString& options)
|
||||
{
|
||||
mOptionsTable->blockSignals( true );
|
||||
mOptionsTable->clearContents();
|
||||
|
||||
QStringList values;
|
||||
QStringList optionsList = options.trimmed().split( ' ', QString::SkipEmptyParts );
|
||||
Q_FOREACH ( const QString &opt, optionsList )
|
||||
{
|
||||
int rowCount = mOptionsTable->rowCount();
|
||||
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 );
|
||||
}
|
||||
|
||||
mOptionsMap[ currentProfileKey()] = options.trimmed();
|
||||
mOptionsLineEdit->setText( options.trimmed() );
|
||||
mOptionsLineEdit->setCursorPosition( 0 );
|
||||
|
||||
mOptionsTable->blockSignals( false );
|
||||
}
|
||||
|
@ -47,20 +47,70 @@ class GUI_EXPORT QgsRasterFormatSaveOptionsWidget: public QWidget,
|
||||
QgsRasterFormatSaveOptionsWidget::Type type = Default,
|
||||
const QString& provider = "gdal" );
|
||||
|
||||
/**
|
||||
* Set output raster format, it is used to determine list
|
||||
* of available options
|
||||
*/
|
||||
void setFormat( const QString& format );
|
||||
|
||||
/**
|
||||
* Set provider key, , it is used to determine list
|
||||
* of available options
|
||||
*/
|
||||
void setProvider( const QString& provider );
|
||||
|
||||
/**
|
||||
* Set output raster layer
|
||||
*/
|
||||
void setRasterLayer( QgsRasterLayer* rasterLayer ) { mRasterLayer = rasterLayer; mRasterFileName = QString(); }
|
||||
|
||||
/**
|
||||
* Set output raster file name
|
||||
*/
|
||||
void setRasterFileName( const QString& file ) { mRasterLayer = nullptr; mRasterFileName = file; }
|
||||
|
||||
/**
|
||||
* Returns list of selected options
|
||||
* @see setOptions()
|
||||
*/
|
||||
QStringList options() const;
|
||||
|
||||
/**
|
||||
* Populate widget with user-defined options
|
||||
* @see options()
|
||||
* @note added in QGIS 3.0
|
||||
*/
|
||||
void setOptions( const QString& options);
|
||||
|
||||
/**
|
||||
* Set widget look and feel
|
||||
*/
|
||||
void setType( QgsRasterFormatSaveOptionsWidget::Type type = Default );
|
||||
|
||||
/**
|
||||
* Set pyramids format to use
|
||||
*/
|
||||
void setPyramidsFormat( QgsRaster::RasterPyramidsFormat format )
|
||||
{ mPyramids = true; mPyramidsFormat = format; }
|
||||
|
||||
public slots:
|
||||
|
||||
void apply();
|
||||
|
||||
/**
|
||||
* Opens window with options desctiption for given provider
|
||||
* and output format
|
||||
*/
|
||||
void helpOptions();
|
||||
|
||||
/**
|
||||
* Validates options correctness
|
||||
*/
|
||||
QString validateOptions( bool gui = true, bool reportOk = true );
|
||||
|
||||
/**
|
||||
* Reloads profiles list from QGIS settings
|
||||
*/
|
||||
void updateProfiles();
|
||||
|
||||
private slots:
|
||||
|
Loading…
x
Reference in New Issue
Block a user