4#include <QtNetwork/private/qnetworkinformation_p.h>
6#include <QtCore/qglobal.h>
7#include <QtCore/private/qobject_p.h>
21 switch (connectivity) {
22 case G_NETWORK_CONNECTIVITY_LOCAL:
24 case G_NETWORK_CONNECTIVITY_LIMITED:
25 case G_NETWORK_CONNECTIVITY_PORTAL:
27 case G_NETWORK_CONNECTIVITY_FULL:
54 return QNetworkInformation::Features(Feature::Reachability | Feature::CaptivePortal
66 GNetworkMonitor *networkMonitor =
nullptr;
67 gulong connectivityHandlerId = 0;
68 gulong meteredHandlerId = 0;
90 if (!backend->isValid())
91 delete std::exchange(backend,
nullptr);
99: networkMonitor(g_network_monitor_get_default())
101 updateConnectivity(
this);
104 connectivityHandlerId = g_signal_connect_swapped(networkMonitor,
"notify::connectivity",
105 G_CALLBACK(updateConnectivity),
this);
107 meteredHandlerId = g_signal_connect_swapped(networkMonitor,
"notify::network-metered",
108 G_CALLBACK(updateMetered),
this);
113 g_signal_handler_disconnect(networkMonitor, meteredHandlerId);
114 g_signal_handler_disconnect(networkMonitor, connectivityHandlerId);
119 return QLatin1StringView(G_OBJECT_TYPE_NAME(networkMonitor)) !=
"GNetworkMonitorBase"_L1;
124 const auto connectivityState = g_network_monitor_get_connectivity(backend->networkMonitor);
125 const bool behindPortal = (connectivityState == G_NETWORK_CONNECTIVITY_PORTAL);
126 backend->
setReachability(reachabilityFromGNetworkConnectivity(connectivityState));
132 backend->
setMetered(g_network_monitor_get_network_metered(backend->networkMonitor));
137#include "qglibnetworkinformationbackend.moc"
\macro QT_RESTRICTED_CAST_FROM_ASCII
Combined button and popup list for selecting options.
#define Q_LOGGING_CATEGORY(name,...)
#define Q_DECLARE_LOGGING_CATEGORY(name)
#define QStringLiteral(str)