[Qt-qml] Timer without animation ?
Alan Alpert
alan.alpert at nokia.com
Mon Jan 10 11:47:11 CET 2011
On Monday, January 10, 2011 08:05:26 pm ext Attila Csipa wrote:
> Is it possible to have a Timer without having a visual item that brings in
> the animation timer ? Think
>
> QtObject {
> Component.onCompleted: console.log("hello world");
> Timer {
> interval: 500; running: true; repeat: true;
> onTriggered: console.log("tick");
> }
> }
>
> This gives somewhat cryptic Component is not ready error, but does work if
> I replace QtObject with Item. Now, you will be asking well, why don't you
> just use Item, and the answer is that it feels a bit weird - I'm
> experimenting with GUIless QML (think custom structured QtObject creation,
> textual UIs, etc).
>
Timer is part of the QtQuick module, and that entire module is designed for
GUI creation. If you don't want a GUI, but want to use QML, then just don't
import the QtQuick module and use items from elsewhere. An example of this is
that .qmlproject files import the QmlProject module to store the project
description in QML, entirely GUI-less.
Since non-GUI modules are not common yet, this means that you may have to
write your own Timer element which does not synchronize with the animation
Timer.
--
Alan Alpert
Software Engineer
Nokia, Qt Development Frameworks
More information about the Qt-qml
mailing list