Commit 20bf24f4 authored by Dennis Nienhüser's avatar Dennis Nienhüser

Provide basic OSM POI information

parent b40c96b8
......@@ -53,7 +53,7 @@ Item {
right: actionsLayout.left
margins: Screen.pixelDensity * 2
}
height: nameLabel.height + (addressLabel.text == "" ? 0 : addressLabel.height)
height: nameLabel.height + (descriptionLabel.text == "" ? 0 : descriptionLabel.height) + (addressLabel.text == "" ? 0 : addressLabel.height)
Text {
id: nameLabel
......@@ -65,6 +65,16 @@ Item {
font.pointSize: 20
}
Text {
id: descriptionLabel
width: parent.width
text: placemark === null ? "" : placemark.description
wrapMode: Text.WordWrap
elide: Text.ElideRight
maximumLineCount: 4
font.pointSize: 14
}
Text {
id: addressLabel
width: parent.width
......
......@@ -44,7 +44,7 @@ void MarbleDeclarativePlugin::registerTypes( const char *uri )
//@uri org.kde.edu.marble
qmlRegisterType<Coordinate>( uri, 0, 20, "Coordinate" );
qmlRegisterType<Placemark>( uri, 0, 20, "Placemark" );
qmlRegisterType<Marble::Placemark>( uri, 0, 20, "Placemark" );
qmlRegisterType<Marble::PositionSource>( uri, 0, 20, "PositionSource" );
qmlRegisterType<Marble::Bookmarks>( uri, 0, 20, "Bookmarks" );
qmlRegisterType<Marble::Tracking>( uri, 0, 20, "Tracking" );
......
This diff is collapsed.
......@@ -14,11 +14,14 @@
#include "Coordinate.h"
#include "GeoDataPlacemark.h"
#include "GeoDataFeature.h"
#include <QObject>
#include <QAbstractListModel>
#include <QQmlComponent>
namespace Marble {
/**
* Wraps a GeoDataPlacemark for QML access
*/
......@@ -28,6 +31,7 @@ class Placemark : public QObject
Q_PROPERTY( Coordinate* coordinate READ coordinate NOTIFY coordinateChanged )
Q_PROPERTY( QString name WRITE setName READ name NOTIFY nameChanged )
Q_PROPERTY( QString description READ description NOTIFY descriptionChanged )
Q_PROPERTY( QString address READ address NOTIFY addressChanged )
public:
......@@ -41,6 +45,7 @@ public:
Coordinate* coordinate();
QString name() const;
QString description() const;
QString address() const;
public Q_SLOTS:
......@@ -50,14 +55,22 @@ Q_SIGNALS:
void coordinateChanged();
void nameChanged();
void descriptionChanged();
void addressChanged();
private:
QString categoryName(GeoDataFeature::GeoDataVisualCategory category) const;
void addTagValue(const QString &key) const;
void addTagDescription(const QString &key, const QString &value, const QString &description) const;
Marble::GeoDataPlacemark m_placemark;
Coordinate m_coordinate;
mutable QString m_address; // mutable to allow lazy calculation in the getter
mutable QString m_description;
};
QML_DECLARE_TYPE( Placemark )
}
QML_DECLARE_TYPE( Marble::Placemark )
#endif // MARBLE_DECLARATIVE_PLACEMARK_H
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment