File indexing completed on 2025-02-02 05:02:32
0001 /* 0002 SPDX-FileCopyrightText: 2019 Volker Krause <vkrause@kde.org> 0003 0004 SPDX-License-Identifier: LGPL-2.0-or-later 0005 */ 0006 0007 #ifndef NAVIGATIONCONTROLLER_H 0008 #define NAVIGATIONCONTROLLER_H 0009 0010 #include <QMetaType> 0011 0012 class QGeoPositionInfo; 0013 class QGeoPositionInfoSource; 0014 class QVariant; 0015 0016 /** Navigation and map display API for use from QML. */ 0017 class NavigationController 0018 { 0019 Q_GADGET 0020 public: 0021 Q_INVOKABLE void showOnMap(const QVariant &place); 0022 Q_INVOKABLE void showOnMap(float latitude, float longitude, int zoom); 0023 Q_INVOKABLE void showOnWheelmap(float latitude, float longitude); 0024 0025 Q_INVOKABLE bool canNavigateTo(const QVariant &place); 0026 Q_INVOKABLE void navigateTo(const QVariant &place); 0027 Q_INVOKABLE void navigateTo(const QVariant &from, const QVariant &to); 0028 0029 private: 0030 #ifndef Q_OS_ANDROID 0031 void navigateTo(const QGeoPositionInfo &from, const QVariant &to); 0032 0033 QGeoPositionInfoSource *m_positionSource = nullptr; 0034 QMetaObject::Connection m_pendingNavigation; 0035 #endif 0036 }; 0037 0038 Q_DECLARE_METATYPE(NavigationController) 0039 0040 #endif // NAVIGATIONCONTROLLER_H