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. BeginInsertRow/EndInsertRow/BeginRemoveRow etc - keeps resetting expanded items states?
Forum Update on Monday, May 27th 2025

BeginInsertRow/EndInsertRow/BeginRemoveRow etc - keeps resetting expanded items states?

Scheduled Pinned Locked Moved Unsolved General and Desktop
1 Posts 1 Posters 228 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 Dariusz
    #1

    Hey

    So I'm working on QAbstractItemModels to build up QTreeView. I'm hand managing all the insert/remove/append/remove rows. I initially built it "as is " and lately I read up that I need to add begin/end routines before and after inserting rows. Now without it, it seemed to work fine, but now with it whenever I drag/drop items, the expanded items close down and so on, entire views gets reset. Is that normal? How can I preserve expanded items or am I doing something wrong?

    For example, if I have

        nodeA->appendItem(someNode);
        appendItem(myNode *node){
            if(model){
                model->beginInsertingRows()
            }
            children.push_back(node)
            if(model){
                model->endInsertingRows()
            }
        }
    

    This is routine more or less, but these model-> signals keeps reseeting my expanded items? Or do we dont use these signals if we use our own drag/drop/model/view etc?

    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