Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. QFileSystemModel vs QTreeWidgetItem
Forum Update on Monday, May 27th 2025

QFileSystemModel vs QTreeWidgetItem

Scheduled Pinned Locked Moved Unsolved General and Desktop
3 Posts 2 Posters 894 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.
  • C Offline
    C Offline
    Crag_Hack
    wrote on last edited by
    #1

    Hi I need to display a tree representing a file structure with the following requirements:

    1. show only directories and files I specify
    2. intercept click events on files/directories and modify background color of file/dir item using click event or signal
    3. derive full path from specific tree file/dir components that have been clicked and set to the corresponding color for use in data backup (green is backup, red is delete, no bg color is ignore)

    Should I just create my own tree with a qtreewidgetitem subclass and QTreeWidget to handle all these things (I already know how to do so...) or is it possible with QFileSystemModel?
    Thanks

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi,

      Use a QFileSystemModel/QTreeView/custom QStyledItemDelegate combo. Going the QTreeWidget way you are going to re-implement some sort of file system model anyway.

      You also have to take into account the performance of your application for a highly loaded file system.

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      0
      • C Offline
        C Offline
        Crag_Hack
        wrote on last edited by
        #3

        Thanks, however I don't know how to do the view/model approach you described. If there aren't a large number of tree entries will a QTreeWidget suffice performance wise? What kind of numbers would slow down the program significantly? I'm thinking about taking the route I know how to just to simplify things. I don't expect tree entry numbers to exceed more than a hundred or so. If you think it's essential can you point me to a tutorial or book?
        Thanks again

        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