Question

i'm trying to set the history on the QFileDialog, but it doesn't seem to appear anywhere.

QFileDialog dialog(parent, caption, path, filter);
dialog.setHistory(history);
dialog.exec();

But i don't see the history in the dialog anywhere. Where should it be? Should it be anywhere? What am I doing wrong here?

edit:

I made this little hack to make it work even with filenames

for(int index = 0; index < files.size(); index++)
{
    QFileinfo info(files[index]);
    files[index] = info.path();
}
Was it helpful?

Solution

If you open the path selection combo box, you should see them under Recent Places.

Example: The following code

QStringList history;
history << "C:\\temp" << "C:\\Development" << "C:\\Development\\temp";

QFileDialog dialog;
dialog.setHistory( history );
dialog.exec();

leads to this result on my computer (Windows XP 32 bit):

Screenshot of QFileDialog, listing the given directories as Recent Places

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top