Details
-
Bug
-
Resolution: Done
-
P2: Important
-
4.8.5, 5.1.1
-
Windows 7
-
9c774b7621fdc99c03fad1b424b09b82057dc748 (dev, 17.7.2014, 5.4)
Description
To reproduce:
1. Add big amount (2000) of items to itemview
2. Select All
3. Change column sorting order pressing from header section
4. Try to resize column from header section
-> column is resized but with extreme long delay
Reason for the delay is investigated to the next lines:
/src/gui/itemviews/qitemselectionmodel.cpp
bool QItemSelectionModel::isColumnSelected(int column, const QModelIndex &parent) const { . . . // add ranges and currentSelection and check through them all QList<QItemSelectionRange>::const_iterator it; QList<QItemSelectionRange> joined = d->ranges; if (d->currentSelection.count()) joined += d->currentSelection; int rowCount = d->model->rowCount(parent); for (int row = 0; row < rowCount; ++row) { for (it = joined.constBegin(); it != joined.constEnd(); ++it) { if ((*it).contains(row, column, parent)) { Qt::ItemFlags flags = d->model->index(row, column, parent).flags(); if ((flags & Qt::ItemIsSelectable) && (flags & Qt::ItemIsEnabled)) { row = qMax(row, (*it).bottom()); break; } } } if (it == joined.constEnd()) return false; } return rowCount > 0; // no rows means no selected items }
Replacing above loop with the following code boosts up issue to invisible. But don't know side-effects if joined/range items are not checked.
for (int row = 0; row < rowCount; ++row) { Qt::ItemFlags flags = d->model->index(row, column, parent).flags(); if ((flags & Qt::ItemIsSelectable) && !(flags & Qt::ItemIsEnabled)) { return false; } }
Attached treewidgetdelay.zip contains full small application to reproduce the issue.
Attachments
For Gerrit Dashboard: QTBUG-33954 | ||||||
---|---|---|---|---|---|---|
# | Subject | Branch | Project | Status | CR | V |
89939,4 | QItemSelectionModel: Sort persistent model indexes taking parent into account. | dev | qt/qtbase | Status: MERGED | +2 | 0 |