summaryrefslogtreecommitdiffstats
path: root/src/gui/itemviews/qabstractproxymodel.cpp
diff options
context:
space:
mode:
authorQt Continuous Integration System <qt-info@nokia.com>2010-09-15 22:08:44 (GMT)
committerQt Continuous Integration System <qt-info@nokia.com>2010-09-15 22:08:44 (GMT)
commit43f13b2deed1dc3797dec58b46957714ff635f66 (patch)
treecb588ed2ac1c9c00ae5129adc6f996f628514b9d /src/gui/itemviews/qabstractproxymodel.cpp
parentab31c1a482630007eccd532b49e03f0345421aa8 (diff)
parentf23bce37a8a3536bfedce7cc2d57f0761b2d1e31 (diff)
downloadQt-43f13b2deed1dc3797dec58b46957714ff635f66.zip
Qt-43f13b2deed1dc3797dec58b46957714ff635f66.tar.gz
Qt-43f13b2deed1dc3797dec58b46957714ff635f66.tar.bz2
Merge branch '4.7' of scm.dev.nokia.troll.no:qt/oslo-staging-2 into 4.7-integration
* '4.7' of scm.dev.nokia.troll.no:qt/oslo-staging-2: Doc: Further QML improvements. Doc: Minor improvements to QML-related documentation. The test livelock of QTimer is now expected to work Make sure mapSelectionFromSource does not return a selection with invalid ranges. QEventDispatcherUnix: do not process too many timer if other events need to be processed first Doc: Continued work on the QML documentation. Doc: More work on the QML documentation. Doc: More work on the declarative API documentation. Doc: Some editing and tidying up. Doc: Added a missing file. Doc: Fixed text in license headers.
Diffstat (limited to 'src/gui/itemviews/qabstractproxymodel.cpp')
-rw-r--r--src/gui/itemviews/qabstractproxymodel.cpp16
1 files changed, 12 insertions, 4 deletions
diff --git a/src/gui/itemviews/qabstractproxymodel.cpp b/src/gui/itemviews/qabstractproxymodel.cpp
index 43a1327..1c600e2 100644
--- a/src/gui/itemviews/qabstractproxymodel.cpp
+++ b/src/gui/itemviews/qabstractproxymodel.cpp
@@ -187,8 +187,12 @@ QItemSelection QAbstractProxyModel::mapSelectionToSource(const QItemSelection &p
{
QModelIndexList proxyIndexes = proxySelection.indexes();
QItemSelection sourceSelection;
- for (int i = 0; i < proxyIndexes.size(); ++i)
- sourceSelection << QItemSelectionRange(mapToSource(proxyIndexes.at(i)));
+ for (int i = 0; i < proxyIndexes.size(); ++i) {
+ const QModelIndex proxyIdx = mapToSource(proxyIndexes.at(i));
+ if (!proxyIdx.isValid())
+ continue;
+ sourceSelection << QItemSelectionRange(proxyIdx);
+ }
return sourceSelection;
}
@@ -201,8 +205,12 @@ QItemSelection QAbstractProxyModel::mapSelectionFromSource(const QItemSelection
{
QModelIndexList sourceIndexes = sourceSelection.indexes();
QItemSelection proxySelection;
- for (int i = 0; i < sourceIndexes.size(); ++i)
- proxySelection << QItemSelectionRange(mapFromSource(sourceIndexes.at(i)));
+ for (int i = 0; i < sourceIndexes.size(); ++i) {
+ const QModelIndex srcIdx = mapFromSource(sourceIndexes.at(i));
+ if (!srcIdx.isValid())
+ continue;
+ proxySelection << QItemSelectionRange(srcIdx);
+ }
return proxySelection;
}