summaryrefslogtreecommitdiffstats
path: root/src/declarative
diff options
context:
space:
mode:
authorAaron Kennedy <aaron.kennedy@nokia.com>2009-10-07 07:43:07 (GMT)
committerAaron Kennedy <aaron.kennedy@nokia.com>2009-10-07 07:43:07 (GMT)
commit26fc680ab4344d1c14756459ab92c0413aebf99c (patch)
treec0eb9cea4e079484a5eb5a0ba1f7db0f3e17e15a /src/declarative
parentc164ba0b9486e0a559ed4daa076416cd9f81962f (diff)
downloadQt-26fc680ab4344d1c14756459ab92c0413aebf99c.zip
Qt-26fc680ab4344d1c14756459ab92c0413aebf99c.tar.gz
Qt-26fc680ab4344d1c14756459ab92c0413aebf99c.tar.bz2
Add Object.destroy(int delay) parameter
Diffstat (limited to 'src/declarative')
-rw-r--r--src/declarative/qml/qmlobjectscriptclass.cpp8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/declarative/qml/qmlobjectscriptclass.cpp b/src/declarative/qml/qmlobjectscriptclass.cpp
index 2d69590..ce74aef 100644
--- a/src/declarative/qml/qmlobjectscriptclass.cpp
+++ b/src/declarative/qml/qmlobjectscriptclass.cpp
@@ -46,6 +46,7 @@
#include <private/qmldeclarativedata_p.h>
#include <private/qmltypenamescriptclass_p.h>
#include <QtDeclarative/qmlbinding.h>
+#include <QtCore/qtimer.h>
QT_BEGIN_NAMESPACE
@@ -290,9 +291,10 @@ QScriptValue QmlObjectScriptClass::destroy(QScriptContext *context, QScriptEngin
int delay = 0;
if(context->argumentCount() > 0)
delay = context->argument(0).toInt32();
- obj->deleteLater();
- //### Should this be delayed as well?
- context->thisObject().setData(QScriptValue(engine, 0));
+ if (delay > 0)
+ QTimer::singleShot(delay, obj, SLOT(deleteLater()));
+ else
+ obj->deleteLater();
}
return engine->nullValue();
}