Merge pull request #8272 from lioncash/overload

DolphinQt: Use qOverload where applicable
This commit is contained in:
Léo Lam 2020-04-28 16:59:43 +02:00 committed by GitHub
commit 82012c4cd6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
28 changed files with 96 additions and 127 deletions

View File

@ -260,20 +260,16 @@ void ControllersWindow::ConnectWidgets()
for (size_t i = 0; i < m_wiimote_groups.size(); i++) for (size_t i = 0; i < m_wiimote_groups.size(); i++)
{ {
connect(m_wiimote_boxes[i], connect(m_wiimote_boxes[i], qOverload<int>(&QComboBox::currentIndexChanged), this,
static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged), this,
&ControllersWindow::SaveSettings); &ControllersWindow::SaveSettings);
connect(m_wiimote_boxes[i], connect(m_wiimote_boxes[i], qOverload<int>(&QComboBox::currentIndexChanged), this,
static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged), this,
&ControllersWindow::OnWiimoteModeChanged); &ControllersWindow::OnWiimoteModeChanged);
connect(m_wiimote_buttons[i], &QPushButton::clicked, this, connect(m_wiimote_buttons[i], &QPushButton::clicked, this,
&ControllersWindow::OnWiimoteConfigure); &ControllersWindow::OnWiimoteConfigure);
connect(m_gc_controller_boxes[i], connect(m_gc_controller_boxes[i], qOverload<int>(&QComboBox::currentIndexChanged), this,
static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged), this,
&ControllersWindow::SaveSettings); &ControllersWindow::SaveSettings);
connect(m_gc_controller_boxes[i], connect(m_gc_controller_boxes[i], qOverload<int>(&QComboBox::currentIndexChanged), this,
static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged), this,
&ControllersWindow::OnGCTypeChanged); &ControllersWindow::OnGCTypeChanged);
connect(m_gc_buttons[i], &QPushButton::clicked, this, &ControllersWindow::OnGCPadConfigure); connect(m_gc_buttons[i], &QPushButton::clicked, this, &ControllersWindow::OnGCPadConfigure);
} }

View File

@ -135,8 +135,8 @@ void GameConfigEdit::ConnectWidgets()
{ {
connect(m_edit, &QTextEdit::textChanged, this, &GameConfigEdit::SaveFile); connect(m_edit, &QTextEdit::textChanged, this, &GameConfigEdit::SaveFile);
connect(m_edit, &QTextEdit::selectionChanged, this, &GameConfigEdit::OnSelectionChanged); connect(m_edit, &QTextEdit::selectionChanged, this, &GameConfigEdit::OnSelectionChanged);
connect(m_completer, static_cast<void (QCompleter::*)(const QString&)>(&QCompleter::activated), connect(m_completer, qOverload<const QString&>(&QCompleter::activated), this,
this, &GameConfigEdit::OnAutoComplete); &GameConfigEdit::OnAutoComplete);
} }
void GameConfigEdit::OnSelectionChanged() void GameConfigEdit::OnSelectionChanged()

View File

@ -210,12 +210,11 @@ void GameConfigWidget::ConnectWidgets()
m_enable_fast_disc, m_use_dsp_hle, m_use_monoscopic_shadows}) m_enable_fast_disc, m_use_dsp_hle, m_use_monoscopic_shadows})
connect(box, &QCheckBox::stateChanged, this, &GameConfigWidget::SaveSettings); connect(box, &QCheckBox::stateChanged, this, &GameConfigWidget::SaveSettings);
connect(m_deterministic_dual_core, connect(m_deterministic_dual_core, qOverload<int>(&QComboBox::currentIndexChanged), this,
static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged), this,
&GameConfigWidget::SaveSettings); &GameConfigWidget::SaveSettings);
connect(m_depth_slider, static_cast<void (QSlider::*)(int)>(&QSlider::valueChanged), this, connect(m_depth_slider, qOverload<int>(&QSlider::valueChanged), this,
&GameConfigWidget::SaveSettings); &GameConfigWidget::SaveSettings);
connect(m_convergence_spin, static_cast<void (QSpinBox::*)(int)>(&QSpinBox::valueChanged), this, connect(m_convergence_spin, qOverload<int>(&QSpinBox::valueChanged), this,
&GameConfigWidget::SaveSettings); &GameConfigWidget::SaveSettings);
} }

View File

@ -144,12 +144,11 @@ void EnhancementsWidget::CreateWidgets()
void EnhancementsWidget::ConnectWidgets() void EnhancementsWidget::ConnectWidgets()
{ {
connect(m_aa_combo, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged), connect(m_aa_combo, qOverload<int>(&QComboBox::currentIndexChanged),
[this](int) { SaveSettings(); }); [this](int) { SaveSettings(); });
connect(m_pp_effect, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged), connect(m_pp_effect, qOverload<int>(&QComboBox::currentIndexChanged),
[this](int) { SaveSettings(); }); [this](int) { SaveSettings(); });
connect(m_3d_mode, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged), connect(m_3d_mode, qOverload<int>(&QComboBox::currentIndexChanged), [this] {
[this] {
m_block_save = true; m_block_save = true;
LoadPPShaders(); LoadPPShaders();
m_block_save = false; m_block_save = false;

View File

@ -138,10 +138,9 @@ void GeneralWidget::CreateWidgets()
void GeneralWidget::ConnectWidgets() void GeneralWidget::ConnectWidgets()
{ {
// Video Backend // Video Backend
connect(m_backend_combo, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged), connect(m_backend_combo, qOverload<int>(&QComboBox::currentIndexChanged), this,
this, &GeneralWidget::SaveSettings); &GeneralWidget::SaveSettings);
connect(m_adapter_combo, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged), connect(m_adapter_combo, qOverload<int>(&QComboBox::currentIndexChanged), this, [](int index) {
this, [](int index) {
g_Config.iAdapter = index; g_Config.iAdapter = index;
Config::SetBaseOrCurrent(Config::GFX_ADAPTER, index); Config::SetBaseOrCurrent(Config::GFX_ADAPTER, index);
}); });

View File

@ -14,8 +14,7 @@ GraphicsChoice::GraphicsChoice(const QStringList& options, const Config::ConfigI
: m_setting(setting) : m_setting(setting)
{ {
addItems(options); addItems(options);
connect(this, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged), this, connect(this, qOverload<int>(&QComboBox::currentIndexChanged), this, &GraphicsChoice::Update);
&GraphicsChoice::Update);
setCurrentIndex(Config::Get(m_setting)); setCurrentIndex(Config::Get(m_setting));
connect(&Settings::Instance(), &Settings::ConfigChanged, [this] { connect(&Settings::Instance(), &Settings::ConfigChanged, [this] {

View File

@ -20,9 +20,7 @@ GraphicsInteger::GraphicsInteger(int minimum, int maximum, const Config::ConfigI
setValue(Config::Get(setting)); setValue(Config::Get(setting));
connect(this, static_cast<void (GraphicsInteger::*)(int)>(&GraphicsInteger::valueChanged), this, connect(this, qOverload<int>(&GraphicsInteger::valueChanged), this, &GraphicsInteger::Update);
&GraphicsInteger::Update);
connect(&Settings::Instance(), &Settings::ConfigChanged, [this] { connect(&Settings::Instance(), &Settings::ConfigChanged, [this] {
QFont bf = font(); QFont bf = font();
bf.setBold(Config::GetActiveLayerForConfig(m_setting) != Config::LayerType::Base); bf.setBold(Config::GetActiveLayerForConfig(m_setting) != Config::LayerType::Base);

View File

@ -111,11 +111,11 @@ void SoftwareRendererWidget::CreateWidgets()
void SoftwareRendererWidget::ConnectWidgets() void SoftwareRendererWidget::ConnectWidgets()
{ {
connect(m_backend_combo, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged), connect(m_backend_combo, qOverload<int>(&QComboBox::currentIndexChanged),
[this](int) { SaveSettings(); }); [this](int) { SaveSettings(); });
connect(m_object_range_min, static_cast<void (QSpinBox::*)(int)>(&QSpinBox::valueChanged), connect(m_object_range_min, qOverload<int>(&QSpinBox::valueChanged),
[this](int) { SaveSettings(); }); [this](int) { SaveSettings(); });
connect(m_object_range_max, static_cast<void (QSpinBox::*)(int)>(&QSpinBox::valueChanged), connect(m_object_range_max, qOverload<int>(&QSpinBox::valueChanged),
[this](int) { SaveSettings(); }); [this](int) { SaveSettings(); });
} }

View File

@ -175,8 +175,7 @@ void InfoWidget::CreateLanguageSelector()
if (m_language_selector->count() == 1) if (m_language_selector->count() == 1)
m_language_selector->setDisabled(true); m_language_selector->setDisabled(true);
connect(m_language_selector, connect(m_language_selector, qOverload<int>(&QComboBox::currentIndexChanged), this,
static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged), this,
&InfoWidget::ChangeLanguage); &InfoWidget::ChangeLanguage);
} }

View File

@ -167,7 +167,7 @@ void LogWidget::ConnectWidgets()
m_log_ring_buffer.clear(); m_log_ring_buffer.clear();
}); });
connect(m_log_wrap, &QCheckBox::toggled, this, &LogWidget::SaveSettings); connect(m_log_wrap, &QCheckBox::toggled, this, &LogWidget::SaveSettings);
connect(m_log_font, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged), this, connect(m_log_font, qOverload<int>(&QComboBox::currentIndexChanged), this,
&LogWidget::SaveSettings); &LogWidget::SaveSettings);
connect(this, &QDockWidget::topLevelChanged, this, &LogWidget::SaveSettings); connect(this, &QDockWidget::topLevelChanged, this, &LogWidget::SaveSettings);
connect(&Settings::Instance(), &Settings::LogVisibilityChanged, this, &LogWidget::setVisible); connect(&Settings::Instance(), &Settings::LogVisibilityChanged, this, &LogWidget::setVisible);

View File

@ -386,9 +386,7 @@ void IOWindow::ConnectWidgets()
connect(m_button_box, &QDialogButtonBox::clicked, this, &IOWindow::OnDialogButtonPressed); connect(m_button_box, &QDialogButtonBox::clicked, this, &IOWindow::OnDialogButtonPressed);
connect(m_devices_combo, &QComboBox::currentTextChanged, this, &IOWindow::OnDeviceChanged); connect(m_devices_combo, &QComboBox::currentTextChanged, this, &IOWindow::OnDeviceChanged);
connect(m_range_spinbox, static_cast<void (QSpinBox::*)(int value)>(&QSpinBox::valueChanged), connect(m_range_spinbox, qOverload<int>(&QSpinBox::valueChanged), this,
this, &IOWindow::OnRangeChanged);
connect(m_range_slider, static_cast<void (QSlider::*)(int value)>(&QSlider::valueChanged), this,
&IOWindow::OnRangeChanged); &IOWindow::OnRangeChanged);
connect(m_expression_text, &QPlainTextEdit::textChanged, [this] { connect(m_expression_text, &QPlainTextEdit::textChanged, [this] {
@ -396,7 +394,7 @@ void IOWindow::ConnectWidgets()
m_apply_button->setText(m_apply_button->text() + QStringLiteral("*")); m_apply_button->setText(m_apply_button->text() + QStringLiteral("*"));
}); });
connect(m_operators_combo, QOverload<int>::of(&QComboBox::activated), [this](int index) { connect(m_operators_combo, qOverload<int>(&QComboBox::activated), [this](int index) {
if (0 == index) if (0 == index)
return; return;
@ -405,7 +403,7 @@ void IOWindow::ConnectWidgets()
m_operators_combo->setCurrentIndex(0); m_operators_combo->setCurrentIndex(0);
}); });
connect(m_functions_combo, QOverload<int>::of(&QComboBox::activated), [this](int index) { connect(m_functions_combo, qOverload<int>(&QComboBox::activated), [this](int index) {
if (0 == index) if (0 == index)
return; return;

View File

@ -19,7 +19,7 @@ MappingDouble::MappingDouble(MappingWidget* parent, ControllerEmu::NumericSettin
if (const auto ui_description = m_setting.GetUIDescription()) if (const auto ui_description = m_setting.GetUIDescription())
setToolTip(tr(ui_description)); setToolTip(tr(ui_description));
connect(this, QOverload<double>::of(&QDoubleSpinBox::valueChanged), this, connect(this, qOverload<double>(&QDoubleSpinBox::valueChanged), this,
[this, parent](double value) { [this, parent](double value) {
m_setting.SetValue(value); m_setting.SetValue(value);
ConfigChanged(); ConfigChanged();

View File

@ -101,7 +101,7 @@ QGroupBox* MappingWidget::CreateGroupBox(const QString& name, ControllerEmu::Con
indicator_layout->setAlignment(Qt::AlignCenter); indicator_layout->setAlignment(Qt::AlignCenter);
form_layout->addRow(indicator_layout); form_layout->addRow(indicator_layout);
connect(this, &MappingWidget::Update, indicator, QOverload<>::of(&MappingIndicator::update)); connect(this, &MappingWidget::Update, indicator, qOverload<>(&MappingIndicator::update));
const bool need_calibration = group->type == ControllerEmu::GroupType::Cursor || const bool need_calibration = group->type == ControllerEmu::GroupType::Cursor ||
group->type == ControllerEmu::GroupType::Stick || group->type == ControllerEmu::GroupType::Stick ||

View File

@ -153,8 +153,8 @@ void MappingWindow::ConnectWidgets()
connect(&Settings::Instance(), &Settings::DevicesChanged, this, connect(&Settings::Instance(), &Settings::DevicesChanged, this,
&MappingWindow::OnGlobalDevicesChanged); &MappingWindow::OnGlobalDevicesChanged);
connect(this, &MappingWindow::ConfigChanged, this, &MappingWindow::OnGlobalDevicesChanged); connect(this, &MappingWindow::ConfigChanged, this, &MappingWindow::OnGlobalDevicesChanged);
connect(m_devices_combo, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged), connect(m_devices_combo, qOverload<int>(&QComboBox::currentIndexChanged), this,
this, &MappingWindow::OnSelectDevice); &MappingWindow::OnSelectDevice);
connect(m_devices_refresh, &QPushButton::clicked, this, &MappingWindow::RefreshDevices); connect(m_devices_refresh, &QPushButton::clicked, this, &MappingWindow::RefreshDevices);

View File

@ -77,9 +77,9 @@ void WiimoteEmuGeneral::CreateMainLayout()
void WiimoteEmuGeneral::Connect() void WiimoteEmuGeneral::Connect()
{ {
connect(m_extension_combo, QOverload<int>::of(&QComboBox::currentIndexChanged), this, connect(m_extension_combo, qOverload<int>(&QComboBox::currentIndexChanged), this,
&WiimoteEmuGeneral::OnAttachmentChanged); &WiimoteEmuGeneral::OnAttachmentChanged);
connect(m_extension_combo, QOverload<int>::of(&QComboBox::activated), this, connect(m_extension_combo, qOverload<int>(&QComboBox::activated), this,
&WiimoteEmuGeneral::OnAttachmentSelected); &WiimoteEmuGeneral::OnAttachmentSelected);
connect(this, &MappingWidget::ConfigChanged, this, &WiimoteEmuGeneral::ConfigChanged); connect(this, &MappingWidget::ConfigChanged, this, &WiimoteEmuGeneral::ConfigChanged);
connect(this, &MappingWidget::Update, this, &WiimoteEmuGeneral::Update); connect(this, &MappingWidget::Update, this, &WiimoteEmuGeneral::Update);

View File

@ -68,7 +68,7 @@ void NewPatchDialog::CreateWidgets()
void NewPatchDialog::ConnectWidgets() void NewPatchDialog::ConnectWidgets()
{ {
connect(m_name_edit, static_cast<void (QLineEdit::*)(const QString&)>(&QLineEdit::textEdited), connect(m_name_edit, qOverload<const QString&>(&QLineEdit::textEdited),
[this](const QString& name) { m_patch.name = name.toStdString(); }); [this](const QString& name) { m_patch.name = name.toStdString(); });
connect(m_add_button, &QPushButton::clicked, this, &NewPatchDialog::AddEntry); connect(m_add_button, &QPushButton::clicked, this, &NewPatchDialog::AddEntry);
@ -130,7 +130,7 @@ QGroupBox* NewPatchDialog::CreateEntry(PatchEngine::PatchEntry& entry)
layout->addWidget(remove, 3, 0, 1, -1); layout->addWidget(remove, 3, 0, 1, -1);
box->setLayout(layout); box->setLayout(layout);
connect(offset, static_cast<void (QLineEdit::*)(const QString&)>(&QLineEdit::textEdited), connect(offset, qOverload<const QString&>(&QLineEdit::textEdited),
[&entry, offset](const QString& text) { [&entry, offset](const QString& text) {
bool okay = true; bool okay = true;
entry.address = text.toUInt(&okay, 16); entry.address = text.toUInt(&okay, 16);
@ -147,7 +147,7 @@ QGroupBox* NewPatchDialog::CreateEntry(PatchEngine::PatchEntry& entry)
offset->setPalette(palette); offset->setPalette(palette);
}); });
connect(value, static_cast<void (QLineEdit::*)(const QString&)>(&QLineEdit::textEdited), connect(value, qOverload<const QString&>(&QLineEdit::textEdited),
[&entry, value](const QString& text) { [&entry, value](const QString& text) {
bool okay; bool okay;
entry.value = text.toUInt(&okay, 16); entry.value = text.toUInt(&okay, 16);

View File

@ -169,14 +169,14 @@ void FIFOPlayerWindow::ConnectWidgets()
connect(m_button_box, &QDialogButtonBox::rejected, this, &FIFOPlayerWindow::reject); connect(m_button_box, &QDialogButtonBox::rejected, this, &FIFOPlayerWindow::reject);
connect(m_early_memory_updates, &QCheckBox::toggled, this, connect(m_early_memory_updates, &QCheckBox::toggled, this,
&FIFOPlayerWindow::OnEarlyMemoryUpdatesChanged); &FIFOPlayerWindow::OnEarlyMemoryUpdatesChanged);
connect(m_frame_range_from, static_cast<void (QSpinBox::*)(int)>(&QSpinBox::valueChanged), this, connect(m_frame_range_from, qOverload<int>(&QSpinBox::valueChanged), this,
&FIFOPlayerWindow::OnLimitsChanged); &FIFOPlayerWindow::OnLimitsChanged);
connect(m_frame_range_to, static_cast<void (QSpinBox::*)(int)>(&QSpinBox::valueChanged), this, connect(m_frame_range_to, qOverload<int>(&QSpinBox::valueChanged), this,
&FIFOPlayerWindow::OnLimitsChanged); &FIFOPlayerWindow::OnLimitsChanged);
connect(m_object_range_from, static_cast<void (QSpinBox::*)(int)>(&QSpinBox::valueChanged), this, connect(m_object_range_from, qOverload<int>(&QSpinBox::valueChanged), this,
&FIFOPlayerWindow::OnLimitsChanged); &FIFOPlayerWindow::OnLimitsChanged);
connect(m_object_range_to, static_cast<void (QSpinBox::*)(int)>(&QSpinBox::valueChanged), this, connect(m_object_range_to, qOverload<int>(&QSpinBox::valueChanged), this,
&FIFOPlayerWindow::OnLimitsChanged); &FIFOPlayerWindow::OnLimitsChanged);
} }

View File

@ -126,8 +126,8 @@ void NetPlayBrowser::CreateWidgets()
void NetPlayBrowser::ConnectWidgets() void NetPlayBrowser::ConnectWidgets()
{ {
connect(m_region_combo, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged), connect(m_region_combo, qOverload<int>(&QComboBox::currentIndexChanged), this,
this, &NetPlayBrowser::Refresh); &NetPlayBrowser::Refresh);
connect(m_button_box, &QDialogButtonBox::accepted, this, &NetPlayBrowser::accept); connect(m_button_box, &QDialogButtonBox::accepted, this, &NetPlayBrowser::accept);
connect(m_button_box, &QDialogButtonBox::rejected, this, &NetPlayBrowser::reject); connect(m_button_box, &QDialogButtonBox::rejected, this, &NetPlayBrowser::reject);

View File

@ -255,7 +255,7 @@ void NetPlayDialog::CreatePlayersLayout()
void NetPlayDialog::ConnectWidgets() void NetPlayDialog::ConnectWidgets()
{ {
// Players // Players
connect(m_room_box, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged), this, connect(m_room_box, qOverload<int>(&QComboBox::currentIndexChanged), this,
&NetPlayDialog::UpdateGUI); &NetPlayDialog::UpdateGUI);
connect(m_hostcode_action_button, &QPushButton::clicked, [this] { connect(m_hostcode_action_button, &QPushButton::clicked, [this] {
if (m_is_copy_button_retry && m_room_box->currentIndex() == 0) if (m_is_copy_button_retry && m_room_box->currentIndex() == 0)
@ -286,8 +286,7 @@ void NetPlayDialog::ConnectWidgets()
[this] { m_chat_send_button->setEnabled(!m_chat_type_edit->text().isEmpty()); }); [this] { m_chat_send_button->setEnabled(!m_chat_type_edit->text().isEmpty()); });
// Other // Other
connect(m_buffer_size_box, static_cast<void (QSpinBox::*)(int)>(&QSpinBox::valueChanged), connect(m_buffer_size_box, qOverload<int>(&QSpinBox::valueChanged), [this](int value) {
[this](int value) {
if (value == m_buffer_size) if (value == m_buffer_size)
return; return;
@ -345,7 +344,7 @@ void NetPlayDialog::ConnectWidgets()
// SaveSettings() - Save Hosting-Dialog Settings // SaveSettings() - Save Hosting-Dialog Settings
connect(m_buffer_size_box, static_cast<void (QSpinBox::*)(int)>(&QSpinBox::valueChanged), this, connect(m_buffer_size_box, qOverload<int>(&QSpinBox::valueChanged), this,
&NetPlayDialog::SaveSettings); &NetPlayDialog::SaveSettings);
connect(m_save_sd_action, &QAction::toggled, this, &NetPlayDialog::SaveSettings); connect(m_save_sd_action, &QAction::toggled, this, &NetPlayDialog::SaveSettings);
connect(m_load_wii_action, &QAction::toggled, this, &NetPlayDialog::SaveSettings); connect(m_load_wii_action, &QAction::toggled, this, &NetPlayDialog::SaveSettings);

View File

@ -199,19 +199,18 @@ void NetPlaySetupDialog::CreateMainLayout()
void NetPlaySetupDialog::ConnectWidgets() void NetPlaySetupDialog::ConnectWidgets()
{ {
connect(m_connection_type, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged), connect(m_connection_type, qOverload<int>(&QComboBox::currentIndexChanged), this,
this, &NetPlaySetupDialog::OnConnectionTypeChanged); &NetPlaySetupDialog::OnConnectionTypeChanged);
connect(m_nickname_edit, &QLineEdit::textChanged, this, &NetPlaySetupDialog::SaveSettings); connect(m_nickname_edit, &QLineEdit::textChanged, this, &NetPlaySetupDialog::SaveSettings);
// Connect widget // Connect widget
connect(m_ip_edit, &QLineEdit::textChanged, this, &NetPlaySetupDialog::SaveSettings); connect(m_ip_edit, &QLineEdit::textChanged, this, &NetPlaySetupDialog::SaveSettings);
connect(m_connect_port_box, static_cast<void (QSpinBox::*)(int)>(&QSpinBox::valueChanged), this, connect(m_connect_port_box, qOverload<int>(&QSpinBox::valueChanged), this,
&NetPlaySetupDialog::SaveSettings); &NetPlaySetupDialog::SaveSettings);
// Host widget // Host widget
connect(m_host_port_box, static_cast<void (QSpinBox::*)(int)>(&QSpinBox::valueChanged), this, connect(m_host_port_box, qOverload<int>(&QSpinBox::valueChanged), this,
&NetPlaySetupDialog::SaveSettings); &NetPlaySetupDialog::SaveSettings);
connect(m_host_games, static_cast<void (QListWidget::*)(int)>(&QListWidget::currentRowChanged), connect(m_host_games, qOverload<int>(&QListWidget::currentRowChanged), [this](int index) {
[this](int index) {
Settings::GetQSettings().setValue(QStringLiteral("netplay/hostgame"), Settings::GetQSettings().setValue(QStringLiteral("netplay/hostgame"),
m_host_games->item(index)->text()); m_host_games->item(index)->text());
}); });
@ -224,8 +223,7 @@ void NetPlaySetupDialog::ConnectWidgets()
m_host_chunked_upload_limit_box->setEnabled(value); m_host_chunked_upload_limit_box->setEnabled(value);
SaveSettings(); SaveSettings();
}); });
connect(m_host_chunked_upload_limit_box, connect(m_host_chunked_upload_limit_box, qOverload<int>(&QSpinBox::valueChanged), this,
static_cast<void (QSpinBox::*)(int)>(&QSpinBox::valueChanged), this,
&NetPlaySetupDialog::SaveSettings); &NetPlaySetupDialog::SaveSettings);
connect(m_host_server_browser, &QCheckBox::toggled, this, &NetPlaySetupDialog::SaveSettings); connect(m_host_server_browser, &QCheckBox::toggled, this, &NetPlaySetupDialog::SaveSettings);

View File

@ -48,11 +48,11 @@ void PadMappingDialog::CreateWidgets()
void PadMappingDialog::ConnectWidgets() void PadMappingDialog::ConnectWidgets()
{ {
connect(m_button_box, &QDialogButtonBox::accepted, this, &QDialog::accept); connect(m_button_box, &QDialogButtonBox::accepted, this, &QDialog::accept);
for (auto& combo_group : {m_gc_boxes, m_wii_boxes}) for (const auto& combo_group : {m_gc_boxes, m_wii_boxes})
{ {
for (auto& combo : combo_group) for (const auto& combo : combo_group)
{ {
connect(combo, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged), this, connect(combo, qOverload<int>(&QComboBox::currentIndexChanged), this,
&PadMappingDialog::OnMappingChanged); &PadMappingDialog::OnMappingChanged);
} }
} }

View File

@ -171,12 +171,12 @@ void AudioPane::CreateWidgets()
void AudioPane::ConnectWidgets() void AudioPane::ConnectWidgets()
{ {
connect(m_backend_combo, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged), connect(m_backend_combo, qOverload<int>(&QComboBox::currentIndexChanged), this,
this, &AudioPane::SaveSettings); &AudioPane::SaveSettings);
connect(m_volume_slider, &QSlider::valueChanged, this, &AudioPane::SaveSettings); connect(m_volume_slider, &QSlider::valueChanged, this, &AudioPane::SaveSettings);
if (m_latency_control_supported) if (m_latency_control_supported)
{ {
connect(m_latency_spin, static_cast<void (QSpinBox::*)(int)>(&QSpinBox::valueChanged), this, connect(m_latency_spin, qOverload<int>(&QSpinBox::valueChanged), this,
&AudioPane::SaveSettings); &AudioPane::SaveSettings);
} }
connect(m_stretching_buffer_slider, &QSlider::valueChanged, this, &AudioPane::SaveSettings); connect(m_stretching_buffer_slider, &QSlider::valueChanged, this, &AudioPane::SaveSettings);
@ -188,8 +188,7 @@ void AudioPane::ConnectWidgets()
connect(m_dsp_interpreter, &QRadioButton::toggled, this, &AudioPane::SaveSettings); connect(m_dsp_interpreter, &QRadioButton::toggled, this, &AudioPane::SaveSettings);
#ifdef _WIN32 #ifdef _WIN32
connect(m_wasapi_device_combo, connect(m_wasapi_device_combo, qOverload<int>(&QComboBox::currentIndexChanged), this,
static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged), this,
&AudioPane::SaveSettings); &AudioPane::SaveSettings);
#endif #endif
} }

View File

@ -130,15 +130,15 @@ void GameCubePane::ConnectWidgets()
{ {
// IPL Settings // IPL Settings
connect(m_skip_main_menu, &QCheckBox::stateChanged, this, &GameCubePane::SaveSettings); connect(m_skip_main_menu, &QCheckBox::stateChanged, this, &GameCubePane::SaveSettings);
connect(m_language_combo, QOverload<int>::of(&QComboBox::currentIndexChanged), this, connect(m_language_combo, qOverload<int>(&QComboBox::currentIndexChanged), this,
&GameCubePane::SaveSettings); &GameCubePane::SaveSettings);
// Device Settings // Device Settings
for (int i = 0; i < SLOT_COUNT; i++) for (int i = 0; i < SLOT_COUNT; i++)
{ {
connect(m_slot_combos[i], QOverload<int>::of(&QComboBox::currentIndexChanged), this, connect(m_slot_combos[i], qOverload<int>(&QComboBox::currentIndexChanged), this,
[this, i] { UpdateButton(i); }); [this, i] { UpdateButton(i); });
connect(m_slot_combos[i], QOverload<int>::of(&QComboBox::currentIndexChanged), this, connect(m_slot_combos[i], qOverload<int>(&QComboBox::currentIndexChanged), this,
&GameCubePane::SaveSettings); &GameCubePane::SaveSettings);
connect(m_slot_buttons[i], &QPushButton::clicked, [this, i] { OnConfigPressed(i); }); connect(m_slot_buttons[i], &QPushButton::clicked, [this, i] { OnConfigPressed(i); });
} }

View File

@ -96,16 +96,14 @@ void GeneralPane::ConnectLayout()
if (AutoUpdateChecker::SystemSupportsAutoUpdates()) if (AutoUpdateChecker::SystemSupportsAutoUpdates())
{ {
connect(m_combobox_update_track, connect(m_combobox_update_track, qOverload<int>(&QComboBox::currentIndexChanged), this,
static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged), this,
&GeneralPane::OnSaveConfig); &GeneralPane::OnSaveConfig);
connect(&Settings::Instance(), &Settings::AutoUpdateTrackChanged, this, connect(&Settings::Instance(), &Settings::AutoUpdateTrackChanged, this,
&GeneralPane::LoadConfig); &GeneralPane::LoadConfig);
} }
// Advanced // Advanced
connect(m_combobox_speedlimit, connect(m_combobox_speedlimit, qOverload<int>(&QComboBox::currentIndexChanged),
static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged),
[this]() { OnSaveConfig(); }); [this]() { OnSaveConfig(); });
#if defined(USE_ANALYTICS) && USE_ANALYTICS #if defined(USE_ANALYTICS) && USE_ANALYTICS

View File

@ -188,14 +188,11 @@ void InterfacePane::ConnectLayout()
connect(m_checkbox_use_covers, &QCheckBox::toggled, this, &InterfacePane::OnSaveConfig); connect(m_checkbox_use_covers, &QCheckBox::toggled, this, &InterfacePane::OnSaveConfig);
connect(m_checkbox_show_debugging_ui, &QCheckBox::toggled, this, &InterfacePane::OnSaveConfig); connect(m_checkbox_show_debugging_ui, &QCheckBox::toggled, this, &InterfacePane::OnSaveConfig);
connect(m_checkbox_focused_hotkeys, &QCheckBox::toggled, this, &InterfacePane::OnSaveConfig); connect(m_checkbox_focused_hotkeys, &QCheckBox::toggled, this, &InterfacePane::OnSaveConfig);
connect(m_combobox_theme, connect(m_combobox_theme, qOverload<const QString&>(&QComboBox::currentIndexChanged),
static_cast<void (QComboBox::*)(const QString&)>(&QComboBox::currentIndexChanged),
&Settings::Instance(), &Settings::SetThemeName); &Settings::Instance(), &Settings::SetThemeName);
connect(m_combobox_userstyle, connect(m_combobox_userstyle, qOverload<const QString&>(&QComboBox::currentIndexChanged), this,
static_cast<void (QComboBox::*)(const QString&)>(&QComboBox::currentIndexChanged), this,
&InterfacePane::OnSaveConfig); &InterfacePane::OnSaveConfig);
connect(m_combobox_language, connect(m_combobox_language, qOverload<int>(&QComboBox::currentIndexChanged), this,
static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged), this,
&InterfacePane::OnSaveConfig); &InterfacePane::OnSaveConfig);
connect(m_checkbox_top_window, &QCheckBox::toggled, this, &InterfacePane::OnSaveConfig); connect(m_checkbox_top_window, &QCheckBox::toggled, this, &InterfacePane::OnSaveConfig);
connect(m_checkbox_confirm_on_stop, &QCheckBox::toggled, this, &InterfacePane::OnSaveConfig); connect(m_checkbox_confirm_on_stop, &QCheckBox::toggled, this, &InterfacePane::OnSaveConfig);

View File

@ -64,11 +64,9 @@ void WiiPane::CreateLayout()
void WiiPane::ConnectLayout() void WiiPane::ConnectLayout()
{ {
// Misc Settings // Misc Settings
connect(m_aspect_ratio_choice, connect(m_aspect_ratio_choice, qOverload<int>(&QComboBox::currentIndexChanged), this,
static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged), this,
&WiiPane::OnSaveConfig); &WiiPane::OnSaveConfig);
connect(m_system_language_choice, connect(m_system_language_choice, qOverload<int>(&QComboBox::currentIndexChanged), this,
static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged), this,
&WiiPane::OnSaveConfig); &WiiPane::OnSaveConfig);
connect(m_screensaver_checkbox, &QCheckBox::toggled, this, &WiiPane::OnSaveConfig); connect(m_screensaver_checkbox, &QCheckBox::toggled, this, &WiiPane::OnSaveConfig);
connect(m_pal60_mode_checkbox, &QCheckBox::toggled, this, &WiiPane::OnSaveConfig); connect(m_pal60_mode_checkbox, &QCheckBox::toggled, this, &WiiPane::OnSaveConfig);
@ -87,8 +85,7 @@ void WiiPane::ConnectLayout()
&WiiPane::OnUSBWhitelistRemoveButton); &WiiPane::OnUSBWhitelistRemoveButton);
// Wii Remote Settings // Wii Remote Settings
connect(m_wiimote_ir_sensor_position, connect(m_wiimote_ir_sensor_position, qOverload<int>(&QComboBox::currentIndexChanged), this,
static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged), this,
&WiiPane::OnSaveConfig); &WiiPane::OnSaveConfig);
connect(m_wiimote_ir_sensitivity, &QSlider::valueChanged, this, &WiiPane::OnSaveConfig); connect(m_wiimote_ir_sensitivity, &QSlider::valueChanged, this, &WiiPane::OnSaveConfig);
connect(m_wiimote_speaker_volume, &QSlider::valueChanged, this, &WiiPane::OnSaveConfig); connect(m_wiimote_speaker_volume, &QSlider::valueChanged, this, &WiiPane::OnSaveConfig);

View File

@ -54,10 +54,8 @@ QGroupBox* TASInputWindow::CreateStickInputs(QString name, QSpinBox*& x_value, Q
y_value->setMaximumWidth(60); y_value->setMaximumWidth(60);
auto* visual = new StickWidget(this, max_x, max_y); auto* visual = new StickWidget(this, max_x, max_y);
connect(x_value, static_cast<void (QSpinBox::*)(int)>(&QSpinBox::valueChanged), visual, connect(x_value, qOverload<int>(&QSpinBox::valueChanged), visual, &StickWidget::SetX);
&StickWidget::SetX); connect(y_value, qOverload<int>(&QSpinBox::valueChanged), visual, &StickWidget::SetY);
connect(y_value, static_cast<void (QSpinBox::*)(int)>(&QSpinBox::valueChanged), visual,
&StickWidget::SetY);
connect(visual, &StickWidget::ChangedX, x_value, &QSpinBox::setValue); connect(visual, &StickWidget::ChangedX, x_value, &QSpinBox::setValue);
connect(visual, &StickWidget::ChangedY, y_value, &QSpinBox::setValue); connect(visual, &StickWidget::ChangedY, y_value, &QSpinBox::setValue);
@ -105,8 +103,7 @@ QSpinBox* TASInputWindow::CreateSliderValuePair(QBoxLayout* layout, u16 max,
{ {
auto* value = new QSpinBox(); auto* value = new QSpinBox();
value->setRange(0, 99999); value->setRange(0, 99999);
connect(value, static_cast<void (QSpinBox::*)(int)>(&QSpinBox::valueChanged), connect(value, qOverload<int>(&QSpinBox::valueChanged), [value, max](int i) {
[value, max](int i) {
if (i > max) if (i > max)
value->setValue(max); value->setValue(max);
}); });
@ -116,8 +113,7 @@ QSpinBox* TASInputWindow::CreateSliderValuePair(QBoxLayout* layout, u16 max,
slider->setInvertedAppearance(invert); slider->setInvertedAppearance(invert);
connect(slider, &QSlider::valueChanged, value, &QSpinBox::setValue); connect(slider, &QSlider::valueChanged, value, &QSpinBox::setValue);
connect(value, static_cast<void (QSpinBox::*)(int)>(&QSpinBox::valueChanged), slider, connect(value, qOverload<int>(&QSpinBox::valueChanged), slider, &QSlider::setValue);
&QSlider::setValue);
auto* shortcut = new QShortcut(shortcut_key_sequence, shortcut_widget); auto* shortcut = new QShortcut(shortcut_key_sequence, shortcut_widget);
connect(shortcut, &QShortcut::activated, [value] { connect(shortcut, &QShortcut::activated, [value] {

View File

@ -58,10 +58,8 @@ WiiTASInputWindow::WiiTASInputWindow(QWidget* parent, int num) : TASInputWindow(
m_ir_y_value->setMaximumWidth(60); m_ir_y_value->setMaximumWidth(60);
auto* visual = new IRWidget(this); auto* visual = new IRWidget(this);
connect(m_ir_x_value, static_cast<void (QSpinBox::*)(int)>(&QSpinBox::valueChanged), visual, connect(m_ir_x_value, qOverload<int>(&QSpinBox::valueChanged), visual, &IRWidget::SetX);
&IRWidget::SetX); connect(m_ir_y_value, qOverload<int>(&QSpinBox::valueChanged), visual, &IRWidget::SetY);
connect(m_ir_y_value, static_cast<void (QSpinBox::*)(int)>(&QSpinBox::valueChanged), visual,
&IRWidget::SetY);
connect(visual, &IRWidget::ChangedX, m_ir_x_value, &QSpinBox::setValue); connect(visual, &IRWidget::ChangedX, m_ir_x_value, &QSpinBox::setValue);
connect(visual, &IRWidget::ChangedY, m_ir_y_value, &QSpinBox::setValue); connect(visual, &IRWidget::ChangedY, m_ir_y_value, &QSpinBox::setValue);