citra_qt: Build fixes for QT 6.8 (#258)

Replace deprecated `stateChanged` function with `checkStateChanged` that was first introduced in QT 6.7 but keep the old code to maintain compatibility with older versions of QT.
This commit is contained in:
Reg Tiangha 2024-09-23 05:07:20 -06:00 committed by GitHub
parent a9775d486e
commit a652fb1697
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 16 additions and 0 deletions

View File

@ -9,6 +9,7 @@
#include <QMediaDevices>
#include <QMessageBox>
#include <QWidget>
#include <QtGlobal>
#include "citra_qt/configuration/configure_camera.h"
#include "common/settings.h"
#include "core/frontend/camera/factory.h"
@ -86,7 +87,11 @@ void ConfigureCamera::ConnectEvents() {
});
connect(ui->toolButton, &QToolButton::clicked, this, &ConfigureCamera::OnToolButtonClicked);
connect(ui->preview_button, &QPushButton::clicked, this, [this] { StartPreviewing(); });
#if QT_VERSION < QT_VERSION_CHECK(6, 7, 0)
connect(ui->prompt_before_load, &QCheckBox::stateChanged, this, [this](int state) {
#else
connect(ui->prompt_before_load, &QCheckBox::checkStateChanged, this, [this](int state) {
#endif
ui->camera_file->setDisabled(state == Qt::Checked);
ui->toolButton->setDisabled(state == Qt::Checked);
if (state == Qt::Checked) {

View File

@ -5,6 +5,7 @@
#include <QCheckBox>
#include <QMessageBox>
#include <QTableWidgetItem>
#include <QtGlobal>
#include "configure_cheats.h"
#include "core/cheats/cheat_base.h"
#include "core/cheats/cheats.h"
@ -60,7 +61,11 @@ void ConfigureCheats::LoadCheats() {
i, 2, new QTableWidgetItem(QString::fromStdString(cheats[i]->GetType())));
enabled->setProperty("row", static_cast<int>(i));
#if QT_VERSION < QT_VERSION_CHECK(6, 7, 0)
connect(enabled, &QCheckBox::stateChanged, this, &ConfigureCheats::OnCheckChanged);
#else
connect(enabled, &QCheckBox::checkStateChanged, this, &ConfigureCheats::OnCheckChanged);
#endif
}
}

View File

@ -5,6 +5,7 @@
#include <QBrush>
#include <QString>
#include <QTreeWidgetItem>
#include <QtGlobal>
#include <fmt/format.h>
#include "citra_qt/debugger/ipc/record_dialog.h"
#include "citra_qt/debugger/ipc/recorder.h"
@ -22,8 +23,13 @@ IPCRecorderWidget::IPCRecorderWidget(Core::System& system_, QWidget* parent)
ui->setupUi(this);
qRegisterMetaType<IPCDebugger::RequestRecord>();
#if QT_VERSION < QT_VERSION_CHECK(6, 7, 0)
connect(ui->enabled, &QCheckBox::stateChanged, this,
[this](int new_state) { SetEnabled(new_state == Qt::Checked); });
#else
connect(ui->enabled, &QCheckBox::checkStateChanged, this,
[this](int new_state) { SetEnabled(new_state == Qt::Checked); });
#endif
connect(ui->clearButton, &QPushButton::clicked, this, &IPCRecorderWidget::Clear);
connect(ui->filter, &QLineEdit::textChanged, this, &IPCRecorderWidget::ApplyFilterToAll);
connect(ui->main, &QTreeWidget::itemDoubleClicked, this, &IPCRecorderWidget::OpenRecordDialog);