PDA

View Full Version : How to select folders from QFileDialog???



IndikaU
30th September 2011, 08:35
I'm using the following code to select folders. But this not working still. Please help.


QFileDialog dialog(this);

dialog.setFileMode(QFileDialog::Directory);

_OutputFolder = dialog.getOpenFileName(this, tr("Select Output Folder"), QDir::currentPath(), tr("Folders"));


Indika...

ChrisW67
30th September 2011, 09:07
What about it is "not working still"? The forum crystal ball is out for polishing.

IndikaU
30th September 2011, 09:20
Even I set the mode to select folders, it just open the folder. I can not select the folder.

ChrisW67
30th September 2011, 09:48
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:


_OutputFolder = QFileDialog::getExistingDirectory(0, ("Select Output Folder"), QDir::currentPath());

IndikaU
30th September 2011, 10:19
Thanks Chris. That's what I wanted exactly. It works fine.