tags:

views:

269

answers:

2

I have a QTreeWidgetItem with two columns of data, is there any way to make only the second column editable? When I do the following:

QTreeWidgetItem* item = new QTreeWidgetItem();
item->setFlags(item->flags() | Qt::ItemIsEditable);

all columns become editable.

A: 

Set the child of the tree-widget editable or not(itmes of tree), based on the row and column.

Shadow
How do I do this? `QTreeWidgetItem::setFlags` doesn't take column as an argument. Am I supposed to do this in the `QTreeWidget`, if so with which method?
Andreas Brinck
A: 

Looks like you will have to forgo using QTreeWidget and QTreeWidgetItem and go with QTreeView and QAbstractItemModel. The "Widget" classes are convenience classes that are concrete implementations of the more abstract but more flexible versions. QAbstractItemModel has a call flags(QModelIndex index) where you would return the appropriate value for your column.

Harald Scheirich