QML Map ElementThe Map element displays a map. More... Properties
MethodsDetailed DescriptionThe Map element can be used be used to display a map of the world. The bulk of the functionality is provided by a mapping plugin described by the Plugin element associated with the Map. Various map objects can be added to the map. These map objects are specified in terms of coordinates and metres. MapObjects can be directly added to the Map element and it will display them automatically. The various objects that can be added include: Of the above list, MapObjectView is a special case and not a MapObject as such. Here is a small example to illustrate this: Map { id: map plugin : Plugin {name : "nokia"} anchors.fill: parent size.width: parent.width size.height: parent.height zoomLevel: 10 MapObjectView { id: allLandmarks model: landmarkModelAll delegate: Component { MapCircle { color: "green" radius: 1000 center: Coordinate { latitude: landmark.coordinate.latitude longitude: landmark.coordinate.longitude } } } } MapCircle { id: myPosition color: "yellow" radius: 1000 center: myPositionSource.position.coordinate } Mouse handling is done by adding MapMouseArea items as children of either MapObjects or the Map item itself. The Map element is part of the QtMobility.location 1.2 module. API break notice: compared to preliminary 1.1 API version, the 1.2 API does not have the objects -property. Property DocumentationThis property holds the coordinate which occupies the center of the mapping viewport. The default value is an arbitrary valid coordinate. This documentation was introduced in Qt Mobility Mobility 1.2. This property holds the connectivity mode used to fetch the map data. The mode can be one of:
The default value is determined by the plugin. This documentation was introduced in Qt Mobility Mobility 1.2. This property holds the type of map to display. The type can be one of:
The default value is determined by the plugin. This documentation was introduced in Qt Mobility Mobility 1.2. This property holds the maximum valid zoom level for the map. This documentation was introduced in Qt Mobility Mobility 1.2. This property holds the minimum valid zoom level for the map. This documentation was introduced in Qt Mobility Mobility 1.2. This property holds the plugin which provides the mapping functionality. This is write-once property. Once the map has a plugin associated with it any attempted modifications of the plugin will be ignored. This documentation was introduced in Qt Mobility Mobility 1.2. This property holds the size of the map viewport. This documentation was introduced in Qt Mobility Mobility 1.2. This property holds the zoom level for the map. Larger values for the zoom level provide more detail. The default value is 8.0. This documentation was introduced in Qt Mobility Mobility 1.2. Method DocumentationAdds the given MapOject to the Map. If the object already is on the Map, it will not be added again. As an example, consider you have a MapCircle presenting your current position: MapCircle { id: myPositionMarker center: myPositionSource.position.coordinate radius: 100 color: "yellow" } You can add it to Map (alterntively it can be defined as a child element of the Map): onButton2Clicked: { map.addMapObject(myPositionMarker) } Note: MapObjectViews can not be added with this method. This documentation was introduced in Qt Mobility Mobility 1.2. Removes the given MapObject from the Map. If the MapObject does not exist, function does nothing. As an example, consider you have a MapCircle presenting your current position: MapCircle { id: myPositionMarker center: myPositionSource.position.coordinate radius: 100 color: "yellow" } You can remove it from the Map element: onButton1Clicked: { map.removeMapObject(myPositionMarker) } This documentation was introduced in Qt Mobility Mobility 1.2. Returns the coordinate which corresponds to the screen position screenPosition. Returns an invalid coordinate if screenPosition is not within the current viewport. An example to constraint landmarks of a model to just those currently on Map: LandmarkBoxFilter { id: boxFilter topLeft: map.toCoordinate(Qt.point(0,0)) bottomRight: map.toCoordinate(Qt.point(map.width, map.height)) } This documentation was introduced in Qt Mobility Mobility 1.2. Returns the screen position which corresponds to the coordinate coordinate. Returns an invalid QPointF if coordinate is not within the current viewport. This documentation was introduced in Qt Mobility Mobility 1.2. |
Publicité
Best OfActualités les plus luesSemaine
Mois
Année
![]()
![]() Le Qt Developer Network au hasard![]() Applications mobiles modernes avec Qt et QMLLe Qt Developer Network est un réseau de développeurs Qt anglophone, où ils peuvent partager leur expérience sur le framework. Lire l'article.
CommunautéRessources
Liens utilesContact
Qt dans le magazine |
Cette page est une traduction d'une page de la documentation de Qt, écrite par Nokia Corporation and/or its subsidiary(-ies). Les éventuels problèmes résultant d'une mauvaise traduction ne sont pas imputables à Nokia. | Qt qtmobility-1.2 | |
Copyright © 2012 Developpez LLC. Tous droits réservés Developpez LLC. Aucune reproduction, même partielle, ne peut être faite de ce site et de l'ensemble de son contenu : textes, documents et images sans l'autorisation expresse de Developpez LLC. Sinon, vous encourez selon la loi jusqu'à 3 ans de prison et jusqu'à 300 000 E de dommages et intérêts. Cette page est déposée à la SACD. | ||
Vous avez déniché une erreur ? Un bug ? Une redirection cassée ? Ou tout autre problème, quel qu'il soit ? Ou bien vous désirez participer à ce projet de traduction ? N'hésitez pas à nous contacter ou par MP ! |
Copyright © 2000-2012 - www.developpez.com