You are not logged in.

1

Wednesday, August 3rd 2011, 3:43pm

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:Directory);

dialog.setOption(QFileDialog:ShowDirsOnly);

dialog.setDirectory(RecentPath);
if(dialog.exec())
{
QStringList list = dialog.selectedFiles();
path = list.at(0);
}