From 06e71be8c38102acc3467c680f1958aa6812f73e Mon Sep 17 00:00:00 2001 From: "Aaron J. Seigo" Date: Sun, 5 Oct 2008 17:48:44 +0000 Subject: [PATCH] we no longer need to check for spontaneity; move the trick up to Applet as well to avoid repaints where possible svn path=/trunk/KDE/kdebase/workspace/libs/plasma/; revision=868200 --- applet.cpp | 10 ++++++++++ applet.h | 18 ++++++++++++++---- containment.cpp | 20 -------------------- containment.h | 2 -- 4 files changed, 24 insertions(+), 26 deletions(-) diff --git a/applet.cpp b/applet.cpp index 829e3b127..fd76b95a9 100644 --- a/applet.cpp +++ b/applet.cpp @@ -1519,6 +1519,16 @@ QSizeF Applet::sizeHint(Qt::SizeHint which, const QSizeF & constraint) const return hint; } +void Applet::hoverEnterEvent(QGraphicsSceneHoverEvent *event) +{ + Q_UNUSED(event) +} + +void Applet::hoverLeaveEvent(QGraphicsSceneHoverEvent *event) +{ + Q_UNUSED(event) +} + void Applet::timerEvent(QTimerEvent *event) { if (d->transient) { diff --git a/applet.h b/applet.h index 1967520fd..4e9137410 100644 --- a/applet.h +++ b/applet.h @@ -783,11 +783,21 @@ class PLASMA_EXPORT Applet : public QGraphicsWidget /** * Reimplemented from QGraphicsLayoutItem */ - QSizeF sizeHint(Qt::SizeHint which, const QSizeF & constraint = QSizeF()) const; + QSizeF sizeHint(Qt::SizeHint which, const QSizeF & constraint = QSizeF()) const; - /** - * Reimplemented from QObject - */ + /** + * Reimplemented from QGraphicsLayoutItem + */ + void hoverEnterEvent(QGraphicsSceneHoverEvent *event); + + /** + * Reimplemented from QGraphicsLayoutItem + */ + void hoverLeaveEvent(QGraphicsSceneHoverEvent *event); + + /** + * Reimplemented from QObject + */ void timerEvent (QTimerEvent *event); private: diff --git a/containment.cpp b/containment.cpp index 9a60499ef..0b4696cd0 100644 --- a/containment.cpp +++ b/containment.cpp @@ -1006,26 +1006,6 @@ void Containment::resizeEvent(QGraphicsSceneResizeEvent *event) } } -void Containment::hoverEnterEvent(QGraphicsSceneHoverEvent *event) -{ - //FIXME Qt4.4 check to see if this is still necessary to avoid unnecessary repaints - // check with QT_FLUSH_PAINT=1 and mouse through applets that accept hover, - // applets that don't and system windows - if (event->spontaneous()) { - Applet::hoverEnterEvent(event); - } - Q_UNUSED(event) -} - -void Containment::hoverLeaveEvent(QGraphicsSceneHoverEvent *event) -{ - //FIXME Qt4.4 check to see if this is still necessary to avoid unnecessary repaints - // check with QT_FLUSH_PAINT=1 and mouse through applets that accept hover, - // applets that don't and system windows -// Applet::hoverLeaveEvent(event); - Q_UNUSED(event) -} - void Containment::keyPressEvent(QKeyEvent *event) { //kDebug() << "keyPressEvent with" << event->key() << "and hoping and wishing for a" << Qt::Key_Tab; diff --git a/containment.h b/containment.h index e1a7eadb2..756350545 100644 --- a/containment.h +++ b/containment.h @@ -461,8 +461,6 @@ class PLASMA_EXPORT Containment : public Applet void mousePressEvent(QGraphicsSceneMouseEvent *event); void mouseReleaseEvent(QGraphicsSceneMouseEvent *event); void contextMenuEvent(QGraphicsSceneContextMenuEvent *event); - void hoverEnterEvent(QGraphicsSceneHoverEvent *event); - void hoverLeaveEvent(QGraphicsSceneHoverEvent *event); void keyPressEvent(QKeyEvent *event); void wheelEvent(QGraphicsSceneWheelEvent *event); bool sceneEventFilter(QGraphicsItem *watched, QEvent *event);