Commit 347b9720 authored by Laurent Montel's avatar Laurent Montel 😁
Browse files

Fix more qt6 compile error

parent cb00d391
Pipeline #122011 passed with stage
in 4 minutes and 18 seconds
......@@ -29,7 +29,6 @@
#include <KCalendarCore/Event>
#endif
#include <kcontacts_version.h>
#include <KContacts/Address>
#include <KLocalizedString>
......@@ -46,11 +45,7 @@ static QString formatAddress(const PostalAddress &addr)
a.setStreet(addr.streetAddress());
a.setPostalCode(addr.postalCode());
a.setLocality(addr.addressLocality());
#if KContacts_VERSION <= QT_VERSION_CHECK(5, 88, 0)
a.setCountry(KContacts::Address::ISOtoCountry(addr.addressCountry()));
#else
a.setCountry(addr.addressCountry());
#endif
return a.formattedAddress();
}
......@@ -444,7 +439,6 @@ static void fillGeoPosition(const QVariant &place, const KCalendarCore::Event::P
return;
}
event->setHasGeo(true);
event->setGeoLatitude(geo.latitude());
event->setGeoLongitude(geo.longitude());
}
......
......@@ -9,8 +9,11 @@
#include "kitinerary_export.h"
#include <QSharedPointer>
template <typename T> class QVector;
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
template<typename T> class QVector;
#else
template<typename T> class QList;
#endif
class QVariant;
namespace KCalendarCore {
......
......@@ -240,12 +240,20 @@ TrainStation ExtractorPostprocessorPrivate::processTrainStation(TrainStation sta
} else if (id.startsWith(QLatin1String("ibnr:")) && id.size() == 12) {
const auto record = KnowledgeDb::stationForIbnr(KnowledgeDb::IBNR{id.mid(5).toUInt()});
applyStationData(record, station);
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
const auto country = KnowledgeDb::countryIdForUicCode(id.midRef(5, 2).toUShort()).toString();
#else
const auto country = KnowledgeDb::countryIdForUicCode(QStringView(id).mid(5, 2).toUShort()).toString();
#endif
applyStationCountry(country, station);
} else if (id.startsWith(QLatin1String("uic:")) && id.size() == 11) {
const auto record = KnowledgeDb::stationForUic(KnowledgeDb::UICStation{id.mid(4).toUInt()});
applyStationData(record, station);
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
const auto country = KnowledgeDb::countryIdForUicCode(id.midRef(4, 2).toUShort()).toString();
#else
const auto country = KnowledgeDb::countryIdForUicCode(QStringView(id).mid(4, 2).toUShort()).toString();
#endif
applyStationCountry(country, station);
} else if (id.startsWith(QLatin1String("ir:")) && id.size() > 4) {
const auto record = KnowledgeDb::stationForIndianRailwaysStationCode(id.mid(3));
......
......@@ -24,7 +24,7 @@ BER::Element::Element() = default;
BER::Element::Element(const QByteArray &data, int offset, int size)
: m_data(data)
, m_offset(offset)
, m_dataSize(size < 0 ? data.size() : std::min(offset + size, data.size()))
, m_dataSize(size < 0 ? data.size() : std::min<int>(offset + size, data.size()))
{
assert(m_dataSize <= m_data.size());
if (!isValid()) {
......
......@@ -38,8 +38,11 @@ QDate Rct2TicketPrivate::firstDayOfValidity() const
if (it == f.end()) {
return {};
}
const auto dtStr = f.midRef(std::distance(f.begin(), it));
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
const auto dtStr = f.midRef(std::distance(f.begin(), it));
#else
const auto dtStr = QStringView(f).mid(std::distance(f.begin(), it));
#endif
auto dt = QDate::fromString(dtStr.left(10).toString(), QStringLiteral("dd.MM.yyyy"));
if (dt.isValid()) {
return dt;
......
......@@ -161,8 +161,11 @@ QString Uic9183TicketLayout::text(int row, int column, int width, int height) co
// split field into lines
// TODO this needs to follow the U_TLAY word-wrapping algorithm?
const auto content = f.text();
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
const auto lines = content.splitRef(QLatin1Char('\n'));
#else
const auto lines = QStringView(content).split(QLatin1Char('\n'));
#endif
// cut out the right part of the line
for (int i = 0; i < lines.size(); ++i) {
if (f.row() + i < row) {
......
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