From 04b26d31c8888e2ac7535e66e426b9b33a871f6e Mon Sep 17 00:00:00 2001 From: Dirk Hohndel Date: Wed, 9 Feb 2022 16:04:33 -0800 Subject: [PATCH] Qt6: deal with changes from QStringRef to QStringView QStringRef is gone in Qt6 and mostly replaced by QStringView. The one major difference is that direct comparisons with string literals are no longer possible. Thanks to Thiago Macieira for helping me avoid more conditional compilation here. Signed-off-by: Dirk Hohndel --- core/parse-gpx.cpp | 5 +++-- core/qthelper.h | 7 +++++++ desktop-widgets/subsurfacewebservices.cpp | 10 +++++----- 3 files changed, 15 insertions(+), 7 deletions(-) diff --git a/core/parse-gpx.cpp b/core/parse-gpx.cpp index 11e332091..72ea6e64d 100644 --- a/core/parse-gpx.cpp +++ b/core/parse-gpx.cpp @@ -1,6 +1,7 @@ // SPDX-License-Identifier: GPL-2.0 #include "core/parse-gpx.h" #include "core/subsurface-time.h" +#include "core/qthelper.h" #include #include @@ -43,7 +44,7 @@ int getCoordsFromGPXFile(struct dive_coords *coords, QString fileName) while (!gpxReader.atEnd()) { gpxReader.readNext(); if (gpxReader.isStartElement()) { - if (gpxReader.name() == "trkpt") { + if (nameCmp(gpxReader, "trkpt") == 0) { trkpt_found = true; line++; foreach (const QXmlStreamAttribute &attr, gpxReader.attributes()) { @@ -53,7 +54,7 @@ int getCoordsFromGPXFile(struct dive_coords *coords, QString fileName) lon = attr.value().toString().toDouble(); } } - if (gpxReader.name() == "time" && trkpt_found) { // Ignore the