galactor88
14th July 2009, 09:31
I'm looking for a way to get buttons (or other controls) in one of the columns of the treeView.
Currently i'm using a QtreeView and have the QStandardItemModel in use.
I'm able to get a string in the columns, but need a button to be there.
My code is written in python, but it should be fairly easy to read for non python users.
I did look around on google to get this solved, that helped a little bit, but it's a bit to complicated to solve on my own.
Is there anyone that knows how to do this?
The code down here is the procedure that fils the currently created treeView:
def addToList2(self):
model = QtGui.QStandardItemModel(self.treeView)
self.treeView.setModel(model)
model.insertRows(0, 4)
model.insertColumns(0, 4)
row = col = 0
while row < 4:
col = 1
while col < 4:
index = model.index(row, col)
model.setData(index, QtCore.QVariant('X'))
col += 1
row += 1
self.treeView.show()
Currently i'm using a QtreeView and have the QStandardItemModel in use.
I'm able to get a string in the columns, but need a button to be there.
My code is written in python, but it should be fairly easy to read for non python users.
I did look around on google to get this solved, that helped a little bit, but it's a bit to complicated to solve on my own.
Is there anyone that knows how to do this?
The code down here is the procedure that fils the currently created treeView:
def addToList2(self):
model = QtGui.QStandardItemModel(self.treeView)
self.treeView.setModel(model)
model.insertRows(0, 4)
model.insertColumns(0, 4)
row = col = 0
while row < 4:
col = 1
while col < 4:
index = model.index(row, col)
model.setData(index, QtCore.QVariant('X'))
col += 1
row += 1
self.treeView.show()