0

我需要在诺基亚 QT 中获取我的位置。

我有以下代码:

Rectangle {
            id: page
            width: 350
            height: 350
            PositionSource {
                id: positionSource
                updateInterval: 1000
                active: true
            onPositionChanged: {
                console.log("latitude : "+positionSource.position.coordinate.latitude);
                console.log("longitude :"+positionSource.position.coordinate.longitude);
            }
        }
}

在项目文件中,我设置了功能和移动性配置:

symbian:
{
    TARGET.CAPABILITY +=  Location
    CONFIG += mobility
    MOBILITY +=location
}

此代码在模拟器上运行良好,但在真正的手机(诺基亚 5530 XpressMusic)上它不起作用,我收到以下消息:

[Qt Message] QGeoPositionInfoSource::createDefaultSource() requires the Symbian Location capability to succeed on the Symbian platform

问题是什么?

4

1 回答 1

0

Other than some certification problems, that CAPABILITY+=Location line is sufficient.

However, after adding that, you must ensure that qmake is run at least once, so all your build scripts and metafiles are refreshed. If you are still getting that error after adding that line, just run qmake either from command line, or from project context manu in qtcreator

于 2012-10-31T13:45:58.743 回答