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::BindWidgetToBoolSetting(sif, m_ui.pioSwitchActive, "PIO", "SwitchActive", true);
SettingWidgetBinder::BindWidgetToBoolSetting(sif, m_ui.pioImageWrites, "PIO", "FlashImageWriteEnable", false);
connect(m_ui.pioDeviceType, QOverload<int>::of(&QComboBox::currentIndexChanged), this,
&BIOSSettingsWidget::onPIODeviceTypeChanged);
connect(m_ui.pioDeviceType, &QComboBox::currentIndexChanged, this, &BIOSSettingsWidget::onPIODeviceTypeChanged);
connect(m_ui.pioImagePathBrowse, &QPushButton::clicked, this, &BIOSSettingsWidget::onPIOImagePathBrowseClicked);
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)
{
m_dialog->removeSettingValue("BIOS", "PathNTSCJ");
@ -54,7 +53,7 @@ BIOSSettingsWidget::BIOSSettingsWidget(SettingsWindow* dialog, QWidget* parent)
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)
{
m_dialog->removeSettingValue("BIOS", "PathNTSCU");
@ -65,7 +64,7 @@ BIOSSettingsWidget::BIOSSettingsWidget(SettingsWindow* dialog, QWidget* parent)
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)
{
m_dialog->removeSettingValue("BIOS", "PathPAL");

@ -52,8 +52,7 @@ ControllerBindingWidget::ControllerBindingWidget(QWidget* parent, ControllerSett
populateControllerTypes();
populateWidgets();
connect(m_ui.controllerType, QOverload<int>::of(&QComboBox::currentIndexChanged), this,
&ControllerBindingWidget::onTypeChanged);
connect(m_ui.controllerType, &QComboBox::currentIndexChanged, this, &ControllerBindingWidget::onTypeChanged);
connect(m_ui.bindings, &QPushButton::clicked, this, &ControllerBindingWidget::onBindingsClicked);
connect(m_ui.settings, &QPushButton::clicked, this, &ControllerBindingWidget::onSettingsClicked);
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)
{
const SpeedControl control{dialog, spinbox, checkbox, setting_name, default_value};
QObject::connect(spinbox, QOverload<int>::of(&QSpinBox::valueChanged), spinbox,
[control](int) { OnSpeedControlValueChanged(control); });
QObject::connect(spinbox, &QSpinBox::valueChanged, spinbox, [control](int) { OnSpeedControlValueChanged(control); });
QObject::connect(checkbox, &QCheckBox::checkStateChanged, checkbox,
[control](Qt::CheckState state) { OnSpeedControlUnlimitedStateChanged(control, state); });
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.useSoftwareRendererForMemoryStates, &QCheckBox::checkStateChanged, this,
&EmulationSettingsWidget::updateRewind);
connect(m_ui.rewindSaveFrequency, QOverload<double>::of(&QDoubleSpinBox::valueChanged), this,
&EmulationSettingsWidget::updateRewind);
connect(m_ui.rewindSaveSlots, QOverload<int>::of(&QSpinBox::valueChanged), this,
&EmulationSettingsWidget::updateRewind);
connect(m_ui.runaheadFrames, QOverload<int>::of(&QComboBox::currentIndexChanged), this,
&EmulationSettingsWidget::updateRewind);
connect(m_ui.rewindSaveFrequency, &QDoubleSpinBox::valueChanged, this, &EmulationSettingsWidget::updateRewind);
connect(m_ui.rewindSaveSlots, &QSpinBox::valueChanged, this, &EmulationSettingsWidget::updateRewind);
connect(m_ui.runaheadFrames, &QComboBox::currentIndexChanged, this, &EmulationSettingsWidget::updateRewind);
dialog->registerWidgetHelp(
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);
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);
connect(use_system_font, &QCheckBox::checkStateChanged, this, &QtHost::UpdateApplicationTheme,
Qt::QueuedConnection);
connect(use_system_font, &QCheckBox::checkStateChanged, &QtHost::UpdateApplicationTheme);
dialog->registerWidgetHelp(
use_system_font, tr("Use System Font"), tr("Unchecked"),
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);
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);
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 "
@ -279,7 +278,7 @@ void InterfaceSettingsWidget::setupThemeCombo(QComboBox* const cb)
}
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()

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

@ -510,7 +510,7 @@ struct SettingAccessor<QSpinBox>
{
if (!isNullable(widget))
{
widget->connect(widget, QOverload<int>::of(&QSpinBox::valueChanged), func);
widget->connect(widget, &QSpinBox::valueChanged, func);
}
else
{
@ -539,7 +539,7 @@ struct SettingAccessor<QSpinBox>
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))
QObject::disconnect(widget, &QSpinBox::customContextMenuRequested, nullptr, nullptr);
}
@ -646,7 +646,7 @@ struct SettingAccessor<QDoubleSpinBox>
{
if (!isNullable(widget))
{
widget->connect(widget, QOverload<double>::of(&QDoubleSpinBox::valueChanged), func);
widget->connect(widget, &QDoubleSpinBox::valueChanged, func);
}
else
{
@ -662,7 +662,7 @@ struct SettingAccessor<QDoubleSpinBox>
});
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)]() {
if (widget->property(IS_NULL_PROPERTY).toBool())
{
@ -676,7 +676,7 @@ struct SettingAccessor<QDoubleSpinBox>
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))
QObject::disconnect(widget, &QDoubleSpinBox::customContextMenuRequested, nullptr, nullptr);
}

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

Loading…
Cancel
Save