Removing tree node not effecting
-
hi all,
i added root tree widget item dynamically,
when i tried to access, i can its name but when i tried to remove that root with specified name, the effect was not reflecting in window...
Please tell me what i'm missing here...
@
void MainWindow::RemoveTreeRoot(QString Filename)
{QList<QTreeWidgetItem *>TempRoot=ui->treeWidget_FilesSelected->findItems(Filename,Qt::MatchExactly,0); foreach (QTreeWidgetItem *temp,TempRoot) { cout<<"ITS FOUND!!!!!!!!!!!!!!!!"<<endl; std::cout<<"remove:"<<temp->text(0).toStdString()<<endl; ///PRINTING CORRECT NODE NAME.... ui->treeWidget_FilesSelected->removeItemWidget(temp,0); // <----This effect not reflecting in mainwindow while executing } }@
-
No effect at all or when cycle end reflecting?
-
no effect at all.....no nodes are removed...all were as they before....
[quote author="kunashir" date="1325233742"]No effect at all or when cycle end reflecting?[/quote] -
I also do not work your code.
I think *temp is const, but it is not right.
However, if You don't want display some item, may use
@setHidden(true);@ -
Calling
@
delete temp;
@is sufficient.
removeItemWidget removes an item widget (set with setItemWidget()), not an item (set with insertTopLevelItem()) - there's a difference!
-
Really simply.
-
thanks a lot...:)