Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Qt for Python
  4. QFileSystemModel limit folder depth
Qt 6.11 is out! See what's new in the release blog

QFileSystemModel limit folder depth

Scheduled Pinned Locked Moved Unsolved Qt for Python
2 Posts 2 Posters 707 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.
  • L Offline
    L Offline
    Lucas kim
    wrote on last edited by
    #1

    I want to limit folder depth using QFileSystemModel.
    e.g. C:\folder1\folder2\folder3

    Using the QStandardItemModel, folders could be explored one by one.
    However, I prefer the fast speed of the QFileSystemModel and I also like the automatic creation of icons.
    Please let me know if there is a way to limit the depth of the folder in the QFileSystemModel.
    Thank you.

    JonBJ 1 Reply Last reply
    0
    • L Lucas kim

      I want to limit folder depth using QFileSystemModel.
      e.g. C:\folder1\folder2\folder3

      Using the QStandardItemModel, folders could be explored one by one.
      However, I prefer the fast speed of the QFileSystemModel and I also like the automatic creation of icons.
      Please let me know if there is a way to limit the depth of the folder in the QFileSystemModel.
      Thank you.

      JonBJ Offline
      JonBJ Offline
      JonB
      wrote on last edited by JonB
      #2

      @Lucas-kim
      There isn't an in-built support in QFileSystemModel for this. What about:

      QTreeView QFileSystemModel - limit expandable to only root

      Use some proxy model to limit depth via hasChildren()/rowCount(). ?

      1 Reply Last reply
      3

      • Login

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