Qt: Remove unnecessary usage of QOverload

pull/3799/head
Davide Pesavento 7 days ago
parent 63d72ac156
commit 9c5137303e
No known key found for this signature in database

@ -38,12 +38,11 @@ BIOSSettingsWidget::BIOSSettingsWidget(SettingsWindow* dialog, QWidget* parent)
SettingWidgetBinder::BindWidgetToStringSetting(sif, m_ui.pioImagePath, "PIO", "FlashImagePath"); SettingWidgetBinder::BindWidgetToStringSetting(sif, m_ui.pioImagePath, "PIO", "FlashImagePath");
SettingWidgetBinder::BindWidgetToBoolSetting(sif, m_ui.pioSwitchActive, "PIO", "SwitchActive", true); SettingWidgetBinder::BindWidgetToBoolSetting(sif, m_ui.pioSwitchActive, "PIO", "SwitchActive", true);
SettingWidgetBinder::BindWidgetToBoolSetting(sif, m_ui.pioImageWrites, "PIO", "FlashImageWriteEnable", false); SettingWidgetBinder::BindWidgetToBoolSetting(sif, m_ui.pioImageWrites, "PIO", "FlashImageWriteEnable", false);
connect(m_ui.pioDeviceType, QOverload<int>::of(&QComboBox::currentIndexChanged), this, connect(m_ui.pioDeviceType, &QComboBox::currentIndexChanged, this, &BIOSSettingsWidget::onPIODeviceTypeChanged);
&BIOSSettingsWidget::onPIODeviceTypeChanged);
connect(m_ui.pioImagePathBrowse, &QPushButton::clicked, this, &BIOSSettingsWidget::onPIOImagePathBrowseClicked); connect(m_ui.pioImagePathBrowse, &QPushButton::clicked, this, &BIOSSettingsWidget::onPIOImagePathBrowseClicked);
onPIODeviceTypeChanged(); onPIODeviceTypeChanged();
connect(m_ui.imageNTSCJ, QOverload<int>::of(&QComboBox::currentIndexChanged), [this](int index) { connect(m_ui.imageNTSCJ, &QComboBox::currentIndexChanged, [this](int index) {
if (m_dialog->isPerGameSettings() && index == 0) if (m_dialog->isPerGameSettings() && index == 0)
{ {
m_dialog->removeSettingValue("BIOS", "PathNTSCJ"); m_dialog->removeSettingValue("BIOS", "PathNTSCJ");
@ -54,7 +53,7 @@ BIOSSettingsWidget::BIOSSettingsWidget(SettingsWindow* dialog, QWidget* parent)
m_ui.imageNTSCJ->itemData(index).toString().toStdString().c_str()); m_ui.imageNTSCJ->itemData(index).toString().toStdString().c_str());
} }
}); });
connect(m_ui.imageNTSCU, QOverload<int>::of(&QComboBox::currentIndexChanged), [this](int index) { connect(m_ui.imageNTSCU, &QComboBox::currentIndexChanged, [this](int index) {
if (m_dialog->isPerGameSettings() && index == 0) if (m_dialog->isPerGameSettings() && index == 0)
{ {
m_dialog->removeSettingValue("BIOS", "PathNTSCU"); m_dialog->removeSettingValue("BIOS", "PathNTSCU");
@ -65,7 +64,7 @@ BIOSSettingsWidget::BIOSSettingsWidget(SettingsWindow* dialog, QWidget* parent)
m_ui.imageNTSCU->itemData(index).toString().toStdString().c_str()); m_ui.imageNTSCU->itemData(index).toString().toStdString().c_str());
} }
}); });
connect(m_ui.imagePAL, QOverload<int>::of(&QComboBox::currentIndexChanged), [this](int index) { connect(m_ui.imagePAL, &QComboBox::currentIndexChanged, [this](int index) {
if (m_dialog->isPerGameSettings() && index == 0) if (m_dialog->isPerGameSettings() && index == 0)
{ {
m_dialog->removeSettingValue("BIOS", "PathPAL"); m_dialog->removeSettingValue("BIOS", "PathPAL");

@ -52,8 +52,7 @@ ControllerBindingWidget::ControllerBindingWidget(QWidget* parent, ControllerSett
populateControllerTypes(); populateControllerTypes();
populateWidgets(); populateWidgets();
connect(m_ui.controllerType, QOverload<int>::of(&QComboBox::currentIndexChanged), this, connect(m_ui.controllerType, &QComboBox::currentIndexChanged, this, &ControllerBindingWidget::onTypeChanged);
&ControllerBindingWidget::onTypeChanged);
connect(m_ui.bindings, &QPushButton::clicked, this, &ControllerBindingWidget::onBindingsClicked); connect(m_ui.bindings, &QPushButton::clicked, this, &ControllerBindingWidget::onBindingsClicked);
connect(m_ui.settings, &QPushButton::clicked, this, &ControllerBindingWidget::onSettingsClicked); connect(m_ui.settings, &QPushButton::clicked, this, &ControllerBindingWidget::onSettingsClicked);
connect(m_ui.macros, &QPushButton::clicked, this, &ControllerBindingWidget::onMacrosClicked); connect(m_ui.macros, &QPushButton::clicked, this, &ControllerBindingWidget::onMacrosClicked);

@ -109,8 +109,7 @@ static void InitializeSpeedControl(SettingsWindow* dialog, QSpinBox* spinbox, QC
QPushButton* reset_button, const char* setting_name, float default_value) QPushButton* reset_button, const char* setting_name, float default_value)
{ {
const SpeedControl control{dialog, spinbox, checkbox, setting_name, default_value}; const SpeedControl control{dialog, spinbox, checkbox, setting_name, default_value};
QObject::connect(spinbox, QOverload<int>::of(&QSpinBox::valueChanged), spinbox, QObject::connect(spinbox, &QSpinBox::valueChanged, spinbox, [control](int) { OnSpeedControlValueChanged(control); });
[control](int) { OnSpeedControlValueChanged(control); });
QObject::connect(checkbox, &QCheckBox::checkStateChanged, checkbox, QObject::connect(checkbox, &QCheckBox::checkStateChanged, checkbox,
[control](Qt::CheckState state) { OnSpeedControlUnlimitedStateChanged(control, state); }); [control](Qt::CheckState state) { OnSpeedControlUnlimitedStateChanged(control, state); });
QObject::connect(reset_button, &QPushButton::clicked, reset_button, [control]() { ResetSpeedControlState(control); }); QObject::connect(reset_button, &QPushButton::clicked, reset_button, [control]() { ResetSpeedControlState(control); });
@ -157,12 +156,9 @@ EmulationSettingsWidget::EmulationSettingsWidget(SettingsWindow* dialog, QWidget
connect(m_ui.rewindEnable, &QCheckBox::checkStateChanged, this, &EmulationSettingsWidget::updateRewind); connect(m_ui.rewindEnable, &QCheckBox::checkStateChanged, this, &EmulationSettingsWidget::updateRewind);
connect(m_ui.useSoftwareRendererForMemoryStates, &QCheckBox::checkStateChanged, this, connect(m_ui.useSoftwareRendererForMemoryStates, &QCheckBox::checkStateChanged, this,
&EmulationSettingsWidget::updateRewind); &EmulationSettingsWidget::updateRewind);
connect(m_ui.rewindSaveFrequency, QOverload<double>::of(&QDoubleSpinBox::valueChanged), this, connect(m_ui.rewindSaveFrequency, &QDoubleSpinBox::valueChanged, this, &EmulationSettingsWidget::updateRewind);
&EmulationSettingsWidget::updateRewind); connect(m_ui.rewindSaveSlots, &QSpinBox::valueChanged, this, &EmulationSettingsWidget::updateRewind);
connect(m_ui.rewindSaveSlots, QOverload<int>::of(&QSpinBox::valueChanged), this, connect(m_ui.runaheadFrames, &QComboBox::currentIndexChanged, this, &EmulationSettingsWidget::updateRewind);
&EmulationSettingsWidget::updateRewind);
connect(m_ui.runaheadFrames, QOverload<int>::of(&QComboBox::currentIndexChanged), this,
&EmulationSettingsWidget::updateRewind);
dialog->registerWidgetHelp( dialog->registerWidgetHelp(
m_ui.normalSpeed, tr("Emulation Speed"), "100%", m_ui.normalSpeed, tr("Emulation Speed"), "100%",

@ -104,8 +104,7 @@ InterfaceSettingsWidget::InterfaceSettingsWidget(SettingsWindow* dialog, QWidget
QCheckBox* const use_system_font = new QCheckBox(tr("Use System Font"), m_ui.appearanceGroup); QCheckBox* const use_system_font = new QCheckBox(tr("Use System Font"), m_ui.appearanceGroup);
SettingWidgetBinder::BindWidgetToBoolSetting(sif, use_system_font, "Main", "UseSystemFont", false); SettingWidgetBinder::BindWidgetToBoolSetting(sif, use_system_font, "Main", "UseSystemFont", false);
m_ui.appearanceLayout->addWidget(use_system_font, next_appearance_row, next_appearance_col++ * 2, 1, 2); m_ui.appearanceLayout->addWidget(use_system_font, next_appearance_row, next_appearance_col++ * 2, 1, 2);
connect(use_system_font, &QCheckBox::checkStateChanged, this, &QtHost::UpdateApplicationTheme, connect(use_system_font, &QCheckBox::checkStateChanged, &QtHost::UpdateApplicationTheme);
Qt::QueuedConnection);
dialog->registerWidgetHelp( dialog->registerWidgetHelp(
use_system_font, tr("Use System Font"), tr("Unchecked"), use_system_font, tr("Use System Font"), tr("Unchecked"),
tr("Uses the system font for the interface, instead of the bundled Roboto font. Enabling " tr("Uses the system font for the interface, instead of the bundled Roboto font. Enabling "
@ -114,7 +113,7 @@ InterfaceSettingsWidget::InterfaceSettingsWidget(SettingsWindow* dialog, QWidget
m_disable_style_sheets = new QCheckBox(tr("Disable Style Sheets"), m_ui.appearanceGroup); m_disable_style_sheets = new QCheckBox(tr("Disable Style Sheets"), m_ui.appearanceGroup);
SettingWidgetBinder::BindWidgetToBoolSetting(sif, m_disable_style_sheets, "Main", "DisableStylesheet", false); SettingWidgetBinder::BindWidgetToBoolSetting(sif, m_disable_style_sheets, "Main", "DisableStylesheet", false);
connect(m_disable_style_sheets, &QCheckBox::checkStateChanged, this, &QtHost::UpdateApplicationTheme); connect(m_disable_style_sheets, &QCheckBox::checkStateChanged, &QtHost::UpdateApplicationTheme);
m_ui.appearanceLayout->addWidget(m_disable_style_sheets, next_appearance_row, next_appearance_col++ * 2, 1, 2); m_ui.appearanceLayout->addWidget(m_disable_style_sheets, next_appearance_row, next_appearance_col++ * 2, 1, 2);
dialog->registerWidgetHelp(m_disable_style_sheets, tr("Disable Style Sheets"), tr("Unchecked"), dialog->registerWidgetHelp(m_disable_style_sheets, tr("Disable Style Sheets"), tr("Unchecked"),
tr("Disables the use of style sheets in the application, reverting to the original " tr("Disables the use of style sheets in the application, reverting to the original "
@ -279,7 +278,7 @@ void InterfaceSettingsWidget::setupThemeCombo(QComboBox* const cb)
} }
SettingWidgetBinder::BindWidgetToStringSetting(nullptr, cb, "UI", "Theme", QtHost::GetDefaultThemeName()); SettingWidgetBinder::BindWidgetToStringSetting(nullptr, cb, "UI", "Theme", QtHost::GetDefaultThemeName());
connect(cb, QOverload<int>::of(&QComboBox::currentIndexChanged), cb, &QtHost::UpdateApplicationTheme); connect(cb, &QComboBox::currentIndexChanged, &QtHost::UpdateApplicationTheme);
} }
void InterfaceSettingsWidget::updateRenderToSeparateWindowOptions() void InterfaceSettingsWidget::updateRenderToSeparateWindowOptions()

@ -115,19 +115,18 @@ void MemoryScannerWindow::connectUi()
m_ui.scanSize->setCurrentIndex(static_cast<int>(m_scanner.GetSize())); m_ui.scanSize->setCurrentIndex(static_cast<int>(m_scanner.GetSize()));
connect(m_ui.scanValue, &QLineEdit::textChanged, this, &MemoryScannerWindow::updateScanValue); connect(m_ui.scanValue, &QLineEdit::textChanged, this, &MemoryScannerWindow::updateScanValue);
connect(m_ui.scanValueBase, QOverload<int>::of(&QComboBox::currentIndexChanged), connect(m_ui.scanValueBase, &QComboBox::currentIndexChanged, [this](int index) { updateScanValue(); });
[this](int index) { updateScanValue(); }); connect(m_ui.scanSize, &QComboBox::currentIndexChanged, [this](int index) {
connect(m_ui.scanSize, QOverload<int>::of(&QComboBox::currentIndexChanged), [this](int index) {
m_scanner.SetSize(static_cast<MemoryAccessSize>(index)); m_scanner.SetSize(static_cast<MemoryAccessSize>(index));
m_scanner.ResetSearch(); m_scanner.ResetSearch();
updateResults(); updateResults();
}); });
connect(m_ui.scanValueSigned, QOverload<int>::of(&QComboBox::currentIndexChanged), [this](int index) { connect(m_ui.scanValueSigned, &QComboBox::currentIndexChanged, [this](int index) {
m_scanner.SetValueSigned(index == 0); m_scanner.SetValueSigned(index == 0);
m_scanner.ResetSearch(); m_scanner.ResetSearch();
updateResults(); updateResults();
}); });
connect(m_ui.scanOperator, QOverload<int>::of(&QComboBox::currentIndexChanged), connect(m_ui.scanOperator, &QComboBox::currentIndexChanged,
[this](int index) { m_scanner.SetOperator(static_cast<MemoryScan::Operator>(index)); }); [this](int index) { m_scanner.SetOperator(static_cast<MemoryScan::Operator>(index)); });
connect(m_ui.scanStartAddress, &QLineEdit::textChanged, [this](const QString& value) { connect(m_ui.scanStartAddress, &QLineEdit::textChanged, [this](const QString& value) {
uint address; uint address;
@ -145,7 +144,7 @@ void MemoryScannerWindow::connectUi()
address = value.toUInt(nullptr, 16); address = value.toUInt(nullptr, 16);
m_scanner.SetEndAddress(static_cast<PhysicalMemoryAddress>(address)); m_scanner.SetEndAddress(static_cast<PhysicalMemoryAddress>(address));
}); });
connect(m_ui.scanPresetRange, QOverload<int>::of(&QComboBox::currentIndexChanged), [this](int index) { connect(m_ui.scanPresetRange, &QComboBox::currentIndexChanged, [this](int index) {
if (index == 0) if (index == 0)
{ {
m_ui.scanStartAddress->setText(formatHexValue(0, MemoryAccessSize::Word)); m_ui.scanStartAddress->setText(formatHexValue(0, MemoryAccessSize::Word));

@ -510,7 +510,7 @@ struct SettingAccessor<QSpinBox>
{ {
if (!isNullable(widget)) if (!isNullable(widget))
{ {
widget->connect(widget, QOverload<int>::of(&QSpinBox::valueChanged), func); widget->connect(widget, &QSpinBox::valueChanged, func);
} }
else else
{ {
@ -539,7 +539,7 @@ struct SettingAccessor<QSpinBox>
static void disconnect(QSpinBox* widget) static void disconnect(QSpinBox* widget)
{ {
QObject::disconnect(widget, QOverload<int>::of(&QSpinBox::valueChanged), nullptr, nullptr); QObject::disconnect(widget, &QSpinBox::valueChanged, nullptr, nullptr);
if (isNullable(widget)) if (isNullable(widget))
QObject::disconnect(widget, &QSpinBox::customContextMenuRequested, nullptr, nullptr); QObject::disconnect(widget, &QSpinBox::customContextMenuRequested, nullptr, nullptr);
} }
@ -646,7 +646,7 @@ struct SettingAccessor<QDoubleSpinBox>
{ {
if (!isNullable(widget)) if (!isNullable(widget))
{ {
widget->connect(widget, QOverload<double>::of(&QDoubleSpinBox::valueChanged), func); widget->connect(widget, &QDoubleSpinBox::valueChanged, func);
} }
else else
{ {
@ -662,7 +662,7 @@ struct SettingAccessor<QDoubleSpinBox>
}); });
menu->popup(widget->mapToGlobal(pt)); menu->popup(widget->mapToGlobal(pt));
}); });
widget->connect(widget, QOverload<double>::of(&QDoubleSpinBox::valueChanged), widget, widget->connect(widget, &QDoubleSpinBox::valueChanged, widget,
[widget, func = std::move(func)]() { [widget, func = std::move(func)]() {
if (widget->property(IS_NULL_PROPERTY).toBool()) if (widget->property(IS_NULL_PROPERTY).toBool())
{ {
@ -676,7 +676,7 @@ struct SettingAccessor<QDoubleSpinBox>
static void disconnect(QDoubleSpinBox* widget) static void disconnect(QDoubleSpinBox* widget)
{ {
QObject::disconnect(widget, QOverload<double>::of(&QDoubleSpinBox::valueChanged), nullptr, nullptr); QObject::disconnect(widget, &QDoubleSpinBox::valueChanged, nullptr, nullptr);
if (isNullable(widget)) if (isNullable(widget))
QObject::disconnect(widget, &QDoubleSpinBox::customContextMenuRequested, nullptr, nullptr); QObject::disconnect(widget, &QDoubleSpinBox::customContextMenuRequested, nullptr, nullptr);
} }

@ -195,8 +195,7 @@ void SetupWizardDialog::setupLanguagePage(bool initial)
SettingWidgetBinder::DisconnectWidget(m_ui.language); SettingWidgetBinder::DisconnectWidget(m_ui.language);
m_ui.language->clear(); m_ui.language->clear();
InterfaceSettingsWidget::setupLanguageCombo(m_ui.language); InterfaceSettingsWidget::setupLanguageCombo(m_ui.language);
connect(m_ui.language, QOverload<int>::of(&QComboBox::currentIndexChanged), this, connect(m_ui.language, &QComboBox::currentIndexChanged, this, &SetupWizardDialog::languageChanged);
&SetupWizardDialog::languageChanged);
if (initial) if (initial)
{ {

Loading…
Cancel
Save