summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDennis Nienhüser <nienhueser@kde.org>2016-07-23 06:53:35 (GMT)
committerDennis Nienhüser <nienhueser@kde.org>2016-07-23 10:07:01 (GMT)
commit52144d888c6f4bcdcec4bcd258e1722160cb4f9e (patch)
tree6f4e4ddf1e30ba9b45bdad956f38d04b79d75021
parent77902db9a1a00c0043e811afc97ef3f513c1ff4f (diff)
Expose longitude and latitude properties to QML
-rw-r--r--src/lib/marble/declarative/Placemark.cpp10
-rw-r--r--src/lib/marble/declarative/Placemark.h4
2 files changed, 14 insertions, 0 deletions
diff --git a/src/lib/marble/declarative/Placemark.cpp b/src/lib/marble/declarative/Placemark.cpp
index d018778..784dec3 100644
--- a/src/lib/marble/declarative/Placemark.cpp
+++ b/src/lib/marble/declarative/Placemark.cpp
@@ -171,6 +171,16 @@ void Placemark::setName(const QString & name)
emit nameChanged();
}
+double Placemark::longitude() const
+{
+ return m_placemark.coordinate().longitude(GeoDataCoordinates::Degree);
+}
+
+double Placemark::latitude() const
+{
+ return m_placemark.coordinate().latitude(GeoDataCoordinates::Degree);
+}
+
QString Placemark::categoryName(GeoDataFeature::GeoDataVisualCategory category) const
{
switch (category) {
diff --git a/src/lib/marble/declarative/Placemark.h b/src/lib/marble/declarative/Placemark.h
index 4c19283..3a40a3f 100644
--- a/src/lib/marble/declarative/Placemark.h
+++ b/src/lib/marble/declarative/Placemark.h
@@ -36,6 +36,8 @@ class Placemark : public QObject
Q_PROPERTY( QString fuelDetails READ fuelDetails NOTIFY fuelDetailsChanged )
Q_PROPERTY( QString openingHours READ openingHours NOTIFY openingHoursChanged )
Q_PROPERTY( QString coordinates READ coordinates NOTIFY coordinatesChanged )
+ Q_PROPERTY(double longitude READ longitude NOTIFY coordinatesChanged)
+ Q_PROPERTY(double latitude READ latitude NOTIFY coordinatesChanged)
public:
/** Constructor */
@@ -53,6 +55,8 @@ public:
QString fuelDetails() const;
QString openingHours() const;
QString coordinates() const;
+ double longitude() const;
+ double latitude() const;
public Q_SLOTS:
void setName(const QString &name);