Skip to content
Permalink
Browse files

Merge pull request #6236 from elpaso/double-linedit-default-widget

[bugfix] Lower priority of range widget for doubles
  • Loading branch information
elpaso committed Feb 1, 2018
2 parents cc92107 + 2263237 commit f3f0eb0035343940501b1166d0d75e0461c5b05d
@@ -37,7 +37,8 @@ QgsEditorConfigWidget *QgsRangeWidgetFactory::configWidget( QgsVectorLayer *vl,
unsigned int QgsRangeWidgetFactory::fieldScore( const QgsVectorLayer *vl, int fieldIdx ) const
{
const QgsField field = vl->fields().at( fieldIdx );
if ( field.type() == QVariant::Int || field.type() == QVariant::Double ) return 20;
if ( field.type() == QVariant::Int ) return 20;
if ( field.type() == QVariant::Double ) return 5; // low priority because the fixed number of decimal places may alter the original data
if ( field.isNumeric() ) return 5; // widgets used support only signed 32bits (int) and double
return 0;
}
@@ -77,7 +77,7 @@ class TestQgsEditorWidgetRegistry: public QObject

void doubleType()
{
checkSimple( QStringLiteral( "double" ), QStringLiteral( "Range" ) );
checkSimple( QStringLiteral( "double" ), QStringLiteral( "TextEdit" ) );
}

void arrayType()

0 comments on commit f3f0eb0

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