QNetworkInformation¶
QNetworkInformation
exposes various network information through native backends. More…
Synopsis¶
Functions¶
def
backendName
()def
isBehindCaptivePortal
()def
reachability
()def
supports
(features)
Signals¶
def
isBehindCaptivePortalChanged
(state)def
reachabilityChanged
(newReachability)
Static functions¶
def
availableBackends
()def
instance
()def
load
(backend)def
load
(features)
Detailed Description¶
QNetworkInformation
provides a cross-platform interface to network-related information through plugins.
Various plugins can have various functionality supported, and so you can load()
plugins based on which features are needed.
QNetworkInformation
is a singleton and stays alive from the first successful load()
until destruction of the QCoreApplication
object. If you destroy and re-create the QCoreApplication
object you must call load()
again.
See also
Feature
- class PySide6.QtNetwork.QNetworkInformation¶
- PySide6.QtNetwork.QNetworkInformation.Reachability¶
Constant
Description
QNetworkInformation.Reachability.Unknown
If this value is returned then we may be connected but the OS has still not confirmed full connectivity, or this feature is not supported.
QNetworkInformation.Reachability.Disconnected
Indicates that the system may have no connectivity at all.
QNetworkInformation.Reachability.Local
Indicates that the system is connected to a network, but it might only be able to access devices on the local network.
QNetworkInformation.Reachability.Site
Indicates that the system is connected to a network, but it might only be able to access devices on the local subnet or an intranet.
QNetworkInformation.Reachability.Online
Indicates that the system is connected to a network and able to access the Internet.
See also
- PySide6.QtNetwork.QNetworkInformation.Feature¶
Lists all of the features that a plugin may currently support. This can be used in load()
.
Constant
Description
QNetworkInformation.Feature.Reachability
If the plugin supports this feature then the
reachability
property will provide useful results. Otherwise it will always returnReachability::Unknown
. See alsoReachability
.QNetworkInformation.Feature.CaptivePortal
If the plugin supports this feature then the
isBehindCaptivePortal
property will provide useful results. Otherwise it will always returnfalse
.
- static PySide6.QtNetwork.QNetworkInformation.availableBackends()¶
- Return type
list of strings
Returns a list of the names of all currently available backends.
- PySide6.QtNetwork.QNetworkInformation.backendName()¶
- Return type
str
Returns the name of the currently loaded backend.
- static PySide6.QtNetwork.QNetworkInformation.instance()¶
- Return type
Returns a pointer to the instance of the QNetworkInformation
, if any.
See also
- PySide6.QtNetwork.QNetworkInformation.isBehindCaptivePortal()¶
- Return type
bool
This property holds Lets you know if the user’s device is behind a captive portal..
This property indicates if the user’s device is currently known to be behind a captive portal. This functionality relies on the operating system’s detection of captive portals and is not supported on systems that don’t report this. On systems where this is not supported this will always return false
.
- PySide6.QtNetwork.QNetworkInformation.isBehindCaptivePortalChanged(state)¶
- Parameters
state – bool
- static PySide6.QtNetwork.QNetworkInformation.load(features)¶
- Parameters
features –
Features
- Return type
bool
Load a backend which supports features
.
Returns true
if it managed to load the requested backend or if it was already loaded. Returns false
otherwise
See also
- static PySide6.QtNetwork.QNetworkInformation.load(backend)
- Parameters
backend –
QStringView
- Return type
bool
Attempts to load a backend whose name matches backend
(case insensitively).
Returns true
if it managed to load the requested backend or if it was already loaded. Returns false
otherwise
See also
- PySide6.QtNetwork.QNetworkInformation.reachability()¶
- Return type
This property holds The current state of the system’s network connectivity..
Indicates the level of connectivity that can be expected. Do note that this is only based on what the plugin/operating system reports. In certain scenarios this is known to be wrong. For example, on Windows the ‘Online’ check, by default, is performed by Windows connecting to a Microsoft-owned server. If this server is for any reason blocked then it will assume it does not have Online reachability. Because of this you should not use this as a pre-check before attempting to make a connection.
- PySide6.QtNetwork.QNetworkInformation.reachabilityChanged(newReachability)¶
- Parameters
newReachability –
Reachability
- PySide6.QtNetwork.QNetworkInformation.supports(features)¶
- Parameters
features –
Features
- Return type
bool
Returns true
if the currently loaded backend supports features
.
© 2022 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.