alter the toolbox backer layout when the items change
CCBUG:224278 svn path=/branches/KDE/4.4/kdelibs/; revision=1080325
This commit is contained in:
parent
88216206bb
commit
635aba8ddf
@ -523,9 +523,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()) {
|
||||
@ -621,14 +643,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)
|
||||
|
@ -60,6 +60,7 @@ public:
|
||||
public Q_SLOTS:
|
||||
void toolTipAboutToShow();
|
||||
void toolTipHidden();
|
||||
void updateToolBox();
|
||||
|
||||
protected:
|
||||
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget = 0);
|
||||
@ -76,6 +77,7 @@ protected Q_SLOTS:
|
||||
*/
|
||||
void toggle();
|
||||
private:
|
||||
void adjustToolBackerGeometry();
|
||||
DesktopToolBoxPrivate *d;
|
||||
};
|
||||
|
||||
|
@ -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();
|
||||
|
Loading…
Reference in New Issue
Block a user