Important: Please read the Qt Code of Conduct -

FolderListModel not showing all the files

  • Hello everyone,
    I am facing troubles using FolderListModel. I am trying to filter only XML files of a specific directory and display them in a ListView. The problem is, it only displays one file whereas I have several XML files in this directory.
    I tried with other types of files (txt, pdf) and it never displays the correct amount of files in the ListView.
    Here is my code, what am I doing wrong?

    ListView {
                    id: listView1
                    x: 0
                    width: 288
                    height: 256
                    anchors.topMargin: 16
                    anchors.horizontalCenter: parent.horizontalCenter
                    delegate: listviewdelegate
                    model: listviewmodel
                    clip: true;
                    nameFilters: ["*.xml"]
                    showDirs: false
                    showDotAndDotDot: false
                    Text {
                        text: fileName
                        color: m_colorDefault
                        font.pixelSize: m_iFontSizeMin
                        anchors.verticalCenter: parent.verticalCenter

    Can't we use a FolderListModel inside a ListView?
    Thanks for your help,


  • Hello,
    I have notice two strange behaviors when dealing with the folder/rootfolder property.

    Despite the documentation, folder is not by default an invalid URL, as it targets the application's directory. Or it means that if you specify an invalid path, it will target the application's directory instead of yelling an error.

    I have also discovered that you can't target a folder which is not in the same HDD partition as the application.
    For example, my app runs on F, and I am trying to get my C:/Users/Foo/Documents folder, without any success. For a while I thought this folder is kinda protected, but I tried other partitions (like my external hard drive), and I always get the same result : the FolderListModel targets the application's folder, because the path I specified is not valid for it.

    This is a huge limitation!

Log in to reply