How to access all files of folderlist model ?
-
i have used folder list model in qml. so i want to know how to access all files of folder list model ?
-
i have used folder list model in qml. so i want to know how to access all files of folder list model ?
@Qt-embedded-developer you could do this using Javascript in QML if you really wanted to. You would need to write a recursive function to traverse the folders. You set the current folder by setting the
folder
property of the model. The number of items in the current folder is given bycount
. The items may be queried usingget(index, property)
. See the documentation for the available properties.However, do you want to do this? Models are usually used to drive a visual component such as a tree view that is written in a declarative style so that you don't need to explicitly loop over all files. If you want to do something like that it might make more sense to do it in your C++ back end and use the appropriate Qt utility classes for querying the filesystem.