some small tweaks to the desktop toolbox to make it work with the cashew-triggers-dashboard change

svn path=/trunk/KDE/kdelibs/; revision=917728
This commit is contained in:
Aaron J. Seigo 2009-01-28 13:38:57 +00:00
parent b0d610d38f
commit ff2402b48b
4 changed files with 16 additions and 2 deletions

View File

@ -206,6 +206,11 @@ void DesktopToolBox::assignColors()
d->fgColor = Plasma::Theme::defaultTheme()->color(Plasma::Theme::TextColor); d->fgColor = Plasma::Theme::defaultTheme()->color(Plasma::Theme::TextColor);
} }
void DesktopToolBox::toolTriggered(bool)
{
hideToolBox();
}
void DesktopToolBox::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) void DesktopToolBox::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget)
{ {
Q_UNUSED(option) Q_UNUSED(option)
@ -552,12 +557,11 @@ void DesktopToolBox::hoverLeaveEvent(QGraphicsSceneHoverEvent *event)
{ {
//kDebug() << event->pos() << event->scenePos() //kDebug() << event->pos() << event->scenePos()
// << d->toolBacker->rect().contains(event->scenePos().toPoint()); // << d->toolBacker->rect().contains(event->scenePos().toPoint());
if (!d->hovering || isToolbar()) { if (!d->hovering || showing() || isToolbar()) {
QGraphicsItem::hoverLeaveEvent(event); QGraphicsItem::hoverLeaveEvent(event);
return; return;
} }
hideToolBox();
Plasma::Animator *animdriver = Plasma::Animator::self(); Plasma::Animator *animdriver = Plasma::Animator::self();
if (d->animHighlightId) { if (d->animHighlightId) {
animdriver->stopCustomAnimation(d->animHighlightId); animdriver->stopCustomAnimation(d->animHighlightId);

View File

@ -60,6 +60,7 @@ protected slots:
void animateHighlight(qreal progress); void animateHighlight(qreal progress);
void toolMoved(QGraphicsItem*); void toolMoved(QGraphicsItem*);
void assignColors(); void assignColors();
void toolTriggered(bool);
/** /**
* show/hide the toolbox * show/hide the toolbox
*/ */

View File

@ -125,6 +125,7 @@ void ToolBox::addTool(QAction *action)
//make enabled/disabled tools appear/disappear instantly //make enabled/disabled tools appear/disappear instantly
connect(tool, SIGNAL(changed()), this, SLOT(updateToolBox())); connect(tool, SIGNAL(changed()), this, SLOT(updateToolBox()));
connect(tool, SIGNAL(triggered(bool)), this, SLOT(toolTriggered(bool)));
//kDebug() << "added tool" << action->text() << (QGraphicsItem*)tool; //kDebug() << "added tool" << action->text() << (QGraphicsItem*)tool;
} }
@ -138,6 +139,10 @@ void ToolBox::updateToolBox()
} }
} }
void ToolBox::toolTriggered(bool)
{
}
void ToolBox::removeTool(QAction *action) void ToolBox::removeTool(QAction *action)
{ {
foreach (QGraphicsItem *child, QGraphicsItem::children()) { foreach (QGraphicsItem *child, QGraphicsItem::children()) {

View File

@ -97,6 +97,7 @@ public Q_SLOTS:
* re-show the toolbox, in case any tools have changed * re-show the toolbox, in case any tools have changed
*/ */
void updateToolBox(); void updateToolBox();
Q_SIGNALS: Q_SIGNALS:
void toggled(); void toggled();
@ -106,6 +107,9 @@ protected:
void mouseMoveEvent(QGraphicsSceneMouseEvent *event); void mouseMoveEvent(QGraphicsSceneMouseEvent *event);
void mouseReleaseEvent(QGraphicsSceneMouseEvent *event); void mouseReleaseEvent(QGraphicsSceneMouseEvent *event);
protected Q_SLOTS:
virtual void toolTriggered(bool);
private: private:
ToolBoxPrivate *d; ToolBoxPrivate *d;
}; };