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. [SOLVED]how to clear the children of a QTreeWidgetItem?
Forum Updated to NodeBB v4.3 + New Features

[SOLVED]how to clear the children of a QTreeWidgetItem?

Scheduled Pinned Locked Moved General and Desktop
2 Posts 2 Posters 4.4k Views 2 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.
  • O Offline
    O Offline
    opengpu2
    wrote on last edited by opengpu2
    #1

    how to clear the children of a QTreeWidgetItem?
    i just found item.takeChildren();
    is there any better way to do this?

    1 Reply Last reply
    0
    • Chris KawaC Offline
      Chris KawaC Offline
      Chris Kawa
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Depends on what you mean by "better" ;)
      That's pretty standard way to do this. If you also want to delete them here's a one-liner:

      foreach(auto i, item.takeChildren()) delete i;
      
      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