Users open files in our app through a QFileDialog. The order of the filenames is bizarre. What is determining the sorting order, and how can we make it sort by filenames, or otherwise impose our own sorting, perhaps giving it a pointer to our own comparison function?

The documentation and online forums haven't been helpful. Unless it's well hidden, there doesn't seem to be any sorting method, property, etc.

This is a primarily Linux app, but also runs on Macs. (I know nothing about Mac.)

Here is the juicy part of the source code:

```
QtFileDialog chooser(parent, caption, directory, filter);
/// QtFileDialog is our class derived from QFileDialog

chooser.setModal(true);
chooser.setAcceptMode(acceptMode);
chooser.setFileMode(fileMode);

QStringList hist = chooser.history();
chooser.setHistory(hist);

/* point "x" */

if(chooser.exec()) {    
    QStringList files = chooser.selectedFiles();
    ...blah blah blah...

```

From one of the answers, I tried an evil experiment, adding this ill-informed guesswork code at "point x":

```
QSortFilterProxyModel *sorter = new QSortFilterProxyModel();
sorter->sort(1);  // ???
chooser.setProxyModel(sorter);

```

But this crashed spectacularly at a point about 33 subroutine calls deep from this level of code. I admit, even after reading the Qt4 documentation and sample code, I have no idea of the proper usage of QSortFilterProxyModel.