QFileSystemModel vs QTreeWidgetItem



  • 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


  • Lifetime Qt Champion

    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.



  • 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


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.