diff options
Diffstat (limited to 'src/remoteobjects/qremoteobjectabstractitemmodelreplica.cpp')
-rw-r--r-- | src/remoteobjects/qremoteobjectabstractitemmodelreplica.cpp | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/remoteobjects/qremoteobjectabstractitemmodelreplica.cpp b/src/remoteobjects/qremoteobjectabstractitemmodelreplica.cpp index cfcaf3c..91c34ab 100644 --- a/src/remoteobjects/qremoteobjectabstractitemmodelreplica.cpp +++ b/src/remoteobjects/qremoteobjectabstractitemmodelreplica.cpp @@ -268,6 +268,8 @@ void QAbstractItemModelReplicaImplementation::onRowsInserted(const IndexList &pa auto parentItem = cacheData(parentIndex); q->beginInsertRows(parentIndex, start, end); parentItem->insertChildren(start, end); + for (int i = start; i <= end; ++i) + m_headerData[1].append(CacheEntry()); q->endInsertRows(); if (!parentItem->hasChildren && parentItem->columnCount > 0) { parentItem->hasChildren = true; @@ -294,6 +296,8 @@ void QAbstractItemModelReplicaImplementation::onColumnsInserted(const IndexList return; q->beginInsertColumns(parentIndex, start, end); parentItem->columnCount += end - start + 1; + for (int i = start; i <= end; ++i) + m_headerData[0].append(CacheEntry()); q->endInsertColumns(); if (!parentItem->hasChildren && parentItem->children.size() > 0) { parentItem->hasChildren = true; @@ -315,6 +319,7 @@ void QAbstractItemModelReplicaImplementation::onRowsRemoved(const IndexList &par q->beginRemoveRows(parentIndex, start, end); if (parentItem) parentItem->removeChildren(start, end); + m_headerData[1].erase(m_headerData[1].begin() + start, m_headerData[1].begin() + end + 1); q->endRemoveRows(); } @@ -673,7 +678,7 @@ void QAbstractItemModelReplicaImplementation::onHeaderDataChanged(Qt::Orientatio // TODO clean cache const int index = orientation == Qt::Horizontal ? 0 : 1; QVector<CacheEntry> &entries = m_headerData[index]; - for (int i = first; i < last; ++i ) + for (int i = first; i <= last && i < entries.size(); ++i ) entries[i].data.clear(); emit q->headerDataChanged(orientation, first, last); } |