diff options
author | Samuel Gaist <samuel.gaist@idiap.ch> | 2018-11-15 00:13:59 +0100 |
---|---|---|
committer | Samuel Gaist <samuel.gaist@idiap.ch> | 2018-12-05 07:59:54 +0000 |
commit | 80ba7e03afe18cc44715f7cf9a038bedff01f328 (patch) | |
tree | 564040eab5382d326808eb3e2001c8dad81f161c /src/controls | |
parent | 50b6fb27458708a18f4114e3ebec0fa632b2659f (diff) | |
download | qtquickcontrols-80ba7e03afe18cc44715f7cf9a038bedff01f328.tar.gz |
QQuickTreeModelAdaptor1: fix out of range issue in selectionForRowRange
If the index of the "to" row is invalid and the one from the "from" row
is good, then the method will try to access an invalid index. This
patch fixes that by ensuring that if the "to" row is invalid (when, for
example, the mouse cursor goes out of the view while multiple selection
is activated), the "to" index used stays valid.
[ChangeLog][Controls][QQuickTreeModelAdaptor1] Fixed an issue where an
invalid access was done if either extended or multiple selection was
in use and the mouse went out of the view on top of the model.
Fixes: QTBUG-71789
Change-Id: I32d8a20ee9ffc1c40584f17c27ceb06d48b81ff0
Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
Diffstat (limited to 'src/controls')
-rw-r--r-- | src/controls/Private/qquicktreemodeladaptor.cpp | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/src/controls/Private/qquicktreemodeladaptor.cpp b/src/controls/Private/qquicktreemodeladaptor.cpp index 495abc9c..d2ed42b2 100644 --- a/src/controls/Private/qquicktreemodeladaptor.cpp +++ b/src/controls/Private/qquicktreemodeladaptor.cpp @@ -283,6 +283,8 @@ QItemSelection QQuickTreeModelAdaptor1::selectionForRowRange(const QModelIndex return QItemSelection(); return QItemSelection(toIndex, toIndex); } + + to = qMax(to, 0); if (from > to) qSwap(from, to); |