Thanks. That clarify my wondering and the sky is even blue(r). :D

On 23 April 2010 01:09, <[email protected]> wrote:

> Hi,
>
>
> On 23/04/10 2:10 AM, "ext Ivan De Marino" <[email protected]>
> wrote:
>
> > 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?
>
> Nothing.  It would be nice if QML handled dynamic component creation like
> this, but it doesn't.  The implementation reason, if you're interested, is
> that the JavaScript is not fully aware of all the types in scope.  In
> future
> releases we might support something closer to your proposed syntax.
>
> Cheers,
>
> Aaron
>
>


-- 
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
_______________________________________________
Qt-qml mailing list
[email protected]
http://lists.trolltech.com/mailman/listinfo/qt-qml

Reply via email to