Fixed problem with inputting numbers in sliders (#6859)
* Fixed problem with inputting numbers in sliders Signed-off-by: John Jones-Steele <82226755+jjjoness@users.noreply.github.com> * Changes from PR Signed-off-by: John Jones-Steele <82226755+jjjoness@users.noreply.github.com> * Missed removing pragma optimize Signed-off-by: John Jones-Steele <82226755+jjjoness@users.noreply.github.com>
This commit is contained in:
committed by
GitHub
parent
76ff7aec29
commit
0b9dc78d67
@@ -870,8 +870,7 @@ void SliderDouble::setCurveMidpoint(double midpoint)
|
||||
|
||||
QString SliderDouble::hoverValueText(int sliderValue) const
|
||||
{
|
||||
// maybe format this, max number of digits?
|
||||
QString valueText = locale().toString(calculateRealSliderValue(sliderValue), 'f', m_decimals);
|
||||
QString valueText = toString(calculateRealSliderValue(sliderValue), m_decimals, locale(), false, true);
|
||||
return QStringLiteral("%1").arg(valueText);
|
||||
}
|
||||
|
||||
|
||||
@@ -14,6 +14,7 @@
|
||||
|
||||
#include <QHBoxLayout>
|
||||
#include <QSignalBlocker>
|
||||
#include <QTimer>
|
||||
|
||||
namespace AzQtComponents
|
||||
{
|
||||
@@ -254,11 +255,12 @@ SliderDoubleCombo::~SliderDoubleCombo()
|
||||
{
|
||||
}
|
||||
|
||||
bool m_fromSlider{ false };
|
||||
|
||||
void SliderDoubleCombo::setValueSlider(double value)
|
||||
{
|
||||
const bool doEmit = m_value != value;
|
||||
m_value = value;
|
||||
|
||||
updateSpinBox();
|
||||
updateSlider();
|
||||
|
||||
@@ -267,6 +269,8 @@ void SliderDoubleCombo::setValueSlider(double value)
|
||||
// We don't want to update the slider from setValue as this
|
||||
// causes rounding errors in the tooltip hint.
|
||||
m_fromSlider = true;
|
||||
QTimer::singleShot( 10, []() { m_fromSlider = false; });
|
||||
|
||||
Q_EMIT valueChanged();
|
||||
}
|
||||
}
|
||||
@@ -286,10 +290,6 @@ void SliderDoubleCombo::setValue(double value)
|
||||
Q_EMIT valueChanged();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
m_fromSlider = false;
|
||||
}
|
||||
}
|
||||
|
||||
SliderDouble* SliderDoubleCombo::slider() const
|
||||
|
||||
@@ -237,6 +237,5 @@ namespace AzQtComponents
|
||||
double m_softMinimum = 0.0;
|
||||
double m_softMaximum = 100.0;
|
||||
double m_value = 0.0;
|
||||
bool m_fromSlider{ false };
|
||||
};
|
||||
} // namespace AzQtComponents
|
||||
|
||||
Reference in New Issue
Block a user