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. Best way to reparent a lot of QTreeWidgetItem
Forum Updated to NodeBB v4.3 + New Features

Best way to reparent a lot of QTreeWidgetItem

Scheduled Pinned Locked Moved General and Desktop
3 Posts 1 Posters 2.2k 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.
  • G Offline
    G Offline
    Galactik
    wrote on last edited by
    #1

    Hi guys,

    I have a little performance issue using QTreeWidget & reparenting a lot of QTreeWidgetItems, and i'm wondering if there's an efficient way of doing that.

    Right now, i don't see any other way than :

    for each items to move

    removeChild() to take the item from it's parent

    addChild() to the new parent

    Depending on the current state of the item in the tree (expanded or not), it takes a lot of time to process.

    I'm speaking about reparenting things like 10000 items each time.

    Did anyone tried something similar and have a better way to handle it ?

    Thanks for any help !

    1 Reply Last reply
    0
    • G Offline
      G Offline
      Galactik
      wrote on last edited by
      #2

      BTW, i tried to encapsulate the loop described above with :

      treeWidget->setUpdatesEnabled(false);
      [...]
      treeWidget->setUpdatesEnabled(true);

      it helps a little but it's not enough to be "real-time". I guess my only option would be to lower the number of calls :-/

      1 Reply Last reply
      0
      • G Offline
        G Offline
        Galactik
        wrote on last edited by
        #3

        i quickly checked the source code around remove/add, it seems a lot of code can handle batch remove/adds but i don't see any way to access it.

        Is there something i'm missing ?

        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