From c40ed6564e8cd0d58c19f099c1aee6b5f3bcbb69 Mon Sep 17 00:00:00 2001 From: Peter Penz Date: Tue, 17 Feb 2009 17:12:31 +0000 Subject: [PATCH] When the selection toggle is clicked and the mouse gets moved outside the selection toggle boundaries, a rubberband with a random start position will get visible. Bypass this issue by consuming the mouse-move events. BUG: 184178 svn path=/trunk/KDE/kdebase/apps/; revision=927488 --- src/selectiontoggle.cpp | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/src/selectiontoggle.cpp b/src/selectiontoggle.cpp index b9b79def0..01cfed0f3 100644 --- a/src/selectiontoggle.cpp +++ b/src/selectiontoggle.cpp @@ -89,9 +89,27 @@ void SelectionToggle::setVisible(bool visible) bool SelectionToggle::eventFilter(QObject* obj, QEvent* event) { - if ((obj == parent()) && (event->type() == QEvent::Leave)) { - hide(); + if (obj == parent()) { + switch (event->type()) { + case QEvent::Leave: + hide(); + break; + + case QEvent::MouseMove: + if (m_isHovered) { + // Don't forward mouse move events to the viewport, + // otherwise a rubberband selection will be shown when + // clicking on the selection toggle and moving the mouse + // above the viewport. + return true; + } + break; + + default: + break; + } } + return QAbstractButton::eventFilter(obj, event); } -- 2.47.3