From c087cacc295666aa79e77c3ca339979df22f6a36 Mon Sep 17 00:00:00 2001
From: Sergey Chupligin <neochapay@gmail.com>
Date: Wed, 20 Jul 2022 18:19:22 +0300
Subject: [PATCH] Fix build warnings and build failure on Debian

---
 apicheck/apicheck.cpp                         |  8 ++-
 src/LomiriGestures/touchregistry.cpp          | 21 ++++++-
 src/LomiriMetrics/logger.cpp                  | 56 ++++++++++++++++---
 .../adapters/alarmsadapter_organizer.cpp      |  4 ++
 src/LomiriToolkit/exclusivegroup.cpp          |  4 ++
 src/LomiriToolkit/i18n.cpp                    |  4 ++
 src/LomiriToolkit/lomirithemeiconprovider.cpp |  4 ++
 src/LomiriToolkit/lomiritoolkitmodule.cpp     | 43 ++++++++++++++
 src/LomiriToolkit/mousetouchadaptor_x11.cpp   |  4 ++
 src/LomiriToolkit/ucarguments.cpp             | 33 +++++++++--
 src/LomiriToolkit/ucqquickimageextension.cpp  | 21 ++++++-
 src/LomiriToolkit/ucstatesaver.cpp            |  4 ++
 src/LomiriToolkit/uctheme.cpp                 | 16 ++++++
 .../PerformanceMetrics/plugin/upmplugin.cpp   |  4 ++
 tests/api/Extinct/Animals/plugin/plugin.cpp   |  4 ++
 tests/unit/arguments/tst_arguments.cpp        |  5 ++
 .../tst_qquick_image_extension.cpp            | 49 +++++++++++++---
 tests/unit/statesaver/tst_statesaver.cpp      | 12 ++++
 .../unit/touchregistry/tst_TouchRegistry.cpp  | 50 +++++++++++++++++
 19 files changed, 321 insertions(+), 25 deletions(-)

--- a/apicheck/apicheck.cpp
+++ b/apicheck/apicheck.cpp
@@ -877,7 +877,11 @@
         QString pluginImportVersion;
         QStringList pathList((QString(getenv("QML2_IMPORT_PATH"))
                               + ":" + QLibraryInfo::location(QLibraryInfo::Qml2ImportsPath))
+#if QT_VERSION < QT_VERSION_CHECK(5, 15, 0)
                              .split(':', QString::SkipEmptyParts));
+#else
+                             .split(':', Qt::SkipEmptyParts));
+#endif
 
         QFile qmlDirFile;
         QString pluginModulePath;
@@ -964,7 +968,7 @@
         Q_FOREACH(const QString& version, importVersions) {
             // First letter must be uppercase
             QString pluginAlias(QString("A%1.%2").arg(pluginImportUri).arg(version).replace(".", "_"));
-            code += QString("import %1 %2 as %3\n").arg(pluginImportUri).arg(version).arg(pluginAlias);
+            code += QString("import %1 %2 as %3\n").arg(pluginImportUri).arg(version).arg(pluginAlias).toUtf8();
         }
         code += "QtObject { }\n";
         if (verbose)
@@ -986,7 +990,7 @@
                     // First letter must be uppercase
                     QString pluginAlias(QString("A%1.%2").arg(pluginImportUri).replace(".", "_"));
                     // 1.0 should work if 0.1 didn't and qmldir didn't specify
-                    code += QString("import %1 1.0 as %3\n").arg(pluginImportUri).arg(pluginAlias);
+                    code += QString("import %1 1.0 as %3\n").arg(pluginImportUri).arg(pluginAlias).toUtf8();
                     c.setData(code, QUrl::fromLocalFile(qmlDirFile.fileName()));
                     std::cerr << "Re-creating QML component for " << qPrintable(pluginImportUri) << std::endl;
                     c.create();
--- a/src/LomiriGestures/touchregistry.cpp
+++ b/src/LomiriGestures/touchregistry.cpp
@@ -164,7 +164,11 @@
 void TouchRegistry::dispatchPointsToItem(const QTouchEvent *event, const QList<int> &touchIds,
         QQuickItem *item)
 {
+#if QT_VERSION < QT_VERSION_CHECK(5, 15, 0)
     Qt::TouchPointStates touchPointStates = 0;
+#else
+    Qt::TouchPointStates touchPointStates;
+#endif
     QList<QTouchEvent::TouchPoint> touchPoints;
 
     const QList<QTouchEvent::TouchPoint> &allTouchPoints = event->touchPoints();
@@ -176,11 +180,18 @@
         const QTouchEvent::TouchPoint &originalTouchPoint = allTouchPoints[i];
         if (touchIds.contains(originalTouchPoint.id())) {
             QTouchEvent::TouchPoint touchPoint = originalTouchPoint;
-
+#if QT_VERSION < QT_VERSION_CHECK(5, 15, 0)
+            touchPoint.setRect(windowToCandidateTransform.mapRect(touchPoint.sceneRect()));
+#else
             translateTouchPointFromScreenToWindowCoords(touchPoint);
+#endif
 
             // Set the point's local coordinates to that of the item
+#if QT_VERSION < QT_VERSION_CHECK(5, 15, 0)
             touchPoint.setRect(windowToCandidateTransform.mapRect(touchPoint.sceneRect()));
+#else
+            touchPoint.setPos(windowToCandidateTransform.map(touchPoint.scenePos()));
+#endif
             touchPoint.setStartPos(windowToCandidateTransform.map(touchPoint.startScenePos()));
             touchPoint.setLastPos(windowToCandidateTransform.map(touchPoint.lastScenePos()));
             touchPoint.setVelocity(windowToCandidateMatrix.mapVector(touchPoint.velocity()).toVector2D());
@@ -209,11 +220,19 @@
 
 void TouchRegistry::translateTouchPointFromScreenToWindowCoords(QTouchEvent::TouchPoint &touchPoint)
 {
+#if QT_VERSION < QT_VERSION_CHECK(5, 15, 0)
     touchPoint.setScreenRect(touchPoint.sceneRect());
+#else
+    touchPoint.setScreenPos(touchPoint.scenePos());
+#endif
     touchPoint.setStartScreenPos(touchPoint.startScenePos());
     touchPoint.setLastScreenPos(touchPoint.lastScenePos());
 
+#if QT_VERSION < QT_VERSION_CHECK(5, 15, 0)
     touchPoint.setSceneRect(touchPoint.rect());
+#else
+    touchPoint.setScenePos(touchPoint.pos());
+#endif
     touchPoint.setStartScenePos(touchPoint.startPos());
     touchPoint.setLastScenePos(touchPoint.lastPos());
 }
--- a/src/LomiriMetrics/logger.cpp
+++ b/src/LomiriMetrics/logger.cpp
@@ -127,7 +127,12 @@
                     << event.process.cpuUsage << ' '
                     << event.process.vszMemory << ' '
                     << event.process.rssMemory << ' '
-                    << event.process.threadCount << '\n' << flush;
+                    << event.process.threadCount << '\n'
+#if QT_VERSION < QT_VERSION_CHECK(5, 15, 0)
+                    << flush;
+#else
+                    << Qt::flush;
+#endif
             } else {
                 m_textStream
                     << (m_flags & Colored ? "\033[33mP\033[00m " : "P ")
@@ -136,7 +141,12 @@
                     << "VSZ" << dimColon << event.process.vszMemory << "kB "
                     << "RSS" << dimColon << event.process.rssMemory << "kB "
                     << "Threads" << dimColon << event.process.threadCount
-                    << '\n' << flush;
+                    << '\n'
+#if QT_VERSION < QT_VERSION_CHECK(5, 15, 0)
+                    << flush;
+#else
+                    << Qt::flush;
+#endif
             }
             break;
         }
@@ -152,7 +162,12 @@
                     << event.frame.syncTime << ' '
                     << event.frame.renderTime << ' '
                     << event.frame.gpuTime << ' '
-                    << event.frame.swapTime << '\n' << flush;
+                    << event.frame.swapTime << '\n'
+#if QT_VERSION < QT_VERSION_CHECK(5, 15, 0)
+                    << flush;
+#else
+                    << Qt::flush;
+#endif
             } else {
                 m_textStream
                     << (m_flags & Colored ? "\033[36mF\033[00m " : "F ")
@@ -163,7 +178,12 @@
                     << "Sync" << dimColon << event.frame.syncTime / 1000000.0f << "ms "
                     << "Render" << dimColon << event.frame.renderTime / 1000000.0f << "ms "
                     << "GPU" << dimColon << event.frame.gpuTime / 1000000.0f << "ms "
-                    << "Swap" << dimColon << event.frame.swapTime / 1000000.0f << "ms\n" << flush;
+                    << "Swap" << dimColon << event.frame.swapTime / 1000000.0f << "ms\n"
+#if QT_VERSION < QT_VERSION_CHECK(5, 15, 0)
+                    << flush;
+#else
+                    << Qt::flush;
+#endif
             }
             break;
 
@@ -175,7 +195,12 @@
                     << event.window.id << ' '
                     << event.window.state << ' '
                     << event.window.width << ' '
-                    << event.window.height << '\n' << flush;
+                    << event.window.height << '\n'
+#if QT_VERSION < QT_VERSION_CHECK(5, 15, 0)
+                    << flush;
+#else
+                    << Qt::flush;
+#endif
             } else {
                 const char* const stateString[] = { "Hidden", "Shown", "Resized" };
                 Q_STATIC_ASSERT(ARRAY_SIZE(stateString) == UMWindowEvent::StateCount);
@@ -185,7 +210,12 @@
                     << "Id" << dimColon << event.window.id << ' '
                     << "State" << dimColon << stateString[event.window.state] << ' '
                     << "Size" << dimColon << event.window.width << 'x' << event.window.height
-                    << '\n' << flush;
+                    << '\n'
+#if QT_VERSION < QT_VERSION_CHECK(5, 15, 0)
+                    << flush;
+#else
+                    << Qt::flush;
+#endif
             }
             break;
         }
@@ -196,14 +226,24 @@
                     << "G "
                     << event.timeStamp << ' '
                     << event.generic.id << ' '
-                    << event.generic.string << '\n' << flush;
+                    << event.generic.string << '\n'
+#if QT_VERSION < QT_VERSION_CHECK(5, 15, 0)
+                    << flush;
+#else
+                    << Qt::flush;
+#endif
             } else {
                 m_textStream
                     << (m_flags & Colored ? "\033[32mG\033[00m " : "G ")
                     << dim << timeString << reset << ' '
                     << "Id" << dimColon << event.generic.id << ' '
                     << "String" << dimColon << '"' << event.generic.string << '"'
-                    << '\n' << flush;
+                    << '\n'
+#if QT_VERSION < QT_VERSION_CHECK(5, 15, 0)
+                    << flush;
+#else
+                    << Qt::flush;
+#endif
             }
             break;
         }
--- a/src/LomiriToolkit/adapters/alarmsadapter_organizer.cpp
+++ b/src/LomiriToolkit/adapters/alarmsadapter_organizer.cpp
@@ -339,7 +339,11 @@
 
 UCAlarm::DaysOfWeek AlarmDataAdapter::daysFromSet(const QSet<Qt::DayOfWeek> &set)
 {
+#if QT_VERSION < QT_VERSION_CHECK(5, 15, 0)
     UCAlarm::DaysOfWeek days = 0;
+#else
+    UCAlarm::DaysOfWeek days;
+#endif
     QSetIterator<Qt::DayOfWeek> i(set);
     while (i.hasNext()) {
         int day = static_cast<int>(i.next());
--- a/src/LomiriToolkit/exclusivegroup.cpp
+++ b/src/LomiriToolkit/exclusivegroup.cpp
@@ -71,7 +71,11 @@
 
     int index = m_signalMapper->metaObject()->indexOfMethod("map()");
     m_updateCurrentMethod = m_signalMapper->metaObject()->method(index);
+#if QT_VERSION < QT_VERSION_CHECK(5, 15, 0)
     connect(m_signalMapper, static_cast<void(QSignalMapper::*)(QObject *)>(&QSignalMapper::mapped), this, [this](QObject *object) {
+#else
+    connect(m_signalMapper, static_cast<void(QSignalMapper::*)(QObject *)>(&QSignalMapper::mappedObject), this, [this](QObject *object) {
+#endif
         if (isChecked(object)) {
             setCurrent(object);
         }
--- a/src/LomiriToolkit/i18n.cpp
+++ b/src/LomiriToolkit/i18n.cpp
@@ -359,7 +359,11 @@
                https://qt-project.org/doc/qt-5-snapshot/qdatetime.html#fromString-2 */
                 : dtr(lomiriUiToolkit, QStringLiteral("ddd d MMM'\u2003'HH:mm")));
     }
+#if QT_VERSION < QT_VERSION_CHECK(5, 15, 0)
     return datetime.toString(Qt::DefaultLocaleShortDate);
+#else
+    return datetime.toString(QLocale().dateFormat(QLocale::ShortFormat));
+#endif
 }
 
 UT_NAMESPACE_END
--- a/src/LomiriToolkit/lomirithemeiconprovider.cpp
+++ b/src/LomiriToolkit/lomirithemeiconprovider.cpp
@@ -299,7 +299,11 @@
     // The hicolor theme will be searched last as per
     // https://specifications.freedesktop.org/icon-theme-spec/icon-theme-spec-latest.html
     QSet<QString> alreadySearchedThemes;
+#if QT_VERSION < QT_VERSION_CHECK(5, 15, 0)
     const QStringList names = id.split(QLatin1Char(','), QString::SkipEmptyParts);
+#else
+    const QStringList names = id.split(QLatin1Char(','), Qt::SkipEmptyParts);
+#endif
     QImage image = getTheme()->findBestIcon(names, size, requestedSize, &alreadySearchedThemes);
 
     if (image.isNull()) {
--- a/src/LomiriToolkit/lomiritoolkitmodule.cpp
+++ b/src/LomiriToolkit/lomiritoolkitmodule.cpp
@@ -22,6 +22,9 @@
 #include <unistd.h>
 
 #include <stdexcept>
+#if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0)
+#include <qqml.h>
+#endif
 
 #include <QtCore/QPointer>
 #include <QtQml/QQmlContext>
@@ -229,7 +232,11 @@
     qmlRegisterExtendedType<
         QQuickImageBase, UCQQuickImageExtension>(uri, major, minor, "QQuickImageBase");
     qmlRegisterUncreatableType<UCUnits>(uri, major, minor, "UCUnits", notInstantiatable);
+#if QT_VERSION < QT_VERSION_CHECK(5, 15, 0)
     if (uri == QLatin1String("Ubuntu.Components")) {
+#else
+    if (QLatin1String(uri) == QLatin1String("Ubuntu.Components")) {
+#endif
         // FIXME/DEPRECATED: Ubuntu.* is exported for backwards compatibility only
         qmlRegisterType<UCLomiriShape>(uri, major, minor, "UbuntuShape");
     } else {
@@ -248,11 +255,19 @@
     }
     qmlRegisterType<UCArguments>(uri, major, minor, "Arguments");
     qmlRegisterType<UCArgument>(uri, major, minor, "Argument");
+#if QT_VERSION < QT_VERSION_CHECK(5, 15, 0)
     qmlRegisterType<QQmlPropertyMap>();
+#else
+    qmlRegisterAnonymousType<QQmlPropertyMap>(uri, major);
+#endif
     qmlRegisterType<UCAlarm>(uri, major, minor, "Alarm");
     qmlRegisterType<UCAlarmModel>(uri, major, minor, "AlarmModel");
     qmlRegisterType<UCStateSaver>(uri, major, minor, "StateSaver");
+#if QT_VERSION < QT_VERSION_CHECK(5, 15, 0)
     qmlRegisterType<UCStateSaverAttached>();
+#else
+    qmlRegisterAnonymousType<UCStateSaverAttached>(uri, major);
+#endif
     qmlRegisterSimpleSingletonType<UCUriHandler>(uri, major, minor, "UriHandler");
     qmlRegisterType<UCMouse>(uri, major, minor, "Mouse");
     qmlRegisterType<UCInverseMouse>(uri, major, minor, "InverseMouse");
@@ -334,7 +349,11 @@
         QString::fromLocal8Bit(qgetenv("UC_METRICS_LOGGING_FILTER"));
     if (!metricsLoggingFilter.isNull()) {
         QStringList filterList =
+#if QT_VERSION < QT_VERSION_CHECK(5, 15, 0)
             metricsLoggingFilter.split(QStringLiteral(","), QString::SkipEmptyParts);
+#else
+            metricsLoggingFilter.split(QStringLiteral(","), Qt::SkipEmptyParts);
+#endif
         UMApplicationMonitor::LoggingFilters filter = 0;
         const int size = filterList.size();
         for (int i = 0; i < size; ++i) {
@@ -403,14 +422,22 @@
 
     // register 1.2 only API
     qmlRegisterType<UCListItem>(uri, 1, 2, "ListItem");
+#if QT_VERSION < QT_VERSION_CHECK(5, 15, 0)
     qmlRegisterType<UCListItemDivider>();
+#else
+    qmlRegisterAnonymousType<UCListItemDivider>(uri, 1);
+#endif
     qmlRegisterUncreatableType<UCSwipeEvent>(
         uri, 1, 2, "SwipeEvent", QStringLiteral("This is an event object."));
     qmlRegisterUncreatableType<UCDragEvent>(
         uri, 1, 2, "ListItemDrag", QStringLiteral("This is an event object"));
     qmlRegisterType<UCListItemActions>(uri, 1, 2, "ListItemActions");
     qmlRegisterUncreatableType<UCViewItemsAttached>(uri, 1, 2, "ViewItems", notInstantiatable);
+#if QT_VERSION < QT_VERSION_CHECK(5, 15, 0)
     if (uri == QLatin1String("Ubuntu.Components")) {
+#else
+    if (QLatin1String(uri) == QLatin1String("Ubuntu.Components")) {
+#endif
         // FIXME/DEPRECATED: Ubuntu.* is exported for backwards compatibility only
         qmlRegisterType<UCLomiriShape, 1>(uri, 1, 2, "UbuntuShape");
         qmlRegisterType<UCLomiriShapeOverlay>(uri, 1, 2, "UbuntuShapeOverlay");
@@ -423,14 +450,22 @@
 
     // register 1.3 API
     qmlRegisterType<UCListItem, 1>(uri, 1, 3, "ListItem");
+#if QT_VERSION < QT_VERSION_CHECK(5, 15, 0)
     qmlRegisterType<UCListItemExpansion>();
+#else
+    qmlRegisterAnonymousType<UCListItemExpansion>(uri, 1);
+#endif
     qmlRegisterType<UCTheme>(uri, 1, 3, "ThemeSettings");
     qmlRegisterType<UCStyledItemBase, 2>(uri, 1, 3, "StyledItem");
     qmlRegisterType<UCStyledItemBase, 2>(uri, 1, 3, "StyledItem");
     qmlRegisterCustomType<UCStyleHints>(uri, 1, 3, "StyleHints", new UCStyleHintsParser);
     qmlRegisterType<UCAction, 1>(uri, 1, 3, "Action");
     qmlRegisterType<UCSlotsLayout>(uri, 1, 3, "SlotsLayout");
+#if QT_VERSION < QT_VERSION_CHECK(5, 15, 0)
     if (uri == QLatin1String("Ubuntu.Components")) {
+#else
+    if (QLatin1String(uri) == QLatin1String("Ubuntu.Components")) {
+#endif
         // FIXME/DEPRECATED: Ubuntu.* is exported for backwards compatibility only
         qmlRegisterType<UCLomiriShape, 2>(uri, 1, 3, "UbuntuShape");
         qmlRegisterSimpleSingletonType<UT_PREPEND_NAMESPACE(UCNamespaceV13)>(uri, 1, 3, "Ubuntu");
@@ -441,7 +476,11 @@
     qmlRegisterType<UCProportionalShape>(uri, 1, 3, "ProportionalShape");
     qmlRegisterType<LiveTimer>(uri, 1, 3, "LiveTimer");
     qmlRegisterType<UCAbstractButton>(uri, 1, 3, "AbstractButton");
+#if QT_VERSION < QT_VERSION_CHECK(5, 15, 0)
     qmlRegisterType<UCMargins>();
+#else
+    qmlRegisterAnonymousType<UCMargins>(uri, 1);
+#endif
     qmlRegisterUncreatableType<UCSlotsAttached>(uri, 1, 3, "SlotsAttached", notInstantiatable);
     qmlRegisterUncreatableType<UCSlotsLayoutPadding>(
         uri, 1, 3, "SlotsLayoutPadding", notInstantiatable);
@@ -458,7 +497,11 @@
     qmlRegisterType<ExclusiveGroup>(uri, 1, 3, "ExclusiveGroup");
 
 #   ifdef LOMIRI_UITK_WANT_UBUNTU_COMPAT
+#if QT_VERSION < QT_VERSION_CHECK(5, 15, 0)
     if (uri == QLatin1String("Ubuntu.Components")) {
+#else
+    if (QLatin1String(uri) == QLatin1String("Ubuntu.Components")) {
+#endif
         DeprecationPrinter::instance()->printDeprecation(
             DeprecationPrinter::COMPONENTS);
     }
--- a/src/LomiriToolkit/mousetouchadaptor_x11.cpp
+++ b/src/LomiriToolkit/mousetouchadaptor_x11.cpp
@@ -73,7 +73,11 @@
 {
     switch (detail) {
         case 1: return Qt::LeftButton;
+#if QT_VERSION < QT_VERSION_CHECK(5, 15, 0)
         case 2: return Qt::MidButton;
+#else
+        case 2: return Qt::MiddleButton;
+#endif
         case 3: return Qt::RightButton;
         // Button values 4-7 are Wheel events
         default: return Qt::NoButton;
--- a/src/LomiriToolkit/ucarguments.cpp
+++ b/src/LomiriToolkit/ucarguments.cpp
@@ -208,15 +208,36 @@
     }
 
     // display what each argument is used for
-    usageStream << endl;
-    usageStream << i18n->tr("Options:") << endl;
+    usageStream
+#if QT_VERSION < QT_VERSION_CHECK(5, 15, 0)
+            << endl;
+#else
+            << Qt::endl;
+#endif
+    usageStream << i18n->tr("Options:")
+#if QT_VERSION < QT_VERSION_CHECK(5, 15, 0)
+                << endl;
+#else
+                << Qt::endl;
+#endif
 
     Q_FOREACH (UCArgument* argument, m_arguments) {
-        usageStream << indentation << argument->usage() << endl;
+        usageStream << indentation << argument->usage()
+#if QT_VERSION < QT_VERSION_CHECK(5, 15, 0)
+                    << endl;
+#else
+                    << Qt::endl;
+#endif
     }
 
     if (m_defaultArgument != NULL) {
-        usageStream << endl << m_defaultArgument->help();
+        usageStream
+#if QT_VERSION < QT_VERSION_CHECK(5, 15, 0)
+               << endl
+#else
+               << Qt::endl
+#endif
+               << m_defaultArgument->help();
     }
 
     return usage;
@@ -446,7 +467,11 @@
         if (rawArgument.startsWith('-')) {
             // it starts with a '-' therefore it is a named argument
             // remove all prepended '-'
+#if QT_VERSION < QT_VERSION_CHECK(5, 15, 0)
             rawArgument = rawArgument.split('-', QString::SkipEmptyParts).join('-');
+#else
+            rawArgument = rawArgument.split('-', Qt::SkipEmptyParts).join('-');
+#endif
             // string after the '=' sign is a value for the argument
             values = rawArgument.split(QStringLiteral("="));
             name = values.takeAt(0);
--- a/src/LomiriToolkit/ucqquickimageextension.cpp
+++ b/src/LomiriToolkit/ucqquickimageextension.cpp
@@ -227,11 +227,26 @@
         while (!sciStream.atEnd()) {
             QString line = sciStream.readLine();
             if (line.startsWith(QStringLiteral("border"))) {
-                output << scaledBorder(line, scaleFactor) << endl;
+                output << scaledBorder(line, scaleFactor)
+#if QT_VERSION < QT_VERSION_CHECK(5, 15, 0)
+                       << endl;
+#else
+                       << Qt::endl;
+#endif
             } else if (line.startsWith(QStringLiteral("source"))) {
-                output << scaledSource(line, sciFilePath, scaleFactor) << endl;
+                output << scaledSource(line, sciFilePath, scaleFactor)
+#if QT_VERSION < QT_VERSION_CHECK(5, 15, 0)
+                                 << endl;
+#else
+                                 << Qt::endl;
+#endif
             } else {
-                output << line << endl;
+                output << line
+#if QT_VERSION < QT_VERSION_CHECK(5, 15, 0)
+                                 << endl;
+#else
+                                 << Qt::endl;
+#endif
             }
         }
         return true;
--- a/src/LomiriToolkit/ucstatesaver.cpp
+++ b/src/LomiriToolkit/ucstatesaver.cpp
@@ -325,7 +325,11 @@
 }
 void UCStateSaverAttached::setProperties(const QString &list)
 {
+#if QT_VERSION < QT_VERSION_CHECK(5, 15, 0)
     QStringList propertyList = list.split(',', QString::SkipEmptyParts);
+#else
+    QStringList propertyList = list.split(',', Qt::SkipEmptyParts);
+#endif
     for (int i = 0; i < propertyList.count(); i++) {
         propertyList[i] = propertyList.at(i).trimmed();
     }
--- a/src/LomiriToolkit/uctheme.cpp
+++ b/src/LomiriToolkit/uctheme.cpp
@@ -168,13 +168,21 @@
 QStringList themeSearchPath()
 {
     QString envPath = QLatin1String(getenv("LOMIRI_UI_TOOLKIT_THEMES_PATH"));
+#if QT_VERSION < QT_VERSION_CHECK(5, 15, 0)
     QStringList pathList = envPath.split(':', QString::SkipEmptyParts);
+#else
+    QStringList pathList = envPath.split(':', Qt::SkipEmptyParts);
+#endif
     if (pathList.isEmpty()) {
         // get the default path list from generic data location, which contains
         // XDG_DATA_DIRS
         QString xdgDirs = QLatin1String(getenv("XDG_DATA_DIRS"));
         if (!xdgDirs.isEmpty()) {
+#if QT_VERSION < QT_VERSION_CHECK(5, 15, 0)
             pathList << xdgDirs.split(':', QString::SkipEmptyParts);
+#else
+            pathList << xdgDirs.split(':', Qt::SkipEmptyParts);
+#endif
         }
         // ~/.local/share
         pathList << QStandardPaths::standardLocations(QStandardPaths::GenericDataLocation);
@@ -183,9 +191,17 @@
     // append QML import path(s); we must explicitly support env override here
     const QString qml2ImportPath = QString::fromLocal8Bit(getenv("QML2_IMPORT_PATH"));
     if (!qml2ImportPath.isEmpty()) {
+#if QT_VERSION < QT_VERSION_CHECK(5, 15, 0)
         pathList << qml2ImportPath.split(':', QString::SkipEmptyParts);
+#else
+        pathList << qml2ImportPath.split(':', Qt::SkipEmptyParts);
+#endif
     }
+#if QT_VERSION < QT_VERSION_CHECK(5, 15, 0)
     pathList << QLibraryInfo::location(QLibraryInfo::Qml2ImportsPath).split(':', QString::SkipEmptyParts);
+#else
+    pathList << QLibraryInfo::location(QLibraryInfo::Qml2ImportsPath).split(':', Qt::SkipEmptyParts);
+#endif
     // fix folders
     QStringList result;
     Q_FOREACH(const QString &path, pathList) {
--- a/src/imports/PerformanceMetrics/plugin/upmplugin.cpp
+++ b/src/imports/PerformanceMetrics/plugin/upmplugin.cpp
@@ -32,7 +32,11 @@
     qmlRegisterType<UPMRenderingTimes>(uri, major, minor, "RenderingTimes");
     qmlRegisterType<UPMCpuUsage>(uri, major, minor, "CpuUsage");
     qmlRegisterType<UPMTextureFromImage>(uri, major, minor, "TextureFromImage");
+#if QT_VERSION < QT_VERSION_CHECK(5, 15, 0)
     qmlRegisterType<UPMGraphModel>();
+#else
+    qmlRegisterAnonymousType<UPMGraphModel>(uri, major);
+#endif
 }
 
 void LomiriPerformanceMetricsPlugin::registerTypes(const char *uri)
--- a/tests/api/Extinct/Animals/plugin/plugin.cpp
+++ b/tests/api/Extinct/Animals/plugin/plugin.cpp
@@ -52,7 +52,11 @@
 {
     Q_ASSERT(uri == QLatin1String("Extinct.Animals"));
 
+#if QT_VERSION < QT_VERSION_CHECK(5, 15, 0)
     qmlRegisterType<EATarpan>();
+#else
+    qmlRegisterAnonymousType<EATarpan>(uri, 1);
+#endif
     qmlRegisterType<EASmilodon>(uri, 1, 0, "Smilodon");
     qmlRegisterType<EASmilodon>(uri, 0, 1, "ScimitarCat");
 
--- a/tests/unit/arguments/tst_arguments.cpp
+++ b/tests/unit/arguments/tst_arguments.cpp
@@ -58,7 +58,12 @@
 
     void setCommandLine(QString commandLine) {
         clearCommandLine();
+
+#if QT_VERSION < QT_VERSION_CHECK(5, 15, 0)
         QStringList arguments = QString(commandLine).split(' ', QString::SkipEmptyParts);
+#else
+        QStringList arguments = QString(commandLine).split(' ', Qt::SkipEmptyParts);
+#endif
 
         Q_FOREACH (QString argument, arguments) {
             QByteArray text = argument.toLocal8Bit();
--- a/tests/unit/qquick_image_extension/tst_qquick_image_extension.cpp
+++ b/tests/unit/qquick_image_extension/tst_qquick_image_extension.cpp
@@ -102,13 +102,48 @@
 
         QString expected;
         QTextStream expectedStream(&expected);
-        expectedStream << "source: \"image://scaling/1/data/borderInName.png\"" << endl;
-        expectedStream << "border.left: 9" << endl;
-        expectedStream << "border.right: 2" << endl;
-        expectedStream << "border.top: 9" << endl;
-        expectedStream << "border.bottom: 0" << endl;
-        expectedStream << "horizontalTileMode: Stretch" << endl;
-        expectedStream << "verticalTileMode: Stretch" << endl;
+        expectedStream << "source: \"image://scaling/1/data/borderInName.png\""
+#if QT_VERSION < QT_VERSION_CHECK(5, 15, 0)
+                       << endl;
+#else
+                       << Qt::endl;
+#endif
+        expectedStream << "border.left: 9"
+#if QT_VERSION < QT_VERSION_CHECK(5, 15, 0)
+                       << endl;
+#else
+                       << Qt::endl;
+#endif
+        expectedStream << "border.right: 2"
+#if QT_VERSION < QT_VERSION_CHECK(5, 15, 0)
+                       << endl;
+#else
+                       << Qt::endl;
+#endif
+        expectedStream << "border.top: 9"
+#if QT_VERSION < QT_VERSION_CHECK(5, 15, 0)
+                         << endl;
+#else
+                         << Qt::endl;
+#endif
+        expectedStream << "border.bottom: 0"
+#if QT_VERSION < QT_VERSION_CHECK(5, 15, 0)
+                         << endl;
+#else
+                         << Qt::endl;
+#endif
+        expectedStream << "horizontalTileMode: Stretch"
+#if QT_VERSION < QT_VERSION_CHECK(5, 15, 0)
+                       << endl;
+#else
+                       << Qt::endl;
+#endif
+        expectedStream << "verticalTileMode: Stretch"
+#if QT_VERSION < QT_VERSION_CHECK(5, 15, 0)
+                       << endl;
+#else
+                       << Qt::endl;
+#endif
 
         QCOMPARE(result, expected);
     }
--- a/tests/unit/statesaver/tst_statesaver.cpp
+++ b/tests/unit/statesaver/tst_statesaver.cpp
@@ -614,15 +614,27 @@
         QTest::qWait(1000);
 
         // make sure we are not killing the parent
+#if QT_VERSION < QT_VERSION_CHECK(5, 15, 0)
         QVERIFY(testApp.pid() != QCoreApplication::applicationPid());
+#else
+        QVERIFY(testApp.processId() != QCoreApplication::applicationPid());
+#endif
         // skip tests if the application PID is zero => the child app PID seems to be zero as well
+#if QT_VERSION < QT_VERSION_CHECK(5, 15, 0)
         if (!testApp.pid()) {
+#else
+        if (!testApp.processId()) {
+#endif
             // kill child process
             testApp.close();
             QSKIP("This test requires valid PID");
         }
         // send SIGINT
+#if QT_VERSION < QT_VERSION_CHECK(5, 15, 0)
         ::kill(testApp.pid(), SIGINT);
+#else
+        ::kill(testApp.processId(), SIGINT);
+#endif
         testApp.waitForFinished();
 
         QString fileName = stateFile("SimpleApp");
--- a/tests/unit/touchregistry/tst_TouchRegistry.cpp
+++ b/tests/unit/touchregistry/tst_TouchRegistry.cpp
@@ -200,7 +200,11 @@
         QList<QTouchEvent::TouchPoint> touchPoints;
         touchPoints.append(QTouchEvent::TouchPoint(0));
         touchPoints[0].setState(Qt::TouchPointPressed);
+#if QT_VERSION < QT_VERSION_CHECK(5, 15, 0)
         touchPoints[0].setRect(QRect(10, 10, 0, 0));
+#else
+        touchPoints[0].setPos(QPoint(10, 10));
+#endif
         QTouchEvent touchEvent(QEvent::TouchBegin,
                                0 /* device */,
                                Qt::NoModifier,
@@ -215,10 +219,18 @@
         QList<QTouchEvent::TouchPoint> touchPoints;
         touchPoints.append(QTouchEvent::TouchPoint(0));
         touchPoints[0].setState(Qt::TouchPointMoved);
+#if QT_VERSION < QT_VERSION_CHECK(5, 15, 0)
         touchPoints[0].setRect(QRect(11, 11, 0, 0));
+#else
+        touchPoints[0].setPos(QPoint(11, 11));
+#endif
         touchPoints.append(QTouchEvent::TouchPoint(1));
         touchPoints[1].setState(Qt::TouchPointPressed);
+#if QT_VERSION < QT_VERSION_CHECK(5, 15, 0)
         touchPoints[1].setRect(QRect(20, 20, 0, 0));
+#else
+        touchPoints[1].setPos(QPoint(20, 20));
+#endif
         QTouchEvent touchEvent(QEvent::TouchUpdate,
                                0 /* device */,
                                Qt::NoModifier,
@@ -233,8 +245,13 @@
     QCOMPARE(candidate0.unownedTouchEvents[0].touchPoints.count(), 1);
     QCOMPARE(candidate0.unownedTouchEvents[0].touchPoints[0].id(), 0);
     // Check that the points local coordinates have been mapped to candidate0's coordinate system.
+#if QT_VERSION < QT_VERSION_CHECK(5, 15, 0)
     QCOMPARE(candidate0.unownedTouchEvents[0].touchPoints[0].rect().x(), 11 - candidate0.x());
     QCOMPARE(candidate0.unownedTouchEvents[0].touchPoints[0].rect().y(), 11 - candidate0.y());
+#else
+    QCOMPARE(candidate0.unownedTouchEvents[0].touchPoints[0].pos().x(), 11 - candidate0.x());
+    QCOMPARE(candidate0.unownedTouchEvents[0].touchPoints[0].pos().y(), 11 - candidate0.y());
+#endif
 
     touchRegistry->addCandidateOwnerForTouch(1, &candidate1);
 
@@ -242,10 +259,18 @@
         QList<QTouchEvent::TouchPoint> touchPoints;
         touchPoints.append(QTouchEvent::TouchPoint(0));
         touchPoints[0].setState(Qt::TouchPointMoved);
+#if QT_VERSION < QT_VERSION_CHECK(5, 15, 0)
         touchPoints[0].setRect(QRect(12, 12, 0, 0));
+#else
+        touchPoints[0].setPos(QPoint(12, 12));
+#endif
         touchPoints.append(QTouchEvent::TouchPoint(1));
         touchPoints[1].setState(Qt::TouchPointMoved);
+#if QT_VERSION < QT_VERSION_CHECK(5, 15, 0)
         touchPoints[1].setRect(QRect(21, 21, 0, 0));
+#else
+        touchPoints[1].setPos(QPoint(21, 21));
+#endif
         QTouchEvent touchEvent(QEvent::TouchUpdate,
                                0 /* device */,
                                Qt::NoModifier,
@@ -280,7 +305,11 @@
         QList<QTouchEvent::TouchPoint> touchPoints;
         touchPoints.append(QTouchEvent::TouchPoint(0));
         touchPoints[0].setState(Qt::TouchPointPressed);
+#if QT_VERSION < QT_VERSION_CHECK(5, 15, 0)
         touchPoints[0].setRect(QRect(10, 10, 0, 0));
+#else
+        touchPoints[0].setPos(QPoint(10, 10));
+#endif
         QTouchEvent touchEvent(QEvent::TouchBegin,
                                0 /* device */,
                                Qt::NoModifier,
@@ -295,10 +324,18 @@
         QList<QTouchEvent::TouchPoint> touchPoints;
         touchPoints.append(QTouchEvent::TouchPoint(0));
         touchPoints[0].setState(Qt::TouchPointMoved);
+#if QT_VERSION < QT_VERSION_CHECK(5, 15, 0)
         touchPoints[0].setRect(QRect(11, 11, 0, 0));
+#else
+        touchPoints[0].setPos(QPoint(11, 11));
+#endif
         touchPoints.append(QTouchEvent::TouchPoint(1));
         touchPoints[1].setState(Qt::TouchPointPressed);
+#if QT_VERSION < QT_VERSION_CHECK(5, 15, 0)
         touchPoints[1].setRect(QRect(20, 20, 0, 0));
+#else
+        touchPoints[1].setPos(QPoint(20, 20));
+#endif
         QTouchEvent touchEvent(QEvent::TouchUpdate,
                                0 /* device */,
                                Qt::NoModifier,
@@ -313,17 +350,30 @@
     QCOMPARE(watcher.unownedTouchEvents[0].touchPoints.count(), 1);
     QCOMPARE(watcher.unownedTouchEvents[0].touchPoints[0].id(), 0);
     // Check that the points local coordinates have been mapped to watcher's coordinate system.
+#if QT_VERSION < QT_VERSION_CHECK(5, 15, 0)
     QCOMPARE(watcher.unownedTouchEvents[0].touchPoints[0].rect().x(), 11 - watcher.x());
     QCOMPARE(watcher.unownedTouchEvents[0].touchPoints[0].rect().y(), 11 - watcher.y());
+#else
+    QCOMPARE(watcher.unownedTouchEvents[0].touchPoints[0].pos().x(), 11 - watcher.x());
+    QCOMPARE(watcher.unownedTouchEvents[0].touchPoints[0].pos().y(), 11 - watcher.y());
+#endif
 
     {
         QList<QTouchEvent::TouchPoint> touchPoints;
         touchPoints.append(QTouchEvent::TouchPoint(0));
         touchPoints[0].setState(Qt::TouchPointMoved);
+#if QT_VERSION < QT_VERSION_CHECK(5, 15, 0)
         touchPoints[0].setRect(QRect(12, 12, 0, 0));
+#else
+        touchPoints[0].setPos(QPoint(12, 12));
+#endif
         touchPoints.append(QTouchEvent::TouchPoint(1));
         touchPoints[1].setState(Qt::TouchPointMoved);
+#if QT_VERSION < QT_VERSION_CHECK(5, 15, 0)
         touchPoints[1].setRect(QRect(21, 21, 0, 0));
+#else
+        touchPoints[1].setPos(QPoint(21, 21));
+#endif
         QTouchEvent touchEvent(QEvent::TouchUpdate,
                                0 /* device */,
                                Qt::NoModifier,
