From 3cf1e3228205933224070543c96333fab21008c7 Mon Sep 17 00:00:00 2001 From: Davide Bettio Date: Wed, 7 Jul 2010 14:24:38 +0000 Subject: [PATCH] Fixes the year toolbutton hover bug in Plasma::Calendar. svn path=/trunk/KDE/kdelibs/; revision=1147175 --- widgets/toolbutton.cpp | 11 +++++++++++ widgets/toolbutton.h | 1 + 2 files changed, 12 insertions(+) diff --git a/widgets/toolbutton.cpp b/widgets/toolbutton.cpp index d58368d59..9dfcf4d08 100644 --- a/widgets/toolbutton.cpp +++ b/widgets/toolbutton.cpp @@ -445,6 +445,17 @@ void ToolButton::changeEvent(QEvent *event) QGraphicsProxyWidget::changeEvent(event); } +QVariant ToolButton::itemChange(GraphicsItemChange change, const QVariant &value) +{ + //If the widget is hidden while it's hovered and then we show it again + //we have to disable the hover otherwise it will remain hovered. + if (change == ItemVisibleHasChanged){ + d->underMouse = false; + } + + return QGraphicsProxyWidget::itemChange(change, value); +} + QSizeF ToolButton::sizeHint(Qt::SizeHint which, const QSizeF & constraint) const { QSizeF hint = QGraphicsProxyWidget::sizeHint(which, constraint); diff --git a/widgets/toolbutton.h b/widgets/toolbutton.h index 087da8034..6271f820a 100644 --- a/widgets/toolbutton.h +++ b/widgets/toolbutton.h @@ -183,6 +183,7 @@ protected: void hoverEnterEvent(QGraphicsSceneHoverEvent *event); void hoverLeaveEvent(QGraphicsSceneHoverEvent *event); void changeEvent(QEvent *event); + QVariant itemChange(GraphicsItemChange change, const QVariant &value); QSizeF sizeHint(Qt::SizeHint which, const QSizeF & constraint) const; private slots: