[Qt-qml] [coding niceness][low priority] Usage of "createComponent()"
Ivan De Marino
ivan.de.marino at gmail.com
Thu Apr 22 18:10:55 CEST 2010
Hello.
This is a message purely about code "niceness". Answer only when u are done
with your daily job, and the thing in your non-mouse-holding hand is a Pina
Colada. :)
Scenario: I have 2 .qml
- Main.qml
- common/SupaDupaComponent.qml
In main.qml I do something like:
import "common"
...
var component = createComponent("common/SupaDupaComponent.qml");
var obj = component.createObject();
obj.parent = aProperParent;
...
This works and the world has a blue sky.
But I don't like it 100%: given that I have imported the component already
(at the first line), why do I have to search the component "by file"?
For me, something like:
var obj = SupaDupaComponent.createObject();
...
Should be the proper thing to have.
I know, is one line, but WHY it doesn't work if I do like that?
Isn't an included component equivalent to a "Component"?
What am I missing from the way QML handles Component's creation?
Saluti and have a nice drink ;)
--
Ivan De Marino | Software Engineer | France Telecom R&D UK - Orange Labs
w. +44 20 8849 5806 | m. +44 7515 955 861 | m. +44 7974 156 216
ivan[dot]demarino[at]orange-ftgroup.com |
ivan[dot]de[dot]marino[at]gmail[dot]com
www.detronizator.org | www.linkedin.com/in/ivandemarino
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt.nokia.com/pipermail/qt-qml/attachments/20100422/145c5fd4/attachment.html
More information about the Qt-qml
mailing list