|
@@ -281,7 +281,7 @@ void ctkVTKScalarsToColorsWidget::setCurrentPoint(vtkObject* caller, void* callD
|
|
|
// When a new point is added, the modified event is fired later.
|
|
|
// however we need to update the max of the current spin box before
|
|
|
// setting the new value.
|
|
|
- this->updateCurrentPoint();
|
|
|
+ this->updateNumberOfPoints();
|
|
|
}
|
|
|
this->setCurrentPoint(newPoint);
|
|
|
}
|
|
@@ -363,13 +363,21 @@ void ctkVTKScalarsToColorsWidget::onCurrentPointChanged(int currentPoint)
|
|
|
}
|
|
|
|
|
|
// ----------------------------------------------------------------------------
|
|
|
+void ctkVTKScalarsToColorsWidget::updateNumberOfPoints()
|
|
|
+{
|
|
|
+ Q_D(ctkVTKScalarsToColorsWidget);
|
|
|
+ const int numberOfPoints = d->CurrentControlPointsItem ?
|
|
|
+ d->CurrentControlPointsItem->GetNumberOfPoints() : 0;
|
|
|
+ d->PointIdSpinBox->setMaximum( numberOfPoints - 1 );
|
|
|
+}
|
|
|
+
|
|
|
+// ----------------------------------------------------------------------------
|
|
|
void ctkVTKScalarsToColorsWidget::updateCurrentPoint()
|
|
|
{
|
|
|
Q_D(ctkVTKScalarsToColorsWidget);
|
|
|
Q_ASSERT(d->CurrentControlPointsItem);
|
|
|
Q_ASSERT(d->PointIdSpinBox->value() == d->CurrentControlPointsItem->GetCurrentPoint());
|
|
|
- d->PointIdSpinBox->setMaximum((d->CurrentControlPointsItem ?
|
|
|
- d->CurrentControlPointsItem->GetNumberOfPoints() : 0) - 1);
|
|
|
+ this->updateNumberOfPoints();
|
|
|
|
|
|
int pointId = d->PointIdSpinBox->value();
|
|
|
if (pointId == -1)
|