[Qt-qml] Semantics of 'return' in a JavaScript block in QML

Gregory Schlomoff gregory.schlomoff at gmail.com
Thu Sep 16 02:46:51 CEST 2010


I'd be definetely in understanding qml "from the grounds up"

Things such as prototype, and how the specifities of qml are implemented
(like the example you gave above), are of huge interest.

Besides, IIRC, qml has a non-standard syntax for switch blocks, requiring
each case to be enclosed within curly braces for the break statement to
work. Why this happens (if it still happens - haven't tested now) would be
interesting to know.

Cheers,

Greg

On Sep 16, 2010 7:38 AM, <aaron.kennedy at nokia.com> wrote:

Hi,

On 15/09/10 10:15 PM, "Kellomaki Pertti (Nokia-MS/Tampere)"

<pertti.kellomaki at nokia.com> wrote: > This caught my eye when looking at
examples in the qt-compone...
All of QML is an extension to JavaScript :)  As another replier identified,
bindings in QML can be though of as a convenient function call.  Internally
the above is actually evaluated like this:

Text {
   text: (function() { if (condition) { return "A"; } return "B"; })()
}

We do this to allow you to write complex bindings without actually having to
go to the trouble of splitting it out into a single-use function call.

We should definitely document these things better.  There is a balancing act
between filling the documentation with descriptions of technical edge cases
that will confuse most people, but are helpful for some that want to
understand things from "the ground up".

Cheers,

Aaron

_______________________________________________ Qt-qml mailing list
Qt-qml at trolltech.com http://li...
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt.nokia.com/pipermail/qt-qml/attachments/20100916/34c7a72a/attachment.html 


More information about the Qt-qml mailing list