[Qt-qml] Why the need for QDeclarativeListProperty?
Gregory Schlomoff
gregory.schlomoff at gmail.com
Tue Aug 10 10:58:19 CEST 2010
Hello,
As we dive more and more into the QML world, we started making C++ code that
needed to define QDeclarativeListProperties.
At first, QDLP can be quite intimidating: you don't really know what to make
of those static functions, then you feel relieved when you see that there is
a constructor that takes a QList, just to discover moments later that the
doc strongly advises against using it, "as a writable QList violates QML's
memory management rules".
So in the end, you end up writing the needed static functions, that interact
with your own QList, but you don't really know why/if this is any better
than using the QDLP constructor with a QList. And actually you don't really
understand the need for the QDLP in the first place...
That's why I'm writing here to see if someone could explain:
1. Why QDeclarativeListProperty is needed, why a QList wouldn't do the job?
2. What's wrong with the constructor that takes a QList? what does it mean
that "a writable QList violates QML's memory management rules"?
3. What's the right way to make a QDLP out of a QList?
4. And finally, why QDLP had to be implemented this way, with those static
functions?
Also, please note that there is no ranting here. I just want to get a better
understanding of the motivations and the needs behind the QDLP so that I
understand what I'm doing.
Thanks in advance to anyone who is willing to take some time to clarify
this!
Greg
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt.nokia.com/pipermail/qt-qml/attachments/20100810/5284d52f/attachment.html
More information about the Qt-qml
mailing list