alter the toolbox backer layout when the items change

BUG:224278

svn path=/trunk/KDE/kdelibs/; revision=1080323
This commit is contained in:
Aaron J. Seigo 2010-01-26 06:06:43 +00:00
parent f8e3b015f6
commit a56fc2ed44
3 changed files with 26 additions and 10 deletions

View File

@ -518,9 +518,31 @@ void DesktopToolBox::showToolBox()
}
d->toolBacker->setZValue(zValue() + 1);
d->toolBacker->clearLayout();
d->toolBacker->setIsToolbar(isToolbar());
adjustToolBackerGeometry();
d->toolBacker->setOpacity(0);
d->toolBacker->show();
Plasma::Animation *fadeAnim = Animator::create(Animator::FadeAnimation, d->toolBacker);
fadeAnim->setTargetWidget(d->toolBacker);
fadeAnim->setProperty("startOpacity", 0);
fadeAnim->setProperty("targetOpacity", 1);
fadeAnim->start(QAbstractAnimation::DeleteWhenStopped);
}
void DesktopToolBox::updateToolBox()
{
adjustToolBackerGeometry();
}
void DesktopToolBox::adjustToolBackerGeometry()
{
if (!d->toolBacker) {
return;
}
d->toolBacker->clearLayout();
QMap<ToolType, IconWidget *> t = tools();
QMapIterator<ToolType, IconWidget *> it(t);
while (it.hasNext()) {
@ -616,14 +638,6 @@ void DesktopToolBox::showToolBox()
d->toolBacker->setPos(x, mapFromParent(QPointF(0, parentSize.height() - 5 - backerRect.height())).y());
}
}
d->toolBacker->setOpacity(0);
d->toolBacker->show();
Plasma::Animation *fadeAnim = Animator::create(Animator::FadeAnimation, d->toolBacker);
fadeAnim->setTargetWidget(d->toolBacker);
fadeAnim->setProperty("startOpacity", 0);
fadeAnim->setProperty("targetOpacity", 1);
fadeAnim->start(QAbstractAnimation::DeleteWhenStopped);
}
void DesktopToolBox::hoverLeaveEvent(QGraphicsSceneHoverEvent *event)

View File

@ -61,6 +61,7 @@ public:
public Q_SLOTS:
void toolTipAboutToShow();
void toolTipHidden();
void updateToolBox();
protected:
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget = 0);
@ -79,6 +80,7 @@ protected Q_SLOTS:
void toggle();
private:
void highlight(bool highlighting);
void adjustToolBackerGeometry();
DesktopToolBoxPrivate *d;
};

View File

@ -99,7 +99,7 @@ public Q_SLOTS:
/**
* re-show the toolbox, in case any tools have changed
*/
void updateToolBox();
virtual void updateToolBox();
protected:
Containment *containment();