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. QTreeView store expanded state - long ?
Forum Updated to NodeBB v4.3 + New Features

QTreeView store expanded state - long ?

Scheduled Pinned Locked Moved Unsolved General and Desktop
qtreeviewqabstractitemmoexpandedisexpanded
2 Posts 1 Posters 985 Views
  • 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.
  • D Offline
    D Offline
    Dariusz
    wrote on last edited by
    #1

    Hey

    So I'm trying to store an expanded state of my custom qtreeView.

    I did a simple model with 100k items. Each item has id.

    And here I hit a wall. It seems that isExpanded(item->index()) is quite expensive call as it does a lot of (expandedIndexes.contains internally which I imagine might be expensive? . How else can I store the list ? or do the checks? Or how can I access diretly expandedIndexes from within tree? Then I can just store the list indexes data(Qt::UserRole) and state which would be a lot faster I think?

    I'm only storing if the check == true,

    Regards
    Dariusz

    1 Reply Last reply
    0
    • D Offline
      D Offline
      Dariusz
      wrote on last edited by
      #2

      Hey

      Just thoguh I'd drop a "temporary" solution I'm testing now. I ended up extending qtreeView, and capturing expand/collapse signals. Then I generate a QSet with these ids that later I can store/restore via model()->match(id) idea. Not sure how well it will work in very large data sets, say 100k items and 10k expanded state items, But well see.

      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