Procházet zdrojové kódy

ENH: ctkRangeWidget - Added convenient signal valuesChanged(double, double)

Jean-Christophe Fillion-Robin před 15 roky
rodič
revize
7f8cce62b9
2 změnil soubory, kde provedl 10 přidání a 0 odebrání
  1. 9 0
      Libs/Widgets/ctkRangeWidget.cpp
  2. 1 0
      Libs/Widgets/ctkRangeWidget.h

+ 9 - 0
Libs/Widgets/ctkRangeWidget.cpp

@@ -350,13 +350,20 @@ void ctkRangeWidget::stopChanging()
     return;
     }
   d->Changing = false;
+  bool changed = false;
   if (qAbs(this->minimumValue() - d->MinimumValueBeforeChange) > (this->singleStep() * 0.000000001))
     {
     emit this->minimumValueChanged(this->minimumValue());
+    changed = true;
     }
   if (qAbs(this->maximumValue() - d->MaximumValueBeforeChange) > (this->singleStep() * 0.000000001))
     {
     emit this->maximumValueChanged(this->maximumValue());
+    changed = true;
+    }
+  if (changed)
+    {
+    emit this->valuesChanged(this->minimumValue(), this->maximumValue());
     }
 }
 
@@ -371,6 +378,7 @@ void ctkRangeWidget::changeMinimumValue(double newValue)
   if (!d->Changing)
     {
     emit this->minimumValueChanged(newValue);
+    emit this->valuesChanged(newValue, this->maximumValue());
     }
 }
 
@@ -385,6 +393,7 @@ void ctkRangeWidget::changeMaximumValue(double newValue)
   if (!d->Changing)
     {
     emit this->maximumValueChanged(newValue);
+    emit this->valuesChanged(this->minimumValue(), newValue);
     }
 }
 

+ 1 - 0
Libs/Widgets/ctkRangeWidget.h

@@ -180,6 +180,7 @@ signals:
   void minimumValueIsChanging(double value);
   void maximumValueChanged(double value);
   void maximumValueIsChanging(double value);
+  void valuesChanged(double minValue, double maxValue);
 
 protected slots:
   void startChanging();