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

Fix some qt6 compile error

parent f7f93ea3
......@@ -52,7 +52,11 @@ Line::Mode HafasParser::parseLineMode(const QString &modeId) const
return parseLineMode(modeNum);
}
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
Line::Mode HafasParser::parseLineMode(const QStringRef &modeId) const
#else
Line::Mode HafasParser::parseLineMode(const QStringView &modeId) const
#endif
{
bool ok = false;
const auto modeNum = modeId.toInt(&ok);
......
......@@ -39,7 +39,11 @@ protected:
void clearErrorState();
Line::Mode parseLineMode(const QString &modeId) const;
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
Line::Mode parseLineMode(const QStringRef &modeId) const;
#else
Line::Mode parseLineMode(const QStringView &modeId) const;
#endif
Line::Mode parseLineMode(int modeId) const;
void setLocationIdentifier(Location &loc, const QString &id) const;
......
......@@ -9,11 +9,11 @@
#include <QJsonArray>
#include <QJsonObject>
#include <QStringList>
#include <vector>
struct QMetaObject;
class QStringList;
namespace KPublicTransport {
......
......@@ -417,7 +417,7 @@ inline QByteArray tagValue(const Elem& elem, const char *keyName, const QLocale
const auto idx = lang.indexOf(QLatin1Char('-'));
if (idx > 0) {
key.resize(baseLen);
key.append(lang.leftRef(idx).toUtf8());
key.append(QStringView(lang).left(idx).toUtf8());
const auto it = std::find_if(elem.tags.begin(), elem.tags.end(), [key](const auto &tag) { return std::strcmp(tag.key.name(), key.constData()) == 0; });
if (it != elem.tags.end()) {
return (*it).value;
......
......@@ -59,7 +59,11 @@ private:
if (!id.startsWith(QLatin1Char(Prefix))) {
return Identifier();
}
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
return Identifier(id.midRef(1).toULongLong());
#else
return Identifier(QStringView(id).mid(1).toULongLong());
#endif
}
static inline Identifier fromString(const QByteArray &id)
{
......
Supports Markdown
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