mirror of
https://github.com/obsproject/obs-studio.git
synced 2026-09-21 12:49:40 +08:00
UI: Fix rounding truncation
Set decimal places before value on QDoubleSpinBox to preserve precision.
This commit is contained in:
@@ -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);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user