Important: Please read the Qt Code of Conduct -

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

  • 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

        appendItem(myNode *node){

    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?

Log in to reply