NetworkInformation QML Type
提供了一个用于访问网络相关信息的跨平台接口。更多...
| Import Statement: | import QtNetwork |
| Since: | Qt 6.7 |
| In C++: | QNetworkInformation |
属性
- isBehindCaptivePortal : bool
- isMetered : bool
- reachability : enumeration
- transportMedium : enumeration
详细说明
NetworkInformation 提供了一个用于访问网络相关信息的跨平台接口。
NetworkInformation 是一个单例。
另请参阅 QNetworkInformation 。
属性文档
isBehindCaptivePortal : bool [read-only]
指示当前是否已知用户的设备位于捕获门户之后。
isMetered : bool [read-only]
返回当前连接是否(已知)为流量计费连接。
reachability : enumeration [read-only]
保存系统网络连接的当前状态。
| 常量 | 描述 |
|---|---|
NetworkInformation.Reachability.Unknown | 可能已建立连接,但操作系统尚未确认完全连接,或者不支持此功能。 |
NetworkInformation.Reachability.Disconnected | 系统可能完全无法连接。 |
NetworkInformation.Reachability.Local | 系统已连接到网络,但可能只能访问本地网络上的设备。 |
NetworkInformation.Reachability.Site | 系统已连接到网络,但可能只能访问本地子网或内网上的设备。 |
NetworkInformation.Reachability.Online | 系统已连接到网络,并且能够访问互联网。 |
transportMedium : enumeration [read-only]
存储该应用程序当前活动的传输介质。
| 常量 | 描述 |
|---|---|
NetworkInformation.TransportMedium.Unknown | 如果操作系统报告没有活动传输介质,则表示 Qt 未识别该活动传输介质,或者不支持 TransportMedium 功能。 |
NetworkInformation.TransportMedium.Ethernet | 当前活动的连接正在使用以太网。注意:当 Windows 连接到蓝牙个人区域网络时,也可能返回此值。 |
NetworkInformation.TransportMedium.Cellular | 当前活动的连接正在使用蜂窝网络。 |
NetworkInformation.TransportMedium.WiFi | 当前活动的连接正在使用 Wi-Fi。 |
NetworkInformation.TransportMedium.Bluetooth | 当前活动的连接是通过蓝牙建立的。 |
© 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.