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

View File

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