Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

[SOLVED] beginInsertRows inside insertRow method?



  • Hello,

    Is it necessary to call beginInsertRows method when implementing this method???

    @QAbstractItemModel::insertRow( int row, const QModelIndex & parent = QModelIndex() )@

    If it's not the case, why is it necessary for this one???
    @QAbstractItemModel::insertRows( int row, int count, const QModelIndex & parent = QModelIndex() )@

    Regards.



  • Function insertRow() is not virtual and not designed to reimplemented. The insertRow() function is implemented in terms of the virtual insertRows(). Get insertRows() right in your subclass and insertRow() follows automatically.



  • Thanks, I didn't realize that It wasn't a virtual method.


Log in to reply