correctly emit appletRemoved

applet remove animation
At the moment is possible only to animate the disappearance of the background, the applet is immediately deleted.

how could be possible to animate the applet as well? (the graphic object should get to live more than Applet* and AppletScript* themselves)
This commit is contained in:
Marco Martin 2013-02-15 18:07:38 +01:00
parent 44b92bec42
commit a139247403
3 changed files with 22 additions and 1 deletions

View File

@ -534,7 +534,7 @@ void Containment::addApplet(Applet *applet, const QPointF &pos)
connect(applet, SIGNAL(configNeedsSaving()), this, SIGNAL(configNeedsSaving()));
connect(applet, SIGNAL(releaseVisualFocus()), this, SIGNAL(releaseVisualFocus()));
connect(applet, SIGNAL(appletDeleted(Plasma::Applet*)), this, SLOT(appletDestroyed(Plasma::Applet*)));
connect(applet, SIGNAL(appletDeleted(Plasma::Applet*)), this, SLOT(appletDeleted(Plasma::Applet*)));
connect(applet, SIGNAL(statusChanged(Plasma::ItemStatus)), this, SLOT(checkStatus(Plasma::ItemStatus)));
connect(applet, SIGNAL(activate()), this, SIGNAL(activate()));

View File

@ -172,6 +172,12 @@ void AppletPrivate::cleanUpAndDelete()
resetConfigurationObject();
if (isContainment) {
// prematurely emit our destruction if we are a Containment,
// giving Corona a chance to remove this Containment from its collection
emit q->QObject::destroyed(q);
}
q->deleteLater();
}

View File

@ -52,6 +52,11 @@ Item {
height: large + frame.margins.top + frame.margins.bottom
property alias applet: appletContainer.children
onAppletChanged: {
if (appletContainer.children.length == 0) {
killAnim.running = true
}
}
property int small: 90
property int large: 400
@ -102,6 +107,16 @@ Item {
running: visible
anchors.centerIn: parent
}
SequentialAnimation {
id: killAnim
NumberAnimation {
target: frame
properties: "scale"
to: 0
duration: 250
}
ScriptAction { script: frame.destroy()}
}
}
}