Skip to content

Commit

Permalink
Fix range widget wrapper not correctly respecting default allow
Browse files Browse the repository at this point in the history
null setting
  • Loading branch information
nyalldawson committed Nov 7, 2016
1 parent 94413c3 commit 11405af
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/gui/editorwidgets/qgsrangewidgetwrapper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -175,15 +175,15 @@ QVariant QgsRangeWidgetWrapper::value() const
if ( mDoubleSpinBox )
{
value = mDoubleSpinBox->value();
if ( value == mDoubleSpinBox->minimum() && config( QStringLiteral( "AllowNull" ) ).toBool() )
if ( value == mDoubleSpinBox->minimum() && config( QStringLiteral( "AllowNull" ), true ).toBool() )
{
value = QVariant( field().type() );
}
}
else if ( mIntSpinBox )
{
value = mIntSpinBox->value();
if ( value == mIntSpinBox->minimum() && config( QStringLiteral( "AllowNull" ) ).toBool() )
if ( value == mIntSpinBox->minimum() && config( QStringLiteral( "AllowNull" ), true ).toBool() )
{
value = QVariant( field().type() );
}
Expand Down Expand Up @@ -212,7 +212,7 @@ void QgsRangeWidgetWrapper::setValue( const QVariant& value )
{
if ( mDoubleSpinBox )
{
if ( value.isNull() && config( QStringLiteral( "AllowNull" ) ).toBool() )
if ( value.isNull() && config( QStringLiteral( "AllowNull" ), true ).toBool() )
{
mDoubleSpinBox->setValue( mDoubleSpinBox->minimum() );
}
Expand All @@ -224,7 +224,7 @@ void QgsRangeWidgetWrapper::setValue( const QVariant& value )

if ( mIntSpinBox )
{
if ( value.isNull() && config( QStringLiteral( "AllowNull" ) ).toBool() )
if ( value.isNull() && config( QStringLiteral( "AllowNull" ), true ).toBool() )
{
mIntSpinBox->setValue( mIntSpinBox->minimum() );
}
Expand Down

0 comments on commit 11405af

Please sign in to comment.