[Qt-qml] Sleeping in javascript
Gregory Schlomoff
gregory.schlomoff at gmail.com
Tue Sep 28 03:59:09 CEST 2010
> I know javascript doesn't have a sleep() per se, but I've tried using
> the setTimeout() function, which I thought was standard,
Technically setTimeout is a member of the window object (you should
write window.setTimeout, but the window object is implicit)
That's why setTimeout doesn't work in QML. There is no windows object.
Same thing for alert(), for example.
Not that this helps solving your problem, but at least I hope it helps
you understand why you can't do some things in QML as you do in JS.
Cheers
On Tue, Sep 28, 2010 at 5:28 AM, Mateu Batle
<mateu.batle at collabora.co.uk> wrote:
> Hi Alex,
>
> one way could be to create a dynamic QML Timer object and customize it
>
> http://doc.qt.nokia.com/4.7-snapshot/qml-timer.html
>
> But maybe there is another solution depending on the specific usage,
> what do you need the timeout for ?
>
> cheers
> Mat
>
>
> On 09/27/2010 02:59 PM, Alex wrote:
>> Hi,
>>
>> I know javascript doesn't have a sleep() per se, but I've tried using
>> the setTimeout() function, which I thought was standard, like so:
>>
>> setTimeout("console.log(\"foo\")", 1000)
>>
>> This is the result:
>>
>> ReferenceError: Can't find variable: setTimeout
>>
>> What is the recommended way to pause/sleep within a javascript block?
>>
>> Thanks,
>> Alex
>> _______________________________________________
>> Qt-qml mailing list
>> Qt-qml at trolltech.com
>> http://lists.trolltech.com/mailman/listinfo/qt-qml
>
>
> --
> Mateu Batle
> Software Engineer
> Collabora Ltd.
>
> _______________________________________________
> Qt-qml mailing list
> Qt-qml at trolltech.com
> http://lists.trolltech.com/mailman/listinfo/qt-qml
>
More information about the Qt-qml
mailing list