×
Namespaces

Variants
Actions
Revision as of 22:43, 6 March 2011 by VEIKKO99 (Talk | contribs)

QmlWebMapsLocation

From Nokia Developer Wiki
Jump to: navigation, search

Using location data and web maps in QML

In this wiki article I describe how you can use web maps and location data in your Qt Quick application. We also see how to integrate CPP and QML code and QML Code and JS code running in webkit. We also see how easy it is to use web APIs. Image below shows the application UI.

x

You can find the application's latest source code from Nokia Projects (https://projects.forum.nokia.com/qmlwebmap)

Application code consists of three major parts:

  1. CPP part (Provides Qt application environment and gets location updates from GPS sensors, sone parts of the UI are also here.)
  2. QML part (Implements major part of the UI by using WebVew element)
  3. HTML part (HTML files used with maps)

Cpp

C++ code part has one class and main function. I have also included one UI form that has only combobox for map provder selection. Here's the definition of the class:

class Widget : public QWidget
{
Q_OBJECT
 
public:
explicit Widget(QWidget *parent = 0);
~Widget();
Q_PROPERTY(QString mapProvider READ mapProvider WRITE setMapProvider NOTIFY mapProviderChanged)
QString mapProvider();
void setMapProvider(QString newMapProvider);
 
private slots:
void mapProviderSelected(int);
void positionUpdated(QGeoPositionInfo);
 
signals:
void mapProviderChanged(QString);
void posUpdated(double lat, double lon);
 
private:
Ui::Widget *ui;
QDeclarativeView* m_view;
QGeoPositionInfoSource* m_geoSource;
QString m_mapProvider;
};

</nowiki>

308 page views in the last 30 days.
×