summaryrefslogtreecommitdiffstats
path: root/src/widgets/itemviews/qabstractitemview.cpp
diff options
context:
space:
mode:
authorVolker Hilsheimer <volker.hilsheimer@qt.io>2019-08-27 10:08:28 +0200
committerVolker Hilsheimer <volker.hilsheimer@qt.io>2019-08-29 09:52:10 +0200
commitd6551fe125209f11445936a90ce2a4207a183917 (patch)
tree02345e56887207f8578b7188d694698a95c1fbd5 /src/widgets/itemviews/qabstractitemview.cpp
parentc28b881c98fadcd3415370fad2525b558f6b03e4 (diff)
QTree/TableView: Don't emit clicked when releasing after double click
If an item is double clicked, then without this fix, the views emit the clicked() signal when the mousebutton is released after the double click event. This is unexpected and wrong. QAbstractItemView keeps track of the item the mouse was pressed on, to verify that the release occurred on the same item before emitting clicked, and to make sure we have a valid pressed item before initiating drag'n'drop. By resetting d->pressedItem when a double click has been handled, we can prevent the emission of a clicked signal in the next release event. [ChangeLog][QtWidgets][QTreeView] Don't emit clicked signal after a doubleClicked signal. Fixes: QTBUG-77771 Change-Id: I05988e9e2222157f4216cebc40c22507e8d83b82 Reviewed-by: André de la Rocha <andre.rocha@qt.io> Reviewed-by: Jesus Fernandez <jsfdez@gmail.com>
Diffstat (limited to 'src/widgets/itemviews/qabstractitemview.cpp')
-rw-r--r--src/widgets/itemviews/qabstractitemview.cpp1
1 files changed, 1 insertions, 0 deletions
diff --git a/src/widgets/itemviews/qabstractitemview.cpp b/src/widgets/itemviews/qabstractitemview.cpp
index 2ed5df46b8..089f398e71 100644
--- a/src/widgets/itemviews/qabstractitemview.cpp
+++ b/src/widgets/itemviews/qabstractitemview.cpp
@@ -1966,6 +1966,7 @@ void QAbstractItemView::mouseDoubleClickEvent(QMouseEvent *event)
if ((event->button() == Qt::LeftButton) && !edit(persistent, DoubleClicked, event)
&& !style()->styleHint(QStyle::SH_ItemView_ActivateItemOnSingleClick, 0, this))
emit activated(persistent);
+ d->pressedIndex = QModelIndex();
}
#if QT_CONFIG(draganddrop)