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. listing available devices in ComboBox
Qt 6.11 is out! See what's new in the release blog

listing available devices in ComboBox

Scheduled Pinned Locked Moved Solved General and Desktop
10 Posts 5 Posters 1.5k 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.
  • K Offline
    K Offline
    kripashree
    wrote on last edited by
    #1

    Re: Get the list of available audio devices in Linux

    Hi,

    I want to display the devices listed under /dev/ttyACM* as the ComboBox inputs.
    Can we make this output as a input to the ComboBox? and How?

    Please guide me on this!

    Thanks in advance!!

    Regards,
    Kripashree

    raven-worxR 1 Reply Last reply
    0
    • K kripashree

      Re: Get the list of available audio devices in Linux

      Hi,

      I want to display the devices listed under /dev/ttyACM* as the ComboBox inputs.
      Can we make this output as a input to the ComboBox? and How?

      Please guide me on this!

      Thanks in advance!!

      Regards,
      Kripashree

      raven-worxR Offline
      raven-worxR Offline
      raven-worx
      Moderators
      wrote on last edited by raven-worx
      #2

      @kripashree said in listing available devices in ComboBox:

      Can we make this output as a input to the ComboBox? and How?

      comboBox->addItems( QDir("/dev/ttyACM").entryList() );
      

      --- SUPPORT REQUESTS VIA CHAT WILL BE IGNORED ---
      If you have a question please use the forum so others can benefit from the solution in the future

      1 Reply Last reply
      2
      • K Offline
        K Offline
        kripashree
        wrote on last edited by
        #3

        Hi Raven,

        It is not displaying any combobox options!! now combobox is empty after adding your code!!

        Regards,
        Kripashree

        jsulmJ 1 Reply Last reply
        0
        • K kripashree

          Hi Raven,

          It is not displaying any combobox options!! now combobox is empty after adding your code!!

          Regards,
          Kripashree

          jsulmJ Online
          jsulmJ Online
          jsulm
          Lifetime Qt Champion
          wrote on last edited by
          #4

          @kripashree

          comboBox->addItems( QDir("/dev").entryList().filter("/dev/ttyACM");
          

          https://forum.qt.io/topic/113070/qt-code-of-conduct

          aha_1980A K 2 Replies Last reply
          2
          • jsulmJ jsulm

            @kripashree

            comboBox->addItems( QDir("/dev").entryList().filter("/dev/ttyACM");
            
            aha_1980A Offline
            aha_1980A Offline
            aha_1980
            Lifetime Qt Champion
            wrote on last edited by
            #5

            @jsulm I have the strange feeling it does not work because the tty* entries are no regular files, but character devices. For me, even QDir("/dev").entryList(); only gives the subdirectories, not the devices itself.

            Qt has to stay free or it will die.

            J.HilkJ 1 Reply Last reply
            0
            • K Offline
              K Offline
              kripashree
              wrote on last edited by
              #6

              This also not working!! combobox is empty!!

              1 Reply Last reply
              0
              • aha_1980A aha_1980

                @jsulm I have the strange feeling it does not work because the tty* entries are no regular files, but character devices. For me, even QDir("/dev").entryList(); only gives the subdirectories, not the devices itself.

                J.HilkJ Online
                J.HilkJ Online
                J.Hilk
                Moderators
                wrote on last edited by
                #7

                @aha_1980 I don't have a linux system here to test, but is that also the case, if you specify QDir::AllEntries and QDir::Hidden and QDir::System as filters ?

                Especially System seems to be important:

                List system files (on Unix, FIFOs, sockets and device files are included...)


                Be aware of the Qt Code of Conduct, when posting : https://forum.qt.io/topic/113070/qt-code-of-conduct


                Q: What's that?
                A: It's blue light.
                Q: What does it do?
                A: It turns blue.

                aha_1980A 1 Reply Last reply
                5
                • J.HilkJ J.Hilk

                  @aha_1980 I don't have a linux system here to test, but is that also the case, if you specify QDir::AllEntries and QDir::Hidden and QDir::System as filters ?

                  Especially System seems to be important:

                  List system files (on Unix, FIFOs, sockets and device files are included...)

                  aha_1980A Offline
                  aha_1980A Offline
                  aha_1980
                  Lifetime Qt Champion
                  wrote on last edited by aha_1980
                  #8

                  @J.Hilk said in listing available devices in ComboBox:

                  QDir::System

                  Thanks, that helped :)

                  The following code shows all tty devices on my Ubuntu system:

                  #include <QDir>
                  #include <QDebug>
                  
                  int main(int argc, char *argv[])
                  {
                      const QStringList entries = QDir("/dev").entryList(QDir::System).filter("tty");
                      qDebug() << entries;
                  }
                  

                  Output:

                  10:16:37: Starting DirEntryList...
                  ("tty", "tty0", "tty1", "tty10", "tty11", "tty12", "tty13", "tty14", "tty15", "tty16", "tty17", "tty18", "tty19", "tty2", "tty20", "tty21", "tty22", "tty23", "tty24", "tty25", "tty26", "tty27", "tty28", "tty29", "tty3", "tty30", "tty31", "tty32", "tty33", "tty34", "tty35", "tty36", "tty37", "tty38", "tty39", "tty4", "tty40", "tty41", "tty42", "tty43", "tty44", "tty45", "tty46", "tty47", "tty48", "tty49", "tty5", "tty50", "tty51", "tty52", "tty53", "tty54", "tty55", "tty56", "tty57", "tty58", "tty59", "tty6", "tty60", "tty61", "tty62", "tty63", "tty7", "tty8", "tty9", "ttyprintk", "ttyS0", "ttyS1", "ttyS10", "ttyS11", "ttyS12", "ttyS13", "ttyS14", "ttyS15", "ttyS16", "ttyS17", "ttyS18", "ttyS19", "ttyS2", "ttyS20", "ttyS21", "ttyS22", "ttyS23", "ttyS24", "ttyS25", "ttyS26", "ttyS27", "ttyS28", "ttyS29", "ttyS3", "ttyS30", "ttyS31", "ttyS4", "ttyS5", "ttyS6", "ttyS7", "ttyS8", "ttyS9")
                  10:16:37: DirEntryList exited with code 0
                  

                  Porting that to a QComboBox should be easy...

                  Qt has to stay free or it will die.

                  1 Reply Last reply
                  6
                  • jsulmJ jsulm

                    @kripashree

                    comboBox->addItems( QDir("/dev").entryList().filter("/dev/ttyACM");
                    
                    K Offline
                    K Offline
                    kripashree
                    wrote on last edited by
                    #9

                    @jsulm Thank you.

                    comboBox->addItems( QDir("/dev").entryList().filter("/dev/ttyACM"); This is helped.

                    aha_1980A 1 Reply Last reply
                    1
                    • K kripashree

                      @jsulm Thank you.

                      comboBox->addItems( QDir("/dev").entryList().filter("/dev/ttyACM"); This is helped.

                      aha_1980A Offline
                      aha_1980A Offline
                      aha_1980
                      Lifetime Qt Champion
                      wrote on last edited by
                      #10

                      @kripashree then please mark this topic as SOLVED. Thanks

                      Qt has to stay free or it will die.

                      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