don't fade out when we're toggled until we closed
svn path=/trunk/KDE/kdebase/workspace/libs/plasma/; revision=828087
This commit is contained in:
parent
6f06fd2590
commit
b9419d74bb
|
@ -83,7 +83,8 @@ public:
|
||||||
: icon("plasma"),
|
: icon("plasma"),
|
||||||
toolBacker(0),
|
toolBacker(0),
|
||||||
animId(0),
|
animId(0),
|
||||||
animFrame(0)
|
animFrame(0),
|
||||||
|
toggled(false)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
KIcon icon;
|
KIcon icon;
|
||||||
|
@ -91,6 +92,7 @@ public:
|
||||||
QTime stopwatch;
|
QTime stopwatch;
|
||||||
int animId;
|
int animId;
|
||||||
qreal animFrame;
|
qreal animFrame;
|
||||||
|
bool toggled;
|
||||||
};
|
};
|
||||||
|
|
||||||
PanelToolBox::PanelToolBox(QGraphicsItem *parent)
|
PanelToolBox::PanelToolBox(QGraphicsItem *parent)
|
||||||
|
@ -98,6 +100,7 @@ PanelToolBox::PanelToolBox(QGraphicsItem *parent)
|
||||||
d(new PanelToolBoxPrivate)
|
d(new PanelToolBoxPrivate)
|
||||||
{
|
{
|
||||||
connect(Plasma::Animator::self(), SIGNAL(movementFinished(QGraphicsItem*)), this, SLOT(toolMoved(QGraphicsItem*)));
|
connect(Plasma::Animator::self(), SIGNAL(movementFinished(QGraphicsItem*)), this, SLOT(toolMoved(QGraphicsItem*)));
|
||||||
|
connect(this, SIGNAL(toggled()), this, SLOT(toggle()));
|
||||||
|
|
||||||
setZValue(10000000);
|
setZValue(10000000);
|
||||||
setFlag(ItemClipsToShape, true);
|
setFlag(ItemClipsToShape, true);
|
||||||
|
@ -276,10 +279,11 @@ void PanelToolBox::hoverLeaveEvent(QGraphicsSceneHoverEvent *event)
|
||||||
{
|
{
|
||||||
//kDebug() << event->pos() << event->scenePos() << d->toolBacker->rect().contains(event->scenePos().toPoint());
|
//kDebug() << event->pos() << event->scenePos() << d->toolBacker->rect().contains(event->scenePos().toPoint());
|
||||||
if ((d->toolBacker && d->toolBacker->rect().contains(event->scenePos().toPoint())) ||
|
if ((d->toolBacker && d->toolBacker->rect().contains(event->scenePos().toPoint())) ||
|
||||||
d->stopwatch.elapsed() < 100) {
|
d->stopwatch.elapsed() < 100 || d->toggled) {
|
||||||
QGraphicsItem::hoverLeaveEvent(event);
|
QGraphicsItem::hoverLeaveEvent(event);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
hideToolBox();
|
hideToolBox();
|
||||||
QGraphicsItem::hoverLeaveEvent(event);
|
QGraphicsItem::hoverLeaveEvent(event);
|
||||||
}
|
}
|
||||||
|
@ -290,6 +294,7 @@ void PanelToolBox::hideToolBox()
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
d->toggled = false;
|
||||||
int x = size() * 2;
|
int x = size() * 2;
|
||||||
int y = 0;
|
int y = 0;
|
||||||
Plasma::Animator* animdriver = Plasma::Animator::self();
|
Plasma::Animator* animdriver = Plasma::Animator::self();
|
||||||
|
@ -342,6 +347,14 @@ void PanelToolBox::toolMoved(QGraphicsItem *item)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void PanelToolBox::toggle()
|
||||||
|
{
|
||||||
|
d->toggled = !d->toggled;
|
||||||
|
if (showing() && !d->toggled) {
|
||||||
|
hideToolBox();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
} // plasma namespace
|
} // plasma namespace
|
||||||
|
|
||||||
#include "paneltoolbox_p.moc"
|
#include "paneltoolbox_p.moc"
|
||||||
|
|
|
@ -59,6 +59,8 @@ protected:
|
||||||
protected slots:
|
protected slots:
|
||||||
void animate(qreal progress);
|
void animate(qreal progress);
|
||||||
void toolMoved(QGraphicsItem*);
|
void toolMoved(QGraphicsItem*);
|
||||||
|
void toggle();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
PanelToolBoxPrivate *d;
|
PanelToolBoxPrivate *d;
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue
Block a user