Qt6: first steps towards map support

There is an initial build of the C++ classes that seems to work, but the QML
integration is still missing. Still, progress is being made.

Unfortunately with Qt6 we can't forward declare the MapLocationModel class (one
of the operators needs to be able to determine the size of the class), so we
need to include the header file.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
Dirk Hohndel 2022-04-08 14:31:02 -10:00
parent 2241a28499
commit ea961edec8
2 changed files with 21 additions and 1 deletions

View file

@ -192,6 +192,26 @@ if(QT_VERSION_MAJOR STREQUAL "6")
# QtWebKit doesn't work with Qt6, so no printing, no manual # QtWebKit doesn't work with Qt6, so no printing, no manual
set(NO_PRINTING ON) set(NO_PRINTING ON)
set(NO_USERMANUAL ON) set(NO_USERMANUAL ON)
# as of Qt 6.3 by default QtLocation isn't included, but one can
# build the module from source; so let's look if the user has installed
# it (or if a newer version is out that includes it, anyway)
find_package(Qt6 COMPONENTS Location)
if(Qt6Location_FOUND)
message(STATUS "Found Qt6Location")
LIST(APPEND QT_EXTRA_COMPONENTS Location)
add_definitions(-DMAP_SUPPORT)
set(MAPSUPPORT ON)
# at least on macOS something goes sideways and we fail to load the
# QML files with a weird error about Qml.WorkerScript missing
# linking Subsurface against that component appears enough to hack
# around that, but that feels... wrong
if(CMAKE_SYSTEM_NAME STREQUAL "Darwin")
find_package(Qt6 COMPONENTS QmlWorkerScript)
LIST(APPEND SUBSURFACE_LINK_LIBRARIES Qt6::QmlWorkerScript)
endif()
endif()
else() else()
# as mentioned above, since some variables appear to fail to populate # as mentioned above, since some variables appear to fail to populate
# on some platforms, simply run this again the 'old' way # on some platforms, simply run this again the 'old' way

View file

@ -12,7 +12,7 @@
Q_IMPORT_PLUGIN(QGeoServiceProviderFactoryGooglemaps) Q_IMPORT_PLUGIN(QGeoServiceProviderFactoryGooglemaps)
#endif #endif
class MapLocationModel; #include "qt-models/maplocationmodel.h"
class MapLocation; class MapLocation;
struct dive_site; struct dive_site;