c++ - Qt Maps (QML) application window is blank -
this code qt maps application i'm trying make. http://pastebin.com/pncyivm9 - main.qml
i'm using qt creator on ubuntu 14.04. when compile , run code application window blank.
i haven't edited main.ui.qml apart adding qt location import.
i've added location keyword in .pro file appreciated since can't find tutorials on maps.
edit: here's code
import qtquick 2.4 import qtquick.controls 1.3 import qtquick.window 2.2 import qtquick.dialogs 1.2 import qtlocation 5.4 applicationwindow { title: qstr("hello world") width: 640 height: 480 visible: true plugin{ id: osmplugin name:"osm" } map { plugin: osmplugin id: map zoomlevel: (maximumzoomlevel - minimumzoomlevel)/2 // center { // latitude: -27.5796 // longitude: 153.1003 // } // enable pinch gestures zoom in , out gesture.flickdeceleration: 3000 gesture.enabled: true // center { // latitude: -27.5796 // longitude: 153.1003 // } } }
your map
has no dimensions set, it's going default width , height of zero. see case, add following map component:
component.oncompleted: { console.log("dimensions: ", width, height) }
this print out:
dimensions: 0 0
so either need set dimensions value other zero, or use anchor
property attach dimensions parent's anchors.
Comments
Post a Comment