Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

Help with QNetworkConfigurationManager!



  • @QNetworkConfigurationManager *mgr = new QNetworkConfigurationManager(this);

    //mgr->updateConfigurations();
    
    QList<QNetworkConfiguration> activeConfigs = mgr->allConfigurations(QNetworkConfiguration::Active);
    
    if (activeConfigs.count() <= 0){
    
        qDebug()<<"activeConfigs:"<<activeConfigs.count();
    
        QMessageBox::warning(this,tr("Connection problems"),
    
                                  tr("No active ethernet connection found\nPlease check your ethernet wiring"));
    
        //exit(0);
    
    }@
    

    The debug version works properly,but the release version always prompt the warning dialog!

    If I add the following code,It will never exit loop.exec(),regardless of debug or release version.
    @QEventLoop loop;
    QObject::connect(mgr, SIGNAL(updateCompleted()), &loop, SLOT(quit()));
    loop.exec();@



  • Any one else come up against the problem?



  • dig it.


Log in to reply