From 3e9ac99d548d8ed5684f761c82160b5a3e59608e Mon Sep 17 00:00:00 2001 From: Stenzek Date: Thu, 11 Apr 2024 21:48:59 +1000 Subject: [PATCH] Qt: Fix 6.7 deprecation warnings --- src/duckstation-qt/achievementsettingswidget.cpp | 10 +++++----- src/duckstation-qt/advancedsettingswidget.cpp | 4 ++-- src/duckstation-qt/audiosettingswidget.cpp | 2 +- src/duckstation-qt/consolesettingswidget.cpp | 2 +- .../controllerglobalsettingswidget.cpp | 4 ++-- src/duckstation-qt/emulationsettingswidget.cpp | 4 ++-- src/duckstation-qt/graphicssettingswidget.cpp | 13 +++++++------ src/duckstation-qt/interfacesettingswidget.cpp | 2 +- src/duckstation-qt/postprocessingsettingswidget.cpp | 2 +- src/duckstation-qt/qtkeycodes.cpp | 4 ---- src/duckstation-qt/settingwidgetbinder.h | 2 +- src/duckstation-qt/setupwizarddialog.cpp | 2 +- 12 files changed, 24 insertions(+), 27 deletions(-) diff --git a/src/duckstation-qt/achievementsettingswidget.cpp b/src/duckstation-qt/achievementsettingswidget.cpp index 0c224e233..d24dc221f 100644 --- a/src/duckstation-qt/achievementsettingswidget.cpp +++ b/src/duckstation-qt/achievementsettingswidget.cpp @@ -73,11 +73,11 @@ AchievementSettingsWidget::AchievementSettingsWidget(SettingsWindow* dialog, QWi tr( "When enabled, the first disc in a playlist will be used for achievements, regardless of which disc is active.")); - connect(m_ui.enable, &QCheckBox::stateChanged, this, &AchievementSettingsWidget::updateEnableState); - connect(m_ui.hardcoreMode, &QCheckBox::stateChanged, this, &AchievementSettingsWidget::updateEnableState); - connect(m_ui.hardcoreMode, &QCheckBox::stateChanged, this, &AchievementSettingsWidget::onHardcoreModeStateChanged); - connect(m_ui.achievementNotifications, &QCheckBox::stateChanged, this, &AchievementSettingsWidget::updateEnableState); - connect(m_ui.leaderboardNotifications, &QCheckBox::stateChanged, this, &AchievementSettingsWidget::updateEnableState); + connect(m_ui.enable, &QCheckBox::checkStateChanged, this, &AchievementSettingsWidget::updateEnableState); + connect(m_ui.hardcoreMode, &QCheckBox::checkStateChanged, this, &AchievementSettingsWidget::updateEnableState); + connect(m_ui.hardcoreMode, &QCheckBox::checkStateChanged, this, &AchievementSettingsWidget::onHardcoreModeStateChanged); + connect(m_ui.achievementNotifications, &QCheckBox::checkStateChanged, this, &AchievementSettingsWidget::updateEnableState); + connect(m_ui.leaderboardNotifications, &QCheckBox::checkStateChanged, this, &AchievementSettingsWidget::updateEnableState); connect(m_ui.achievementNotificationsDuration, &QSlider::valueChanged, this, &AchievementSettingsWidget::onAchievementsNotificationDurationSliderChanged); connect(m_ui.leaderboardNotificationsDuration, &QSlider::valueChanged, this, diff --git a/src/duckstation-qt/advancedsettingswidget.cpp b/src/duckstation-qt/advancedsettingswidget.cpp index 1a35e48a1..b24927b0c 100644 --- a/src/duckstation-qt/advancedsettingswidget.cpp +++ b/src/duckstation-qt/advancedsettingswidget.cpp @@ -176,9 +176,9 @@ AdvancedSettingsWidget::AdvancedSettingsWidget(SettingsWindow* dialog, QWidget* SettingWidgetBinder::BindWidgetToBoolSetting(sif, m_ui.showDebugMenu, "Main", "ShowDebugMenu", false); connect(m_ui.resetToDefaultButton, &QPushButton::clicked, this, &AdvancedSettingsWidget::onResetToDefaultClicked); - connect(m_ui.showDebugMenu, &QCheckBox::stateChanged, g_main_window, &MainWindow::updateDebugMenuVisibility, + connect(m_ui.showDebugMenu, &QCheckBox::checkStateChanged, g_main_window, &MainWindow::updateDebugMenuVisibility, Qt::QueuedConnection); - connect(m_ui.showDebugMenu, &QCheckBox::stateChanged, this, &AdvancedSettingsWidget::onShowDebugOptionsStateChanged); + connect(m_ui.showDebugMenu, &QCheckBox::checkStateChanged, this, &AdvancedSettingsWidget::onShowDebugOptionsStateChanged); m_ui.tweakOptionTable->setColumnWidth(0, 380); m_ui.tweakOptionTable->setColumnWidth(1, 170); diff --git a/src/duckstation-qt/audiosettingswidget.cpp b/src/duckstation-qt/audiosettingswidget.cpp index 5ed11b152..34ec95056 100644 --- a/src/duckstation-qt/audiosettingswidget.cpp +++ b/src/duckstation-qt/audiosettingswidget.cpp @@ -50,7 +50,7 @@ AudioSettingsWidget::AudioSettingsWidget(SettingsWindow* dialog, QWidget* parent m_ui.muted->setChecked(m_dialog->getEffectiveBoolValue("Audio", "OutputMuted", false)); connect(m_ui.volume, &QSlider::valueChanged, this, &AudioSettingsWidget::onOutputVolumeChanged); connect(m_ui.fastForwardVolume, &QSlider::valueChanged, this, &AudioSettingsWidget::onFastForwardVolumeChanged); - connect(m_ui.muted, &QCheckBox::stateChanged, this, &AudioSettingsWidget::onOutputMutedChanged); + connect(m_ui.muted, &QCheckBox::checkStateChanged, this, &AudioSettingsWidget::onOutputMutedChanged); updateVolumeLabel(); } else diff --git a/src/duckstation-qt/consolesettingswidget.cpp b/src/duckstation-qt/consolesettingswidget.cpp index 5cb39e275..1150c5f4d 100644 --- a/src/duckstation-qt/consolesettingswidget.cpp +++ b/src/duckstation-qt/consolesettingswidget.cpp @@ -108,7 +108,7 @@ ConsoleSettingsWidget::ConsoleSettingsWidget(SettingsWindow* dialog, QWidget* pa m_ui.cpuClockSpeed->setEnabled(m_dialog->getEffectiveBoolValue("CPU", "OverclockEnable", false)); - connect(m_ui.enableCPUClockSpeedControl, &QCheckBox::stateChanged, this, + connect(m_ui.enableCPUClockSpeedControl, &QCheckBox::checkStateChanged, this, &ConsoleSettingsWidget::onEnableCPUClockSpeedControlChecked); connect(m_ui.cpuClockSpeed, &QSlider::valueChanged, this, &ConsoleSettingsWidget::onCPUClockSpeedValueChanged); diff --git a/src/duckstation-qt/controllerglobalsettingswidget.cpp b/src/duckstation-qt/controllerglobalsettingswidget.cpp index 5d21ccc93..4367eb350 100644 --- a/src/duckstation-qt/controllerglobalsettingswidget.cpp +++ b/src/duckstation-qt/controllerglobalsettingswidget.cpp @@ -19,7 +19,7 @@ ControllerGlobalSettingsWidget::ControllerGlobalSettingsWidget(QWidget* parent, SettingWidgetBinder::BindWidgetToBoolSetting(sif, m_ui.enableSDLSource, "InputSources", "SDL", true); SettingWidgetBinder::BindWidgetToBoolSetting(sif, m_ui.enableSDLEnhancedMode, "InputSources", "SDLControllerEnhancedMode", false); - connect(m_ui.enableSDLSource, &QCheckBox::stateChanged, this, + connect(m_ui.enableSDLSource, &QCheckBox::checkStateChanged, this, &ControllerGlobalSettingsWidget::updateSDLOptionsEnabled); connect(m_ui.ledSettings, &QToolButton::clicked, this, &ControllerGlobalSettingsWidget::ledSettingsClicked); @@ -62,7 +62,7 @@ ControllerGlobalSettingsWidget::ControllerGlobalSettingsWidget(QWidget* parent, { m_ui.useProfileHotkeyBindings->setChecked( m_dialog->getBoolValue("ControllerPorts", "UseProfileHotkeyBindings", false)); - connect(m_ui.useProfileHotkeyBindings, &QCheckBox::stateChanged, this, [this](int new_state) { + connect(m_ui.useProfileHotkeyBindings, &QCheckBox::checkStateChanged, this, [this](int new_state) { m_dialog->setBoolValue("ControllerPorts", "UseProfileHotkeyBindings", (new_state == Qt::Checked)); emit bindingSetupChanged(); }); diff --git a/src/duckstation-qt/emulationsettingswidget.cpp b/src/duckstation-qt/emulationsettingswidget.cpp index e1cba8dfa..6c45dacd8 100644 --- a/src/duckstation-qt/emulationsettingswidget.cpp +++ b/src/duckstation-qt/emulationsettingswidget.cpp @@ -68,9 +68,9 @@ EmulationSettingsWidget::EmulationSettingsWidget(SettingsWindow* dialog, QWidget } connect(m_ui.turboSpeed, QOverload::of(&QComboBox::currentIndexChanged), this, &EmulationSettingsWidget::onTurboSpeedIndexChanged); - connect(m_ui.vsync, &QCheckBox::stateChanged, this, &EmulationSettingsWidget::onVSyncChanged); + connect(m_ui.vsync, &QCheckBox::checkStateChanged, this, &EmulationSettingsWidget::onVSyncChanged); - connect(m_ui.rewindEnable, &QCheckBox::stateChanged, this, &EmulationSettingsWidget::updateRewind); + connect(m_ui.rewindEnable, &QCheckBox::checkStateChanged, this, &EmulationSettingsWidget::updateRewind); connect(m_ui.rewindSaveFrequency, QOverload::of(&QDoubleSpinBox::valueChanged), this, &EmulationSettingsWidget::updateRewind); connect(m_ui.rewindSaveSlots, QOverload::of(&QSpinBox::valueChanged), this, diff --git a/src/duckstation-qt/graphicssettingswidget.cpp b/src/duckstation-qt/graphicssettingswidget.cpp index 7326caf28..a6e87bbe8 100644 --- a/src/duckstation-qt/graphicssettingswidget.cpp +++ b/src/duckstation-qt/graphicssettingswidget.cpp @@ -94,8 +94,8 @@ GraphicsSettingsWidget::GraphicsSettingsWidget(SettingsWindow* dialog, QWidget* &GraphicsSettingsWidget::onAspectRatioChanged); connect(m_ui.gpuDownsampleMode, QOverload::of(&QComboBox::currentIndexChanged), this, &GraphicsSettingsWidget::onDownsampleModeChanged); - connect(m_ui.trueColor, &QCheckBox::stateChanged, this, &GraphicsSettingsWidget::onTrueColorChanged); - connect(m_ui.pgxpEnable, &QCheckBox::stateChanged, this, &GraphicsSettingsWidget::updatePGXPSettingsEnabled); + connect(m_ui.trueColor, &QCheckBox::checkStateChanged, this, &GraphicsSettingsWidget::onTrueColorChanged); + connect(m_ui.pgxpEnable, &QCheckBox::checkStateChanged, this, &GraphicsSettingsWidget::updatePGXPSettingsEnabled); if (!dialog->isPerGameSettings() || (dialog->containsSettingValue("GPU", "Multisamples") || dialog->containsSettingValue("GPU", "PerSampleShading"))) @@ -158,9 +158,10 @@ GraphicsSettingsWidget::GraphicsSettingsWidget(SettingsWindow* dialog, QWidget* SettingWidgetBinder::BindWidgetToBoolSetting(sif, m_ui.pgxpCPU, "GPU", "PGXPCPU", false); SettingWidgetBinder::BindWidgetToBoolSetting(sif, m_ui.pgxpVertexCache, "GPU", "PGXPVertexCache", false); - connect(m_ui.pgxpTextureCorrection, &QCheckBox::stateChanged, this, + connect(m_ui.pgxpTextureCorrection, &QCheckBox::checkStateChanged, this, + &GraphicsSettingsWidget::updatePGXPSettingsEnabled); + connect(m_ui.pgxpDepthBuffer, &QCheckBox::checkStateChanged, this, &GraphicsSettingsWidget::updatePGXPSettingsEnabled); - connect(m_ui.pgxpDepthBuffer, &QCheckBox::stateChanged, this, &GraphicsSettingsWidget::updatePGXPSettingsEnabled); // OSD Tab @@ -206,9 +207,9 @@ GraphicsSettingsWidget::GraphicsSettingsWidget(SettingsWindow* dialog, QWidget* "DumpVRAMWriteHeightThreshold", Settings::DEFAULT_VRAM_WRITE_DUMP_HEIGHT_THRESHOLD); - connect(m_ui.vramWriteReplacement, &QCheckBox::stateChanged, this, + connect(m_ui.vramWriteReplacement, &QCheckBox::checkStateChanged, this, &GraphicsSettingsWidget::onEnableAnyTextureReplacementsChanged); - connect(m_ui.vramWriteDumping, &QCheckBox::stateChanged, this, + connect(m_ui.vramWriteDumping, &QCheckBox::checkStateChanged, this, &GraphicsSettingsWidget::onEnableVRAMWriteDumpingChanged); // Debugging Tab diff --git a/src/duckstation-qt/interfacesettingswidget.cpp b/src/duckstation-qt/interfacesettingswidget.cpp index 260ca297d..66c96ca90 100644 --- a/src/duckstation-qt/interfacesettingswidget.cpp +++ b/src/duckstation-qt/interfacesettingswidget.cpp @@ -52,7 +52,7 @@ InterfaceSettingsWidget::InterfaceSettingsWidget(SettingsWindow* dialog, QWidget SettingWidgetBinder::BindWidgetToBoolSetting(sif, m_ui.createSaveStateBackups, "Main", "CreateSaveStateBackups", Settings::DEFAULT_SAVE_STATE_BACKUPS); SettingWidgetBinder::BindWidgetToBoolSetting(sif, m_ui.enableDiscordPresence, "Main", "EnableDiscordPresence", false); - connect(m_ui.renderToSeparateWindow, &QCheckBox::stateChanged, this, + connect(m_ui.renderToSeparateWindow, &QCheckBox::checkStateChanged, this, &InterfaceSettingsWidget::onRenderToSeparateWindowChanged); onRenderToSeparateWindowChanged(); diff --git a/src/duckstation-qt/postprocessingsettingswidget.cpp b/src/duckstation-qt/postprocessingsettingswidget.cpp index 64ce89ae3..8b842c8b3 100644 --- a/src/duckstation-qt/postprocessingsettingswidget.cpp +++ b/src/duckstation-qt/postprocessingsettingswidget.cpp @@ -348,7 +348,7 @@ void PostProcessingShaderConfigWidget::createUi() QCheckBox* checkbox = new QCheckBox(QString::fromStdString(option.ui_name), this); checkbox->setToolTip(tooltip); checkbox->setChecked(option.value[0].int_value != 0); - connect(checkbox, &QCheckBox::stateChanged, [this, &option](int state) { + connect(checkbox, &QCheckBox::checkStateChanged, [this, &option](Qt::CheckState state) { option.value[0].int_value = (state == Qt::Checked) ? 1 : 0; updateConfigForOption(option); }); diff --git a/src/duckstation-qt/qtkeycodes.cpp b/src/duckstation-qt/qtkeycodes.cpp index 051da26ea..2a8c9f610 100644 --- a/src/duckstation-qt/qtkeycodes.cpp +++ b/src/duckstation-qt/qtkeycodes.cpp @@ -180,11 +180,7 @@ static constexpr KeyCodeName s_qt_key_names[] = {{Qt::Key_Escape, "Escape", ICON {Qt::Key_twosuperior, "twosuperior", nullptr}, {Qt::Key_threesuperior, "threesuperior", nullptr}, {Qt::Key_acute, "acute", nullptr}, -#if (QT_VERSION >= QT_VERSION_CHECK(6, 7, 0)) {Qt::Key_micro, "micro", nullptr}, -#else - {Qt::Key_mu, "mu", nullptr}, -#endif {Qt::Key_paragraph, "paragraph", nullptr}, {Qt::Key_periodcentered, "periodcentered", nullptr}, {Qt::Key_cedilla, "cedilla", nullptr}, diff --git a/src/duckstation-qt/settingwidgetbinder.h b/src/duckstation-qt/settingwidgetbinder.h index 6b4bdd167..36b53bd57 100644 --- a/src/duckstation-qt/settingwidgetbinder.h +++ b/src/duckstation-qt/settingwidgetbinder.h @@ -265,7 +265,7 @@ struct SettingAccessor template static void connectValueChanged(QCheckBox* widget, F func) { - widget->connect(widget, &QCheckBox::stateChanged, func); + widget->connect(widget, &QCheckBox::checkStateChanged, func); } }; diff --git a/src/duckstation-qt/setupwizarddialog.cpp b/src/duckstation-qt/setupwizarddialog.cpp index cc770e845..aa7931e8a 100644 --- a/src/duckstation-qt/setupwizarddialog.cpp +++ b/src/duckstation-qt/setupwizarddialog.cpp @@ -328,7 +328,7 @@ void SetupWizardDialog::addPathToTable(const std::string& path, bool recursive) m_ui.searchDirectoryList->setCellWidget(row, 1, cb); cb->setChecked(recursive); - connect(cb, &QCheckBox::stateChanged, [item](int state) { + connect(cb, &QCheckBox::checkStateChanged, [item](Qt::CheckState state) { const std::string path(item->text().toStdString()); if (state == Qt::Checked) {