Trolltech Home | Qt-interest Home | Recent Threads | All Threads | Author | Date
All threads index page 1

Qt-interest Archive, April 2007
Remove CheckBox in QTreeWidgetItem


Message 1 in thread

Hello,

Is there a way to remove checkboxes from a QTreeWidgetItem, except by 
removing them and inserting a new one?

I'd like to enable checkboxes on sets of items, depending on circumstance. 
The most logical is setting/clearing the ItemIsUserCheckable flag:

itemCut->setFlags( itemCut->flags() | Qt::ItemIsUserCheckable); // set
itemCut->setFlags( itemCut->flags() & ~Qt::ItemIsUserCheckable);        // 
clear

However, this doesn't do anything. With the flag set, you need to call 
setCheckState() as well, which isn't a problem, but it's awkward.

When the flag is then cleared, the checkbox remains visible, it just can't 
be used.

Any alternatives?


-Marc