mirror of
https://github.com/obsproject/obs-studio.git
synced 2024-07-19 17:49:14 +00:00
UI: Fix rounding truncation
Set decimal places before value on QDoubleSpinBox to preserve precision.
This commit is contained in:
parent
091bdb9832
commit
bd98e41ca1
|
@ -393,13 +393,6 @@ void OBSPropertiesView::AddFloat(obs_property_t *prop, QFormLayout *layout,
|
|||
double stepVal = obs_property_float_step(prop);
|
||||
const char *suffix = obs_property_float_suffix(prop);
|
||||
|
||||
spin->setMinimum(minVal);
|
||||
spin->setMaximum(maxVal);
|
||||
spin->setSingleStep(stepVal);
|
||||
spin->setValue(val);
|
||||
spin->setToolTip(QT_UTF8(obs_property_long_description(prop)));
|
||||
spin->setSuffix(QT_UTF8(suffix));
|
||||
|
||||
if (stepVal < 1.0) {
|
||||
int decimals = (int)(log10(1.0 / stepVal) + 0.99);
|
||||
constexpr int sane_limit = 8;
|
||||
|
@ -408,6 +401,13 @@ void OBSPropertiesView::AddFloat(obs_property_t *prop, QFormLayout *layout,
|
|||
spin->setDecimals(decimals);
|
||||
}
|
||||
|
||||
spin->setMinimum(minVal);
|
||||
spin->setMaximum(maxVal);
|
||||
spin->setSingleStep(stepVal);
|
||||
spin->setValue(val);
|
||||
spin->setToolTip(QT_UTF8(obs_property_long_description(prop)));
|
||||
spin->setSuffix(QT_UTF8(suffix));
|
||||
|
||||
WidgetInfo *info = new WidgetInfo(this, prop, spin);
|
||||
children.emplace_back(info);
|
||||
|
||||
|
|
Loading…
Reference in a new issue