Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. get the interface of network
Qt 6.11 is out! See what's new in the release blog

get the interface of network

Scheduled Pinned Locked Moved Solved General and Desktop
5 Posts 2 Posters 843 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    saber
    wrote on last edited by
    #1

    how can i get what interface is system is using to connect Internet??
    i want to know if system using wifi or Ethernet to go online.

    is there any way?

    1 Reply Last reply
    0
    • sierdzioS Offline
      sierdzioS Offline
      sierdzio
      Moderators
      wrote on last edited by
      #2

      Check active configuration in QNAM: https://doc.qt.io/qt-5/qnetworkaccessmanager.html#activeConfiguration

      And there, you can check BearerType. https://doc.qt.io/qt-5/qnetworkconfiguration.html#BearerType-enum

      (Z(:^

      S 1 Reply Last reply
      4
      • sierdzioS sierdzio

        Check active configuration in QNAM: https://doc.qt.io/qt-5/qnetworkaccessmanager.html#activeConfiguration

        And there, you can check BearerType. https://doc.qt.io/qt-5/qnetworkconfiguration.html#BearerType-enum

        S Offline
        S Offline
        saber
        wrote on last edited by
        #3

        @sierdzio i wrote this

        qDebug()<< QNetworkConfiguration::Active;
        
        

        output is "14" .

        i am using my mobile Tethering .

        1 Reply Last reply
        0
        • sierdzioS Offline
          sierdzioS Offline
          sierdzio
          Moderators
          wrote on last edited by
          #4

          You have just printed the int value of an enum ;-) That won't tell you anything.

          QNetworkAccessManager manager;
          const auto config = manager.activeConfiguration();
          qDebug() << config.bearerType() << config.bearerTypeName();
          

          (Z(:^

          S 1 Reply Last reply
          3
          • sierdzioS sierdzio

            You have just printed the int value of an enum ;-) That won't tell you anything.

            QNetworkAccessManager manager;
            const auto config = manager.activeConfiguration();
            qDebug() << config.bearerType() << config.bearerTypeName();
            
            S Offline
            S Offline
            saber
            wrote on last edited by
            #5

            @sierdzio

            thanks it's working.

            1 Reply Last reply
            0

            • Login

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • Users
            • Groups
            • Search
            • Get Qt Extensions
            • Unsolved