Skip to content

Commit

Permalink
Qt6: first steps towards map support
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
dirkhh committed Apr 18, 2022
1 parent 2241a28 commit ea961ed
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 1 deletion.
20 changes: 20 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,26 @@ if(QT_VERSION_MAJOR STREQUAL "6")
# QtWebKit doesn't work with Qt6, so no printing, no manual
set(NO_PRINTING 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()
# as mentioned above, since some variables appear to fail to populate
# on some platforms, simply run this again the 'old' way
Expand Down
2 changes: 1 addition & 1 deletion map-widget/qmlmapwidgethelper.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
Q_IMPORT_PLUGIN(QGeoServiceProviderFactoryGooglemaps)
#endif

class MapLocationModel;
#include "qt-models/maplocationmodel.h"
class MapLocation;
struct dive_site;

Expand Down

0 comments on commit ea961ed

Please sign in to comment.