获得我在QtQuick的职位

时间:2012-06-16 19:48:21

标签: qt geolocation nokia qt-mobility

我需要在诺基亚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

有什么问题?

1 个答案:

答案 0 :(得分:0)

除了一些认证问题,CAPABILITY+=Location行就足够了。

但是,在添加之后,您必须确保qmake至少运行一次,因此所有构建脚本和元文件都会刷新。如果在添加该行后仍然出现该错误,只需从命令行或qtcreator中的项目上下文manu运行qmake