仅使用 qml 可以在 BlackBerry 中获取经度和纬度吗?我找到了http://dengineer.com/adding-qml-gps-to-blackberry-10/但它不起作用。我的设备上只有黑屏。这是我的代码:
import bb.cascades 1.0
import QtMobilitySubset.location 1.1
Page {
property string longitude
property string latitude
property variant cord
Container {
layout: DockLayout {}
attachedObjects: [
PositionSource{
id: location
updateInterval: 1000
onPointChanged: {
cord = location.position.coordinate;
longitude = cord.longitude;
latitude = cord.latitude;
result.setText(longitude + " " + latitude)
}
}]
Button {
text: qsTr("Locate me")
horizontalAlignment: HorizontalAlignment.Center
onClicked: {
location.start()
}
}
Label {
id: result
text: qsTr("0 0")
textStyle.base: SystemDefaults.TextStyles.BigText
verticalAlignment: VerticalAlignment.Center
horizontalAlignment: HorizontalAlignment.Center
}
}
}
我有错误:6 月 8 日 19:31:14.025 com.example.GPS_qml.testDev_ple_GPS_qml341af9aa.30007492 默认 9000 警告 --- 错误:(file:///apps/com.example.GPS_qml.testDev_ple_GPS_qml341af9aa/native/assets//main .qml:32:13:无法分配给不存在的属性“onPointChanged”onPointChanged:{ ^)