Dear visitor, welcome to QtForum.org.
If this is your first visit here, please read the Help. It explains in detail how this page works.
To use all features of this page, you should consider registering.
Please use the registration form, to register here or read more information about the registration process.
If you are already registered, please login here.
QFileDialog with ShowDirsOnly works only in Qt4.5.3
To select a directory with QFileDialog I write the code bellow.
In Qt 4.5.3 it works but in a computer in QT 4.7 the vertical splitter is at the right of the file dialog. So you must drag and drop the splitter to the left to select a directory.
Could you help me please ?
QString path="";
QFileDialog dialog(
this);dialog.setLabelText(QFileDialog::LookIn,"Choose directory");
dialog.setFileMode(QFileDialog
irectory);
dialog.setOption(QFileDialog
howDirsOnly);
dialog.setDirectory(RecentPath);
if(dialog.exec())
{
QStringList list = dialog.selectedFiles();
path = list.at(0);
}