Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Removing tree node not effecting
Qt 6.11 is out! See what's new in the release blog

Removing tree node not effecting

Scheduled Pinned Locked Moved General and Desktop
7 Posts 3 Posters 2.8k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    A Offline
    aurora
    wrote on last edited by
    #1

    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
    
    }
    }@
    
    1 Reply Last reply
    0
    • K Offline
      K Offline
      kunashir
      wrote on last edited by
      #2

      No effect at all or when cycle end reflecting?

      1 Reply Last reply
      0
      • A Offline
        A Offline
        aurora
        wrote on last edited by
        #3

        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]

        1 Reply Last reply
        0
        • K Offline
          K Offline
          kunashir
          wrote on last edited by
          #4

          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);@

          1 Reply Last reply
          0
          • G Offline
            G Offline
            goetz
            wrote on last edited by
            #5

            Calling

            @
            delete temp;
            @

            is sufficient.

            removeItemWidget removes an item widget (set with setItemWidget()), not an item (set with insertTopLevelItem()) - there's a difference!

            http://www.catb.org/~esr/faqs/smart-questions.html

            1 Reply Last reply
            0
            • K Offline
              K Offline
              kunashir
              wrote on last edited by
              #6

              Really simply.

              1 Reply Last reply
              0
              • A Offline
                A Offline
                aurora
                wrote on last edited by
                #7

                thanks a lot...:)

                1 Reply Last reply
                0

                • Login

                • Login or register to search.
                • First post
                  Last post
                0
                • Categories
                • Recent
                • Tags
                • Popular
                • Users
                • Groups
                • Search
                • Get Qt Extensions
                • Unsolved