On my Laptop (Qt 5.11, Win10 x64) I am connected via WIFI, Qt https connections work. I wonder why I do not see any active network configurations, but can create HTTP requests. Also m_networkConfigManager->isOnline()
is always false
. Am I missing something, or is this just a Qt bug?
// signal / slot
connect(m_networkConfigManager, &QNetworkConfigurationManager::updateCompleted, this, &CApplication::onNetworkConfigurationsUpdateCompleted, Qt::QueuedConnection);
// called via signal
void CApplication::onNetworkConfigurationsUpdateCompleted()
{
const QNetworkConfiguration config = m_networkConfigManager->defaultConfiguration();
for (const QNetworkConfiguration &config : m_networkConfigManager->allConfigurations())
{
// never reached
const QString cs = CNetworkUtils::toString(config);
CLogMessage(this).info("Network config: %1") << cs;
}
// always false
bool isOnline = m_networkConfigManager->isOnline();
.... debug messages, I see onNetworkConfigurationsUpdateCompleted being called 3 times
....
}
--- edit ---
- I see
onNetworkConfigurationsUpdateCompleted
being called 3 times and then somehow periodically every 10 secs. - after I init
m_networkConfigManager
I callm_networkConfigManager->updateConfigurations();
--- edit 2 ---
This version yields the same result (false) (not Queued)
connect(m_networkConfigManager, &QNetworkConfigurationManager::updateCompleted, [ = ]
{
bool isOnline = m_networkConfigManager->isOnline();
qDebug() << isOnline;
});
and this is never called
connect(m_networkConfigManager, &QNetworkConfigurationManager::onlineStateChanged, [](bool isOnline)
{
qDebug() << isOnline; // never get here
});
--- edit 3 ---
Follow up question: Disable Qt bearer management at runtime