“group by” proxy model

北慕城南 提交于 2020-01-02 08:28:27
问题 I have tree model with theoretically infinite depth and some property "Group". In addition to standard view, I need to show this model (and keep it in sync) in such way that each group becomes a virtual parent for all items with the same property value. What is the best way to achieve this with Qt's model/view architecture? I had solved similar problem not a long time ago via inserting additional virtual "groups" on adding/removing items to/from the model, but this method proved not to be

How to create a filter for QTableWidget?

删除回忆录丶 提交于 2019-12-18 04:29:11
问题 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. 回答1: 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

Layering proxy models in PyQt

最后都变了- 提交于 2019-12-13 19:23:20
问题 Using PyQt5, I'm trying to build a GUI part that displays two parts; one gives an overview in a QTableView (class Overview), the other shows details of the selected item of the overview in a QTabWidget (class DetailledView). Now, the data in the QTabWidget is spread over several tabs, showing data from different tables (it's much more complex than in the minimal example below). Since these behave like key:value pairs, I want to display them vertically instead of horizontally. So I have an

QtGui.QIdentityProxyModel missing in PySide?

陌路散爱 提交于 2019-12-13 15:41:38
问题 I want to write my own proxy model to "flatten" a tree-like model (i.e. some items might have children items) into a list-like model (i.e. no items have children) by mapping the indices. Subclassing QtGui.QIdentityProxyModel seems to be the best way: http://qt-project.org/doc/qt-4.8/qidentityproxymodel.html but I cannot find it in PySide 1.2.1 which is built with Qt 4.8 (which includes QIdentityProxyModel ): http://seanfisk.github.io/pyside-docs/pyside/PySide/QtGui/index.html. So this seems

Avoid redundant calls to QSortFilterProxyModel::filterAcceptsRow() if the filter has become strictly narrower

馋奶兔 提交于 2019-12-13 11:58:25
问题 Is there any way invalidate the filter in a QSortFilterProxyModel, but to indicate that the filter has been narrowed down so filterAcceptsRow() should be called only on the currently visible rows? Currently Qt doesn't do that. When I call QSortFilterProxyModel::invalidateFilter() , and my filter is changed from "abcd" to "abcde", an entirely new mapping is created, and filterAcceptsRow() is called on all source rows, even though it's obvious that source rows that were hidden so far will

how to use QSortFilterProxyModel for filter a 2d array?

孤人 提交于 2019-12-13 03:23:50
问题 I have been struggling with this for a while, and i am not even sure i am using the right pyqt classes. I have a QTableView that display a 2d array of integers and i wish to filter it to only show the integer under a value. This is the example: from PyQt4 import QtCore, QtGui import random class TableModel(QtCore.QAbstractTableModel): def __init__(self, parent=None): super(TableModel, self).__init__(parent) self._columns = 3 self._parent = parent def rowCount(self, parent=QtCore.QModelIndex()