Important: Please read the Qt Code of Conduct -

What happens between beginMoveRows() and endMoveRows() in QAbstractItemModel

  • I have custom model for table view.

    To change rows in the model i use beginMoveRows() and endMoveRows().

    In docs I don't found the answer about what this methods do with model: are they moves indexes or just serves to emit signal(s) about rows moved rowsMoved()

    So I need to know should I change my data directly or need to use beginMoveRows() and endMoveRows() for this purpose.

  • Hi,

    According to the documentation and the source code, these methods will change the persistent indexes of your model (not really sure about what is a persistent index, if someone has some tips...) and, you're right, will emit the corresponding signals. If it is your question, it won't do anything on the underlying data : it's up to you to modify them (and keep the model aware e.g. by using beginMoveRows() and endMoveRows(), so it could inform the connected views).

Log in to reply