From 0d3fdb718a86a352f8bf6ca9f537267133792916 Mon Sep 17 00:00:00 2001 From: "Aaron J. Seigo" Date: Wed, 7 Oct 2009 18:32:15 +0000 Subject: [PATCH] add a tooltip svn path=/trunk/KDE/kdelibs/; revision=1032393 --- private/desktoptoolbox.cpp | 22 ++++++++++++++++++++++ private/desktoptoolbox_p.h | 4 ++++ 2 files changed, 26 insertions(+) diff --git a/private/desktoptoolbox.cpp b/private/desktoptoolbox.cpp index 92a7eb11c..04c261a6a 100644 --- a/private/desktoptoolbox.cpp +++ b/private/desktoptoolbox.cpp @@ -36,6 +36,8 @@ #include #include +#include +#include #include namespace Plasma @@ -222,6 +224,7 @@ DesktopToolBox::DesktopToolBox(Containment *parent) connect(this, SIGNAL(toggled()), this, SLOT(toggle())); connect(Plasma::Theme::defaultTheme(), SIGNAL(themeChanged()), this, SLOT(updateTheming())); + ToolTipManager::self()->registerWidget(this); } DesktopToolBox::~DesktopToolBox() @@ -269,6 +272,25 @@ QSize DesktopToolBox::fullHeight() const return QSize(size() + left, size() + top + bottom + extraSpace); } +void DesktopToolBox::toolTipAboutToShow() +{ + if (isToolbar() || showing()) { + return; + } + + ToolTipContent c(i18n("Tool Box"), + i18n("Click to access configuration options and controls or to add more widget to the %1.", + containment()->name()), + KIcon("plasma")); + c.setAutohide(false); + ToolTipManager::self()->setContent(this, c); +} + +void DesktopToolBox::toolTipHidden() +{ + ToolTipManager::self()->clearContent(this); +} + QRectF DesktopToolBox::boundingRect() const { int extraSpace = size(); diff --git a/private/desktoptoolbox_p.h b/private/desktoptoolbox_p.h index 3ceca7c5d..4be3f0a83 100644 --- a/private/desktoptoolbox_p.h +++ b/private/desktoptoolbox_p.h @@ -55,6 +55,10 @@ public: QSize fullWidth() const; QSize fullHeight() const; +public Q_SLOTS: + void toolTipAboutToShow(); + void toolTipHidden(); + protected: void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget = 0); void hoverEnterEvent(QGraphicsSceneHoverEvent *event);