Commit 2c38f332 authored by Volker Krause's avatar Volker Krause
Browse files

Build with Qt6 on Android

Not sure why the Linux/Qt6 build isn't seeing those issues.
parent d11946a6
Pipeline #182585 passed with stage
in 3 minutes and 26 seconds
......@@ -7,3 +7,5 @@ include:
- https://invent.kde.org/sysadmin/ci-utilities/raw/master/gitlab-templates/freebsd.yml
- https://invent.kde.org/sysadmin/ci-utilities/raw/master/gitlab-templates/android.yml
- https://invent.kde.org/sysadmin/ci-utilities/raw/master/gitlab-templates/windows.yml
- https://invent.kde.org/sysadmin/ci-utilities/raw/master/gitlab-templates/linux-qt6.yml
- https://invent.kde.org/sysadmin/ci-utilities/raw/master/gitlab-templates/android-qt6.yml
......@@ -4,7 +4,7 @@
@PACKAGE_INIT@
include(CMakeFindDependencyMacro)
find_dependency(Qt5Gui)
find_dependency(Qt@QT_MAJOR_VERSION@Gui)
find_dependency(ZLIB)
include("${CMAKE_CURRENT_LIST_DIR}/KPublicTransportTargets.cmake")
......@@ -8,6 +8,7 @@ add_library(KGraphQL STATIC
kgraphqlminimizer_p.h
)
target_link_libraries(KGraphQL PUBLIC Qt::Network)
set_target_properties(KGraphQL PROPERTIES POSITION_INDEPENDENT_CODE ON)
if (NOT BUILD_SHARED_LIBS)
install(TARGETS KGraphQL EXPORT KPublicTransportTargets ${INSTALL_TARGETS_DEFAULT_ARGS})
......
......@@ -78,7 +78,7 @@ static QByteArray readReplyAsUtf8(QNetworkReply *reply)
if (charsetStart < 0) {
return data;
}
const auto codec = QTextCodec::codecForName(contentType.midRef(charsetStart + 8).toUtf8());
const auto codec = QTextCodec::codecForName(QStringView(contentType).mid(charsetStart + 8).toUtf8());
if (!codec) {
return data;
}
......
......@@ -338,7 +338,7 @@ std::vector<Journey> HafasQueryParser::parseQueryJourneyResponse(const QByteArra
++commentPtr;
// format: XX - <human readable comment>, where XX is two character code for the comment
const auto note = stringTable.lookup(*commentPtr);
if (note.size() > 5 && note.midRef(2, 3) == QLatin1String(" - ")) {
if (note.size() > 5 && QStringView(note).mid(2, 3) == QLatin1String(" - ")) {
section.addNote(note.mid(5));
} else {
section.addNote(note);
......
......@@ -373,7 +373,11 @@ std::vector<Journey> IvvAssParser::parseJourneys(const QByteArray &data)
s.setDistance(segmentObj.value(QLatin1String("distance")).toInt());
const auto polygon = segmentObj.value(QLatin1String("polygon")).toString();
QPolygonF poly;
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
const auto coords = polygon.splitRef(QLatin1Char(' '), Qt::SkipEmptyParts);
#else
const auto coords = QStringView(polygon).split(QLatin1Char(' '), Qt::SkipEmptyParts);
#endif
poly.reserve(coords.size());
for (const auto &coord : coords) {
const auto p = coord.split(QLatin1Char(','));
......
......@@ -232,7 +232,7 @@ static Path parsePathFromLength(const QPolygonF &pathLineString, const QJsonArra
QPolygonF subPoly;
subPoly.reserve(polyIdx - prevPolyIdx + 1);
std::copy(pathLineString.begin() + prevPolyIdx, pathLineString.begin() + std::min(polyIdx + 1, pathLineString.size()), std::back_inserter(subPoly));
std::copy(pathLineString.begin() + prevPolyIdx, pathLineString.begin() + std::min<int>(polyIdx + 1, pathLineString.size()), std::back_inserter(subPoly));
pathSec.setPath(std::move(subPoly));
prevPolyIdx = polyIdx;
pathSections.push_back(std::move(pathSec));
......
......@@ -237,7 +237,11 @@ void Json::fromJson(const QMetaObject *mo, const QJsonObject &obj, void *elem)
}
auto valueData = mt.create();
*reinterpret_cast<int*>(valueData) = numValue;
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
QVariant value(prop.userType(), valueData);
#else
QVariant value(prop.metaType(), valueData);
#endif
prop.writeOnGadget(elem, value);
continue;
}
......
......@@ -24,9 +24,9 @@ QString NotesUtil::normalizeNote(const QString &note)
const auto match = linkRegExp.match(n);
if (match.hasMatch()) {
n.replace(match.capturedStart(), match.capturedLength(), QLatin1String("<a href=\"")
+ (match.capturedRef().startsWith(QLatin1String("http")) ? QString() : QStringLiteral("https://"))
+ match.capturedRef().toString()
+ QLatin1String("\">") + match.capturedRef() + QLatin1String("</a>"));
+ (match.capturedView().startsWith(QLatin1String("http")) ? QString() : QStringLiteral("https://"))
+ match.capturedView()
+ QLatin1String("\">") + match.capturedView() + QLatin1String("</a>"));
}
}
......
......@@ -242,7 +242,7 @@ static void applyBackendOptions(AbstractBackend *backend, const QMetaObject *mo,
const auto langArray = obj.value(QLatin1String("supportedLanguages")).toArray();
QStringList langs;
langs.reserve(langArray.size());
std::transform(langArray.begin(), langArray.end(), std::back_inserter(langs), std::mem_fn(qOverload<>(&QJsonValue::toString)));
std::transform(langArray.begin(), langArray.end(), std::back_inserter(langs), [](const auto &v) { return v.toString(); });
backend->setSupportedLanguages(langs);
}
......
......@@ -32,6 +32,7 @@ add_library(KOSM STATIC
target_include_directories(KOSM PUBLIC "$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/..>")
target_include_directories(KOSM PRIVATE ${Protobuf_INCLUDE_DIRS})
target_link_libraries(KOSM PUBLIC Qt::Core PRIVATE Qt::Network ${EXTRA_LIBS})
set_target_properties(KOSM PROPERTIES POSITION_INDEPENDENT_CODE ON)
if (NOT BUILD_SHARED_LIBS)
install(TARGETS KOSM EXPORT KPublicTransportTargets ${INSTALL_TARGETS_DEFAULT_ARGS})
......
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