diff options
author | A-Team <ateam@pad.test.qt.nokia.com> | 2010-10-21 22:00:10 (GMT) |
---|---|---|
committer | A-Team <ateam@pad.test.qt.nokia.com> | 2010-10-21 22:00:10 (GMT) |
commit | 215f46d0a61a2f48d1ccbbc52c3b161fa36c84ec (patch) | |
tree | 77e8cfce5c765702e5f60daf123d2740c1879d1c /src/gui | |
parent | dd97db856bc19d648d7faa3aac4e27576dcb2512 (diff) | |
parent | be6a0b58680213da42d956ed9d1c77103be24c93 (diff) | |
download | Qt-215f46d0a61a2f48d1ccbbc52c3b161fa36c84ec.zip Qt-215f46d0a61a2f48d1ccbbc52c3b161fa36c84ec.tar.gz Qt-215f46d0a61a2f48d1ccbbc52c3b161fa36c84ec.tar.bz2 |
Merge branch '4.7-upstream' into 4.7-doc
Diffstat (limited to 'src/gui')
-rw-r--r-- | src/gui/itemviews/qitemselectionmodel.cpp | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/src/gui/itemviews/qitemselectionmodel.cpp b/src/gui/itemviews/qitemselectionmodel.cpp index f848321..e69cd65 100644 --- a/src/gui/itemviews/qitemselectionmodel.cpp +++ b/src/gui/itemviews/qitemselectionmodel.cpp @@ -1059,6 +1059,19 @@ void QItemSelectionModel::select(const QItemSelection &selection, QItemSelection // store old selection QItemSelection sel = selection; + // If d->ranges is non-empty when the source model is reset the persistent indexes + // it contains will be invalid. We can't clear them in a modelReset slot because that might already + // be too late if another model observer is connected to the same modelReset slot and is invoked first + // it might call select() on this selection model before any such QItemSelectionModelPrivate::_q_modelReset() slot + // is invoked, so it would not be cleared yet. We clear it invalid ranges in it here. + QItemSelection::iterator it = d->ranges.begin(); + while (it != d->ranges.end()) { + if (!it->isValid()) + it = d->ranges.erase(it); + else + ++it; + } + QItemSelection old = d->ranges; old.merge(d->currentSelection, d->currentCommand); |