Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. How to access all files of folderlist model ?
Forum Updated to NodeBB v4.3 + New Features

How to access all files of folderlist model ?

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
2 Posts 2 Posters 246 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • Q Offline
    Q Offline
    Qt embedded developer
    wrote on last edited by
    #1

    i have used folder list model in qml. so i want to know how to access all files of folder list model ?

    B 1 Reply Last reply
    0
    • Q Qt embedded developer

      i have used folder list model in qml. so i want to know how to access all files of folder list model ?

      B Offline
      B Offline
      Bob64
      wrote on last edited by
      #2

      @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 by count. The items may be queried using get(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.

      1 Reply Last reply
      0

      • Login

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved