From 15bf145f14ac00c1e6bc989a15092408b3c17753 Mon Sep 17 00:00:00 2001 From: Michael Keller Date: Mon, 24 Apr 2023 17:31:25 +1200 Subject: [PATCH] Desktop: Fix build for Qt6 This seems to be needed to make the build work with Qt6, which is needed for M1 based Macs. Signed-off-by: Michael Keller --- qt-models/divelocationmodel.cpp | 6 +++--- qt-models/divesiteimportmodel.cpp | 4 ++-- qt-models/yearlystatisticsmodel.cpp | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/qt-models/divelocationmodel.cpp b/qt-models/divelocationmodel.cpp index ca84927de..d382d6f94 100644 --- a/qt-models/divelocationmodel.cpp +++ b/qt-models/divelocationmodel.cpp @@ -91,11 +91,11 @@ QVariant LocationInformationModel::getDiveSiteData(const struct dive_site *ds, i case Qt::DisplayRole: switch(column) { case DIVESITE: return QVariant::fromValue((dive_site *)ds); // Not nice: casting away const - case NAME: return ds->name; + case NAME: return QString(ds->name); case NUM_DIVES: return ds->dives.nr; case LOCATION: return "TODO"; - case DESCRIPTION: return ds->description; - case NOTES: return ds->name; + case DESCRIPTION: return QString(ds->description); + case NOTES: return QString(ds->name); case TAXONOMY: return "TODO"; } break; diff --git a/qt-models/divesiteimportmodel.cpp b/qt-models/divesiteimportmodel.cpp index d8ffd6011..07c763bb5 100644 --- a/qt-models/divesiteimportmodel.cpp +++ b/qt-models/divesiteimportmodel.cpp @@ -59,7 +59,7 @@ QVariant DivesiteImportedModel::data(const QModelIndex &index, int role) const if (role == Qt::DisplayRole) { switch (index.column()) { case NAME: - return ds->name; + return QString(ds->name); case LOCATION: return printGPSCoords(&ds->location); case COUNTRY: @@ -70,7 +70,7 @@ QVariant DivesiteImportedModel::data(const QModelIndex &index, int role) const get_dive_site_by_gps_proximity(&ds->location, 40075000, divelog.sites); if (nearest_ds) - return nearest_ds->name; + return QString(nearest_ds->name); else return QString(); } diff --git a/qt-models/yearlystatisticsmodel.cpp b/qt-models/yearlystatisticsmodel.cpp index dd570e361..b6613d253 100644 --- a/qt-models/yearlystatisticsmodel.cpp +++ b/qt-models/yearlystatisticsmodel.cpp @@ -54,7 +54,7 @@ QVariant YearStatisticsItem::data(int column, int role) const switch (column) { case YEAR: if (stats_interval.is_trip) { - ret = stats_interval.location; + ret = QString(stats_interval.location); } else { ret = stats_interval.period; }