Qt World Summit: Submit your Presentation

QFileDialog doesn't list tty* files in /dev/ on Linux

  • I'm working on a Linux desktop application that needs to open a USB serial port, typically /dev/ttyUSB0 or /dev/ttyUSB1. I'm using QFileDialog to let the user select the file:
    QFileDialog dialog(this);
    dialog.setFilter(QDir::System | QDir::AllEntries | QDir::Hidden);
    QStringList fileNames;
    if (dialog.exec())
    fileNames = dialog.selectedFiles();

    When I direct the FileDialog to /dev, none of the files that I can see by typing "ls /dev -al" are there. The directories show up, but for example, this file doesn't:

    $ ls -al /dev/ttyS0
    crw-rw---- 1 root dialout 4, 64 2011-10-09 10:47 /dev/ttyS0

    My user is a member of the dialout group:
    $ groups
    luke adm dialout cdrom audio video plugdev users fuse netdev bluetooth lpadmin admin sambashare

    I've tried adding QDir::Readable and QDir::Writable and the above file still doesn't show up. What am I doing wrong?


Log in to reply