mirror of
https://github.com/RetroDECK/Duckstation.git
synced 2024-11-23 06:15:38 +00:00
Qt: Display deadzone/sensitivity/etc as whole number instead of decimal
This commit is contained in:
parent
b154579c0d
commit
6def728888
|
@ -574,10 +574,29 @@ void ControllerCustomSettingsWidget::createSettingWidgets(ControllerBindingWidge
|
||||||
{
|
{
|
||||||
QDoubleSpinBox* sb = new QDoubleSpinBox(this);
|
QDoubleSpinBox* sb = new QDoubleSpinBox(this);
|
||||||
sb->setObjectName(QString::fromUtf8(si.name));
|
sb->setObjectName(QString::fromUtf8(si.name));
|
||||||
sb->setMinimum(si.FloatMinValue());
|
if (si.multiplier != 0.0f && si.multiplier != 1.0f)
|
||||||
sb->setMaximum(si.FloatMaxValue());
|
{
|
||||||
sb->setSingleStep(si.FloatStepValue());
|
const float multiplier = si.multiplier;
|
||||||
SettingWidgetBinder::BindWidgetToFloatSetting(sif, sb, section, std::move(key_name), si.FloatDefaultValue());
|
sb->setMinimum(si.FloatMinValue() * multiplier);
|
||||||
|
sb->setMaximum(si.FloatMaxValue() * multiplier);
|
||||||
|
sb->setSingleStep(si.FloatStepValue() * multiplier);
|
||||||
|
if (std::abs(si.multiplier - 100.0f) < 0.01f)
|
||||||
|
{
|
||||||
|
sb->setDecimals(0);
|
||||||
|
sb->setSuffix(QStringLiteral("%"));
|
||||||
|
}
|
||||||
|
|
||||||
|
SettingWidgetBinder::BindWidgetToNormalizedSetting(sif, sb, section, std::move(key_name), si.multiplier,
|
||||||
|
si.FloatDefaultValue() * multiplier);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
sb->setMinimum(si.FloatMinValue());
|
||||||
|
sb->setMaximum(si.FloatMaxValue());
|
||||||
|
sb->setSingleStep(si.FloatStepValue());
|
||||||
|
|
||||||
|
SettingWidgetBinder::BindWidgetToFloatSetting(sif, sb, section, std::move(key_name), si.FloatDefaultValue());
|
||||||
|
}
|
||||||
layout->addWidget(new QLabel(qApp->translate(cinfo->name, si.display_name), this), current_row, 0);
|
layout->addWidget(new QLabel(qApp->translate(cinfo->name, si.display_name), this), current_row, 0);
|
||||||
layout->addWidget(sb, current_row, 1, 1, 3);
|
layout->addWidget(sb, current_row, 1, 1, 3);
|
||||||
current_row++;
|
current_row++;
|
||||||
|
@ -667,7 +686,12 @@ void ControllerCustomSettingsWidget::restoreDefaults()
|
||||||
{
|
{
|
||||||
QDoubleSpinBox* widget = findChild<QDoubleSpinBox*>(QString::fromStdString(si.name));
|
QDoubleSpinBox* widget = findChild<QDoubleSpinBox*>(QString::fromStdString(si.name));
|
||||||
if (widget)
|
if (widget)
|
||||||
widget->setValue(si.FloatDefaultValue());
|
{
|
||||||
|
if (si.multiplier != 0.0f && si.multiplier != 1.0f)
|
||||||
|
widget->setValue(si.FloatDefaultValue() * si.multiplier);
|
||||||
|
else
|
||||||
|
widget->setValue(si.FloatDefaultValue());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue