Results 1 to 6 of 6

Thread: QFileDialog selecting file or directory

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Dec 2018
    Posts
    1
    Qt products
    Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android

    Default Re: QFileDialog selecting file or directory

    This fails for me. I can only select files. No way to select the directory without opening it up. The question was how to select a file, or a directory. This only selects files.
    -- Doug Royer (https://DougRoyer.US)

  2. #2
    Join Date
    Jan 2008
    Location
    Alameda, CA, USA
    Posts
    5,329
    Thanks
    317
    Thanked 871 Times in 858 Posts
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: QFileDialog selecting file or directory

    If you are using the QFileDialog static methods, then you call QFileDialog::getExistingDirectory() to select directories only and QFileDialog::getOpenFileName() for files only. If you are using the non-static method (ie. via QFileDialog::exec()) than you set the option QFileDialog::ShowDirsOnly and use QFileDialog::Directory file mode.

    The original post is 13 years old, during Qt 3 or Qt 4 days. Qt is three major revisions past that now.
    <=== The Great Pumpkin says ===>
    Please use CODE tags when posting source code so it is more readable. Click "Go Advanced" and then the "#" icon to insert the tags. Paste your code between them.

Similar Threads

  1. Replies: 4
    Last Post: 13th June 2007, 15:37
  2. qt-3.3.8 fail in scratchbox
    By nass in forum Installation and Deployment
    Replies: 0
    Last Post: 25th May 2007, 15:21
  3. errors while installing Qt4.2 in Linux
    By nimmyj in forum Installation and Deployment
    Replies: 11
    Last Post: 13th December 2006, 11:58
  4. create file in another directory
    By raphaelf in forum Qt Programming
    Replies: 3
    Last Post: 16th February 2006, 10:04
  5. Am I the only one with "make" error ?
    By probine in forum Installation and Deployment
    Replies: 1
    Last Post: 13th February 2006, 12:54

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Qt is a trademark of The Qt Company.