Skip to content
Permalink
Browse files

Fix int range widget minimum value

The int range widget so far assigned NULL to the minimum value when allowNull was activated. This made it impossible to enter the minimum value into a range widget.

This also fixes some signals which in case of a NULL value would emit a slightly-below-minimum value for double and int spinboxes.

Fix #18297
  • Loading branch information
m-kuhn committed Mar 1, 2018
1 parent 752dc7d commit 0b49a83a89615ac01d624ad2108ad538b83296d8
Showing with 6 additions and 3 deletions.
  1. +6 −3 src/gui/editorwidgets/qgsrangewidgetwrapper.cpp
@@ -128,24 +128,27 @@ void QgsRangeWidgetWrapper::initWidget( QWidget *editor )
mDoubleSpinBox->setSuffix( config( QStringLiteral( "Suffix" ) ).toString() );

connect( mDoubleSpinBox, static_cast < void ( QDoubleSpinBox::* )( double ) > ( &QDoubleSpinBox::valueChanged ),
this, [ = ]( double value ) { emit valueChanged( value ); } );
this, [ = ]( double ) { emitValueChanged(); } );
}
else if ( mIntSpinBox )
{
QgsSpinBox *qgsWidget = qobject_cast<QgsSpinBox *>( mIntSpinBox );
if ( qgsWidget )
qgsWidget->setShowClearButton( allowNull );
int minval = min.toInt();
if ( allowNull )
{
int minval = min.toInt();
int stepval = step.toInt();
minval -= stepval;
mIntSpinBox->setValue( minval );
mIntSpinBox->setSpecialValueText( QgsApplication::nullRepresentation() );
}
setupIntEditor( min, max, step, mIntSpinBox, this );
setupIntEditor( minval, max, step, mIntSpinBox, this );
if ( config( QStringLiteral( "Suffix" ) ).isValid() )
mIntSpinBox->setSuffix( config( QStringLiteral( "Suffix" ) ).toString() );

connect( mIntSpinBox, static_cast < void ( QSpinBox::* )( int ) > ( &QSpinBox::valueChanged ),
this, [ = ]( int ) { emitValueChanged(); } );
}
else
{

0 comments on commit 0b49a83

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