diff options
author | Stephen Kelly <stephen.kelly@kdab.com> | 2012-09-27 11:36:23 +0200 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2012-10-22 19:36:43 +0200 |
commit | d18eb260d70b75376411fe3f69da82bf46fb503f (patch) | |
tree | 691ebaa77e301f0b3b52e894dbfd9e7085a292bd /src/corelib/itemmodels/qitemselectionmodel_p.h | |
parent | 0693082c95c1833f686accee74024db4eead3003 (diff) |
Use the layout change hint to speed up QItemSelectionModel.
The testcase in the bug report takes 370035 ms to sort the rows with
Qt 4, and 5646 ms in Qt 5 (when using the extra hints to layout*Changed).
That's an improvement of more than 98%.
Task-number: QTBUG-17732
Change-Id: If78f972d80c501e0cb39078228086c4f4ac8a65b
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
Diffstat (limited to 'src/corelib/itemmodels/qitemselectionmodel_p.h')
-rw-r--r-- | src/corelib/itemmodels/qitemselectionmodel_p.h | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/corelib/itemmodels/qitemselectionmodel_p.h b/src/corelib/itemmodels/qitemselectionmodel_p.h index cc278346ff..9439bb772b 100644 --- a/src/corelib/itemmodels/qitemselectionmodel_p.h +++ b/src/corelib/itemmodels/qitemselectionmodel_p.h @@ -76,8 +76,8 @@ public: void _q_columnsAboutToBeRemoved(const QModelIndex &parent, int start, int end); void _q_rowsAboutToBeInserted(const QModelIndex &parent, int start, int end); void _q_columnsAboutToBeInserted(const QModelIndex &parent, int start, int end); - void _q_layoutAboutToBeChanged(); - void _q_layoutChanged(); + void _q_layoutAboutToBeChanged(const QList<QPersistentModelIndex> &parents = QList<QPersistentModelIndex>(), QAbstractItemModel::LayoutChangeHint hint = QAbstractItemModel::NoLayoutChangeHint); + void _q_layoutChanged(const QList<QPersistentModelIndex> &parents = QList<QPersistentModelIndex>(), QAbstractItemModel::LayoutChangeHint hint = QAbstractItemModel::NoLayoutChangeHint); inline void remove(QList<QItemSelectionRange> &r) { @@ -100,6 +100,8 @@ public: QItemSelectionModel::SelectionFlags currentCommand; QVector<QPersistentModelIndex> savedPersistentIndexes; QVector<QPersistentModelIndex> savedPersistentCurrentIndexes; + QVector<QPair<QPersistentModelIndex, uint> > savedPersistentRowLengths; + QVector<QPair<QPersistentModelIndex, uint> > savedPersistentCurrentRowLengths; // optimization when all indexes are selected bool tableSelected; QPersistentModelIndex tableParent; |