Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-56760

QNetworkSettings API is unusable from C++

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • P1: Critical
    • None
    • 5.7.0
    • Device Creation
    • None

    Description

      I am trying to create a Wi-Fi connection from C++.
      (pseudocode)

      slot void setupWifi(){
          manager->getService("networkName", QNetworkSettingsType::Wifi);
          if (!mService) {
               errorMessage();
          } else {
               doSetup();
          }
      }
      
      main() {
          manager = new QNetworkSettingsManager();
          connect(manager, servicesChanged, this, setupWifi);
      }
      

      When the signal "servicesChanged" is emitted all the network names are empty and each network type is 'unknown'. In this case "getService" will never return anything. The names and types of the networks are received asynchronously via DBus. But after all information retrieval is done the end user code is not notified again.
      You have to find a solution where you can notify the end user code when it makes sense to use the "getService" to return some actual service.
      The same applies to the network type. When asking "getService" for a Wifi type network the first time all networks are in "unknown" state and will not return a value. The users have to wait until enumeration has completed.

      I made a quick and dirty patch https://codereview.qt-project.org/#/c/175046/ which emits the signal 'servicesChanged' on every name and type change. This allows customers to retry getting the network service.

      Attachments

        For Gerrit Dashboard: QTBUG-56760
        # Subject Branch Project Status CR V

        Activity

          People

            teemu.holappa Teemu Holappa
            rakeller Rainer Keller
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes