Qt Positioning GeoClue v2 插件
概述
该插件是GeoClue v2库的接口。它需要系统中已安装该库才能正常运行。
该插件使用 D-Bus 与 GeoClue v2 D-Bus 服务建立通信,并提供定位信息。
该插件仅用于接收定位信息,不提供卫星信息。
可通过提供程序名称geoclue2 加载该插件。
参数
下表列出了可传递给 geoclue2 插件的参数。
| 参数 | 描述 |
|---|---|
| desktopId | D-Bus 服务所使用的桌面 ID属性。如果未指定该参数,则将使用 QGuiApplication::desktopFileName() 提供的桌面文件名。 |
示例
以下示例演示了如何使用 C++ 和 QML 创建geoclue2的 `PositionSource `。
QML
PositionSource {
name: "geoclue2"
PluginParameter { name: "desktopId"; value: "SomeIdentifierString" }
}C++
QVariantMap params;
params["desktopId"] = "SomeIdentifierString";
QGeoPositionInfoSource *positionSource = QGeoPositionInfoSource::createSource("geoclue2", params, this);© 2026 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.