add a tooltip

svn path=/trunk/KDE/kdelibs/; revision=1032393
This commit is contained in:
Aaron J. Seigo 2009-10-07 18:32:15 +00:00
parent 3037b9823d
commit 0d3fdb718a
2 changed files with 26 additions and 0 deletions

View File

@ -36,6 +36,8 @@
#include <plasma/applet.h>
#include <plasma/containment.h>
#include <plasma/tooltipcontent.h>
#include <plasma/tooltipmanager.h>
#include <plasma/widgets/iconwidget.h>
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();

View File

@ -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);