Re: [PyQt] Item data on QTreeView

2012-07-09 Thread Diego
On Mon, Jul 9, 2012 at 3:42 AM, Andreas Pakulat wrote: > > > You could store it only in the first item of a row and always access it > there. Another option would be have a dict of messages and use the > row-number as key - this only works of course as long as your rows are not > re-arranged frequ

Re: [PyQt] Item data on QTreeView

2012-07-09 Thread Andrew Suffield
On Sun, Jul 08, 2012 at 07:02:27PM -0300, Diego wrote: > When a row is selected in the QTreeView, I need to be able to access > the object whose attributes are being displayed in that row. I don't > know how to properly do that, and the only thing that worked for me is > to store the original objec

Re: [PyQt] Item data on QTreeView

2012-07-08 Thread Andreas Pakulat
Hi, On Mon, Jul 9, 2012 at 12:02 AM, Diego wrote: > Hi, > > I have a QTreeView widget that displays one Message per row. It also > has several columns, each of which displays one Message's attribute. > The tree's model is a QStandardItemModel that I populate this way: > > for m in messages: >

[PyQt] Item data on QTreeView

2012-07-08 Thread Diego
Hi, I have a QTreeView widget that displays one Message per row. It also has several columns, each of which displays one Message's attribute. The tree's model is a QStandardItemModel that I populate this way: for m in messages: items = [] it = QStandardItem() it.message = m # (1)