[PySide] Trouble understanding QStandardItemModel

Jonas Thiem jonasthiem at googlemail.com
Wed Apr 16 23:08:47 CEST 2014


Hi,

Trying to understand QStandardItemModel I came up with this:

from PySide.QtCore import *
from PySide.QtGui import *

model = QStandardItemModel()
model.invisibleRootItem().appendRow(QStandardItem("test"))
assert(model.rowCount() == 1)
assert(model.columnCount() == 1)
mIndex = model.createIndex(0, 0)
print(model.data(model.index(0, 0)))
assert(model.itemFromIndex(mIndex) != None)

The last assert fails with PySide 1.2.1 and Python 3.3.5 on Windows 7.
Is that supposed to happen? What would be the proper approach to
simply get the first most topleft item in a QStandardItemModel?

Regards,
Jonas Thiem



More information about the PySide mailing list