Andreas Pakulat wrote:
Keeping a record of which nodes I have open ending up being slow, and there were other problems with the fullOn 06.10.06 10:14:17, Matt Chambers wrote: refresh option that turned me off to it. So I started to look into doing a single full update in the beginning, and then pulling incremental updates which update my underlying data. Question now is, I can update the data no problem. How can I find out what indexes to use when emiting a dataChanged signal if I update the underlying data in an elementtree ? class TreeModel( QtCore.QAbstractItemModel ): def __init__(self, show ): QtCore.QAbstractItemModel.__init__(self) self.__columns = [ ] self.__data = Data(show,self) def addColumn(self,label,tag): """addColumn(String label, string Tag) """ self.__columns.append( [QtCore.QVariant(label),tag] ) def data(self, index, role): if role != DISPLAY_ROLE: return EMPTY_VARIANT if not index.isValid(): return EMPTY_VARIANT el = index.internalPointer() return QtCore.QVariant( el.get(self.__columns[index.column()][1]) ) def headerData(self, section, orientation, role): if orientation == QtCore.Qt.Horizontal and role == DISPLAY_ROLE: return self.__columns[section][0] return EMPTY_VARIANT def index(self, row, column, parent): if parent.isValid(): item = parent.internalPointer() else: item = self.__data.rootNode return self.createIndex(row, column, item[row]) def parent(self, index): if not index.isValid(): return EMPTY_INDEX item,row = self.__data.parentMap[index.internalPointer()] if id(item) == id(self.__data.rootNode): return EMPTY_INDEX else: return self.createIndex(self.__data.parentMap[item][1],0,item) def rowCount(self, parent): if parent.isValid(): item = parent.internalPointer() else: item = self.__data.rootNode return len(item) def columnCount(self, parent): return len(self.__columns) |
_______________________________________________ PyKDE mailing list [email protected] http://mats.imk.fraunhofer.de/mailman/listinfo/pykde
