From 20733306925ec5556ae57b247e7d14238c3cf4c0 Mon Sep 17 00:00:00 2001 From: "Aaron J. Seigo" Date: Tue, 8 Jan 2008 00:41:53 +0000 Subject: [PATCH] * remove unneeded members (like a copy of the icon) * don't re-do math we've already done (progress var) * go from disable dto enabled, after all that is exactly what's happening: when you mouse over it becomes active. now that the items don't overlap the icon this works out nicely; it also makes the toolbox less LOUD and in your face when not in use svn path=/trunk/KDE/kdebase/workspace/libs/plasma/; revision=758486 --- desktoptoolbox.cpp | 15 ++++++--------- desktoptoolbox_p.h | 1 - 2 files changed, 6 insertions(+), 10 deletions(-) diff --git a/desktoptoolbox.cpp b/desktoptoolbox.cpp index 22a597b77..d419e52d7 100644 --- a/desktoptoolbox.cpp +++ b/desktoptoolbox.cpp @@ -39,7 +39,6 @@ static const int ToolName = 7001; DesktopToolbox::DesktopToolbox(QGraphicsItem *parent) : QGraphicsItem(parent), m_icon("plasma"), - m_iconSelected("plasma"), m_size(50), m_showing(false), m_animId(0), @@ -94,13 +93,13 @@ void DesktopToolbox::paint(QPainter *painter, const QStyleOptionGraphicsItem *op const qreal progress = m_animFrame / m_size; if (progress > 0.1) { - m_iconSelected.paint(painter, QRect(m_size*2 - 34, 2, 32, 32), Qt::AlignCenter, QIcon::Disabled, QIcon::Off); - } - - if (progress < 0.95) { - painter->save(); - painter->setOpacity(1.0 - m_animFrame / m_size); m_icon.paint(painter, QRect(m_size*2 - 34, 2, 32, 32)); + } + + if (progress <= 0.9) { + painter->save(); + painter->setOpacity(1 - progress); + m_icon.paint(painter, QRect(m_size*2 - 34, 2, 32, 32), Qt::AlignCenter, QIcon::Disabled, QIcon::Off); painter->restore(); } } @@ -116,7 +115,6 @@ QPainterPath DesktopToolbox::shape() const void DesktopToolbox::hoverEnterEvent(QGraphicsSceneHoverEvent *event) { -// Plasma::Phase::self()->moveItem(this, Phase::SlideIn, QPoint(-25, -25)); int maxwidth = 0; foreach (QGraphicsItem* tool, QGraphicsItem::children()) { if (!tool->isEnabled()) { @@ -155,7 +153,6 @@ void DesktopToolbox::hoverEnterEvent(QGraphicsSceneHoverEvent *event) void DesktopToolbox::hoverLeaveEvent(QGraphicsSceneHoverEvent *event) { -// Plasma::Phase::self->moveItem(this, Phase::SlideOut, boundingRect()QPoint(-50, -50)); int x = m_size*2; int y = 0; Plasma::Phase* phase = Plasma::Phase::self(); diff --git a/desktoptoolbox_p.h b/desktoptoolbox_p.h index 5f57a6bb6..e40c5a599 100644 --- a/desktoptoolbox_p.h +++ b/desktoptoolbox_p.h @@ -57,7 +57,6 @@ protected slots: private: KIcon m_icon; - KIcon m_iconSelected; int m_size; bool m_hidden; bool m_showing;