@@ -576,7 +576,7 @@ void QgsGraduatedSymbolRendererWidget::connectUpdateHandlers()
576
576
connect ( cbxClassifySymmetric, &QAbstractButton::toggled, this , &QgsGraduatedSymbolRendererWidget::classifyGraduated );
577
577
connect ( cbxAstride, &QAbstractButton::toggled, this , &QgsGraduatedSymbolRendererWidget::classifyGraduated );
578
578
connect ( cboSymmetryPointForPretty, static_cast <void ( QComboBox::* )( int )>( &QComboBox::activated ), this , &QgsGraduatedSymbolRendererWidget::classifyGraduated );
579
- connect ( spinSymmetryPointForOtherMethods, static_cast <void ( QgsDoubleSpinBox::* )()>( &QgsDoubleSpinBox::editingFinished ), this , &QgsGraduatedSymbolRendererWidget::classifyGraduated );
579
+ connect ( spinSymmetryPointForOtherMethods, static_cast <void ( QgsDoubleSpinBox::* )( double )>( &QgsDoubleSpinBox::valueChanged ), this , &QgsGraduatedSymbolRendererWidget::classifyGraduated );
580
580
}
581
581
582
582
// Connect/disconnect event handlers which trigger updating renderer
@@ -597,7 +597,7 @@ void QgsGraduatedSymbolRendererWidget::disconnectUpdateHandlers()
597
597
disconnect ( cbxClassifySymmetric, &QAbstractButton::toggled, this , &QgsGraduatedSymbolRendererWidget::classifyGraduated );
598
598
disconnect ( cbxAstride, &QAbstractButton::toggled, this , &QgsGraduatedSymbolRendererWidget::classifyGraduated );
599
599
disconnect ( cboSymmetryPointForPretty, static_cast <void ( QComboBox::* )( int )>( &QComboBox::activated ), this , &QgsGraduatedSymbolRendererWidget::classifyGraduated );
600
- disconnect ( spinSymmetryPointForOtherMethods, static_cast <void ( QgsDoubleSpinBox::* )()>( &QgsDoubleSpinBox::editingFinished ), this , &QgsGraduatedSymbolRendererWidget::classifyGraduated );
600
+ disconnect ( spinSymmetryPointForOtherMethods, static_cast <void ( QgsDoubleSpinBox::* )( double )>( &QgsDoubleSpinBox::valueChanged ), this , &QgsGraduatedSymbolRendererWidget::classifyGraduated );
601
601
}
602
602
603
603
void QgsGraduatedSymbolRendererWidget::updateUiFromRenderer ( bool updateCount )
@@ -871,14 +871,16 @@ void QgsGraduatedSymbolRendererWidget::classifyGraduated()
871
871
spinSymmetryPointForOtherMethods->setMinimum ( minimum );
872
872
spinSymmetryPointForOtherMethods->setMaximum ( maximum );
873
873
spinSymmetryPointForOtherMethods->setDecimals ( spinPrecision->value () );
874
+
874
875
double symmetryPoint = spinSymmetryPointForOtherMethods->value ();
875
876
876
877
if ( cboGraduatedMode->currentIndex () == 0 ) // EqualInterval
877
878
{
878
879
mode = QgsGraduatedSymbolRenderer::EqualInterval;
879
- // because spinSymmetryPointForOtherMethods->value() is put at minimum when out of min-max
880
- if ( spinSymmetryPointForOtherMethods->value () <= minimum + ( maximum - minimum ) / 100 . ) // to avoid direct comparison of doubles
881
- symmetryPoint = minimum + ( maximum - minimum ) / 2 ;
880
+ // knowing that spinSymmetryPointForOtherMethods->value() is automatically put at minimum when out of min-max
881
+ // using "(maximum-minimum)/100)" to avoid direct comparison of doubles
882
+ if ( spinSymmetryPointForOtherMethods->value () < ( minimum + ( maximum - minimum ) / 100 . ) || spinSymmetryPointForOtherMethods->value () > ( maximum - ( maximum - minimum ) / 100 . ) )
883
+ spinSymmetryPointForOtherMethods->setValue ( minimum + ( maximum - minimum ) / 2 . );
882
884
883
885
if ( cbxClassifySymmetric->isChecked () )
884
886
{
@@ -894,8 +896,10 @@ void QgsGraduatedSymbolRendererWidget::classifyGraduated()
894
896
else if ( cboGraduatedMode->currentIndex () == 3 ) // StdDev
895
897
{
896
898
mode = QgsGraduatedSymbolRenderer::StdDev;
897
- if ( spinSymmetryPointForOtherMethods->value () <= minimum + ( maximum - minimum ) / 100 . ) // to avoid direct comparison of doubles
898
- symmetryPoint = minimum + ( maximum - minimum ) / 2 ;
899
+ // knowing that spinSymmetryPointForOtherMethods->value() is automatically put at minimum when out of min-max
900
+ // using "(maximum-minimum)/100)" to avoid direct comparison of doubles
901
+ if ( spinSymmetryPointForOtherMethods->value () < ( minimum + ( maximum - minimum ) / 100 . ) || spinSymmetryPointForOtherMethods->value () > ( maximum - ( maximum - minimum ) / 100 . ) )
902
+ spinSymmetryPointForOtherMethods->setValue ( minimum + ( maximum - minimum ) / 2 . );
899
903
900
904
if ( cbxClassifySymmetric->isChecked () )
901
905
{
0 commit comments