Skip to content

Commit

Permalink
fix displaying of the enum parameter options when static strings mode is
Browse files Browse the repository at this point in the history
active and multiple selection is enabled. Also improve conversion to
Python string
  • Loading branch information
alexbruy authored and nyalldawson committed Apr 24, 2023
1 parent 1abf9dc commit 245703f
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/core/processing/qgsprocessingparameters.cpp
Expand Up @@ -4918,7 +4918,7 @@ QString QgsProcessingParameterEnum::valueAsPythonString( const QVariant &value,

if ( mUsesStaticStrings )
{
if ( value.type() == QVariant::StringList )
if ( value.type() == QVariant::List || value.type() == QVariant::StringList )
{
QStringList parts;
const QStringList constList = value.toStringList();
Expand Down
15 changes: 13 additions & 2 deletions src/gui/processing/qgsprocessingwidgetwrapperimpl.cpp
Expand Up @@ -2445,8 +2445,19 @@ void QgsProcessingEnumPanelWidget::showDialog()
if ( mParam )
{
availableOptions.reserve( mParam->options().size() );
for ( int i = 0; i < mParam->options().count(); ++i )
availableOptions << i;

if ( mParam->usesStaticStrings() )
{
for ( QString o : mParam->options() )
{
availableOptions << o;
}
}
else
{
for ( int i = 0; i < mParam->options().count(); ++i )
availableOptions << i;
}
}

const QStringList options = mParam ? mParam->options() : QStringList();
Expand Down

0 comments on commit 245703f

Please sign in to comment.