PDA

View Full Version : QTreeWidget read only?



td
15th July 2009, 13:32
Hi all,

I have a QTreeWidget in my program and am wondering of a way or making it "read only"? I can't seem to find any way of doing this. Well I did use "setDisabled(true)" which worked but then wouldn't allow the user to scroll down the widget.

Any help would be appreciated.

Lykurg
15th July 2009, 14:00
Hi, you could use:

treeWidget->editTriggers(QAbstractItemView::NoEditTriggers);
or set all items in it non editable.

td
15th July 2009, 14:26
Thanks. Set all the child items to disabled.

jpn
15th July 2009, 21:46
Thanks. Set all the child items to disabled.
Earlier you said it didn't suit your needs. Anyway, see also QTreeWidgetItem::setFlags() and Qt::ItemIsEditable.

td
21st July 2009, 12:28
Earlier you said it didn't suit your needs.

Doing it for the whole tree didn't (i.e. not being able to scroll down), but using it just on the child items did the trick and allowed scrolling. Thanks.