The previous "hover effect on drag" patch was buggy. Now we are using sceneEventFilter and it seems better.

svn path=/trunk/KDE/kdelibs/; revision=948792
This commit is contained in:
Davide Bettio 2009-04-03 19:57:13 +00:00
parent 1b49180a0c
commit 2f0da61660
2 changed files with 10 additions and 17 deletions

View File

@ -1186,23 +1186,17 @@ void IconWidget::hoverLeaveEvent(QGraphicsSceneHoverEvent *event)
QGraphicsWidget::hoverLeaveEvent(event); QGraphicsWidget::hoverLeaveEvent(event);
} }
bool IconWidget::sceneEventFilter(QGraphicsItem *watched, QEvent *event)
void IconWidget::dragEnterEvent(QGraphicsSceneDragDropEvent * event)
{ {
event->ignore(); if (event->type() == QEvent::GraphicsSceneDragEnter){
d->hoverEffect(true); d->hoverEffect(true);
update(); update();
}else if (event->type() == QEvent::GraphicsSceneDragLeave){
QGraphicsWidget::dragEnterEvent(event);
}
void IconWidget::dragLeaveEvent(QGraphicsSceneDragDropEvent * event)
{
// d->states &= ~IconWidgetPrivate::HoverState; // Will be set once progress is zero again ...
d->hoverEffect(false); d->hoverEffect(false);
update(); update();
}
QGraphicsWidget::dragLeaveEvent(event); return false;
} }
void IconWidget::setPressed(bool pressed) void IconWidget::setPressed(bool pressed)

View File

@ -283,8 +283,7 @@ protected:
void hoverEnterEvent(QGraphicsSceneHoverEvent *event); void hoverEnterEvent(QGraphicsSceneHoverEvent *event);
void hoverLeaveEvent(QGraphicsSceneHoverEvent *event); void hoverLeaveEvent(QGraphicsSceneHoverEvent *event);
void dragEnterEvent(QGraphicsSceneDragDropEvent *event); bool sceneEventFilter(QGraphicsItem *watched, QEvent *event);
void dragLeaveEvent(QGraphicsSceneDragDropEvent *event);
public: public:
/** /**