summaryrefslogtreecommitdiffstats
path: root/src/gui/itemviews
diff options
context:
space:
mode:
authorA-Team <ateam@pad.test.qt.nokia.com>2010-09-16 22:00:18 (GMT)
committerA-Team <ateam@pad.test.qt.nokia.com>2010-09-16 22:00:18 (GMT)
commit0f71215693713fef4fd9dabeae8e6a574deff415 (patch)
tree27d8a11e29f87813df5cbb644389cbfdfebc1abb /src/gui/itemviews
parentacab3259e9f57e436f475b4c0d1d7e7fb194e983 (diff)
parentfc007d0a99cc52e673c5d2606e5076831f6103b1 (diff)
downloadQt-0f71215693713fef4fd9dabeae8e6a574deff415.zip
Qt-0f71215693713fef4fd9dabeae8e6a574deff415.tar.gz
Qt-0f71215693713fef4fd9dabeae8e6a574deff415.tar.bz2
Merge branch '4.7-upstream' into 4.7-doc
Diffstat (limited to 'src/gui/itemviews')
-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;
}