rbutil: Drop support for QT5, start cleaning up the warnings

* All deprecation warnings fixed
 * Explicitly set QT_NO_USE_NODISCARD_FILE_OPEN

Change-Id: Ice52133e93d4a01f12ff845a3056a81b100ed891
This commit is contained in:
Solomon Peachy 2026-06-21 08:56:09 -04:00
parent 22b4cd3232
commit e0bbf8f9da
11 changed files with 25 additions and 31 deletions

View file

@ -45,19 +45,17 @@ endif()
enable_testing()
# Qt
find_package(QT NAMES Qt6 Qt5 REQUIRED)
if(QT_VERSION_MAJOR EQUAL 5)
find_package(Qt5 REQUIRED COMPONENTS
Core Widgets Svg Multimedia Network Test LinguistTools)
else()
find_package(QT NAMES Qt6 REQUIRED)
find_package(Qt6 REQUIRED COMPONENTS
Core Core5Compat Widgets Svg Network LinguistTools SvgWidgets
OPTIONAL_COMPONENTS Multimedia Test)
endif()
get_target_property(_moc_executable Qt${QT_VERSION_MAJOR}::moc IMPORTED_LOCATION)
get_filename_component(QT_BINDIR "${_moc_executable}" DIRECTORY)
message("-- Found Qt${QT_VERSION_MAJOR}: ${Qt${QT_VERSION_MAJOR}_DIR}")
# Added in QT 6.10
add_compile_options(-DQT_NO_USE_NODISCARD_FILE_OPEN)
# If we're on Linux, try to find the used libs in the system.
if (CMAKE_SYSTEM_NAME STREQUAL "Linux")
# required system libs

View file

@ -1053,11 +1053,11 @@ qint64 Utils::recursiveFolderSize(QString path)
{
qint64 size = 0;
QList<QFileInfo> items = QDir(path).entryInfoList(QDir::Files | QDir::NoDotAndDotDot);
for (const auto &item: qAsConst(items)) {
for (const auto &item: std::as_const(items)) {
size += item.size();
}
QList<QString> folders = QDir(path).entryList(QDir::Dirs | QDir::NoDotAndDotDot);
for (auto const& folder: qAsConst(folders)) {
for (auto const& folder: std::as_const(folders)) {
size += recursiveFolderSize(path + "/" + folder);
}
return size;

View file

@ -55,3 +55,4 @@ Version 1.5.2
* Generate additional talk clips for language name and 'invalid voice file'
* When installing development builds, fall back to daily artefacts for non-firmware files
* Where possible, extract voice corrections file from the actual device
* Drop support for Qt5, now requires Qt6.

View file

@ -610,7 +610,7 @@ void Config::updateLanguage()
if(!translator->load("rbutil_" + language, absolutePath))
translator->load("rbutil_" + language, ":/lang");
if(!qttrans->load("qt_" + language,
QLibraryInfo::location(QLibraryInfo::TranslationsPath)))
QLibraryInfo::path(QLibraryInfo::TranslationsPath)))
qttrans->load("qt_" + language, ":/lang");
qApp->installTranslator(translator);
@ -986,4 +986,3 @@ void Config::changeEvent(QEvent *e)
QWidget::changeEvent(e);
}
}

View file

@ -123,7 +123,7 @@ QWidget* EncTtsCfgGui::createWidgets(EncTtsSetting* setting)
value = spinBox;
connect(spinBox, static_cast<void (QDoubleSpinBox::*)(double)>(&QDoubleSpinBox::valueChanged),
this, [=](double value) {
this, [=, this](double value) {
this->m_settingsWidgetsMap.key(spinBox)->setCurrent(value, false);
});
connect(setting, &EncTtsSetting::updateGui, this,
@ -145,7 +145,7 @@ QWidget* EncTtsCfgGui::createWidgets(EncTtsSetting* setting)
spinBox->setValue(setting->current().toInt());
value = spinBox;
connect(spinBox, static_cast<void (QSpinBox::*)(int)>(&QSpinBox::valueChanged),
this, [=](int value) {
this, [=, this](int value) {
this->m_settingsWidgetsMap.key(spinBox)->setCurrent(value, false);
});
connect(setting, &EncTtsSetting::updateGui, this,
@ -166,7 +166,7 @@ QWidget* EncTtsCfgGui::createWidgets(EncTtsSetting* setting)
value = lineEdit;
connect(lineEdit, &QLineEdit::textChanged,
this, [=](QString value) {
this, [=, this](QString value) {
this->m_settingsWidgetsMap.key(lineEdit)->setCurrent(value, false);
});
connect(setting, &EncTtsSetting::updateGui, this,
@ -198,7 +198,7 @@ QWidget* EncTtsCfgGui::createWidgets(EncTtsSetting* setting)
int index = comboBox->findText(setting->current().toString());
comboBox->setCurrentIndex(index);
connect(comboBox, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged),
this, [=](int) {
this, [=, this](int) {
this->m_settingsWidgetsMap.key(comboBox)->setCurrent(comboBox->currentText(), false);
});
value = comboBox;
@ -219,8 +219,8 @@ QWidget* EncTtsCfgGui::createWidgets(EncTtsSetting* setting)
checkbox->setAccessibleName(setting->name());
checkbox->setCheckState(setting->current().toBool() == true
? Qt::Checked : Qt::Unchecked);
connect(checkbox, &QCheckBox::stateChanged,
this, [=](int value) {
connect(checkbox, &QCheckBox::checkStateChanged,
this, [=, this](int value) {
this->m_settingsWidgetsMap.key(checkbox)->setCurrent(value, false);
});
value = checkbox;
@ -306,5 +306,3 @@ void EncTtsCfgGui::reject(void)
{
this->done(0);
}

View file

@ -79,7 +79,7 @@ PreviewLabel::PreviewLabel(QWidget * parent, Qt::WindowFlags f)
void PreviewLabel::mouseMoveEvent(QMouseEvent * event)
{
hovertimer.start();
mousepos = event->globalPos();
mousepos = event->globalPosition().toPoint();
}
void PreviewLabel::enterEvent(QEvent * event)
{
@ -119,4 +119,3 @@ void PreviewLabel::setText(QString text)
QLabel::setText(text);
preview->setText(text);
}

View file

@ -213,7 +213,7 @@ void TestPlayerBuildInfo::testBuildInfo()
RbSettings::setValue(RbSettings::CurrentPlatform, target);
QVariant result = PlayerBuildInfo::instance()->value(item, type);
if(result.canConvert(QMetaType::QStringList))
if(result.canConvert(QMetaType(QMetaType::QStringList)))
QCOMPARE(result.toStringList().join(","), QString(expected));
else
QCOMPARE(result.toString(), QString(expected));
@ -253,7 +253,7 @@ void TestPlayerBuildInfo::testPlayerInfo()
QFETCH(QString, expected);
QVariant result = PlayerBuildInfo::instance()->value(item, target);
if(result.canConvert(QMetaType::QStringList))
if(result.canConvert(QMetaType(QMetaType::QStringList)))
QCOMPARE(result.toStringList().join(","), QString(expected));
else
QCOMPARE(result.toString(), QString(expected));
@ -265,4 +265,3 @@ QTEST_MAIN(TestPlayerBuildInfo)
// this include is needed because we don't use a separate header file for the
// test class. It also needs to be at the end.
#include "test-playerbuildinfo.moc"

View file

@ -63,7 +63,7 @@ void RBTouchArea::paint(QPainter *painter,
void RBTouchArea::mousePressEvent(QGraphicsSceneMouseEvent *event)
{
if(action[0] == '&')
action = action.right(action.count() - 1);
action = action.right(action.size() - 1);
action = action.toLower();

View file

@ -482,7 +482,7 @@ void DeviceState::setData(QString tag, QVariant data)
break;
case Combo:
if(data.type() == QVariant::String)
if(data.typeId() == QVariant::String)
dynamic_cast<QComboBox*>
(found.second)->
setCurrentIndex(dynamic_cast<QComboBox*>

View file

@ -245,7 +245,7 @@ bool ParseTreeModel::setData(const QModelIndex &index, const QVariant &value,
}
else if(tolower(param->type_code) == 'i')
{
if(!value.canConvert(QVariant::Int))
if(!value.canConvert(QMetaType(QVariant::Int)))
return false;
param->type = skin_tag_parameter::INTEGER;

View file

@ -1078,7 +1078,7 @@ QVariant ParseTreeNode::evalTag(const RBRenderInfo& info, bool conditional,
child = val.toInt();
child = branches * child / 100;
}
else if(val.type() == QVariant::Bool)
else if(val.typeId() == QVariant::Bool)
{
/* Boolean values have to be reversed, because conditionals are
* always of the form %?tag<true|false>
@ -1096,7 +1096,7 @@ QVariant ParseTreeNode::evalTag(const RBRenderInfo& info, bool conditional,
else
child = 1;
}
else if(val.type() == QVariant::String)
else if(val.typeId() == QVariant::String)
{
if(val.toString().length() > 0)
child = 0;
@ -1180,18 +1180,18 @@ void ParseTreeNode::modParam(QVariant value, int index)
}
else if(param)
{
if(value.type() == QVariant::Double)
if(value.typeId() == QVariant::Double)
{
param->type = skin_tag_parameter::DECIMAL;
param->data.number = static_cast<int>(value.toDouble() * 10);
}
else if(value.type() == QVariant::String)
else if(value.typeId() == QVariant::String)
{
param->type = skin_tag_parameter::STRING;
free(param->data.text);
param->data.text = strdup(value.toString().toStdString().c_str());
}
else if(value.type() == QVariant::Int)
else if(value.typeId() == QVariant::Int)
{
param->type = skin_tag_parameter::INTEGER;
param->data.number = value.toInt();