【问题标题】:Getting my position in QtQuick在 QtQuick 中获得我的职位
【发布时间】:2012-06-16 19:48:21
【问题描述】:

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

有什么问题?

【问题讨论】:

    标签: qt geolocation nokia qt-mobility


    【解决方案1】:

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

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

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2013-08-15
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-05-13
      • 1970-01-01
      • 2018-11-23
      相关资源
      最近更新 更多