what is the best way to Filter different types of files in QTreewidget/QListWidget?
-
it seems that there is no good way to filter...
i think i have to re-setup the QTreeWidget/QListWidget everytime i select a different type of filterType...because i found there is not way to use QFileSystemMode or QSortFilterModel while i use QTreeWidget/QListWidget
-
No there's not indeed, however your have QTreeView that might your needs
-
@SGaist thank you ,i traverse all the items and setHidden true or false by myself...
-
How many files/folders are you going to handle that way ?
-
@SGaist maybe hundreds or even thousands...is there better way?
-
Then why don't you use a QFileSystemModel ?
-
@SGaist i don't know how to use it...because i use QTreeWidget but not QTreeView...
i think i even can't find a setModel() api in QTreeWidget/QListWidget... -
You have to use QTreeView/QListView classes when using a model like that.
-
@SGaist ok...but i think i can't use QTreeView...
-
Why can't you ?
-
@SGaist already write many code...
-
Refactoring might be hard but it's generally a good thing to have a clean code base