qsortfilterproxymodel

Chained QSortFilterProxyModels

末鹿安然 提交于 2019-12-03 14:54:42
Let's say I have a list variable datalist storing 10,000 string entities. The QTableView needs to display only some of these entities. That's is why QTableView was assigned QSortFilterProxyModel that does all the filtering. After all Proxy work is completed the QTableView "receives" 25 entities to display (so remaining 9,975 entities were "filtered out". Now, I create a QLineEdit to be used as a search field where the user can type a keyword to narrow down the list of the displayed 25 entities (items) even further. For this purpose I link QLineEdit 's textChanged signal to assigned to

Using QSortFilterProxyModel with a tree model

混江龙づ霸主 提交于 2019-12-03 12:57:52
问题 I have a QDirModel whose current directory is set. Then I have a QListView which is supposed to show the files in that directory. This works fine. Now I want to limit the files shown, so it only shows png files (the filename ends with .png). The problem is that using a QSortFilterProxyModel and setting the filter regexp will try to match every parent of the files as well. According to the documentation: For hierarchical models, the filter is applied recursively to all children. If a parent

Using QSortFilterProxyModel with a tree model

自古美人都是妖i 提交于 2019-12-03 03:13:14
I have a QDirModel whose current directory is set. Then I have a QListView which is supposed to show the files in that directory. This works fine. Now I want to limit the files shown, so it only shows png files (the filename ends with .png). The problem is that using a QSortFilterProxyModel and setting the filter regexp will try to match every parent of the files as well. According to the documentation: For hierarchical models, the filter is applied recursively to all children. If a parent item doesn't match the filter, none of its children will be shown. So, how do I get the

How to create a filter for QTableWidget?

爱⌒轻易说出口 提交于 2019-11-29 05:11:00
I'm trying to create a filter for QTableWidget with QLineEdit in PySide. I've seen some tutorials using QSortFilterProxyModel for C++ but couldn't understood how to do it in Python. I need to search in 'VALUE' column. Trilarion A QSortFilterProxyModel is a proxy model, that means that you put it between the your complete data model and a view. The comment by titusjan is good, you can look in your local PySide/PyQt installation for basicsortfiltermodel.py to get an example in Python. Also, instead of using a QTableWidget a QTableView is sufficient - you won't need the inbuilt model of