Filter QTableView rows with QSortFilterProxyModel and ComboBox

只愿长相守 提交于 2021-02-17 06:36:05

问题


I'm using Pyside2, python 3.8, Qt 5.

  • I have a QTableView with a QAbstractTableModel to it. I have a Combobox (ComboBoxColumns) that lists all my columns headers, and a second Combobox (ComboBoxValues) that lists all the distinct values in the column that is selected in the ComboBoxColumns. My two ComboBoxs are connected to two different QStringListModel.

  • What I want is to only keep the rows where the Value(row, ComboboxColumns.currentIndex) == ComboBoxValues.currentIndex.

  • I'm trying to implement a PrxyModel class from QSortFilterProxyModel, even after two days of reading documentations and other threads on StackOverflow, Qt Forum. I still have no clue on how to do it.

来源:https://stackoverflow.com/questions/65336881/filter-qtableview-rows-with-qsortfilterproxymodel-and-combobox

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!