Skip to content

Commit f3f0eb0

Browse files
authored
Merge pull request #6236 from elpaso/double-linedit-default-widget
[bugfix] Lower priority of range widget for doubles
2 parents cc92107 + 2263237 commit f3f0eb0

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

src/gui/editorwidgets/qgsrangewidgetfactory.cpp

+2-1
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,8 @@ QgsEditorConfigWidget *QgsRangeWidgetFactory::configWidget( QgsVectorLayer *vl,
3737
unsigned int QgsRangeWidgetFactory::fieldScore( const QgsVectorLayer *vl, int fieldIdx ) const
3838
{
3939
const QgsField field = vl->fields().at( fieldIdx );
40-
if ( field.type() == QVariant::Int || field.type() == QVariant::Double ) return 20;
40+
if ( field.type() == QVariant::Int ) return 20;
41+
if ( field.type() == QVariant::Double ) return 5; // low priority because the fixed number of decimal places may alter the original data
4142
if ( field.isNumeric() ) return 5; // widgets used support only signed 32bits (int) and double
4243
return 0;
4344
}

tests/src/gui/testqgseditorwidgetregistry.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ class TestQgsEditorWidgetRegistry: public QObject
7777

7878
void doubleType()
7979
{
80-
checkSimple( QStringLiteral( "double" ), QStringLiteral( "Range" ) );
80+
checkSimple( QStringLiteral( "double" ), QStringLiteral( "TextEdit" ) );
8181
}
8282

8383
void arrayType()

0 commit comments

Comments
 (0)