Skip to content
Permalink
Browse files

Merge pull request #8990 from elpaso/bugfix-21086-wfs-field-calculator

Field calculator: provide a list of default field types

Cherry-picked from master d61caab
  • Loading branch information
elpaso authored and nyalldawson committed Feb 6, 2019
1 parent 8f05c7e commit 18c0c4d2284b507cea2878ce418ec3d93ffc2c32
Showing with 20 additions and 1 deletion.
  1. +20 −1 src/app/qgsfieldcalculator.cpp
@@ -348,7 +348,25 @@ void QgsFieldCalculator::populateOutputFieldTypes()
}

mOutputFieldTypeComboBox->blockSignals( true );
const QList< QgsVectorDataProvider::NativeType > &typelist = provider->nativeTypes();

// Standard subset of fields in case of virtual
const QList< QgsVectorDataProvider::NativeType > &typelist { mCreateVirtualFieldCheckbox->isChecked() ? ( QList< QgsVectorDataProvider::NativeType >()
<< QgsVectorDataProvider::NativeType( tr( "Whole number (integer)" ), QStringLiteral( "integer" ), QVariant::Int, 0, 10 )
<< QgsVectorDataProvider::NativeType( tr( "Decimal number (double)" ), QStringLiteral( "double precision" ), QVariant::Double, -1, -1, -1, -1 )
<< QgsVectorDataProvider::NativeType( tr( "Text (string)" ), QStringLiteral( "string" ), QVariant::String )
// date time
<< QgsVectorDataProvider::NativeType( tr( "Date" ), QStringLiteral( "date" ), QVariant::Date, -1, -1, -1, -1 )
<< QgsVectorDataProvider::NativeType( tr( "Time" ), QStringLiteral( "time" ), QVariant::Time, -1, -1, -1, -1 )
<< QgsVectorDataProvider::NativeType( tr( "Date & Time" ), QStringLiteral( "datetime" ), QVariant::DateTime, -1, -1, -1, -1 )
// string types
<< QgsVectorDataProvider::NativeType( tr( "Text, unlimited length (text)" ), QStringLiteral( "text" ), QVariant::String, -1, -1, -1, -1 )
// boolean
<< QgsVectorDataProvider::NativeType( tr( "Boolean" ), QStringLiteral( "bool" ), QVariant::Bool )
// blob
<< QgsVectorDataProvider::NativeType( tr( "Binary object (BLOB)" ), QStringLiteral( "binary" ), QVariant::ByteArray ) ) :
provider->nativeTypes() };

mOutputFieldTypeComboBox->clear();
for ( int i = 0; i < typelist.size(); i++ )
{
mOutputFieldTypeComboBox->addItem( typelist[i].mTypeDesc );
@@ -417,6 +435,7 @@ void QgsFieldCalculator::mCreateVirtualFieldCheckbox_stateChanged( int state )
{
mEditModeAutoTurnOnLabel->setVisible( true );
}
populateOutputFieldTypes();
mInfoIcon->setVisible( mOnlyVirtualFieldsInfoLabel->isVisible() || mEditModeAutoTurnOnLabel->isVisible() );
}

0 comments on commit 18c0c4d

Please sign in to comment.
You can’t perform that action at this time.