PDA

View Full Version : Problem with Editable QTreeWidgetItem



delalaym
12th March 2009, 15:48
Hello,

I am using a QTreeWidget with QTreeWidgetItem. My Widget Items have many columns but I want only the first column to be editable... How do I do that? For now, it seems that if I set the Flag to Editable, all the row is editable.

Thanks!

Marc-Andre

spirit
12th March 2009, 16:01
you can create delegate and return an editor only for first column,for other just return "0".

delalaym
12th March 2009, 16:52
Where is there information about "delegate". I am not familiar with the concept. I checked that QTreeWidget and QTreeWidgetItem but there is nothing about that. It seems that the concept is more present in QTreeView...

spirit
12th March 2009, 16:55
take a look at this example QTDIR/examples/itemviews/spinboxdelegate and QItemDelegate. QTreeWidget inherits setItemDelegate method.

spirit
12th March 2009, 17:01
you can also remove Qt::ItemIsEditable for items when you populate a tree.