Commit e02405e8 authored by Volker Krause's avatar Volker Krause
Browse files

Compile with Qt6

parent b18a5ca0
......@@ -40,7 +40,7 @@ find_package(KOpeningHours)
set_package_properties(KOpeningHours PROPERTIES TYPE OPTIONAL PURPOSE "Highlight currently open amenities/shops/etc.")
if (BUILD_TESTING)
find_package(Qt5 5.15 REQUIRED COMPONENTS Test Widgets)
find_package(Qt${QT_MAJOR_VERSION} 5.15 REQUIRED COMPONENTS Test Widgets)
endif()
if (BUILD_STANDALONE_APP)
......
......@@ -4,6 +4,6 @@
@PACKAGE_INIT@
include(CMakeFindDependencyMacro)
find_dependency(Qt5Gui)
find_dependency(Qt@QT_MAJOR_VERSION@Gui)
include("${CMAKE_CURRENT_LIST_DIR}/KOSMIndoorMapTargets.cmake")
......@@ -11,6 +11,7 @@
#include <KOSMIndoorMap/OverlaySource>
#include <QDebug>
#include <QFile>
#include <QGuiApplication>
#include <QPainter>
#include <QPalette>
......@@ -121,9 +122,15 @@ FloorLevelModel* MapItem::floorLevelModel() const
return m_floorLevelModel;
}
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
void MapItem::geometryChanged(const QRectF &newGeometry, const QRectF &oldGeometry)
{
QQuickPaintedItem::geometryChanged(newGeometry, oldGeometry);
#else
void MapItem::geometryChange(const QRectF &newGeometry, const QRectF &oldGeometry)
{
QQuickPaintedItem::geometryChange(newGeometry, oldGeometry);
#endif
m_view->setScreenSize(newGeometry.size().toSize());
// the scale factor isn't automatically applied to the paint device, only to the input coordinates
// so we need to handle this manually here
......
......@@ -89,7 +89,11 @@ Q_SIGNALS:
void timeZoneChanged();
protected:
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
void geometryChanged(const QRectF &newGeometry, const QRectF &oldGeometry) override;
#else
void geometryChange(const QRectF &newGeometry, const QRectF &oldGeometry) override;
#endif
private:
void clear();
......
......@@ -30,7 +30,11 @@ public:
~IconEngine() = default;
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
QList<QSize> availableSizes(QIcon::Mode mode, QIcon::State state) const override
#else
QList<QSize> availableSizes(QIcon::Mode mode, QIcon::State state) override
#endif
{
Q_UNUSED(mode);
Q_UNUSED(state);
......
......@@ -393,7 +393,11 @@ inline QByteArray tagValue(const Elem& elem, const char *keyName, const QLocale
const auto idx = lang.indexOf(QLatin1Char('-'));
if (idx > 0) {
key.resize(baseLen);
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
key.append(lang.leftRef(idx).toUtf8());
#else
key.append(QStringView(lang).left(idx).toUtf8());
#endif
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;
......
......@@ -73,7 +73,7 @@ int main(int argc, char **argv)
}
OSM::BoundingBox bbox;
const auto coords = parser.value(bboxOpt).splitRef(QLatin1Char(','));
const auto coords = QStringView(parser.value(bboxOpt)).split(QLatin1Char(','));
if (coords.size() == 4) {
bbox.min = OSM::Coordinate(coords[0].toDouble(), coords[1].toDouble());
bbox.max = OSM::Coordinate(coords[2].toDouble(), coords[3].toDouble());
......
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