import PySide import PySide.QtCore as QtCore import PySide.QtGui as QtGui import PySide.QtUiTools as QtUiTools import sys class dictItem(dict): pass class Model(QtGui.QStringListModel): DictRole = QtCore.Qt.UserRole + 1 def data(self, index, role=QtCore.Qt.DisplayRole): if role == self.DictRole: return dictItem() else: return super(Model,self).data(index, role) if __name__ == "__main__": app = QtGui.QApplication(sys.argv) # Just building a basic model and widget widget = QtGui.QWidget() mainlayout = QtGui.QHBoxLayout(widget) widget.setLayout(mainlayout) string_model = Model() string_model.setStringList( [str(i) for i in xrange(50)] ) list_view = QtGui.QListView(widget) list_view.setModel(string_model) mainlayout.addWidget(list_view) # The correct type is not kept for data returned through index.data print type(string_model.index(0,0, QtCore.QModelIndex()).data(Model.DictRole)) # Works model.data the way it is suppose to print type(string_model.data(string_model.index(0,0,QtCore.QModelIndex()),Model.DictRole)) widget.show() app.exec_()