Results 1 to 2 of 2

Thread: Get GPS Position with QML

  1. #1
    Join Date
    Nov 2010
    Posts
    4
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    Unix/X11 Windows Symbian S60

    Question Get GPS Position with QML

    I have a following code:

    import QtQuick 1.0
    import Qt 4.7
    import QtMobility.location 1.1

    Rectangle {
    id: page
    width: 350
    height: 350
    PositionSource {
    id: positionSource
    updateInterval: 5000

    active: true
    //nmeaSource: "nmealog.txt"
    }
    Column {
    Text {text: "<==== PositionSource ====>"}
    Text {text: "positioningMethod: " + printableMethod(positionSource.positioningMethod)}
    Text {text: "nmeaSource: " + positionSource.nmeaSource}
    Text {text: "updateInterval: " + positionSource.updateInterval}
    Text {text: "active: " + positionSource.active}
    Text {text: "<==== Position ====>"}
    Text {text: "latitude: " + positionSource.position.coordinate.latitude}
    Text {text: "longitude: " + positionSource.position.coordinate.longitude}
    Text {text: "altitude: " + positionSource.position.coordinate.altitude}
    Text {text: "speed: " + positionSource.position.speed}
    Text {text: "timestamp: " + positionSource.position.timestamp}
    Text {text: "altitudeValid: " + positionSource.position.altitudeValid}
    Text {text: "longitudeValid: " + positionSource.position.longitudeValid}
    Text {text: "latitudeValid: " + positionSource.position.latitudeValid}
    Text {text: "speedValid: " + positionSource.position.speedValid}
    }
    function printableMethod(method) {
    if (method == PositionSource.SatellitePositioningMethod)
    return "Satellite";
    else if (method == PositionSource.NoPositioningMethod)
    return "Not available"
    else if (method == PositionSource.NonSatellitePositioningMethod)
    return "Non-satellite"
    else if (method == PositionSource.AllPositioningMethods)
    return "All/multiple"
    return "source error";
    }
    }

    In the simulator works fine but in Nokia N8 not works.

    Qt 4.7
    QtMobility 1.1.3

    Thx for your help.

    Julio C

  2. #2
    Join Date
    Aug 2011
    Posts
    1
    Platforms
    Symbian S60

    Default Re: Get GPS Position with QML

    I just started working on a very similar project and had the exact same problem.

    The solution is to go into your .pro file and add one single line of code...

    symbian:TARGET.CAPABILITY += Location

    This should be added in the

    QML_IMPORT_PATH =

    section.

    So now mine looks like:

    # Additional import path used to resolve QML modules in Creator's code model
    QML_IMPORT_PATH =

    symbian:TARGET.UID3 = 0xE6090127
    symbian:TARGET.CAPABILITY += Location

Similar Threads

  1. relative position
    By franco.amato in forum Newbie
    Replies: 2
    Last Post: 8th December 2009, 18:08
  2. X and Y position of QWidget
    By bear101 in forum Qt Programming
    Replies: 1
    Last Post: 22nd May 2009, 23:27
  3. QTextCursor position
    By high_flyer in forum Qt Programming
    Replies: 3
    Last Post: 10th December 2007, 09:17
  4. How to get mouse's position?
    By coralbird in forum Newbie
    Replies: 4
    Last Post: 23rd July 2006, 03:52
  5. set Position
    By mickey in forum Newbie
    Replies: 3
    Last Post: 17th June 2006, 21:30

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.