NetworkInformation QML Type

Provides a cross-platform interface to network-related information. 更多...

import 语句: import QtNetwork
Since: Qt 6.7
实例化: QNetworkInformation

特性

详细描述

NetworkInformation provides a cross-platform interface to network-related information.

NetworkInformation is a singleton.

另请参阅 QNetworkInformation .

特性文档编制

isBehindCaptivePortal : bool [read-only]

Indicates if the user's device is currently known to be behind a captive portal.

isMetered : bool [read-only]

Returns whether the current connection is (known to be) metered or not.

reachability : enumeration [read-only]

Holds the current state of the system's network connectivity.

常量 描述
NetworkInformation.Reachability.Unknown Connection may be established but the OS has yet to confirm full connectivity, or this feature is not supported.
NetworkInformation.Reachability.Disconnected The system may not have connectivity at all.
NetworkInformation.Reachability.Local The system is connected to a network, but might only be able to access devices on the local network.
NetworkInformation.Reachability.Site The system is connected to a network, but might only be able to access devices on the local subnet or an intranet.
NetworkInformation.Reachability.Online The system is connected to a network and able to access the Internet.

transportMedium : enumeration [read-only]

Holds the currently active transport medium for the application.

常量 描述
NetworkInformation.TransportMedium.Unknown If the OS reports no active medium, the active medium is not recognized by Qt, or the TransportMedium feature is not supported.
NetworkInformation.TransportMedium.Ethernet The currently active connection is using Ethernet. Note: This value may also be returned when Windows is connected to a Bluetooth personal area network.
NetworkInformation.TransportMedium.Cellular The currently active connection is using a cellular network.
NetworkInformation.TransportMedium.WiFi The currently active connection is using Wi-Fi.
NetworkInformation.TransportMedium.Bluetooth The currently active connection is connected using Bluetooth.