Skip to content

Commit 314b69c

Browse files
committed
Qt: save spinbox values with fmt::format
This prevents saving localized strings with different decimal characters
1 parent bc55f77 commit 314b69c

File tree

5 files changed

+10
-12
lines changed

5 files changed

+10
-12
lines changed

rpcs3/rpcs3qt/emu_settings.cpp

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -668,10 +668,9 @@ void emu_settings::EnhanceSpinBox(QSpinBox* spinbox, emu_settings_type type, con
668668
spinbox->setRange(min, max);
669669
spinbox->setValue(val);
670670

671-
connect(spinbox, &QSpinBox::textChanged, this, [type, spinbox, this](const QString& /* text*/)
671+
connect(spinbox, &QSpinBox::valueChanged, this, [type, this](int value)
672672
{
673-
if (!spinbox) return;
674-
SetSetting(type, spinbox->cleanText().toStdString());
673+
SetSetting(type, fmt::format("%d", value));
675674
});
676675

677676
connect(this, &emu_settings::RestoreDefaultsSignal, spinbox, [def, spinbox]()
@@ -724,10 +723,9 @@ void emu_settings::EnhanceDoubleSpinBox(QDoubleSpinBox* spinbox, emu_settings_ty
724723
spinbox->setRange(min, max);
725724
spinbox->setValue(val);
726725

727-
connect(spinbox, &QDoubleSpinBox::textChanged, this, [type, spinbox, this](const QString& /* text*/)
726+
connect(spinbox, &QDoubleSpinBox::valueChanged, this, [type, this](double value)
728727
{
729-
if (!spinbox) return;
730-
SetSetting(type, spinbox->cleanText().toStdString());
728+
SetSetting(type, fmt::format("%f", value));
731729
});
732730

733731
connect(this, &emu_settings::RestoreDefaultsSignal, spinbox, [def, spinbox]()

rpcs3/rpcs3qt/memory_viewer_panel.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -432,9 +432,9 @@ memory_viewer_panel::memory_viewer_panel(QWidget* parent, std::shared_ptr<CPUDis
432432

433433
scroll(0); // Refresh
434434
});
435-
connect(sb_words, static_cast<void (QSpinBox::*)(int)>(&QSpinBox::valueChanged), this, [=, this]()
435+
connect(sb_words, &QSpinBox::valueChanged, this, [this](int value)
436436
{
437-
m_colcount = 1 << sb_words->value();
437+
m_colcount = 1 << value;
438438
ShowMemory();
439439
});
440440

rpcs3/rpcs3qt/pad_motion_settings_dialog.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ pad_motion_settings_dialog::pad_motion_settings_dialog(QDialog* parent, std::sha
105105
m_config_entries[i]->mirrored.set(state != Qt::Unchecked);
106106
});
107107

108-
connect(m_shifts[i], QOverload<int>::of(&QSpinBox::valueChanged), this, [this, i](int value)
108+
connect(m_shifts[i], &QSpinBox::valueChanged, this, [this, i](int value)
109109
{
110110
std::lock_guard lock(m_config_mutex);
111111
m_config_entries[i]->shift.set(value);

rpcs3/rpcs3qt/patch_manager_dialog.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -123,8 +123,8 @@ patch_manager_dialog::patch_manager_dialog(std::shared_ptr<gui_settings> gui_set
123123
handle_config_value_changed(ui->configurable_combo_box->itemData(index).toDouble());
124124
}
125125
});
126-
connect(ui->configurable_spin_box, QOverload<int>::of(&QSpinBox::valueChanged), this, &patch_manager_dialog::handle_config_value_changed);
127-
connect(ui->configurable_double_spin_box, QOverload<double>::of(&QDoubleSpinBox::valueChanged), this, &patch_manager_dialog::handle_config_value_changed);
126+
connect(ui->configurable_spin_box, &QSpinBox::valueChanged, this, &patch_manager_dialog::handle_config_value_changed);
127+
connect(ui->configurable_double_spin_box, &QDoubleSpinBox::valueChanged, this, &patch_manager_dialog::handle_config_value_changed);
128128
connect(ui->buttonBox, &QDialogButtonBox::rejected, this, &QWidget::close);
129129
connect(ui->buttonBox, &QDialogButtonBox::clicked, [this](QAbstractButton* button)
130130
{

rpcs3/rpcs3qt/raw_mouse_settings_dialog.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -281,7 +281,7 @@ void raw_mouse_settings_dialog::add_tabs(QTabWidget* tabs)
281281
m_accel_spin_boxes.push_back(mouse_acceleration_spin_box);
282282
mouse_acceleration_spin_box->setRange(0.1, 10.0);
283283
mouse_acceleration_spin_box->setValue(config->mouse_acceleration.get() / 100.0);
284-
connect(mouse_acceleration_spin_box, QOverload<double>::of(&QDoubleSpinBox::valueChanged), this, [player](double value)
284+
connect(mouse_acceleration_spin_box, &QDoubleSpinBox::valueChanged, this, [player](double value)
285285
{
286286
auto& config = ::at32(g_cfg_raw_mouse.players, player)->mouse_acceleration;
287287
config.set(std::clamp(value * 100.0, config.min, config.max));

0 commit comments

Comments
 (0)