mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-24 14:49:42 -06:00
DolphinQt: Use qOverload where applicable
Provides the same behvaior, but in a much more concise manner.
This commit is contained in:
@ -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<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged), this,
|
||||
connect(m_wiimote_boxes[i], qOverload<int>(&QComboBox::currentIndexChanged), this,
|
||||
&ControllersWindow::SaveSettings);
|
||||
connect(m_wiimote_boxes[i],
|
||||
static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged), this,
|
||||
connect(m_wiimote_boxes[i], qOverload<int>(&QComboBox::currentIndexChanged), this,
|
||||
&ControllersWindow::OnWiimoteModeChanged);
|
||||
connect(m_wiimote_buttons[i], &QPushButton::clicked, this,
|
||||
&ControllersWindow::OnWiimoteConfigure);
|
||||
|
||||
connect(m_gc_controller_boxes[i],
|
||||
static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged), this,
|
||||
connect(m_gc_controller_boxes[i], qOverload<int>(&QComboBox::currentIndexChanged), this,
|
||||
&ControllersWindow::SaveSettings);
|
||||
connect(m_gc_controller_boxes[i],
|
||||
static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged), this,
|
||||
connect(m_gc_controller_boxes[i], qOverload<int>(&QComboBox::currentIndexChanged), this,
|
||||
&ControllersWindow::OnGCTypeChanged);
|
||||
connect(m_gc_buttons[i], &QPushButton::clicked, this, &ControllersWindow::OnGCPadConfigure);
|
||||
}
|
||||
|
@ -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<void (QCompleter::*)(const QString&)>(&QCompleter::activated),
|
||||
this, &GameConfigEdit::OnAutoComplete);
|
||||
connect(m_completer, qOverload<const QString&>(&QCompleter::activated), this,
|
||||
&GameConfigEdit::OnAutoComplete);
|
||||
}
|
||||
|
||||
void GameConfigEdit::OnSelectionChanged()
|
||||
|
@ -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<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged), this,
|
||||
connect(m_deterministic_dual_core, qOverload<int>(&QComboBox::currentIndexChanged), this,
|
||||
&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);
|
||||
connect(m_convergence_spin, static_cast<void (QSpinBox::*)(int)>(&QSpinBox::valueChanged), this,
|
||||
connect(m_convergence_spin, qOverload<int>(&QSpinBox::valueChanged), this,
|
||||
&GameConfigWidget::SaveSettings);
|
||||
}
|
||||
|
||||
|
@ -144,18 +144,17 @@ void EnhancementsWidget::CreateWidgets()
|
||||
|
||||
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(); });
|
||||
connect(m_pp_effect, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged),
|
||||
connect(m_pp_effect, qOverload<int>(&QComboBox::currentIndexChanged),
|
||||
[this](int) { SaveSettings(); });
|
||||
connect(m_3d_mode, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged),
|
||||
[this] {
|
||||
m_block_save = true;
|
||||
LoadPPShaders();
|
||||
m_block_save = false;
|
||||
connect(m_3d_mode, qOverload<int>(&QComboBox::currentIndexChanged), [this] {
|
||||
m_block_save = true;
|
||||
LoadPPShaders();
|
||||
m_block_save = false;
|
||||
|
||||
SaveSettings();
|
||||
});
|
||||
SaveSettings();
|
||||
});
|
||||
connect(m_configure_pp_effect, &QPushButton::clicked, this,
|
||||
&EnhancementsWidget::ConfigurePostProcessingShader);
|
||||
}
|
||||
|
@ -138,13 +138,12 @@ void GeneralWidget::CreateWidgets()
|
||||
void GeneralWidget::ConnectWidgets()
|
||||
{
|
||||
// Video Backend
|
||||
connect(m_backend_combo, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged),
|
||||
this, &GeneralWidget::SaveSettings);
|
||||
connect(m_adapter_combo, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged),
|
||||
this, [](int index) {
|
||||
g_Config.iAdapter = index;
|
||||
Config::SetBaseOrCurrent(Config::GFX_ADAPTER, index);
|
||||
});
|
||||
connect(m_backend_combo, qOverload<int>(&QComboBox::currentIndexChanged), this,
|
||||
&GeneralWidget::SaveSettings);
|
||||
connect(m_adapter_combo, qOverload<int>(&QComboBox::currentIndexChanged), this, [](int index) {
|
||||
g_Config.iAdapter = index;
|
||||
Config::SetBaseOrCurrent(Config::GFX_ADAPTER, index);
|
||||
});
|
||||
}
|
||||
|
||||
void GeneralWidget::LoadSettings()
|
||||
|
@ -14,8 +14,7 @@ GraphicsChoice::GraphicsChoice(const QStringList& options, const Config::ConfigI
|
||||
: m_setting(setting)
|
||||
{
|
||||
addItems(options);
|
||||
connect(this, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged), this,
|
||||
&GraphicsChoice::Update);
|
||||
connect(this, qOverload<int>(&QComboBox::currentIndexChanged), this, &GraphicsChoice::Update);
|
||||
setCurrentIndex(Config::Get(m_setting));
|
||||
|
||||
connect(&Settings::Instance(), &Settings::ConfigChanged, [this] {
|
||||
|
@ -20,9 +20,7 @@ GraphicsInteger::GraphicsInteger(int minimum, int maximum, const Config::ConfigI
|
||||
|
||||
setValue(Config::Get(setting));
|
||||
|
||||
connect(this, static_cast<void (GraphicsInteger::*)(int)>(&GraphicsInteger::valueChanged), this,
|
||||
&GraphicsInteger::Update);
|
||||
|
||||
connect(this, qOverload<int>(&GraphicsInteger::valueChanged), this, &GraphicsInteger::Update);
|
||||
connect(&Settings::Instance(), &Settings::ConfigChanged, [this] {
|
||||
QFont bf = font();
|
||||
bf.setBold(Config::GetActiveLayerForConfig(m_setting) != Config::LayerType::Base);
|
||||
|
@ -111,11 +111,11 @@ void SoftwareRendererWidget::CreateWidgets()
|
||||
|
||||
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(); });
|
||||
connect(m_object_range_min, static_cast<void (QSpinBox::*)(int)>(&QSpinBox::valueChanged),
|
||||
connect(m_object_range_min, qOverload<int>(&QSpinBox::valueChanged),
|
||||
[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(); });
|
||||
}
|
||||
|
||||
|
@ -175,8 +175,7 @@ void InfoWidget::CreateLanguageSelector()
|
||||
if (m_language_selector->count() == 1)
|
||||
m_language_selector->setDisabled(true);
|
||||
|
||||
connect(m_language_selector,
|
||||
static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged), this,
|
||||
connect(m_language_selector, qOverload<int>(&QComboBox::currentIndexChanged), this,
|
||||
&InfoWidget::ChangeLanguage);
|
||||
}
|
||||
|
||||
|
@ -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<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged), this,
|
||||
connect(m_log_font, qOverload<int>(&QComboBox::currentIndexChanged), this,
|
||||
&LogWidget::SaveSettings);
|
||||
connect(this, &QDockWidget::topLevelChanged, this, &LogWidget::SaveSettings);
|
||||
connect(&Settings::Instance(), &Settings::LogVisibilityChanged, this, &LogWidget::setVisible);
|
||||
|
@ -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<void (QSpinBox::*)(int value)>(&QSpinBox::valueChanged),
|
||||
this, &IOWindow::OnRangeChanged);
|
||||
connect(m_range_slider, static_cast<void (QSlider::*)(int value)>(&QSlider::valueChanged), this,
|
||||
connect(m_range_spinbox, qOverload<int>(&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<int>::of(&QComboBox::activated), [this](int index) {
|
||||
connect(m_operators_combo, qOverload<int>(&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<int>::of(&QComboBox::activated), [this](int index) {
|
||||
connect(m_functions_combo, qOverload<int>(&QComboBox::activated), [this](int index) {
|
||||
if (0 == index)
|
||||
return;
|
||||
|
||||
|
@ -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<double>::of(&QDoubleSpinBox::valueChanged), this,
|
||||
connect(this, qOverload<double>(&QDoubleSpinBox::valueChanged), this,
|
||||
[this, parent](double value) {
|
||||
m_setting.SetValue(value);
|
||||
ConfigChanged();
|
||||
|
@ -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 ||
|
||||
|
@ -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<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged),
|
||||
this, &MappingWindow::OnSelectDevice);
|
||||
connect(m_devices_combo, qOverload<int>(&QComboBox::currentIndexChanged), this,
|
||||
&MappingWindow::OnSelectDevice);
|
||||
|
||||
connect(m_devices_refresh, &QPushButton::clicked, this, &MappingWindow::RefreshDevices);
|
||||
|
||||
|
@ -77,9 +77,9 @@ void WiimoteEmuGeneral::CreateMainLayout()
|
||||
|
||||
void WiimoteEmuGeneral::Connect()
|
||||
{
|
||||
connect(m_extension_combo, QOverload<int>::of(&QComboBox::currentIndexChanged), this,
|
||||
connect(m_extension_combo, qOverload<int>(&QComboBox::currentIndexChanged), this,
|
||||
&WiimoteEmuGeneral::OnAttachmentChanged);
|
||||
connect(m_extension_combo, QOverload<int>::of(&QComboBox::activated), this,
|
||||
connect(m_extension_combo, qOverload<int>(&QComboBox::activated), this,
|
||||
&WiimoteEmuGeneral::OnAttachmentSelected);
|
||||
connect(this, &MappingWidget::ConfigChanged, this, &WiimoteEmuGeneral::ConfigChanged);
|
||||
connect(this, &MappingWidget::Update, this, &WiimoteEmuGeneral::Update);
|
||||
|
@ -68,7 +68,7 @@ void NewPatchDialog::CreateWidgets()
|
||||
|
||||
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(); });
|
||||
|
||||
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<void (QLineEdit::*)(const QString&)>(&QLineEdit::textEdited),
|
||||
connect(offset, qOverload<const QString&>(&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<void (QLineEdit::*)(const QString&)>(&QLineEdit::textEdited),
|
||||
connect(value, qOverload<const QString&>(&QLineEdit::textEdited),
|
||||
[&entry, value](const QString& text) {
|
||||
bool okay;
|
||||
entry.value = text.toUInt(&okay, 16);
|
||||
|
Reference in New Issue
Block a user