Results 1 to 2 of 2

Thread: Not able to remove the root of the tree widget.

  1. #1
    Join Date
    Oct 2011
    Posts
    160
    Thanks
    31
    Qt products
    Qt4
    Platforms
    Windows

    Default Not able to remove the root of the tree widget.

    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...
    Qt Code:
    1. void MainWindow::RemoveTreeRoot(QString Filename)
    2. {
    3.  
    4. QList<QTreeWidgetItem *>TempRoot=ui->treeWidget_FilesSelected->findItems(Filename,Qt::MatchExactly,0);
    5. foreach (QTreeWidgetItem *temp,TempRoot)
    6. {
    7. cout<<"ITS FOUND!!!!!!!!!!!!!!!!"<<endl;
    8. std::cout<<"remove:"<<temp->text(0).toStdString()<<endl; ///PRINTING CORRECT NODE NAME....
    9. ui->treeWidget_FilesSelected->removeItemWidget(temp,0); // <----This effect not reflecting in mainwindow while executing
    10.  
    11. }
    12. }
    To copy to clipboard, switch view to plain text mode 

  2. #2
    Join Date
    Sep 2011
    Posts
    1,241
    Thanks
    3
    Thanked 127 Times in 126 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Not able to remove the root of the tree widget.

    removeitemwidget only removes the widget, not the node in the tree, according to the docs.

    http://developer.qt.nokia.com/doc/qt...#setItemWidget
    http://developer.qt.nokia.com/doc/qt...moveItemWidget
    If you have a problem, CUT and PASTE your code. Do not retype or simplify it. Give a COMPLETE and COMPILABLE example of your problem. Otherwise we are all guessing the problem from a fabrication where relevant details are often missing.

Similar Threads

  1. tree widget item's widget don't respond to any event.
    By quantity in forum Qt Programming
    Replies: 0
    Last Post: 11th April 2011, 04:30
  2. Problem with tree widget
    By keyurparekh in forum Qt Programming
    Replies: 4
    Last Post: 8th April 2011, 22:14
  3. tree widget like designer's widget tree
    By nroberts in forum Newbie
    Replies: 1
    Last Post: 20th November 2010, 00:06
  4. QTreeView: include root in tree?
    By meter in forum Newbie
    Replies: 2
    Last Post: 14th June 2010, 12:59
  5. Tree Widget
    By bismitapadhy in forum Qt Programming
    Replies: 1
    Last Post: 9th June 2009, 07:31

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.