lime_qt: Build fixes for QT 6.8 (#441)
Some checks failed
lime-build / source (push) Has been cancelled
lime-build / linux (appimage) (push) Has been cancelled
lime-build / linux (fresh) (push) Has been cancelled
lime-build / macos (arm64) (push) Has been cancelled
lime-build / macos (x86_64) (push) Has been cancelled
lime-build / windows (msvc) (push) Has been cancelled
lime-build / windows (msys2) (push) Has been cancelled
lime-build / android (push) Has been cancelled
lime-format / clang-format (push) Has been cancelled
lime-transifex / transifex (push) Has been cancelled
lime-build / macos-universal (push) Has been cancelled
lime-build / release (push) Has been cancelled

* lime_qt: Build fixes for QT 6.8

Replace deprecated `stateChanged` function with `checkStateChanged` that was first introduced in QT 6.7.

* lime_qt: Use macros to detect QT version

* lime_qt: Group QT macro version checks together
This commit is contained in:
Reg Tiangha 2024-10-15 04:40:46 -06:00 committed by GitHub
parent d739ef13ab
commit 48447fc8c5
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 40 additions and 4 deletions

View file

@ -1,4 +1,4 @@
// Copyright 2018 Citra Emulator Project // Copyright Citra Emulator Project / Lime3DS Emulator Project
// Licensed under GPLv2 or any later version // Licensed under GPLv2 or any later version
// Refer to the license.txt file included. // Refer to the license.txt file included.
@ -9,6 +9,7 @@
#include <QMediaDevices> #include <QMediaDevices>
#include <QMessageBox> #include <QMessageBox>
#include <QWidget> #include <QWidget>
#include <QtGlobal>
#include "common/settings.h" #include "common/settings.h"
#include "core/frontend/camera/factory.h" #include "core/frontend/camera/factory.h"
#include "core/hle/service/cam/cam.h" #include "core/hle/service/cam/cam.h"
@ -86,7 +87,11 @@ void ConfigureCamera::ConnectEvents() {
}); });
connect(ui->toolButton, &QToolButton::clicked, this, &ConfigureCamera::OnToolButtonClicked); connect(ui->toolButton, &QToolButton::clicked, this, &ConfigureCamera::OnToolButtonClicked);
connect(ui->preview_button, &QPushButton::clicked, this, [this] { StartPreviewing(); }); 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) { 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->camera_file->setDisabled(state == Qt::Checked);
ui->toolButton->setDisabled(state == Qt::Checked); ui->toolButton->setDisabled(state == Qt::Checked);
if (state == Qt::Checked) { if (state == Qt::Checked) {

View file

@ -1,10 +1,11 @@
// Copyright 2018 Citra Emulator Project // Copyright Citra Emulator Project / Lime3DS Emulator Project
// Licensed under GPLv2 or any later version // Licensed under GPLv2 or any later version
// Refer to the license.txt file included. // Refer to the license.txt file included.
#include <QCheckBox> #include <QCheckBox>
#include <QMessageBox> #include <QMessageBox>
#include <QTableWidgetItem> #include <QTableWidgetItem>
#include <QtGlobal>
#include "configure_cheats.h" #include "configure_cheats.h"
#include "core/cheats/cheat_base.h" #include "core/cheats/cheat_base.h"
#include "core/cheats/cheats.h" #include "core/cheats/cheats.h"
@ -59,7 +60,11 @@ void ConfigureCheats::LoadCheats() {
i, 2, new QTableWidgetItem(QString::fromStdString(cheats[i]->GetType()))); i, 2, new QTableWidgetItem(QString::fromStdString(cheats[i]->GetType())));
enabled->setProperty("row", static_cast<int>(i)); enabled->setProperty("row", static_cast<int>(i));
#if QT_VERSION < QT_VERSION_CHECK(6, 7, 0)
connect(enabled, &QCheckBox::stateChanged, this, &ConfigureCheats::OnCheckChanged); connect(enabled, &QCheckBox::stateChanged, this, &ConfigureCheats::OnCheckChanged);
#else
connect(enabled, &QCheckBox::checkStateChanged, this, &ConfigureCheats::OnCheckChanged);
#endif
} }
} }

View file

@ -1,8 +1,9 @@
// Copyright 2019 Citra Emulator Project // Copyright Citra Emulator Project / Lime3DS Emulator Project
// Licensed under GPLv2 or any later version // Licensed under GPLv2 or any later version
// Refer to the license.txt file included. // Refer to the license.txt file included.
#include <QColorDialog> #include <QColorDialog>
#include <QtGlobal>
#include "common/settings.h" #include "common/settings.h"
#include "lime_qt/configuration/configuration_shared.h" #include "lime_qt/configuration/configuration_shared.h"
#include "lime_qt/configuration/configure_layout.h" #include "lime_qt/configuration/configure_layout.h"
@ -48,6 +49,8 @@ ConfigureLayout::ConfigureLayout(QWidget* parent)
}); });
ui->screen_top_leftright_padding->setEnabled(Settings::values.screen_top_stretch.GetValue()); ui->screen_top_leftright_padding->setEnabled(Settings::values.screen_top_stretch.GetValue());
#if QT_VERSION < QT_VERSION_CHECK(6, 7, 0)
connect(ui->screen_top_stretch, static_cast<void (QCheckBox::*)(int)>(&QCheckBox::stateChanged), connect(ui->screen_top_stretch, static_cast<void (QCheckBox::*)(int)>(&QCheckBox::stateChanged),
this, this,
[this](bool checkState) { ui->screen_top_leftright_padding->setEnabled(checkState); }); [this](bool checkState) { ui->screen_top_leftright_padding->setEnabled(checkState); });
@ -67,6 +70,23 @@ ConfigureLayout::ConfigureLayout(QWidget* parent)
ui->screen_bottom_stretch, static_cast<void (QCheckBox::*)(int)>(&QCheckBox::stateChanged), ui->screen_bottom_stretch, static_cast<void (QCheckBox::*)(int)>(&QCheckBox::stateChanged),
this, this,
[this](bool checkState) { ui->screen_bottom_topbottom_padding->setEnabled(checkState); }); [this](bool checkState) { ui->screen_bottom_topbottom_padding->setEnabled(checkState); });
#else
connect(ui->screen_top_stretch, &QCheckBox::checkStateChanged, this,
[this](bool checkState) { ui->screen_top_leftright_padding->setEnabled(checkState); });
ui->screen_top_topbottom_padding->setEnabled(Settings::values.screen_top_stretch.GetValue());
connect(ui->screen_top_stretch, &QCheckBox::checkStateChanged, this,
[this](bool checkState) { ui->screen_top_topbottom_padding->setEnabled(checkState); });
ui->screen_bottom_leftright_padding->setEnabled(
Settings::values.screen_bottom_topbottom_padding.GetValue());
connect(
ui->screen_bottom_stretch, &QCheckBox::checkStateChanged, this,
[this](bool checkState) { ui->screen_bottom_leftright_padding->setEnabled(checkState); });
ui->screen_bottom_topbottom_padding->setEnabled(
Settings::values.screen_bottom_topbottom_padding.GetValue());
connect(
ui->screen_bottom_stretch, &QCheckBox::checkStateChanged, this,
[this](bool checkState) { ui->screen_bottom_topbottom_padding->setEnabled(checkState); });
#endif
connect(ui->bg_button, &QPushButton::clicked, this, [this] { connect(ui->bg_button, &QPushButton::clicked, this, [this] {
const QColor new_bg_color = QColorDialog::getColor(bg_color); const QColor new_bg_color = QColorDialog::getColor(bg_color);

View file

@ -1,10 +1,11 @@
// Copyright 2019 Citra Emulator Project // Copyright Citra Emulator Project / Lime3DS Emulator Project
// Licensed under GPLv2 or any later version // Licensed under GPLv2 or any later version
// Refer to the license.txt file included. // Refer to the license.txt file included.
#include <QBrush> #include <QBrush>
#include <QString> #include <QString>
#include <QTreeWidgetItem> #include <QTreeWidgetItem>
#include <QtGlobal>
#include <fmt/format.h> #include <fmt/format.h>
#include "common/assert.h" #include "common/assert.h"
#include "common/string_util.h" #include "common/string_util.h"
@ -22,8 +23,13 @@ IPCRecorderWidget::IPCRecorderWidget(Core::System& system_, QWidget* parent)
ui->setupUi(this); ui->setupUi(this);
qRegisterMetaType<IPCDebugger::RequestRecord>(); qRegisterMetaType<IPCDebugger::RequestRecord>();
#if QT_VERSION < QT_VERSION_CHECK(6, 7, 0)
connect(ui->enabled, &QCheckBox::stateChanged, this, connect(ui->enabled, &QCheckBox::stateChanged, this,
[this](int new_state) { SetEnabled(new_state == Qt::Checked); }); [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->clearButton, &QPushButton::clicked, this, &IPCRecorderWidget::Clear);
connect(ui->filter, &QLineEdit::textChanged, this, &IPCRecorderWidget::ApplyFilterToAll); connect(ui->filter, &QLineEdit::textChanged, this, &IPCRecorderWidget::ApplyFilterToAll);
connect(ui->main, &QTreeWidget::itemDoubleClicked, this, &IPCRecorderWidget::OpenRecordDialog); connect(ui->main, &QTreeWidget::itemDoubleClicked, this, &IPCRecorderWidget::OpenRecordDialog);