From 4ec169a60f9270a9ba673857de90e3b38ac94e7c Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Mon, 6 Aug 2012 17:20:35 +0200 Subject: [PATCH] Use == for button flag test instead of & QMouseEvent::button() returns Qt::MouseButton, not Qt::MouseButtons. Change-Id: Ib5dc5b3998ed8f442c72e26d1aff62bc4ebcff71 Reviewed-by: Marc Mutz Reviewed-by: Olivier Goffart --- src/widgets/itemviews/qabstractitemview.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/widgets/itemviews/qabstractitemview.cpp b/src/widgets/itemviews/qabstractitemview.cpp index ebfe20c..40aa429 100644 --- a/src/widgets/itemviews/qabstractitemview.cpp +++ b/src/widgets/itemviews/qabstractitemview.cpp @@ -1845,7 +1845,7 @@ void QAbstractItemView::mouseReleaseEvent(QMouseEvent *event) } bool click = (index == d->pressedIndex && index.isValid()); - bool selectedClicked = click && (event->button() & Qt::LeftButton) && d->pressedAlreadySelected; + bool selectedClicked = click && (event->button() == Qt::LeftButton) && d->pressedAlreadySelected; EditTrigger trigger = (selectedClicked ? SelectedClicked : NoEditTriggers); bool edited = edit(index, trigger, event); @@ -1892,7 +1892,7 @@ void QAbstractItemView::mouseDoubleClickEvent(QMouseEvent *event) // signal handlers may change the model QPersistentModelIndex persistent = index; emit doubleClicked(persistent); - if ((event->button() & Qt::LeftButton) && !edit(persistent, DoubleClicked, event) + if ((event->button() == Qt::LeftButton) && !edit(persistent, DoubleClicked, event) && !style()->styleHint(QStyle::SH_ItemView_ActivateItemOnSingleClick, 0, this)) emit activated(persistent); } -- 2.7.4