You can iterate your QNetworkInterface instances (QT+=network
in your .pro), and check the type()
for a wireless interface, and also check the flags()
to see if it is up and running. Example:
#include <QCoreApplication>
#include <QNetworkInterface>
int main(int argc, char *argv[])
{
QCoreApplication a(argc, argv);
for(const QNetworkInterface& iface : QNetworkInterface::allInterfaces()) {
if (iface.type() == QNetworkInterface::Wifi) {
qDebug() << iface.humanReadableName() << "(" << iface.name() << ")"
<< "is up:" << iface.flags().testFlag(QNetworkInterface::IsUp)
<< "is running:" << iface.flags().testFlag(QNetworkInterface::IsRunning);
}
}
}
It should be cross-platform, but the documentation says that:
Not all operating systems support reporting all features. Only the
IPv4 addresses are guaranteed to be listed by this class in all
platforms. In particular, IPv6 address listing is only supported on
Windows, Linux, macOS and the BSDs.
There is no word about other attributes.