Skip to content

Commit

Permalink
Merge pull request #6236 from elpaso/double-linedit-default-widget
Browse files Browse the repository at this point in the history
[bugfix] Lower priority of range widget for doubles
  • Loading branch information
elpaso committed Feb 1, 2018
2 parents cc92107 + 2263237 commit f3f0eb0
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
3 changes: 2 additions & 1 deletion src/gui/editorwidgets/qgsrangewidgetfactory.cpp
Expand Up @@ -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;
}
Expand Down
2 changes: 1 addition & 1 deletion tests/src/gui/testqgseditorwidgetregistry.cpp
Expand Up @@ -77,7 +77,7 @@ class TestQgsEditorWidgetRegistry: public QObject

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

void arrayType()
Expand Down

0 comments on commit f3f0eb0

Please sign in to comment.