diff --git a/Fwk/AppFwk/cafUserInterface/cafPdmUiDoubleSliderEditor.cpp b/Fwk/AppFwk/cafUserInterface/cafPdmUiDoubleSliderEditor.cpp index fc73ec86dd..832c6857d6 100644 --- a/Fwk/AppFwk/cafUserInterface/cafPdmUiDoubleSliderEditor.cpp +++ b/Fwk/AppFwk/cafUserInterface/cafPdmUiDoubleSliderEditor.cpp @@ -115,6 +115,8 @@ void PdmUiDoubleSliderEditor::configureAndUpdateUi(const QString& uiConfigName) { uiObject->editorAttribute(field()->fieldHandle(), uiConfigName, &m_attributes); } + + m_slider->setMaximum(m_attributes.m_sliderResolution); PdmDoubleValidator* pdmValidator = new PdmDoubleValidator(m_attributes.m_minimum, m_attributes.m_maximum, m_attributes.m_decimals, this); m_lineEdit->setValidator(pdmValidator); @@ -142,6 +144,8 @@ 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); @@ -218,7 +222,7 @@ int PdmUiDoubleSliderEditor::convertToSliderValue(double value) { double exactSliderValue = m_slider->maximum() * (value - m_attributes.m_minimum) / (m_attributes.m_maximum - m_attributes.m_minimum); - int sliderValue = static_cast(exactSliderValue); + int sliderValue = static_cast(nearbyint( exactSliderValue)); sliderValue = qBound(m_slider->minimum(), sliderValue, m_slider->maximum()); return sliderValue; diff --git a/Fwk/AppFwk/cafUserInterface/cafPdmUiDoubleSliderEditor.h b/Fwk/AppFwk/cafUserInterface/cafPdmUiDoubleSliderEditor.h index f92cb32c67..eeb71db6e5 100644 --- a/Fwk/AppFwk/cafUserInterface/cafPdmUiDoubleSliderEditor.h +++ b/Fwk/AppFwk/cafUserInterface/cafPdmUiDoubleSliderEditor.h @@ -62,12 +62,14 @@ public: m_minimum = 0; m_maximum = 10; m_decimals = 6; + m_sliderResolution = 2000; } public: double m_minimum; double m_maximum; int m_decimals; + int m_sliderResolution; };