]> cloud.milkyroute.net Git - dolphin.git/blobdiff - src/views/selectiontoggle.cpp
Move the FileMetaDataConfigurationDialog from "settings" to "panels/information"...
[dolphin.git] / src / views / selectiontoggle.cpp
index f5287a3dd7a2c05637f5669de31d61865696d7cc..c1272fa0f764385131dc65e1df264e4e8497adc0 100644 (file)
 #include <kiconeffect.h>
 #include <klocale.h>
 
+#include <QApplication>
 #include <QPainter>
 #include <QPaintEvent>
 #include <QRect>
 #include <QTimer>
 #include <QTimeLine>
 
+#include <kdebug.h>
+
 SelectionToggle::SelectionToggle(QWidget* parent) :
     QAbstractButton(parent),
     m_isHovered(false),
@@ -104,25 +107,12 @@ void SelectionToggle::setVisible(bool visible)
 
 bool SelectionToggle::eventFilter(QObject* obj, QEvent* event)
 {
-    if (obj == parent()) {
-        switch (event->type()) {
-        case QEvent::Leave:
-            hide();
-            break;
-
-        case QEvent::MouseMove:
-            if (m_leftMouseButtonPressed) {
-                // 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;
-        }
+    if ((obj == parent()) && (event->type() == QEvent::MouseMove) && m_leftMouseButtonPressed) {
+        // 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;
     }
 
     return QAbstractButton::eventFilter(obj, event);
@@ -147,6 +137,7 @@ void SelectionToggle::enterEvent(QEvent* event)
 void SelectionToggle::leaveEvent(QEvent* event)
 {
     QAbstractButton::leaveEvent(event);
+
     m_isHovered = false;
     update();
 }