smooth animation until the end ensuring the repaint is scheduled before
the delete by emitting the signal in the paint event and with a singleshot timer svn path=/trunk/KDE/kdebase/workspace/libs/plasma/; revision=863664
This commit is contained in:
parent
a90457d7a1
commit
2e8dba5df2
@ -224,6 +224,9 @@ void AppletHandle::paint(QPainter *painter, const QStyleOptionGraphicsItem *opti
|
|||||||
Q_UNUSED(widget);
|
Q_UNUSED(widget);
|
||||||
|
|
||||||
if (qFuzzyCompare(m_opacity + 1.0, 1.0)) {
|
if (qFuzzyCompare(m_opacity + 1.0, 1.0)) {
|
||||||
|
if (m_anim == FadeOut) {
|
||||||
|
QTimer::singleShot(0, this, SLOT(emitDisappear()));
|
||||||
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -379,6 +382,11 @@ void AppletHandle::paint(QPainter *painter, const QStyleOptionGraphicsItem *opti
|
|||||||
painter->restore();
|
painter->restore();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void AppletHandle::emitDisappear()
|
||||||
|
{
|
||||||
|
emit disappearDone(this);
|
||||||
|
}
|
||||||
|
|
||||||
AppletHandle::ButtonType AppletHandle::mapToButton(const QPointF &point) const
|
AppletHandle::ButtonType AppletHandle::mapToButton(const QPointF &point) const
|
||||||
{
|
{
|
||||||
int iconMargin = m_iconSize / 2;
|
int iconMargin = m_iconSize / 2;
|
||||||
@ -872,10 +880,6 @@ void AppletHandle::fadeAnimation(qreal progress)
|
|||||||
m_animId = 0;
|
m_animId = 0;
|
||||||
delete m_backgroundBuffer;
|
delete m_backgroundBuffer;
|
||||||
m_backgroundBuffer = 0;
|
m_backgroundBuffer = 0;
|
||||||
|
|
||||||
if (m_anim == FadeOut) {
|
|
||||||
emit disappearDone(this);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
update();
|
update();
|
||||||
|
@ -74,6 +74,7 @@ class AppletHandle : public QObject, public QGraphicsItem
|
|||||||
void appletResized();
|
void appletResized();
|
||||||
void fadeIn();
|
void fadeIn();
|
||||||
void leaveTimeout();
|
void leaveTimeout();
|
||||||
|
void emitDisappear();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
static const int HANDLE_MARGIN = 3;
|
static const int HANDLE_MARGIN = 3;
|
||||||
|
Loading…
Reference in New Issue
Block a user