diff --git a/Source/Core/DolphinQt/Config/ControllersWindow.cpp b/Source/Core/DolphinQt/Config/ControllersWindow.cpp index 65ab32cbe6..2f3d03ed43 100644 --- a/Source/Core/DolphinQt/Config/ControllersWindow.cpp +++ b/Source/Core/DolphinQt/Config/ControllersWindow.cpp @@ -260,20 +260,16 @@ void ControllersWindow::ConnectWidgets() for (size_t i = 0; i < m_wiimote_groups.size(); i++) { - connect(m_wiimote_boxes[i], - static_cast(&QComboBox::currentIndexChanged), this, + connect(m_wiimote_boxes[i], qOverload(&QComboBox::currentIndexChanged), this, &ControllersWindow::SaveSettings); - connect(m_wiimote_boxes[i], - static_cast(&QComboBox::currentIndexChanged), this, + connect(m_wiimote_boxes[i], qOverload(&QComboBox::currentIndexChanged), this, &ControllersWindow::OnWiimoteModeChanged); connect(m_wiimote_buttons[i], &QPushButton::clicked, this, &ControllersWindow::OnWiimoteConfigure); - connect(m_gc_controller_boxes[i], - static_cast(&QComboBox::currentIndexChanged), this, + connect(m_gc_controller_boxes[i], qOverload(&QComboBox::currentIndexChanged), this, &ControllersWindow::SaveSettings); - connect(m_gc_controller_boxes[i], - static_cast(&QComboBox::currentIndexChanged), this, + connect(m_gc_controller_boxes[i], qOverload(&QComboBox::currentIndexChanged), this, &ControllersWindow::OnGCTypeChanged); connect(m_gc_buttons[i], &QPushButton::clicked, this, &ControllersWindow::OnGCPadConfigure); } diff --git a/Source/Core/DolphinQt/Config/GameConfigEdit.cpp b/Source/Core/DolphinQt/Config/GameConfigEdit.cpp index fbbdd3b509..b4ca822d1d 100644 --- a/Source/Core/DolphinQt/Config/GameConfigEdit.cpp +++ b/Source/Core/DolphinQt/Config/GameConfigEdit.cpp @@ -135,8 +135,8 @@ void GameConfigEdit::ConnectWidgets() { connect(m_edit, &QTextEdit::textChanged, this, &GameConfigEdit::SaveFile); connect(m_edit, &QTextEdit::selectionChanged, this, &GameConfigEdit::OnSelectionChanged); - connect(m_completer, static_cast(&QCompleter::activated), - this, &GameConfigEdit::OnAutoComplete); + connect(m_completer, qOverload(&QCompleter::activated), this, + &GameConfigEdit::OnAutoComplete); } void GameConfigEdit::OnSelectionChanged() diff --git a/Source/Core/DolphinQt/Config/GameConfigWidget.cpp b/Source/Core/DolphinQt/Config/GameConfigWidget.cpp index b0df740ba9..178541d144 100644 --- a/Source/Core/DolphinQt/Config/GameConfigWidget.cpp +++ b/Source/Core/DolphinQt/Config/GameConfigWidget.cpp @@ -210,12 +210,11 @@ void GameConfigWidget::ConnectWidgets() m_enable_fast_disc, m_use_dsp_hle, m_use_monoscopic_shadows}) connect(box, &QCheckBox::stateChanged, this, &GameConfigWidget::SaveSettings); - connect(m_deterministic_dual_core, - static_cast(&QComboBox::currentIndexChanged), this, + connect(m_deterministic_dual_core, qOverload(&QComboBox::currentIndexChanged), this, &GameConfigWidget::SaveSettings); - connect(m_depth_slider, static_cast(&QSlider::valueChanged), this, + connect(m_depth_slider, qOverload(&QSlider::valueChanged), this, &GameConfigWidget::SaveSettings); - connect(m_convergence_spin, static_cast(&QSpinBox::valueChanged), this, + connect(m_convergence_spin, qOverload(&QSpinBox::valueChanged), this, &GameConfigWidget::SaveSettings); } diff --git a/Source/Core/DolphinQt/Config/Graphics/EnhancementsWidget.cpp b/Source/Core/DolphinQt/Config/Graphics/EnhancementsWidget.cpp index c6a472a143..d84a8b0174 100644 --- a/Source/Core/DolphinQt/Config/Graphics/EnhancementsWidget.cpp +++ b/Source/Core/DolphinQt/Config/Graphics/EnhancementsWidget.cpp @@ -144,18 +144,17 @@ void EnhancementsWidget::CreateWidgets() void EnhancementsWidget::ConnectWidgets() { - connect(m_aa_combo, static_cast(&QComboBox::currentIndexChanged), + connect(m_aa_combo, qOverload(&QComboBox::currentIndexChanged), [this](int) { SaveSettings(); }); - connect(m_pp_effect, static_cast(&QComboBox::currentIndexChanged), + connect(m_pp_effect, qOverload(&QComboBox::currentIndexChanged), [this](int) { SaveSettings(); }); - connect(m_3d_mode, static_cast(&QComboBox::currentIndexChanged), - [this] { - m_block_save = true; - LoadPPShaders(); - m_block_save = false; + connect(m_3d_mode, qOverload(&QComboBox::currentIndexChanged), [this] { + m_block_save = true; + LoadPPShaders(); + m_block_save = false; - SaveSettings(); - }); + SaveSettings(); + }); connect(m_configure_pp_effect, &QPushButton::clicked, this, &EnhancementsWidget::ConfigurePostProcessingShader); } diff --git a/Source/Core/DolphinQt/Config/Graphics/GeneralWidget.cpp b/Source/Core/DolphinQt/Config/Graphics/GeneralWidget.cpp index 3f829124f8..c616880632 100644 --- a/Source/Core/DolphinQt/Config/Graphics/GeneralWidget.cpp +++ b/Source/Core/DolphinQt/Config/Graphics/GeneralWidget.cpp @@ -138,13 +138,12 @@ void GeneralWidget::CreateWidgets() void GeneralWidget::ConnectWidgets() { // Video Backend - connect(m_backend_combo, static_cast(&QComboBox::currentIndexChanged), - this, &GeneralWidget::SaveSettings); - connect(m_adapter_combo, static_cast(&QComboBox::currentIndexChanged), - this, [](int index) { - g_Config.iAdapter = index; - Config::SetBaseOrCurrent(Config::GFX_ADAPTER, index); - }); + connect(m_backend_combo, qOverload(&QComboBox::currentIndexChanged), this, + &GeneralWidget::SaveSettings); + connect(m_adapter_combo, qOverload(&QComboBox::currentIndexChanged), this, [](int index) { + g_Config.iAdapter = index; + Config::SetBaseOrCurrent(Config::GFX_ADAPTER, index); + }); } void GeneralWidget::LoadSettings() diff --git a/Source/Core/DolphinQt/Config/Graphics/GraphicsChoice.cpp b/Source/Core/DolphinQt/Config/Graphics/GraphicsChoice.cpp index 80b713c84c..8be984db06 100644 --- a/Source/Core/DolphinQt/Config/Graphics/GraphicsChoice.cpp +++ b/Source/Core/DolphinQt/Config/Graphics/GraphicsChoice.cpp @@ -14,8 +14,7 @@ GraphicsChoice::GraphicsChoice(const QStringList& options, const Config::ConfigI : m_setting(setting) { addItems(options); - connect(this, static_cast(&QComboBox::currentIndexChanged), this, - &GraphicsChoice::Update); + connect(this, qOverload(&QComboBox::currentIndexChanged), this, &GraphicsChoice::Update); setCurrentIndex(Config::Get(m_setting)); connect(&Settings::Instance(), &Settings::ConfigChanged, [this] { diff --git a/Source/Core/DolphinQt/Config/Graphics/GraphicsInteger.cpp b/Source/Core/DolphinQt/Config/Graphics/GraphicsInteger.cpp index cabca80d52..6fd1049e86 100644 --- a/Source/Core/DolphinQt/Config/Graphics/GraphicsInteger.cpp +++ b/Source/Core/DolphinQt/Config/Graphics/GraphicsInteger.cpp @@ -20,9 +20,7 @@ GraphicsInteger::GraphicsInteger(int minimum, int maximum, const Config::ConfigI setValue(Config::Get(setting)); - connect(this, static_cast(&GraphicsInteger::valueChanged), this, - &GraphicsInteger::Update); - + connect(this, qOverload(&GraphicsInteger::valueChanged), this, &GraphicsInteger::Update); connect(&Settings::Instance(), &Settings::ConfigChanged, [this] { QFont bf = font(); bf.setBold(Config::GetActiveLayerForConfig(m_setting) != Config::LayerType::Base); diff --git a/Source/Core/DolphinQt/Config/Graphics/SoftwareRendererWidget.cpp b/Source/Core/DolphinQt/Config/Graphics/SoftwareRendererWidget.cpp index 1e2496d2f7..5af91d0ff5 100644 --- a/Source/Core/DolphinQt/Config/Graphics/SoftwareRendererWidget.cpp +++ b/Source/Core/DolphinQt/Config/Graphics/SoftwareRendererWidget.cpp @@ -111,11 +111,11 @@ void SoftwareRendererWidget::CreateWidgets() void SoftwareRendererWidget::ConnectWidgets() { - connect(m_backend_combo, static_cast(&QComboBox::currentIndexChanged), + connect(m_backend_combo, qOverload(&QComboBox::currentIndexChanged), [this](int) { SaveSettings(); }); - connect(m_object_range_min, static_cast(&QSpinBox::valueChanged), + connect(m_object_range_min, qOverload(&QSpinBox::valueChanged), [this](int) { SaveSettings(); }); - connect(m_object_range_max, static_cast(&QSpinBox::valueChanged), + connect(m_object_range_max, qOverload(&QSpinBox::valueChanged), [this](int) { SaveSettings(); }); } diff --git a/Source/Core/DolphinQt/Config/InfoWidget.cpp b/Source/Core/DolphinQt/Config/InfoWidget.cpp index c382c7dc1b..9d7c643a14 100644 --- a/Source/Core/DolphinQt/Config/InfoWidget.cpp +++ b/Source/Core/DolphinQt/Config/InfoWidget.cpp @@ -175,8 +175,7 @@ void InfoWidget::CreateLanguageSelector() if (m_language_selector->count() == 1) m_language_selector->setDisabled(true); - connect(m_language_selector, - static_cast(&QComboBox::currentIndexChanged), this, + connect(m_language_selector, qOverload(&QComboBox::currentIndexChanged), this, &InfoWidget::ChangeLanguage); } diff --git a/Source/Core/DolphinQt/Config/LogWidget.cpp b/Source/Core/DolphinQt/Config/LogWidget.cpp index e21ac34043..577916e67a 100644 --- a/Source/Core/DolphinQt/Config/LogWidget.cpp +++ b/Source/Core/DolphinQt/Config/LogWidget.cpp @@ -167,7 +167,7 @@ void LogWidget::ConnectWidgets() m_log_ring_buffer.clear(); }); connect(m_log_wrap, &QCheckBox::toggled, this, &LogWidget::SaveSettings); - connect(m_log_font, static_cast(&QComboBox::currentIndexChanged), this, + connect(m_log_font, qOverload(&QComboBox::currentIndexChanged), this, &LogWidget::SaveSettings); connect(this, &QDockWidget::topLevelChanged, this, &LogWidget::SaveSettings); connect(&Settings::Instance(), &Settings::LogVisibilityChanged, this, &LogWidget::setVisible); diff --git a/Source/Core/DolphinQt/Config/Mapping/IOWindow.cpp b/Source/Core/DolphinQt/Config/Mapping/IOWindow.cpp index aa0f1efa0d..a7e88e3092 100644 --- a/Source/Core/DolphinQt/Config/Mapping/IOWindow.cpp +++ b/Source/Core/DolphinQt/Config/Mapping/IOWindow.cpp @@ -386,9 +386,7 @@ void IOWindow::ConnectWidgets() connect(m_button_box, &QDialogButtonBox::clicked, this, &IOWindow::OnDialogButtonPressed); connect(m_devices_combo, &QComboBox::currentTextChanged, this, &IOWindow::OnDeviceChanged); - connect(m_range_spinbox, static_cast(&QSpinBox::valueChanged), - this, &IOWindow::OnRangeChanged); - connect(m_range_slider, static_cast(&QSlider::valueChanged), this, + connect(m_range_spinbox, qOverload(&QSpinBox::valueChanged), this, &IOWindow::OnRangeChanged); connect(m_expression_text, &QPlainTextEdit::textChanged, [this] { @@ -396,7 +394,7 @@ void IOWindow::ConnectWidgets() m_apply_button->setText(m_apply_button->text() + QStringLiteral("*")); }); - connect(m_operators_combo, QOverload::of(&QComboBox::activated), [this](int index) { + connect(m_operators_combo, qOverload(&QComboBox::activated), [this](int index) { if (0 == index) return; @@ -405,7 +403,7 @@ void IOWindow::ConnectWidgets() m_operators_combo->setCurrentIndex(0); }); - connect(m_functions_combo, QOverload::of(&QComboBox::activated), [this](int index) { + connect(m_functions_combo, qOverload(&QComboBox::activated), [this](int index) { if (0 == index) return; diff --git a/Source/Core/DolphinQt/Config/Mapping/MappingNumeric.cpp b/Source/Core/DolphinQt/Config/Mapping/MappingNumeric.cpp index 6079bd4881..d84310ffa7 100644 --- a/Source/Core/DolphinQt/Config/Mapping/MappingNumeric.cpp +++ b/Source/Core/DolphinQt/Config/Mapping/MappingNumeric.cpp @@ -19,7 +19,7 @@ MappingDouble::MappingDouble(MappingWidget* parent, ControllerEmu::NumericSettin if (const auto ui_description = m_setting.GetUIDescription()) setToolTip(tr(ui_description)); - connect(this, QOverload::of(&QDoubleSpinBox::valueChanged), this, + connect(this, qOverload(&QDoubleSpinBox::valueChanged), this, [this, parent](double value) { m_setting.SetValue(value); ConfigChanged(); diff --git a/Source/Core/DolphinQt/Config/Mapping/MappingWidget.cpp b/Source/Core/DolphinQt/Config/Mapping/MappingWidget.cpp index d9f348947e..01512d0cc3 100644 --- a/Source/Core/DolphinQt/Config/Mapping/MappingWidget.cpp +++ b/Source/Core/DolphinQt/Config/Mapping/MappingWidget.cpp @@ -101,7 +101,7 @@ QGroupBox* MappingWidget::CreateGroupBox(const QString& name, ControllerEmu::Con indicator_layout->setAlignment(Qt::AlignCenter); 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 || group->type == ControllerEmu::GroupType::Stick || diff --git a/Source/Core/DolphinQt/Config/Mapping/MappingWindow.cpp b/Source/Core/DolphinQt/Config/Mapping/MappingWindow.cpp index 0052278b90..4622b86271 100644 --- a/Source/Core/DolphinQt/Config/Mapping/MappingWindow.cpp +++ b/Source/Core/DolphinQt/Config/Mapping/MappingWindow.cpp @@ -153,8 +153,8 @@ void MappingWindow::ConnectWidgets() connect(&Settings::Instance(), &Settings::DevicesChanged, this, &MappingWindow::OnGlobalDevicesChanged); connect(this, &MappingWindow::ConfigChanged, this, &MappingWindow::OnGlobalDevicesChanged); - connect(m_devices_combo, static_cast(&QComboBox::currentIndexChanged), - this, &MappingWindow::OnSelectDevice); + connect(m_devices_combo, qOverload(&QComboBox::currentIndexChanged), this, + &MappingWindow::OnSelectDevice); connect(m_devices_refresh, &QPushButton::clicked, this, &MappingWindow::RefreshDevices); diff --git a/Source/Core/DolphinQt/Config/Mapping/WiimoteEmuGeneral.cpp b/Source/Core/DolphinQt/Config/Mapping/WiimoteEmuGeneral.cpp index 0084bc5bee..090e050a1e 100644 --- a/Source/Core/DolphinQt/Config/Mapping/WiimoteEmuGeneral.cpp +++ b/Source/Core/DolphinQt/Config/Mapping/WiimoteEmuGeneral.cpp @@ -77,9 +77,9 @@ void WiimoteEmuGeneral::CreateMainLayout() void WiimoteEmuGeneral::Connect() { - connect(m_extension_combo, QOverload::of(&QComboBox::currentIndexChanged), this, + connect(m_extension_combo, qOverload(&QComboBox::currentIndexChanged), this, &WiimoteEmuGeneral::OnAttachmentChanged); - connect(m_extension_combo, QOverload::of(&QComboBox::activated), this, + connect(m_extension_combo, qOverload(&QComboBox::activated), this, &WiimoteEmuGeneral::OnAttachmentSelected); connect(this, &MappingWidget::ConfigChanged, this, &WiimoteEmuGeneral::ConfigChanged); connect(this, &MappingWidget::Update, this, &WiimoteEmuGeneral::Update); diff --git a/Source/Core/DolphinQt/Config/NewPatchDialog.cpp b/Source/Core/DolphinQt/Config/NewPatchDialog.cpp index eb5e9fd354..9ee9e76218 100644 --- a/Source/Core/DolphinQt/Config/NewPatchDialog.cpp +++ b/Source/Core/DolphinQt/Config/NewPatchDialog.cpp @@ -68,7 +68,7 @@ void NewPatchDialog::CreateWidgets() void NewPatchDialog::ConnectWidgets() { - connect(m_name_edit, static_cast(&QLineEdit::textEdited), + connect(m_name_edit, qOverload(&QLineEdit::textEdited), [this](const QString& name) { m_patch.name = name.toStdString(); }); 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); box->setLayout(layout); - connect(offset, static_cast(&QLineEdit::textEdited), + connect(offset, qOverload(&QLineEdit::textEdited), [&entry, offset](const QString& text) { bool okay = true; entry.address = text.toUInt(&okay, 16); @@ -147,7 +147,7 @@ QGroupBox* NewPatchDialog::CreateEntry(PatchEngine::PatchEntry& entry) offset->setPalette(palette); }); - connect(value, static_cast(&QLineEdit::textEdited), + connect(value, qOverload(&QLineEdit::textEdited), [&entry, value](const QString& text) { bool okay; entry.value = text.toUInt(&okay, 16); diff --git a/Source/Core/DolphinQt/FIFO/FIFOPlayerWindow.cpp b/Source/Core/DolphinQt/FIFO/FIFOPlayerWindow.cpp index 7e1ccb6075..ae351792fe 100644 --- a/Source/Core/DolphinQt/FIFO/FIFOPlayerWindow.cpp +++ b/Source/Core/DolphinQt/FIFO/FIFOPlayerWindow.cpp @@ -169,14 +169,14 @@ void FIFOPlayerWindow::ConnectWidgets() connect(m_button_box, &QDialogButtonBox::rejected, this, &FIFOPlayerWindow::reject); connect(m_early_memory_updates, &QCheckBox::toggled, this, &FIFOPlayerWindow::OnEarlyMemoryUpdatesChanged); - connect(m_frame_range_from, static_cast(&QSpinBox::valueChanged), this, + connect(m_frame_range_from, qOverload(&QSpinBox::valueChanged), this, &FIFOPlayerWindow::OnLimitsChanged); - connect(m_frame_range_to, static_cast(&QSpinBox::valueChanged), this, + connect(m_frame_range_to, qOverload(&QSpinBox::valueChanged), this, &FIFOPlayerWindow::OnLimitsChanged); - connect(m_object_range_from, static_cast(&QSpinBox::valueChanged), this, + connect(m_object_range_from, qOverload(&QSpinBox::valueChanged), this, &FIFOPlayerWindow::OnLimitsChanged); - connect(m_object_range_to, static_cast(&QSpinBox::valueChanged), this, + connect(m_object_range_to, qOverload(&QSpinBox::valueChanged), this, &FIFOPlayerWindow::OnLimitsChanged); } diff --git a/Source/Core/DolphinQt/NetPlay/NetPlayBrowser.cpp b/Source/Core/DolphinQt/NetPlay/NetPlayBrowser.cpp index 29016b7565..3c68a5c274 100644 --- a/Source/Core/DolphinQt/NetPlay/NetPlayBrowser.cpp +++ b/Source/Core/DolphinQt/NetPlay/NetPlayBrowser.cpp @@ -126,8 +126,8 @@ void NetPlayBrowser::CreateWidgets() void NetPlayBrowser::ConnectWidgets() { - connect(m_region_combo, static_cast(&QComboBox::currentIndexChanged), - this, &NetPlayBrowser::Refresh); + connect(m_region_combo, qOverload(&QComboBox::currentIndexChanged), this, + &NetPlayBrowser::Refresh); connect(m_button_box, &QDialogButtonBox::accepted, this, &NetPlayBrowser::accept); connect(m_button_box, &QDialogButtonBox::rejected, this, &NetPlayBrowser::reject); diff --git a/Source/Core/DolphinQt/NetPlay/NetPlayDialog.cpp b/Source/Core/DolphinQt/NetPlay/NetPlayDialog.cpp index 230823b8b6..caa0037d81 100644 --- a/Source/Core/DolphinQt/NetPlay/NetPlayDialog.cpp +++ b/Source/Core/DolphinQt/NetPlay/NetPlayDialog.cpp @@ -255,7 +255,7 @@ void NetPlayDialog::CreatePlayersLayout() void NetPlayDialog::ConnectWidgets() { // Players - connect(m_room_box, static_cast(&QComboBox::currentIndexChanged), this, + connect(m_room_box, qOverload(&QComboBox::currentIndexChanged), this, &NetPlayDialog::UpdateGUI); connect(m_hostcode_action_button, &QPushButton::clicked, [this] { if (m_is_copy_button_retry && m_room_box->currentIndex() == 0) @@ -286,18 +286,17 @@ void NetPlayDialog::ConnectWidgets() [this] { m_chat_send_button->setEnabled(!m_chat_type_edit->text().isEmpty()); }); // Other - connect(m_buffer_size_box, static_cast(&QSpinBox::valueChanged), - [this](int value) { - if (value == m_buffer_size) - return; + connect(m_buffer_size_box, qOverload(&QSpinBox::valueChanged), [this](int value) { + if (value == m_buffer_size) + return; - auto client = Settings::Instance().GetNetPlayClient(); - auto server = Settings::Instance().GetNetPlayServer(); - if (server && !m_host_input_authority) - server->AdjustPadBufferSize(value); - else - client->AdjustPadBufferSize(value); - }); + auto client = Settings::Instance().GetNetPlayClient(); + auto server = Settings::Instance().GetNetPlayServer(); + if (server && !m_host_input_authority) + server->AdjustPadBufferSize(value); + else + client->AdjustPadBufferSize(value); + }); const auto hia_function = [this](bool enable) { if (m_host_input_authority != enable) @@ -345,7 +344,7 @@ void NetPlayDialog::ConnectWidgets() // SaveSettings() - Save Hosting-Dialog Settings - connect(m_buffer_size_box, static_cast(&QSpinBox::valueChanged), this, + connect(m_buffer_size_box, qOverload(&QSpinBox::valueChanged), this, &NetPlayDialog::SaveSettings); connect(m_save_sd_action, &QAction::toggled, this, &NetPlayDialog::SaveSettings); connect(m_load_wii_action, &QAction::toggled, this, &NetPlayDialog::SaveSettings); diff --git a/Source/Core/DolphinQt/NetPlay/NetPlaySetupDialog.cpp b/Source/Core/DolphinQt/NetPlay/NetPlaySetupDialog.cpp index 634c3fb17d..d35970288d 100644 --- a/Source/Core/DolphinQt/NetPlay/NetPlaySetupDialog.cpp +++ b/Source/Core/DolphinQt/NetPlay/NetPlaySetupDialog.cpp @@ -199,22 +199,21 @@ void NetPlaySetupDialog::CreateMainLayout() void NetPlaySetupDialog::ConnectWidgets() { - connect(m_connection_type, static_cast(&QComboBox::currentIndexChanged), - this, &NetPlaySetupDialog::OnConnectionTypeChanged); + connect(m_connection_type, qOverload(&QComboBox::currentIndexChanged), this, + &NetPlaySetupDialog::OnConnectionTypeChanged); connect(m_nickname_edit, &QLineEdit::textChanged, this, &NetPlaySetupDialog::SaveSettings); // Connect widget connect(m_ip_edit, &QLineEdit::textChanged, this, &NetPlaySetupDialog::SaveSettings); - connect(m_connect_port_box, static_cast(&QSpinBox::valueChanged), this, + connect(m_connect_port_box, qOverload(&QSpinBox::valueChanged), this, &NetPlaySetupDialog::SaveSettings); // Host widget - connect(m_host_port_box, static_cast(&QSpinBox::valueChanged), this, + connect(m_host_port_box, qOverload(&QSpinBox::valueChanged), this, &NetPlaySetupDialog::SaveSettings); - connect(m_host_games, static_cast(&QListWidget::currentRowChanged), - [this](int index) { - Settings::GetQSettings().setValue(QStringLiteral("netplay/hostgame"), - m_host_games->item(index)->text()); - }); + connect(m_host_games, qOverload(&QListWidget::currentRowChanged), [this](int index) { + Settings::GetQSettings().setValue(QStringLiteral("netplay/hostgame"), + m_host_games->item(index)->text()); + }); connect(m_host_games, &QListWidget::itemDoubleClicked, this, &NetPlaySetupDialog::accept); @@ -224,8 +223,7 @@ void NetPlaySetupDialog::ConnectWidgets() m_host_chunked_upload_limit_box->setEnabled(value); SaveSettings(); }); - connect(m_host_chunked_upload_limit_box, - static_cast(&QSpinBox::valueChanged), this, + connect(m_host_chunked_upload_limit_box, qOverload(&QSpinBox::valueChanged), this, &NetPlaySetupDialog::SaveSettings); connect(m_host_server_browser, &QCheckBox::toggled, this, &NetPlaySetupDialog::SaveSettings); diff --git a/Source/Core/DolphinQt/NetPlay/PadMappingDialog.cpp b/Source/Core/DolphinQt/NetPlay/PadMappingDialog.cpp index b9caaace82..83df023028 100644 --- a/Source/Core/DolphinQt/NetPlay/PadMappingDialog.cpp +++ b/Source/Core/DolphinQt/NetPlay/PadMappingDialog.cpp @@ -48,11 +48,11 @@ void PadMappingDialog::CreateWidgets() void PadMappingDialog::ConnectWidgets() { 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(&QComboBox::currentIndexChanged), this, + connect(combo, qOverload(&QComboBox::currentIndexChanged), this, &PadMappingDialog::OnMappingChanged); } } diff --git a/Source/Core/DolphinQt/Settings/AudioPane.cpp b/Source/Core/DolphinQt/Settings/AudioPane.cpp index 8eec0dfae6..4932ce1a7e 100644 --- a/Source/Core/DolphinQt/Settings/AudioPane.cpp +++ b/Source/Core/DolphinQt/Settings/AudioPane.cpp @@ -171,12 +171,12 @@ void AudioPane::CreateWidgets() void AudioPane::ConnectWidgets() { - connect(m_backend_combo, static_cast(&QComboBox::currentIndexChanged), - this, &AudioPane::SaveSettings); + connect(m_backend_combo, qOverload(&QComboBox::currentIndexChanged), this, + &AudioPane::SaveSettings); connect(m_volume_slider, &QSlider::valueChanged, this, &AudioPane::SaveSettings); if (m_latency_control_supported) { - connect(m_latency_spin, static_cast(&QSpinBox::valueChanged), this, + connect(m_latency_spin, qOverload(&QSpinBox::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); #ifdef _WIN32 - connect(m_wasapi_device_combo, - static_cast(&QComboBox::currentIndexChanged), this, + connect(m_wasapi_device_combo, qOverload(&QComboBox::currentIndexChanged), this, &AudioPane::SaveSettings); #endif } diff --git a/Source/Core/DolphinQt/Settings/GameCubePane.cpp b/Source/Core/DolphinQt/Settings/GameCubePane.cpp index b0cfab9999..6700984ac7 100644 --- a/Source/Core/DolphinQt/Settings/GameCubePane.cpp +++ b/Source/Core/DolphinQt/Settings/GameCubePane.cpp @@ -130,15 +130,15 @@ void GameCubePane::ConnectWidgets() { // IPL Settings connect(m_skip_main_menu, &QCheckBox::stateChanged, this, &GameCubePane::SaveSettings); - connect(m_language_combo, QOverload::of(&QComboBox::currentIndexChanged), this, + connect(m_language_combo, qOverload(&QComboBox::currentIndexChanged), this, &GameCubePane::SaveSettings); // Device Settings for (int i = 0; i < SLOT_COUNT; i++) { - connect(m_slot_combos[i], QOverload::of(&QComboBox::currentIndexChanged), this, + connect(m_slot_combos[i], qOverload(&QComboBox::currentIndexChanged), this, [this, i] { UpdateButton(i); }); - connect(m_slot_combos[i], QOverload::of(&QComboBox::currentIndexChanged), this, + connect(m_slot_combos[i], qOverload(&QComboBox::currentIndexChanged), this, &GameCubePane::SaveSettings); connect(m_slot_buttons[i], &QPushButton::clicked, [this, i] { OnConfigPressed(i); }); } diff --git a/Source/Core/DolphinQt/Settings/GeneralPane.cpp b/Source/Core/DolphinQt/Settings/GeneralPane.cpp index 1d8cc485a7..24370daa77 100644 --- a/Source/Core/DolphinQt/Settings/GeneralPane.cpp +++ b/Source/Core/DolphinQt/Settings/GeneralPane.cpp @@ -96,16 +96,14 @@ void GeneralPane::ConnectLayout() if (AutoUpdateChecker::SystemSupportsAutoUpdates()) { - connect(m_combobox_update_track, - static_cast(&QComboBox::currentIndexChanged), this, + connect(m_combobox_update_track, qOverload(&QComboBox::currentIndexChanged), this, &GeneralPane::OnSaveConfig); connect(&Settings::Instance(), &Settings::AutoUpdateTrackChanged, this, &GeneralPane::LoadConfig); } // Advanced - connect(m_combobox_speedlimit, - static_cast(&QComboBox::currentIndexChanged), + connect(m_combobox_speedlimit, qOverload(&QComboBox::currentIndexChanged), [this]() { OnSaveConfig(); }); #if defined(USE_ANALYTICS) && USE_ANALYTICS diff --git a/Source/Core/DolphinQt/Settings/InterfacePane.cpp b/Source/Core/DolphinQt/Settings/InterfacePane.cpp index 8281ae0132..51422f237b 100644 --- a/Source/Core/DolphinQt/Settings/InterfacePane.cpp +++ b/Source/Core/DolphinQt/Settings/InterfacePane.cpp @@ -188,14 +188,11 @@ void InterfacePane::ConnectLayout() connect(m_checkbox_use_covers, &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_combobox_theme, - static_cast(&QComboBox::currentIndexChanged), + connect(m_combobox_theme, qOverload(&QComboBox::currentIndexChanged), &Settings::Instance(), &Settings::SetThemeName); - connect(m_combobox_userstyle, - static_cast(&QComboBox::currentIndexChanged), this, + connect(m_combobox_userstyle, qOverload(&QComboBox::currentIndexChanged), this, &InterfacePane::OnSaveConfig); - connect(m_combobox_language, - static_cast(&QComboBox::currentIndexChanged), this, + connect(m_combobox_language, qOverload(&QComboBox::currentIndexChanged), this, &InterfacePane::OnSaveConfig); connect(m_checkbox_top_window, &QCheckBox::toggled, this, &InterfacePane::OnSaveConfig); connect(m_checkbox_confirm_on_stop, &QCheckBox::toggled, this, &InterfacePane::OnSaveConfig); diff --git a/Source/Core/DolphinQt/Settings/WiiPane.cpp b/Source/Core/DolphinQt/Settings/WiiPane.cpp index 2a4771292a..6cdf0670b6 100644 --- a/Source/Core/DolphinQt/Settings/WiiPane.cpp +++ b/Source/Core/DolphinQt/Settings/WiiPane.cpp @@ -64,11 +64,9 @@ void WiiPane::CreateLayout() void WiiPane::ConnectLayout() { // Misc Settings - connect(m_aspect_ratio_choice, - static_cast(&QComboBox::currentIndexChanged), this, + connect(m_aspect_ratio_choice, qOverload(&QComboBox::currentIndexChanged), this, &WiiPane::OnSaveConfig); - connect(m_system_language_choice, - static_cast(&QComboBox::currentIndexChanged), this, + connect(m_system_language_choice, qOverload(&QComboBox::currentIndexChanged), this, &WiiPane::OnSaveConfig); connect(m_screensaver_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); // Wii Remote Settings - connect(m_wiimote_ir_sensor_position, - static_cast(&QComboBox::currentIndexChanged), this, + connect(m_wiimote_ir_sensor_position, qOverload(&QComboBox::currentIndexChanged), this, &WiiPane::OnSaveConfig); connect(m_wiimote_ir_sensitivity, &QSlider::valueChanged, this, &WiiPane::OnSaveConfig); connect(m_wiimote_speaker_volume, &QSlider::valueChanged, this, &WiiPane::OnSaveConfig); diff --git a/Source/Core/DolphinQt/TAS/TASInputWindow.cpp b/Source/Core/DolphinQt/TAS/TASInputWindow.cpp index 7373c323b6..aee223b3c6 100644 --- a/Source/Core/DolphinQt/TAS/TASInputWindow.cpp +++ b/Source/Core/DolphinQt/TAS/TASInputWindow.cpp @@ -54,10 +54,8 @@ QGroupBox* TASInputWindow::CreateStickInputs(QString name, QSpinBox*& x_value, Q y_value->setMaximumWidth(60); auto* visual = new StickWidget(this, max_x, max_y); - connect(x_value, static_cast(&QSpinBox::valueChanged), visual, - &StickWidget::SetX); - connect(y_value, static_cast(&QSpinBox::valueChanged), visual, - &StickWidget::SetY); + connect(x_value, qOverload(&QSpinBox::valueChanged), visual, &StickWidget::SetX); + connect(y_value, qOverload(&QSpinBox::valueChanged), visual, &StickWidget::SetY); connect(visual, &StickWidget::ChangedX, x_value, &QSpinBox::setValue); connect(visual, &StickWidget::ChangedY, y_value, &QSpinBox::setValue); @@ -105,19 +103,17 @@ QSpinBox* TASInputWindow::CreateSliderValuePair(QBoxLayout* layout, u16 max, { auto* value = new QSpinBox(); value->setRange(0, 99999); - connect(value, static_cast(&QSpinBox::valueChanged), - [value, max](int i) { - if (i > max) - value->setValue(max); - }); + connect(value, qOverload(&QSpinBox::valueChanged), [value, max](int i) { + if (i > max) + value->setValue(max); + }); auto* slider = new QSlider(orientation); slider->setRange(0, max); slider->setFocusPolicy(Qt::ClickFocus); slider->setInvertedAppearance(invert); connect(slider, &QSlider::valueChanged, value, &QSpinBox::setValue); - connect(value, static_cast(&QSpinBox::valueChanged), slider, - &QSlider::setValue); + connect(value, qOverload(&QSpinBox::valueChanged), slider, &QSlider::setValue); auto* shortcut = new QShortcut(shortcut_key_sequence, shortcut_widget); connect(shortcut, &QShortcut::activated, [value] { diff --git a/Source/Core/DolphinQt/TAS/WiiTASInputWindow.cpp b/Source/Core/DolphinQt/TAS/WiiTASInputWindow.cpp index b656ca280d..39a6db58a1 100644 --- a/Source/Core/DolphinQt/TAS/WiiTASInputWindow.cpp +++ b/Source/Core/DolphinQt/TAS/WiiTASInputWindow.cpp @@ -58,10 +58,8 @@ WiiTASInputWindow::WiiTASInputWindow(QWidget* parent, int num) : TASInputWindow( m_ir_y_value->setMaximumWidth(60); auto* visual = new IRWidget(this); - connect(m_ir_x_value, static_cast(&QSpinBox::valueChanged), visual, - &IRWidget::SetX); - connect(m_ir_y_value, static_cast(&QSpinBox::valueChanged), visual, - &IRWidget::SetY); + connect(m_ir_x_value, qOverload(&QSpinBox::valueChanged), visual, &IRWidget::SetX); + connect(m_ir_y_value, qOverload(&QSpinBox::valueChanged), visual, &IRWidget::SetY); connect(visual, &IRWidget::ChangedX, m_ir_x_value, &QSpinBox::setValue); connect(visual, &IRWidget::ChangedY, m_ir_y_value, &QSpinBox::setValue);