The program:
#include <QString>
#include <QApplication>
#include <QNetworkConfigurationManager>
#include <QNetworkConfiguration>
#include <QNetworkSession>
#include <QDebug>
int main(int argc, char *argv[])
{
QApplication app(argc, argv);
QString intr;
QList<QNetworkInterface> interfaces = QNetworkInterface::allInterfaces();
for (int i = 0; i < interfaces.count(); i++) {
QNetworkInterface networkInterface = interfaces.at(i);
qDebug("NetworkName %s\n", networkInterface.humanReadableName().toLatin1().constData());
}
QNetworkConfigurationManager networkConfigurationManager;
QNetworkConfiguration configuration = networkConfigurationManager.defaultConfiguration();
QNetworkSession *session = new QNetworkSession(configuration);
intr = session->interface().humanReadableName();
qDebug("Active interface :%s \n", intr.toLatin1().constData());
QNetworkConfigurationManager NetworkConfigurationManager;
QList<QNetworkConfiguration> Configuration = NetworkConfigurationManager.allConfigurations();
qDebug("Config count : %d", Configuration.size());
app.exec();
return true;
}
On executing the above code after deploying using macdeployqt tool.The output is as follows:
NetworkName : en0
NetworkName : en1
………….[list around 6 interface names]
Active interface null
Config count 0.
Were as if the same application without deploying .The output is as follows:
NetworkName : en0
NetworkName : en1
………….[list around 6 interface names]
Active interface en0
Config count 6.
Any one faced a similar kind of issue with QNetworkConfigurationManager, were it does not work properly after deployment using macdeployqt tool.
↧