Use a QVector to store QPersistentModelIndexes.
QPersistentModelIndex is not so big that it causes very bad QList performance, but considering how we use the container, QVector is fine. We never prepend to the container, we only ever append, clear and iterate over it. Change-Id: If1e53db9252c22340f1e0179b14a460495b5b35d Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
This commit is contained in:
parent
edec823c00
commit
978d3d01cf
@ -459,9 +459,9 @@ QModelIndexList QItemSelection::indexes() const
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
static QList<QPersistentModelIndex> qSelectionPersistentindexes(const QItemSelection &sel)
|
static QVector<QPersistentModelIndex> qSelectionPersistentindexes(const QItemSelection &sel)
|
||||||
{
|
{
|
||||||
QList<QPersistentModelIndex> result;
|
QVector<QPersistentModelIndex> result;
|
||||||
QList<QItemSelectionRange>::const_iterator it = sel.constBegin();
|
QList<QItemSelectionRange>::const_iterator it = sel.constBegin();
|
||||||
for (; it != sel.constEnd(); ++it)
|
for (; it != sel.constEnd(); ++it)
|
||||||
indexesFromRange(*it, result);
|
indexesFromRange(*it, result);
|
||||||
@ -846,7 +846,7 @@ void QItemSelectionModelPrivate::_q_layoutAboutToBeChanged()
|
|||||||
Merges \a indexes into an item selection made up of ranges.
|
Merges \a indexes into an item selection made up of ranges.
|
||||||
Assumes that the indexes are sorted.
|
Assumes that the indexes are sorted.
|
||||||
*/
|
*/
|
||||||
static QItemSelection mergeIndexes(const QList<QPersistentModelIndex> &indexes)
|
static QItemSelection mergeIndexes(const QVector<QPersistentModelIndex> &indexes)
|
||||||
{
|
{
|
||||||
QItemSelection colSpans;
|
QItemSelection colSpans;
|
||||||
// merge columns
|
// merge columns
|
||||||
|
@ -98,8 +98,8 @@ public:
|
|||||||
QItemSelection currentSelection;
|
QItemSelection currentSelection;
|
||||||
QPersistentModelIndex currentIndex;
|
QPersistentModelIndex currentIndex;
|
||||||
QItemSelectionModel::SelectionFlags currentCommand;
|
QItemSelectionModel::SelectionFlags currentCommand;
|
||||||
QList<QPersistentModelIndex> savedPersistentIndexes;
|
QVector<QPersistentModelIndex> savedPersistentIndexes;
|
||||||
QList<QPersistentModelIndex> savedPersistentCurrentIndexes;
|
QVector<QPersistentModelIndex> savedPersistentCurrentIndexes;
|
||||||
// optimization when all indexes are selected
|
// optimization when all indexes are selected
|
||||||
bool tableSelected;
|
bool tableSelected;
|
||||||
QPersistentModelIndex tableParent;
|
QPersistentModelIndex tableParent;
|
||||||
|
Loading…
Reference in New Issue
Block a user