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. Qt Mobility Declarative Mapviewer Example
Forum Updated to NodeBB v4.3 + New Features

Qt Mobility Declarative Mapviewer Example

Scheduled Pinned Locked Moved QML and Qt Quick
3 Posts 2 Posters 3.3k 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

    When I run the Qt Mobility 1.1 Declarative Mapviewer Example I just get a blank blue screen with a dot in it. Apart from this, the app runs without error. I have also changed the default lat/lon in case it's in the Sea!.. but it still doesn't work.

    Do I have to configure something extra to get maps working? (under Ubuntu, mobility 1.1 Qt 4.7.1).

    Thanks

    Simon

    1 Reply Last reply
    0
    • K Offline
      K Offline
      kyleplattner
      wrote on last edited by
      #2

      You are over water. Try this:

      @ Map {
      id: map
      plugin : Plugin {
      name : "nokia"
      }
      size.width: parent.width
      size.height: parent.height
      mapType: Map.SatelliteMapDay
      zoomLevel: 7
      center: Coordinate {
      latitude : 40.482209
      longitude : -89.489779
      }
      MapCircle{
      center : Coordinate {
      latitude : 40.482209
      longitude : -89.489779
      }
      color: green
      radius : 1000.0
      }
      MapCircle{
      center : Coordinate {
      latitude : 40.482209
      longitude : -89.489779
      }
      radius : 500.0
      color : "green"
      }
      MapCircle{
      center : Coordinate {
      latitude : 40.482209
      longitude : -89.489779
      }
      color : "red"
      radius: 300

          }
      
           MapRectangle{
      
      
               bottomRight : Coordinate {
                             latitude : 40.5
                             longitude : -89.5
                         }
                   topLeft : Coordinate {
                            latitude : 40.4
                            longitude : -89.4
                        }
      
      
           }
      
      
      
      
      }
      
      MouseArea {
      
          anchors.fill : parent
      
          property bool mouseDown : false
          property int lastX : -1
          property int lastY : -1
      
          hoverEnabled : true
      
          onPressed : {
              mouseDown = true
              lastX = mouse.x
              lastY = mouse.y
          }
          onReleased : {
              mouseDown = false
              lastX = -1
              lastY = -1
          }
          onPositionChanged: {
              if (mouseDown) {
                  var dx = mouse.x - lastX
                  var dy = mouse.y - lastY
                  map.pan(-dx, -dy)
                  lastX = mouse.x
                  lastY = mouse.y
              }
          }
          onDoubleClicked: {
              map.center = map.toCoordinate(Qt.point(mouse.x, mouse.y))
              map.zoomLevel += 1
          }
      
      }
      
      Keys.onPressed: {
          if (event.key == Qt.Key_Plus) {
              map.zoomLevel += 1
          } else if (event.key == Qt.Key_Minus) {
              map.zoomLevel -= 1
          } else if (event.key == Qt.Key_T) {
              if (map.mapType == Map.SatelliteMapDay) {
                  map.mapType = Map.SatelliteMapDay
              } else if (map.mapType == Map.SatelliteMapDay) {
                  map.mapType = Map.SatelliteMapDay
              }
          }
      }
      

      @

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

        Great, solved thanks

        Simon

        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