Indeed, according to the documentation, createIndex seems to be there for buidling one's own models. The regular operation is model.index(r,c)
stF > Le 17 avril 2014 à 15:16, Tony Barbieri <great...@gmail.com> a écrit : > > > You could try model.itemFromIndex(model.index(0, 0)), that should return > the item. You also don't need to use the invisibleRootItem to append a > row, you should be able to just call model.appendRow(QStandardItem("test")). > > > On Thu, Apr 17, 2014 at 2:20 AM, S. Champailler <schampail...@skynet.be>wrote: > > > Tried your code, same error. > > > > I'm just wondering if model.data(...) default role is not preventing > > something > > to work in QStandardItemModel.... > > > > Stefan > > > > > Le 16 avril 2014 à 23:08, Jonas Thiem <jonasth...@googlemail.com> a > > écrit : > > > > > > > > > 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 > > > _______________________________________________ > > > PySide mailing list > > > PySide@qt-project.org > > > http://lists.qt-project.org/mailman/listinfo/pyside > > _______________________________________________ > > PySide mailing list > > PySide@qt-project.org > > http://lists.qt-project.org/mailman/listinfo/pyside > > > > > > -- > -tony _______________________________________________ PySide mailing list PySide@qt-project.org http://lists.qt-project.org/mailman/listinfo/pyside