Re: [PyQt] dense about qvariant and dict

2012-12-08 Thread David Cortesi
qv.toPyObject() gives the same as qv.toMap, a python dict in which the keys have been changed to QStrings (these keys were all python strings originally, don't know what it would do with numeric keys) and the values to QVariants. This is ok in the sense that no data is lost, but adds some code in

Re: [PyQt] dense about qvariant and dict

2012-12-08 Thread Phil Thompson
On Fri, 7 Dec 2012 16:06:28 -0800, David Cortesi wrote: > OK, I implement QListView.itemData() returning a python dict, > which then arrives at QListView.setItemData() as a QVariant > of length 1. The problem is, how to cast that qv back to a dict? > I have read > > http://www.riverbankcomputing.

Re: [PyQt] dense about qvariant and dict

2012-12-07 Thread David Boddie
On Sat Dec 8 00:06:28 GMT 2012, David Cortesi wrote: > dict(qv) doesn't do it. qv.toHash produces an empty dict. > qv.toMap produces a QMap with the original keys as QStrings and > the original data as QVariants. OK, but I'd rather have the python > dict -- is there a way to get it, or do I have t

[PyQt] dense about qvariant and dict

2012-12-07 Thread David Cortesi
OK, I implement QListView.itemData() returning a python dict, which then arrives at QListView.setItemData() as a QVariant of length 1. The problem is, how to cast that qv back to a dict? I have read http://www.riverbankcomputing.co.uk/static/Docs/PyQt4/html/qvariant.html and noted especially the