From 7e60858cbc40b8958482ca2e77bed4fda69b161c Mon Sep 17 00:00:00 2001 From: Andy Shaw Date: Thu, 14 Feb 2019 13:27:18 +0100 Subject: 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 --- src/widgets/itemviews/qabstractitemview.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/widgets/itemviews/qabstractitemview.cpp') 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; -- cgit v1.2.3