Hi, Here is the PyQt implementation of the editabletreemodel itemviews example.
The code was written from the C++ implementation, with space only inside.Feel free to make any necessary changes such as adjusting the header (copied from simpletreemodel.py example) or removing ui_mainwindow.py and editabletreemodel_rc.py generated files provided for convenience.
Feel also free to add that example in the next PyQt release. Best regards, CyrilPS: if you really want the exactly the same behaviour than the C++ implementation, you can apply the provided patch. I think it is more consistent to insert "[No data]" whatever the insertion case though.
editabletreemodel.tar.gz
Description: application/gzip
diff --git a/editabletreemodel.py b/editabletreemodel.py index eab1af7..da98bf7 100755 --- a/editabletreemodel.py +++ b/editabletreemodel.py @@ -53,7 +53,7 @@ class TreeItem: for row in range(count): data = [] for v in range(columns): - data.append(QtCore.QVariant("[No data]")) + data.append(QtCore.QVariant()) item = TreeItem(data, self) self.childItems.insert(position, item) return True @@ -62,7 +62,7 @@ class TreeItem: if position < 0 or position > len(self.itemData): return False for column in range(columns): - self.itemData.insert(position, QtCore.QVariant("[No data]")) + self.itemData.insert(position, QtCore.QVariant()) for child in self.childItems: child.insertColumns(position, columns) return True
_______________________________________________ PyQt mailing list PyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt