From e8bfa2273cd9edd539555b7e09f8c14c41b89c62 Mon Sep 17 00:00:00 2001 From: spycrab Date: Sun, 21 May 2017 12:03:13 +0200 Subject: [PATCH] Qt: Fix rounding errors --- Source/Core/DolphinQt2/Config/Mapping/MappingNumeric.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Source/Core/DolphinQt2/Config/Mapping/MappingNumeric.cpp b/Source/Core/DolphinQt2/Config/Mapping/MappingNumeric.cpp index e1c1f237bf..a13d17fa5c 100644 --- a/Source/Core/DolphinQt2/Config/Mapping/MappingNumeric.cpp +++ b/Source/Core/DolphinQt2/Config/Mapping/MappingNumeric.cpp @@ -10,8 +10,8 @@ MappingNumeric::MappingNumeric(MappingWidget* widget, ControllerEmu::NumericSetting* setting) : m_parent(widget), m_setting(setting), m_range(setting->m_high - setting->m_low) { - setValue(setting->GetValue() * m_range); setRange(setting->m_low, setting->m_high); + setValue(setting->m_low + setting->GetValue() * m_range); Connect(); } @@ -19,19 +19,19 @@ void MappingNumeric::Connect() { connect(this, static_cast(&QSpinBox::valueChanged), this, [this](int value) { - m_setting->SetValue(static_cast(value) / m_range); + m_setting->SetValue(static_cast(value - m_setting->m_low) / m_range); Update(); }); } void MappingNumeric::Clear() { - setValue((m_setting->m_low + m_setting->m_high) / 2); + setValue(m_setting->m_low + (m_setting->m_low + m_setting->m_high) / 2); Update(); } void MappingNumeric::Update() { - setValue(m_setting->GetValue() * m_range); + setValue(m_setting->m_low + m_setting->GetValue() * m_range); m_parent->SaveSettings(); }