本页内容

QGeoSatelliteInfo Class

QGeoSatelliteInfo 类包含有关卫星的基本信息。更多内容...

头文件: #include <QGeoSatelliteInfo>
CMake: find_package(Qt6 REQUIRED COMPONENTS Positioning)
target_link_libraries(mytarget PRIVATE Qt6::Positioning)
qmake: QT += positioning

公共类型

enum Attribute { Elevation, Azimuth }
enum SatelliteSystem { Undefined, GPS, GLONASS, GALILEO, BEIDOU, …, CustomType }

属性

公开活动

QGeoSatelliteInfo()
QGeoSatelliteInfo(const QGeoSatelliteInfo &other)
(since 6.2) QGeoSatelliteInfo(QGeoSatelliteInfo &&other)
~QGeoSatelliteInfo()
qreal attribute(QGeoSatelliteInfo::Attribute attribute) const
bool hasAttribute(QGeoSatelliteInfo::Attribute attribute) const
void removeAttribute(QGeoSatelliteInfo::Attribute attribute)
int satelliteIdentifier() const
QGeoSatelliteInfo::SatelliteSystem satelliteSystem() const
void setAttribute(QGeoSatelliteInfo::Attribute attribute, qreal value)
void setSatelliteIdentifier(int satId)
void setSatelliteSystem(QGeoSatelliteInfo::SatelliteSystem system)
void setSignalStrength(int signalStrength)
int signalStrength() const
(since 6.2) void swap(QGeoSatelliteInfo &other)
(since 6.2) QGeoSatelliteInfo &operator=(QGeoSatelliteInfo &&other)
QGeoSatelliteInfo &operator=(const QGeoSatelliteInfo &other)
bool operator!=(const QGeoSatelliteInfo &lhs, const QGeoSatelliteInfo &rhs)
QDataStream &operator<<(QDataStream &stream, const QGeoSatelliteInfo &info)
bool operator==(const QGeoSatelliteInfo &lhs, const QGeoSatelliteInfo &rhs)
QDataStream &operator>>(QDataStream &stream, QGeoSatelliteInfo &info)

详细说明

另请参阅 QGeoSatelliteInfoSource 。

成员类型文档

enum QGeoSatelliteInfo::Attribute

定义卫星信息的属性。

常量值描述
QGeoSatelliteInfo::Elevation0卫星的仰角,单位为度。
QGeoSatelliteInfo::Azimuth1相对于真北的方位角,单位为度。

enum QGeoSatelliteInfo::SatelliteSystem

定义该卫星所属的GNSS系统。

常量值描述
QGeoSatelliteInfo::Undefined0x00未定义。
QGeoSatelliteInfo::GPS0x01全球定位系统(美国)。
QGeoSatelliteInfo::GLONASS0x02全球定位系统(俄罗斯)。
QGeoSatelliteInfo::GALILEO0x03全球导航卫星系统(欧盟)。
QGeoSatelliteInfo::BEIDOU0x04北斗导航卫星系统(中国)。
QGeoSatelliteInfo::QZSS0x05准天顶卫星系统(日本)。
QGeoSatelliteInfo::IRNSS (since Qt 6.12)0x06印度区域导航卫星系统。
QGeoSatelliteInfo::SBAS (since Qt 6.12)0x07卫星增强系统。
QGeoSatelliteInfo::Multiple0xFF此类通常表示信息来自支持多种卫星系统的设备,且未明确指定卫星系统。 根据数据源的不同,您可以使用其他信息来确定实际的系统类型。此类型的一个使用示例是 NMEA $GNGSA 消息,其中包含所用卫星的 ID,但未明确提及其系统类型。
QGeoSatelliteInfo::CustomType0x100可用于用户目的的第一种类型。例如,在QNmeaSatelliteInfoSource 中重新实现NMEA数据解析时。用户可以使用CustomType + 1 、CustomType + 2 等方法添加更多类型。

属性文档

[read-only] satelliteIdentifier : int

该属性存储卫星标识号。

卫星标识号可用于在卫星系统中识别某颗卫星。

实际值可能会因平台和所选后端而异。

例如,如果使用nmea插件,GPS 卫星系统的卫星标识符代表 PRN(伪随机噪声)号,而 GLONASS 卫星系统的卫星标识符代表槽号。

对于基于 NMEA 的后端,如果无法从其他来源获取卫星系统类型,则可使用卫星标识符来确定卫星系统类型。您可以参考卫星 ID 列表,查看不同卫星系统的 ID 范围。

注意:根据 平台和所选后端的不同,不同卫星系统的卫星标识符范围可能会存在重叠。要唯一标识一颗卫星,必须同时使用 satelliteIdentifier() 和satelliteSystem() 函数。

访问函数:

int satelliteIdentifier() const

[read-only] satelliteSystem : SatelliteSystem

该属性存储正在使用的卫星系统,例如 GPS 或 GLONASS。

返回卫星系统(GPS、GLONASS 等)

注意:该 值可与satelliteIdentifier 结合使用,以唯一标识一颗卫星。

访问函数:

QGeoSatelliteInfo::SatelliteSystem satelliteSystem() const

另请参阅 satelliteIdentifier 。

[read-only] signalStrength : qreal

该属性存储信号强度。

访问函数:

int signalStrength() const

成员函数文档

QGeoSatelliteInfo::QGeoSatelliteInfo()

创建一个卫星信息对象。

QGeoSatelliteInfo::QGeoSatelliteInfo(const QGeoSatelliteInfo &other)

创建一个卫星信息对象,其值为other 。

[constexpr noexcept default, since 6.2] QGeoSatelliteInfo::QGeoSatelliteInfo(QGeoSatelliteInfo &&other)

通过从other 移动数据来创建一个卫星信息对象。

请注意,被移动来源的 QGeoSatelliteInfo 只能被销毁或被赋值。调用除析构函数或赋值运算符以外的其他函数,其行为未定义。

该函数在 Qt 6.2 中引入。

[noexcept] QGeoSatelliteInfo::~QGeoSatelliteInfo()

销毁一个卫星信息对象。

[invokable] qreal QGeoSatelliteInfo::attribute(QGeoSatelliteInfo::Attribute attribute) const

返回指定attribute 的值,该值以qreal类型表示。

如果该值尚未设置,则返回 -1。

注意: 可通过元对象系统和 QML 调用此 函数。参见Q_INVOKABLE 。

另请参阅 hasAttribute() 和setAttribute()。

[invokable] bool QGeoSatelliteInfo::hasAttribute(QGeoSatelliteInfo::Attribute attribute) const

如果本次更新中包含指定的attribute ,则返回true。

注意: 可通过元对象系统和 QML 调用此 函数。请参阅Q_INVOKABLE 。

void QGeoSatelliteInfo::removeAttribute(QGeoSatelliteInfo::Attribute attribute)

删除指定的attribute 及其值。

int QGeoSatelliteInfo::satelliteIdentifier() const

返回卫星标识符编号。

注意: 这是 satelliteIdentifier 属性的获取函数 。

另请参阅 setSatelliteIdentifier() 和satelliteSystem()。

void QGeoSatelliteInfo::setAttribute(QGeoSatelliteInfo::Attribute attribute, qreal value)

将attribute 的值设置为value 。

另请参阅 attribute()。

void QGeoSatelliteInfo::setSatelliteIdentifier(int satId)

将卫星标识号设置为satId 。

卫星标识号可用于在卫星系统中识别某颗卫星。

实际值可能会因平台和所选后端而异。

例如,如果使用nmea插件,GPS 卫星系统的卫星标识符代表 PRN(伪随机噪声)编号,而 GLONASS 卫星系统的卫星标识符代表时隙编号。

另请参阅 satelliteIdentifier()。

void QGeoSatelliteInfo::setSatelliteSystem(QGeoSatelliteInfo::SatelliteSystem system)

将卫星系统(GPS、GLONASS 等)设置为system 。

另请参阅 satelliteSystem()。

void QGeoSatelliteInfo::setSignalStrength(int signalStrength)

将信号强度设置为signalStrength ,单位为分贝。

另请参阅 signalStrength()。

int QGeoSatelliteInfo::signalStrength() const

返回信号强度;如果该值尚未设置,则返回 -1。

注意: 这是 signalStrength 属性的获取函数 。

另请参阅 setSignalStrength()。

[noexcept, since 6.2] void QGeoSatelliteInfo::swap(QGeoSatelliteInfo &other)

与other 交换此卫星信息。该操作速度极快,且绝不会失败。

该函数于 Qt 6.2 中引入。

[noexcept, since 6.2] QGeoSatelliteInfo &QGeoSatelliteInfo::operator=(QGeoSatelliteInfo &&other)

将other 中的值通过移动赋值给此对象

请注意,被移动的QGeoSatelliteInfo 仅可被销毁或被赋值。调用除析构函数或赋值运算符以外的其他函数,其行为未定义。

该函数在 Qt 6.2 中引入。

QGeoSatelliteInfo &QGeoSatelliteInfo::operator=(const QGeoSatelliteInfo &other)

将other 中的值赋给此对象。

相关的非成员

bool operator!=(const QGeoSatelliteInfo &lhs, const QGeoSatelliteInfo &rhs)

如果“lhs ”卫星的任何参数与“rhs ”中的参数不一致,则返回true 。否则返回false 。

QDataStream &operator<<(QDataStream &stream, const QGeoSatelliteInfo &info)

将给定的info 写入指定的stream 。

另请参阅 《Qt 数据类型的序列化》。

bool operator==(const QGeoSatelliteInfo &lhs, const QGeoSatelliteInfo &rhs)

如果lhs 卫星的所有参数都与rhs 中的参数相同,则返回true ;否则返回false 。

QDataStream &operator>>(QDataStream &stream, QGeoSatelliteInfo &info)

从指定的stream 中读取卫星信息,并将其写入给定的info 中。

另请参阅 《Qt 数据类型的序列化》。

© 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.