diff --git a/Fwk/AppFwk/cafUserInterface/cafPdmUiDoubleSliderEditor.cpp b/Fwk/AppFwk/cafUserInterface/cafPdmUiDoubleSliderEditor.cpp index 5363a41d3c..18ce56ffba 100644 --- a/Fwk/AppFwk/cafUserInterface/cafPdmUiDoubleSliderEditor.cpp +++ b/Fwk/AppFwk/cafUserInterface/cafPdmUiDoubleSliderEditor.cpp @@ -74,7 +74,7 @@ public: //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- - virtual void fixup(QString& stringValue) const + virtual void fixup(QString& stringValue) const override { double doubleValue = stringValue.toDouble(); doubleValue = qBound(bottom(), doubleValue, top()); @@ -116,15 +116,18 @@ void PdmUiDoubleSliderEditor::configureAndUpdateUi(const QString& uiConfigName) uiObject->editorAttribute(field()->fieldHandle(), uiConfigName, &m_attributes); } - m_slider->setMaximum(m_attributes.m_sliderResolution); + QString textValue = field()->uiValue().toString(); + + m_slider->blockSignals(true); + m_slider->setMaximum(m_attributes.m_sliderTickCount); + m_slider->blockSignals(false); PdmDoubleValidator* pdmValidator = new PdmDoubleValidator(m_attributes.m_minimum, m_attributes.m_maximum, m_attributes.m_decimals, this); - m_lineEdit->setValidator(pdmValidator); - - QString textValue = field()->uiValue().toString(); pdmValidator->fixup(textValue); - + + m_lineEdit->setValidator(pdmValidator); m_lineEdit->setText(textValue); + updateSliderPosition(); } @@ -144,7 +147,6 @@ QWidget* PdmUiDoubleSliderEditor::createEditorWidget(QWidget * parent) connect(m_lineEdit, SIGNAL(editingFinished()), this, SLOT(slotEditingFinished())); m_slider = new QSlider(Qt::Horizontal, containerWidget); - layout->addWidget(m_lineEdit); layout->addWidget(m_slider); diff --git a/Fwk/AppFwk/cafUserInterface/cafPdmUiDoubleSliderEditor.h b/Fwk/AppFwk/cafUserInterface/cafPdmUiDoubleSliderEditor.h index eeb71db6e5..dba27056c8 100644 --- a/Fwk/AppFwk/cafUserInterface/cafPdmUiDoubleSliderEditor.h +++ b/Fwk/AppFwk/cafUserInterface/cafPdmUiDoubleSliderEditor.h @@ -62,14 +62,14 @@ public: m_minimum = 0; m_maximum = 10; m_decimals = 6; - m_sliderResolution = 2000; + m_sliderTickCount = 2000; } public: double m_minimum; double m_maximum; int m_decimals; - int m_sliderResolution; + int m_sliderTickCount; };