PDA

View Full Version : hidden a QTreeWidgetItem



mattia
19th March 2008, 09:07
Hi there,
i have a QTreeWidget with some QTreeWidgetItem in, i'd like to hide one of them, i tried with setHidden method but it does not work, i add the item in this way:


QTreeWidgetItem *parentFake = new QTreeWidgetItem ();
parentFake->setText ( 0 , tr ("fake") );
parentFake->setHidden(true);
itemsList.append( parentFake );

and i'm able to see them on my GUI...thx

wysota
19th March 2008, 09:10
Append first, hide later.

mattia
19th March 2008, 09:25
thanks, but its always the same, i tried to disable the item with
setDisabled(true)
and its works, but i can't hide the item...it sounds quite strange...

wysota
19th March 2008, 09:30
Ok, but what is "itemList"? It's not a QTreeWidget, is it? You are adding the item to the tree elsewhere.

mattia
19th March 2008, 09:51
itemList is a QList<QTreeWidgetItem*>
and then i add al the list in QTreeWidget


QTreeWidget * treeWidget
treeWidget->insertTopLevelItems ( 0 , itemList );

wysota
19th March 2008, 10:41
So as I already said add those items to the tree before you hide them.

jokker
19th February 2014, 14:04
Hi! wysota is right! Setting the hidden parameter of the QTreeWidgetItem is only works if it has a parent or container (QTreeWidget) or something like that.