Commit cb00d391 authored by Laurent Montel's avatar Laurent Montel 😁
Browse files

Fix some qt6 compile error

parent 80b64f22
Pipeline #121926 passed with stage
in 2 minutes and 50 seconds
......@@ -68,7 +68,11 @@ QVariant Ticket::ticketTokenData() const
} else if (d->ticketToken.startsWith(QLatin1String("azteccode:"), Qt::CaseInsensitive)) {
return ticketToken().mid(10);
} else if (d->ticketToken.startsWith(QLatin1String("aztecbin:"), Qt::CaseInsensitive)) {
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
return QByteArray::fromBase64(d->ticketToken.midRef(9).toLatin1());
#else
return QByteArray::fromBase64(QStringView(d->ticketToken).mid(9).toLatin1());
#endif
} else if (d->ticketToken.startsWith(QLatin1String("barcode128:"), Qt::CaseInsensitive)) {
return ticketToken().mid(11);
} else if (d->ticketToken.startsWith(QLatin1String("datamatrix:"), Qt::CaseInsensitive)) {
......@@ -76,7 +80,11 @@ QVariant Ticket::ticketTokenData() const
} else if (d->ticketToken.startsWith(QLatin1String("pdf417:"), Qt::CaseInsensitive)) {
return ticketToken().mid(7);
} else if (d->ticketToken.startsWith(QLatin1String("pdf417bin:"), Qt::CaseInsensitive)) {
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
return QByteArray::fromBase64(d->ticketToken.midRef(10).toLatin1());
#else
return QByteArray::fromBase64(QStringView(d->ticketToken).mid(10).toLatin1());
#endif
}
return ticketToken();
}
......
......@@ -136,7 +136,11 @@ void ExtractorFilter::setScope(Scope scope)
static QString valueForJsonPath(const QJsonObject &obj, const QString &path)
{
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
const auto pathSections = path.splitRef(QLatin1Char('.'));
#else
const auto pathSections = QStringView(path).split(QLatin1Char('.'));
#endif
QJsonValue v(obj);
for (const auto &pathSection : pathSections) {
if (!v.isObject()) {
......
......@@ -351,8 +351,13 @@ QJSValue JsApi::JsonLd::toGeoCoordinates(const QString &mapUrl)
if (match.hasMatch()) {
auto geo = m_engine->newObject();
geo.setProperty(QStringLiteral("@type"), QStringLiteral("GeoCoordinates"));
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
geo.setProperty(QStringLiteral("latitude"), match.capturedRef(1).toDouble());
geo.setProperty(QStringLiteral("longitude"), match.capturedRef(2).toDouble());
#else
geo.setProperty(QStringLiteral("latitude"), match.capturedView(1).toDouble());
geo.setProperty(QStringLiteral("longitude"), match.capturedView(2).toDouble());
#endif
return geo;
}
}
......
......@@ -9,7 +9,7 @@
#include <QStringView>
class QStringList;
#include <QStringList>
namespace KItinerary {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment