]> cloud.milkyroute.net Git - dolphin.git/commitdiff
The latest fix still had the same problem when dragging went out of the viewport...
authorRafael Fernández López <ereslibre@kde.org>
Sun, 16 Dec 2007 02:14:15 +0000 (02:14 +0000)
committerRafael Fernández López <ereslibre@kde.org>
Sun, 16 Dec 2007 02:14:15 +0000 (02:14 +0000)
flag. This completely fixes the problem for all cases, the problem was the hovered cached index being updated at indexAt() method used for general purposes. Now it is
updated on the MouseMove method, and this gives consistence.

CCMAIL: peter.penz@gmx.at

svn path=/trunk/KDE/kdebase/apps/; revision=748970

src/kcategorizedview.cpp

index d612f4b1c0597635730788098deb56a0d04fbbcb..42ee7b1adc36c77d110816b8bded0f49e57f165d 100644 (file)
@@ -662,8 +662,6 @@ QModelIndex KCategorizedView::indexAt(const QPoint &point) const
         index = item[0];
     }
 
-    d->hovered = index;
-
     return index;
 }
 
@@ -744,7 +742,10 @@ void KCategorizedView::paintEvent(QPaintEvent *event)
                 option.state |= QStyle::State_Editing;
         }
 
-        if ((index == d->hovered) && !d->mouseButtonPressed && (this->state() != QAbstractItemView::DraggingState))
+        // we are only interested to give the mouse over feedback when no
+        // dragging is happening (ereslibre)
+        if ((index == d->hovered) && !d->mouseButtonPressed &&
+            (this->state() == QAbstractItemView::NoState))
             option.state |= QStyle::State_MouseOver;
         else
             option.state &= ~QStyle::State_MouseOver;
@@ -986,6 +987,17 @@ void KCategorizedView::mouseMoveEvent(QMouseEvent *event)
         return;
     }
 
+    QModelIndexList item = d->intersectionSet(QRect(event->pos(), event->pos()));
+
+    if (item.count() == 1)
+    {
+        d->hovered = item[0];
+    }
+    else
+    {
+        d->hovered = QModelIndex();
+    }
+
     const QString previousHoveredCategory = d->hoveredCategory;
 
     d->mousePosition = event->pos();