I think the reference is to QTreeView::sortByColumn() but I am still having trouble seeing a problem that needs solving. For example, this works just fine for me;
#include <QtGui>
int main(int argc, char *argv[])
{
QFileSystemModel f;
f.setRootPath("/");
proxy.setSourceModel(&f);
proxy.setDynamicSortFilter(true);
t.setModel(&proxy);
t.sortByColumn(0, Qt::DescendingOrder);
QModelIndex idx
= proxy.
mapFromSource(f.
index("/usr/include"));
t.setRootIndex(idx);
t.show();
return app.exec();
}
#include <QtGui>
int main(int argc, char *argv[])
{
QApplication app(argc, argv);
QFileSystemModel f;
f.setRootPath("/");
QSortFilterProxyModel proxy;
proxy.setSourceModel(&f);
proxy.setDynamicSortFilter(true);
QTreeView t;
t.setModel(&proxy);
t.sortByColumn(0, Qt::DescendingOrder);
QModelIndex idx = proxy.mapFromSource(f.index("/usr/include"));
t.setRootIndex(idx);
t.show();
return app.exec();
}
To copy to clipboard, switch view to plain text mode
Even on large folders the files are always sorted correctly.
Bookmarks