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

rockbox-gerrit-noreply--- via rockbox-cvs <[email protected]> Fri, 26 Jun 2026 16:53:18 -0400
Newsgroups gmane.comp.systems.archos.rockbox.cvs
Message-ID <[email protected]>
commit e0bbf8f9da94e9e4ba04e7da2d659d0cf2f02269
Author: Solomon Peachy <[email protected]>
Date:   Sun Jun 21 08:56:09 2026 -0400

    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

diff --git a/utils/CMakeLists.txt b/utils/CMakeLists.txt
index 7ee5864e96..3ff13ec8a9 100644
--- a/utils/CMakeLists.txt
+++ b/utils/CMakeLists.txt
@@ -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
diff --git a/utils/rbutilqt/base/utils.cpp b/utils/rbutilqt/base/utils.cpp
index 7b6eed30bc..2bbab9d2d9 100644
--- a/utils/rbutilqt/base/utils.cpp
+++ b/utils/rbutilqt/base/utils.cpp
@@ -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;
diff --git a/utils/rbutilqt/changelog.txt b/utils/rbutilqt/changelog.txt
index e2eb98cc76..fef1e317c6 100644
--- a/utils/rbutilqt/changelog.txt
+++ b/utils/rbutilqt/changelog.txt
@@ -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.
diff --git a/utils/rbutilqt/configure.cpp b/utils/rbutilqt/configure.cpp
index 422c16d222..2d4f3a62bc 100644
--- a/utils/rbutilqt/configure.cpp
+++ b/utils/rbutilqt/configure.cpp
@@ -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);
     }
 }
-
diff --git a/utils/rbutilqt/encttscfggui.cpp b/utils/rbutilqt/encttscfggui.cpp
index 5d05abd583..35e73ae907 100644
--- a/utils/rbutilqt/encttscfggui.cpp
+++ b/utils/rbutilqt/encttscfggui.cpp
@@ -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);
 }
-
-
diff --git a/utils/rbutilqt/preview.cpp b/utils/rbutilqt/preview.cpp
index ba241dfe01..3d90753709 100644
--- a/utils/rbutilqt/preview.cpp
+++ b/utils/rbutilqt/preview.cpp
@@ -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);
 }
-
diff --git a/utils/rbutilqt/test/test-playerbuildinfo.cpp b/utils/rbutilqt/test/test-playerbuildinfo.cpp
index aa42cd0992..cb261820d7 100644
--- a/utils/rbutilqt/test/test-playerbuildinfo.cpp
+++ b/utils/rbutilqt/test/test-playerbuildinfo.cpp
@@ -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"
-
diff --git a/utils/themeeditor/graphics/rbtoucharea.cpp b/utils/themeeditor/graphics/rbtoucharea.cpp
index 992d3f5f84..980975048e 100644
--- a/utils/themeeditor/graphics/rbtoucharea.cpp
+++ b/utils/themeeditor/graphics/rbtoucharea.cpp
@@ -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();
 
diff --git a/utils/themeeditor/gui/devicestate.cpp b/utils/themeeditor/gui/devicestate.cpp
index 8b4b72505a..395e8b3721 100644
--- a/utils/themeeditor/gui/devicestate.cpp
+++ b/utils/themeeditor/gui/devicestate.cpp
@@ -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*>
diff --git a/utils/themeeditor/models/parsetreemodel.cpp b/utils/themeeditor/models/parsetreemodel.cpp
index 94570aa343..3c1446988a 100644
--- a/utils/themeeditor/models/parsetreemodel.cpp
+++ b/utils/themeeditor/models/parsetreemodel.cpp
@@ -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;
diff --git a/utils/themeeditor/models/parsetreenode.cpp b/utils/themeeditor/models/parsetreenode.cpp
index 3f09a1798b..2489a3b985 100644
--- a/utils/themeeditor/models/parsetreenode.cpp
+++ b/utils/themeeditor/models/parsetreenode.cpp
@@ -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();
-- 
rockbox-cvs mailing list
[email protected]
https://lists.haxx.se/mailman/listinfo/rockbox-cvs