Results 1 to 5 of 5

Thread: How to select folders from QFileDialog???

  1. #1
    Join Date
    Sep 2011
    Posts
    24
    Qt products
    Qt4
    Platforms
    Windows

    Default How to select folders from QFileDialog???

    I'm using the following code to select folders. But this not working still. Please help.

    Qt Code:
    1. QFileDialog dialog(this);
    2.  
    3. dialog.setFileMode(QFileDialog::Directory);
    4.  
    5. _OutputFolder = dialog.getOpenFileName(this, tr("Select Output Folder"), QDir::currentPath(), tr("Folders"));
    To copy to clipboard, switch view to plain text mode 


    Indika...
    Last edited by IndikaU; 30th September 2011 at 08:21.

  2. #2
    Join Date
    Mar 2009
    Location
    Brisbane, Australia
    Posts
    7,729
    Thanks
    13
    Thanked 1,610 Times in 1,537 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Wiki edits
    17

    Default Re: How to select folders from QFileDialog???

    What about it is "not working still"? The forum crystal ball is out for polishing.
    "We can't solve problems by using the same kind of thinking we used when we created them." -- Einstein
    If you are posting code then please use [code] [/code] tags around it - makes addressing the problem easier.

  3. #3
    Join Date
    Sep 2011
    Posts
    24
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: How to select folders from QFileDialog???

    Even I set the mode to select folders, it just open the folder. I can not select the folder.

  4. #4
    Join Date
    Mar 2009
    Location
    Brisbane, Australia
    Posts
    7,729
    Thanks
    13
    Thanked 1,610 Times in 1,537 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Wiki edits
    17

    Default Re: How to select folders from QFileDialog???

    The static convenience function you are currently using is for selecting a file, and sets itself accordingly. There is a convenience method for doing a directory selection:
    Qt Code:
    1. _OutputFolder = QFileDialog::getExistingDirectory(0, ("Select Output Folder"), QDir::currentPath());
    To copy to clipboard, switch view to plain text mode 

  5. #5
    Join Date
    Sep 2011
    Posts
    24
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: How to select folders from QFileDialog???

    Thanks Chris. That's what I wanted exactly. It works fine.

Similar Threads

  1. QFileDialog to select files AND folders
    By superpacko in forum Qt Programming
    Replies: 3
    Last Post: 16th April 2013, 12:59
  2. Replies: 8
    Last Post: 15th May 2012, 05:21
  3. Replies: 0
    Last Post: 11th February 2011, 04:48
  4. Qt select folders and files dialog.
    By bunjee in forum Qt Programming
    Replies: 5
    Last Post: 13th July 2009, 08:53
  5. Replies: 1
    Last Post: 5th October 2007, 09:51

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
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.