diff options
author | Andy Shaw <andy.shaw@qt.io> | 2019-02-14 13:27:18 +0100 |
---|---|---|
committer | Andy Shaw <andy.shaw@qt.io> | 2019-02-26 14:18:18 +0000 |
commit | 7e60858cbc40b8958482ca2e77bed4fda69b161c (patch) | |
tree | 4b014069d18b53c6f4c27a192abfc5b6ed2224c0 /src/widgets/itemviews/qabstractitemview.cpp | |
parent | 9694d754b815abdf302aba26bd1eada5768adb97 (diff) |
Don't edit the item if we did not get the press event on the same item
With a QTreeView it is possible that collapsing an item can cause the
item under the mouse to be a new one and over the checkbox area for the
new item. As a result, a release can cause it to change the check state
even though it did not get the press for that item. This ensures that
it only allows the edit if it got the press as well.
Fixes: QTBUG-61476
Change-Id: I9a0821466afc84c97c9819755ccbacd729f7fbd7
Reviewed-by: Christian Ehrlicher <ch.ehrlicher@gmx.de>
Diffstat (limited to 'src/widgets/itemviews/qabstractitemview.cpp')
-rw-r--r-- | src/widgets/itemviews/qabstractitemview.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/widgets/itemviews/qabstractitemview.cpp b/src/widgets/itemviews/qabstractitemview.cpp index 02eae33a12..e1e45143b4 100644 --- a/src/widgets/itemviews/qabstractitemview.cpp +++ b/src/widgets/itemviews/qabstractitemview.cpp @@ -1912,7 +1912,7 @@ void QAbstractItemView::mouseReleaseEvent(QMouseEvent *event) bool click = (index == d->pressedIndex && index.isValid()); bool selectedClicked = click && (event->button() == Qt::LeftButton) && d->pressedAlreadySelected; EditTrigger trigger = (selectedClicked ? SelectedClicked : NoEditTriggers); - bool edited = edit(index, trigger, event); + const bool edited = click ? edit(index, trigger, event) : false; d->ctrlDragSelectionFlag = QItemSelectionModel::NoUpdate; |