3

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();
}
0xbaadf00d
  • 2,535
  • 2
  • 24
  • 46

1 Answers1

2

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

Tim Meyer
  • 12,210
  • 8
  • 64
  • 97
  • Ok, now it makes sense. I thought i could enter a list of recent files, but it seems that only folders are accepted. – 0xbaadf00d Jan 18 '13 at 13:00