[Qt-qml] QML JS Weirdness
Jason H
scorp1us at yahoo.com
Fri Dec 3 02:48:54 CET 2010
Addendum.
No joy. None of the animations start. I have declared the bool as
property bool active: false
and set the
running: root.active
then in my start() function:
root.active = true
Conceptually, it should work.
----- Original Message ----
From: Jason H <scorp1us at yahoo.com>
To: Adriano Rezende <adriano.rezende at openbossa.org>; Petrus Lundqvist
<petrus.lundqvist at nokia.com>
Cc: "qt-qml at trolltech.com" <qt-qml at trolltech.com>
Sent: Thu, December 2, 2010 6:30:17 PM
Subject: Re: [Qt-qml] QML JS Weirdness
Thank you all for the suggestions. They will be utilized...
I still did want to iterate because I wanted to find the longest running
animation and set that as the one to signal the completion. I created a property
alias to be the longest running animation and in the script assigned the
animation with the longest duration to the alias. But it didn't work (reference
error IIRC). So I just made sure the longest-running animation is always used in
the connection, and added the convention that its always a PauseAnimation of the
same name at the top of the file.
----- Original Message ----
From: Adriano Rezende <adriano.rezende at openbossa.org>
To: Petrus Lundqvist <petrus.lundqvist at nokia.com>
Cc: Jason H <scorp1us at yahoo.com>; "qt-qml at trolltech.com" <qt-qml at trolltech.com>
Sent: Thu, December 2, 2010 9:51:42 AM
Subject: Re: [Qt-qml] QML JS Weirdness
On Thu, Dec 2, 2010 at 11:22 AM, Petrus Lundqvist
<petrus.lundqvist at nokia.com> wrote:
> And not to nit-pick, but you don't even get the index of the property
> but the "name" of the property, i.e. the name of the index. So the
> result is a string rather than a number.
Yes, I'm talking about index as a key, since it can be used to iterate
over generic js objects as well.
> [textAnimation, eyeAnimation, eyeOutline,
> pulseAnimation].forEach(function(animation) {
> if (!value && animation.running) ...
> });
Well, instead of using JS, I think it's always better to use QML
features to solve simple issues like this.
In this case, QML property bindings will do all the work in the C++
side and will also reduce the number of lines of code in JS side.
Br,
Adriano
_______________________________________________
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