Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

backup

Signed-off-by: André L. V. Loureiro <loureiro.andrew@gmail.com>
  • Loading branch information...
commit 2a507487617d99257d72d4194038bb28237cfb7d 1 parent e5ee3a5
@alvloureiro alvloureiro authored André Loureiro committed
View
6 PopupDialog.qml
@@ -6,12 +6,18 @@ Item {
height: 100
width: 200
+ property real latitude: 0.0
+ property real longitude: 0.0
+ property alias inputText: inputName.text
+
signal popupOk(string text)
Rectangle {
id: background
anchors.fill: parent
color: "white"
+ border.width: 2
+ border.color: "black"
}
Text {
View
14 landmarkmanager.cpp
@@ -2,6 +2,7 @@
#include <qlandmarkmanager.h>
#include <qlandmark.h>
+#include <qgeocoordinate.h>
#include <QObject>
#include <QString>
#include <QStringList>
@@ -29,11 +30,20 @@ void LandmarkManager::init()
}
}
-void LandmarkManager::saveLandmark(QLandmark *landmark)
+void LandmarkManager::saveLandmark(double latitude, double longitude, QString name)
{
if (!m_manager)
return;
- Q_UNUSED(landmark);
+
+ QGeoCoordinate coordinate;
+ coordinate.setLatitude(latitude);
+ coordinate.setLongitude(longitude);
+ QLandmark *landmark = new QLandmark;
+ landmark->setName(name);
+ landmark->setCoordinate(coordinate);
+
+ bool result = m_manager->saveLandmark(landmark);
+ qDebug() << __func__ << "#### result of save landmark: " << result;
}
void LandmarkManager::landmarks()
View
2  landmarkmanager.h
@@ -16,7 +16,7 @@ class LandmarkManager : public QObject
public slots:
void init();
- void saveLandmark(QLandmark *landmark);
+ void saveLandmark(double latitude, double longitude, QString name);
void landmarks();
bool cleanLandmarks();
View
8 main.qml
@@ -22,6 +22,8 @@ Item {
onAddLandmark: {
popupDialog.x = mouseObject.x
popupDialog.y = mouseObject.y
+ popupDialog.latitude = mouseObject.coordinate.latitude
+ popupDialog.longitude = mouseObject.coordinate.longitude
popupDialog.visible = !popupDialog.visible
}
}
@@ -29,5 +31,11 @@ Item {
PopupDialog {
id: popupDialog
visible: false
+
+ onPopupOk: {
+ controller.saveLandmark(popupDialog.latitude, popupDialog.longitude, text)
+ popupDialog.visible = !popupDialog.visible
+ popupDialog.inputText = ""
+ }
}
}
Please sign in to comment.
Something went wrong with that request. Please try again.