Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. [Moved] QML Map Centre
Forum Updated to NodeBB v4.3 + New Features

[Moved] QML Map Centre

Scheduled Pinned Locked Moved QML and Qt Quick
6 Posts 4 Posters 4.0k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    SimonJudge
    wrote on last edited by
    #1

    I am using the QML Map (http://doc.qt.nokia.com/qtmobility/qml-map.html). When I change the map.center, the map doesn't move to the new coordinate. How can I force the map to redraw with the new coordinate?

    Thanks

    Simon

    1 Reply Last reply
    0
    • D Offline
      D Offline
      dalaing
      wrote on last edited by
      #2

      Can you post some code which demonstrates the problem?

      David Laing
      Location API team
      Qt Mobility

      1 Reply Last reply
      0
      • S Offline
        S Offline
        SimonJudge
        wrote on last edited by
        #3

        I have an Item containing a Map. The item has its own property center. The map.center correctly gets initialised to Item.center. When I change the Item.center, the Item.onCenterChanged gets called correctly (as tested by console.log) but the Map center doesn't change (visually).

        @Item {
        id: mapControl
        focus : true
        width: parent.width
        height: parent.height

        property int zoomLevel: 16
        property Coordinate center
        property ListModel mapItems
        
        Map {
            id: map
            plugin : Plugin {
                name : "nokia"
            }
            size.width: parent.width
            size.height: parent.height
            zoomLevel: mapControl.zoomLevel
            center: mapControl.center
        }
        
        onCenterChanged: {
            map.center = mapControl.center
            console.log("Map Centre changed")
        }
        

        }@

        1 Reply Last reply
        0
        • H Offline
          H Offline
          huluyige
          wrote on last edited by
          #4

          Hi SimonJudge,
          I've got the same problem, did you solve it?

          [quote author="SimonJudge" date="1297246075"]I am using the QML Map (http://doc.qt.nokia.com/qtmobility/qml-map.html). When I change the map.center, the map doesn't move to the new coordinate. How can I force the map to redraw with the new coordinate?

          Thanks

          Simon[/quote]

          1 Reply Last reply
          0
          • C Offline
            C Offline
            cmer4
            wrote on last edited by
            #5

            Hi,

            you have to use ToCoordinate method to tell Map to center to new position.

            But I also found it strange that if I state:
            Text {
            text: map.center.longitude
            }

            I will render coordinates for the center but console log will keep telling me about text loop detected...

            1 Reply Last reply
            0
            • H Offline
              H Offline
              huluyige
              wrote on last edited by
              #6

              i got a workground, we can create an qml object on the fly:
              @ function setPosition(lat, lon) {
              var coord = Qt.createQmlObject('import QtMobility.location 1.1; Coordinate{latitude:' + lat + ';longitude:' + lon + ';}', container, "coord");
              map.center = coord;
              barLocation.coordinate=coord;
              }@

              1 Reply Last reply
              0

              • Login

              • Login or register to search.
              • First post
                Last post
              0
              • Categories
              • Recent
              • Tags
              • Popular
              • Users
              • Groups
              • Search
              • Get Qt Extensions
              • Unsolved