How do you do to sort a QFileSystemModel with QDir::DirsFirst like in QDirModel?
The QFileSystemModel does not have a setSorting method.
How do you do to sort a QFileSystemModel with QDir::DirsFirst like in QDirModel? The
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
As far as I can tell, you can’t (in Qt4).
The default sort order (by the “name” column), or sorting by size behaves like
QDir::DirsFirst(orDirsLastif in reverse order for ), but sorting by time or type doesn’t treat directories differently from ordinary files.The
QFileSystemModeldoesn’t expose an API for changing the sort order, and I don’t see any opportunity for influencing it in theQFileSystemModelcode.(I don’t see anything in the current Qt5 docs to indicate that this has changed, but those aren’t final and I haven’t looked very closely.)