Qt Mobility Declarative Mapviewer Example



  • 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



  • 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
            }
        }
    }
    

    @



  • Great, solved thanks

    Simon


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.