alter the toolbox backer layout when the items change
BUG:224278 svn path=/trunk/KDE/kdelibs/; revision=1080323
This commit is contained in:
parent
f8e3b015f6
commit
a56fc2ed44
@ -518,9 +518,31 @@ void DesktopToolBox::showToolBox()
|
|||||||
}
|
}
|
||||||
|
|
||||||
d->toolBacker->setZValue(zValue() + 1);
|
d->toolBacker->setZValue(zValue() + 1);
|
||||||
d->toolBacker->clearLayout();
|
|
||||||
d->toolBacker->setIsToolbar(isToolbar());
|
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();
|
QMap<ToolType, IconWidget *> t = tools();
|
||||||
QMapIterator<ToolType, IconWidget *> it(t);
|
QMapIterator<ToolType, IconWidget *> it(t);
|
||||||
while (it.hasNext()) {
|
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->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)
|
void DesktopToolBox::hoverLeaveEvent(QGraphicsSceneHoverEvent *event)
|
||||||
|
@ -61,6 +61,7 @@ public:
|
|||||||
public Q_SLOTS:
|
public Q_SLOTS:
|
||||||
void toolTipAboutToShow();
|
void toolTipAboutToShow();
|
||||||
void toolTipHidden();
|
void toolTipHidden();
|
||||||
|
void updateToolBox();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget = 0);
|
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget = 0);
|
||||||
@ -79,6 +80,7 @@ protected Q_SLOTS:
|
|||||||
void toggle();
|
void toggle();
|
||||||
private:
|
private:
|
||||||
void highlight(bool highlighting);
|
void highlight(bool highlighting);
|
||||||
|
void adjustToolBackerGeometry();
|
||||||
DesktopToolBoxPrivate *d;
|
DesktopToolBoxPrivate *d;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -99,7 +99,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();
|
virtual void updateToolBox();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
Containment *containment();
|
Containment *containment();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user