Skip to content

Commit

Permalink
citra_qt: Build fixes for QT 6.8
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
rtiangha authored and Gamer64ytb committed Sep 28, 2024
1 parent 689cfdc commit 32e07a2
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/mandarine_qt/configuration/configure_camera.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
#include <QMediaDevices>
#include <QMessageBox>
#include <QWidget>
#include <QtGlobal>
#include "common/settings.h"
#include "core/frontend/camera/factory.h"
#include "core/hle/service/cam/cam.h"
Expand Down Expand Up @@ -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) {
Expand Down
5 changes: 5 additions & 0 deletions src/mandarine_qt/configuration/configure_cheats.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -59,7 +60,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
}
}

Expand Down
6 changes: 6 additions & 0 deletions src/mandarine_qt/debugger/ipc/recorder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
#include <QBrush>
#include <QString>
#include <QTreeWidgetItem>
#include <QtGlobal>
#include <fmt/format.h>
#include "common/assert.h"
#include "common/string_util.h"
Expand All @@ -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);
Expand Down

0 comments on commit 32e07a2

Please sign in to comment.