add a tooltip to the panel toolbox. hooray for discoverability.

svn path=/trunk/KDE/kdelibs/; revision=1032380
This commit is contained in:
Aaron J. Seigo 2009-10-07 17:11:03 +00:00
parent 4fc13d171a
commit f55ece10b0
2 changed files with 28 additions and 1 deletions

View File

@ -30,8 +30,10 @@
#include <plasma/applet.h>
#include <plasma/paintutils.h>
#include <plasma/theme.h>
#include <plasma/svg.h>
#include <plasma/theme.h>
#include <plasma/tooltipcontent.h>
#include <plasma/tooltipmanager.h>
namespace Plasma
{
@ -75,6 +77,8 @@ PanelToolBox::PanelToolBox(Containment *parent)
d->background = new Plasma::Svg(this);
d->background->setImagePath("widgets/toolbox");
d->background->setContainsMultipleImages(true);
ToolTipManager::self()->registerWidget(this);
}
PanelToolBox::~PanelToolBox()
@ -236,6 +240,25 @@ void PanelToolBox::hideToolBox()
highlight(false);
}
void PanelToolBox::toolTipAboutToShow()
{
if (showing()) {
return;
}
ToolTipContent c(i18n("Panel Tool Box"),
i18n("Click to access size, location and hiding controls as well as to add "
"new widgets to the panel."),
KIcon("plasma"));
c.setAutohide(false);
ToolTipManager::self()->setContent(this, c);
}
void PanelToolBox::toolTipHidden()
{
ToolTipManager::self()->clearContent(this);
}
void PanelToolBox::highlight(bool highlighting)
{
if (d->highlighting == highlighting) {

View File

@ -51,6 +51,10 @@ public:
void showToolBox();
void hideToolBox();
public Q_SLOTS:
void toolTipAboutToShow();
void toolTipHidden();
protected:
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget = 0);
void hoverEnterEvent(QGraphicsSceneHoverEvent *event);