Hi all, I am building a model for a tree view and have a dictionary that represents all the data in the required hierarchy. I have to be able to filter the view, select things programmatically and show info based on selected items etc. I am wondering: With all required data per item available in a dict, is it more efficient to just stuff that into the item's UserRole data or to create custom user roles for each value in the dict that I will be filtering/sorting by or looking up for some other reason? E.g.: Will there be a difference in performance with this: item = QStandardItem() item.setData(my_dict, UserRole) then: item.data(UserRole)["typeA"] item.data(UserRole)["typeB"] item.data(UserRole)["typeC"]
compared to this approach?: item = QStandardItem() item.setData(my_dict["dataA"], UserRole) item.setData(my_dict["dataB"], UserRole+1) item.setData(my_dict["dataC"], UserRole+2) then: item.data(UserRole) item.data(UserRole+1) item.data(UserRole+2) Cheers, frank
_______________________________________________ PySide mailing list PySide@qt-project.org https://lists.qt-project.org/listinfo/pyside