Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Use proper enum for return value
  • Loading branch information
nyalldawson committed May 15, 2023
1 parent b0d67ec commit 28747c9
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 15 deletions.
Expand Up @@ -39,7 +39,7 @@ Class to select destination file, type and CRS for ogr layers



QgsVectorLayerSaveAsDialog( QgsVectorLayer *layer, Options options = Option::AllOptions, QWidget *parent = 0, Qt::WindowFlags fl = Qt::WindowFlags() );
QgsVectorLayerSaveAsDialog( QgsVectorLayer *layer, QgsVectorLayerSaveAsDialog::Options options = QgsVectorLayerSaveAsDialog::Option::AllOptions, QWidget *parent = 0, Qt::WindowFlags fl = Qt::WindowFlags() );
%Docstring
Construct a new QgsVectorLayerSaveAsDialog
%End
Expand Down Expand Up @@ -126,12 +126,9 @@ Sets whether the "add to canvas" checkbox should be ``checked``.
.. versionadded:: 3.6
%End

int symbologyExport() const;
Qgis::FeatureSymbologyExport symbologyExport() const;
%Docstring
Returns type of symbology export.
0: No symbology
1: Feature symbology
2: Symbol level symbology
%End

double scale() const;
Expand Down
10 changes: 5 additions & 5 deletions src/gui/ogr/qgsvectorlayersaveasdialog.cpp
Expand Up @@ -176,9 +176,9 @@ void QgsVectorLayerSaveAsDialog::setup()
mFormatComboBox_currentIndexChanged( mFormatComboBox->currentIndex() );

//symbology export combo box
mSymbologyExportComboBox->addItem( tr( "No Symbology" ), QgsVectorFileWriter::NoSymbology );
mSymbologyExportComboBox->addItem( tr( "Feature Symbology" ), QgsVectorFileWriter::FeatureSymbology );
mSymbologyExportComboBox->addItem( tr( "Symbol Layer Symbology" ), QgsVectorFileWriter::SymbolLayerSymbology );
mSymbologyExportComboBox->addItem( tr( "No Symbology" ), QVariant::fromValue( Qgis::FeatureSymbologyExport::NoSymbology ) );
mSymbologyExportComboBox->addItem( tr( "Feature Symbology" ), QVariant::fromValue( Qgis::FeatureSymbologyExport::PerFeature ) );
mSymbologyExportComboBox->addItem( tr( "Symbol Layer Symbology" ), QVariant::fromValue( Qgis::FeatureSymbologyExport::PerSymbolLayer ) );
mSymbologyExportComboBox_currentIndexChanged( mSymbologyExportComboBox->currentText() );

// extent group box
Expand Down Expand Up @@ -1072,9 +1072,9 @@ void QgsVectorLayerSaveAsDialog::setAddToCanvas( bool enabled )
mAddToCanvas->setChecked( enabled );
}

int QgsVectorLayerSaveAsDialog::symbologyExport() const
Qgis::FeatureSymbologyExport QgsVectorLayerSaveAsDialog::symbologyExport() const
{
return mSymbologyExportComboBox->currentData().toInt();
return mSymbologyExportComboBox->currentData().value< Qgis::FeatureSymbologyExport >();
}

double QgsVectorLayerSaveAsDialog::scale() const
Expand Down
7 changes: 2 additions & 5 deletions src/gui/ogr/qgsvectorlayersaveasdialog.h
Expand Up @@ -69,7 +69,7 @@ class GUI_EXPORT QgsVectorLayerSaveAsDialog : public QDialog, private Ui::QgsVec
/**
* Construct a new QgsVectorLayerSaveAsDialog
*/
QgsVectorLayerSaveAsDialog( QgsVectorLayer *layer, Options options = Option::AllOptions, QWidget *parent = nullptr, Qt::WindowFlags fl = Qt::WindowFlags() );
QgsVectorLayerSaveAsDialog( QgsVectorLayer *layer, QgsVectorLayerSaveAsDialog::Options options = QgsVectorLayerSaveAsDialog::Option::AllOptions, QWidget *parent = nullptr, Qt::WindowFlags fl = Qt::WindowFlags() );

/**
* Returns the selected format in which the export should be written.
Expand Down Expand Up @@ -154,11 +154,8 @@ class GUI_EXPORT QgsVectorLayerSaveAsDialog : public QDialog, private Ui::QgsVec

/**
* Returns type of symbology export.
* 0: No symbology
* 1: Feature symbology
* 2: Symbol level symbology
*/
int symbologyExport() const;
Qgis::FeatureSymbologyExport symbologyExport() const;

/**
* Returns the specified map scale.
Expand Down

0 comments on commit 28747c9

Please sign in to comment.