[Qt-interest] [QML] Some Questions still

Mihail Naydenov mlists at ymail.com
Mon Oct 18 22:40:22 CEST 2010


Im in my 4th day studying Qt Quick, and have read most if not all the docs.
Played also with some samples.

I first really *must* congratulate you for the great work done - the docs and 
samples are great, qml itself also exceeds my expectations so far!

On the topic. 
Overall the docs focus mostly on c++ to qml, this is, how to extend the types 
using cpp and how to give qml data, which is great.
However the reverse is almost completely neglected - how one uses the nice qml 
files from c++.

Right now I am still  not sure how to address Items (QObjects), available in a 
qml. Most of the snippets do component.create() to get an object, defined in qml 

created, but I am wondering: 

"Ok here is a scene.qml full of Items and I call 
view->setSource(QUrl::fromLocalFile("scene.qml"));

Now I have a full blown scene onscreen, how to access anything beyond root?"

In general I learned about Context, Engine and Component but in the end I still 
dont know how to do the above, this is - to have access to elements NOT created 
explicitly from cpp code. 

How to access members is also not that obvious - lats say I managed to get a 
pointer to an (Q)Object I want, now what, should I cast it? 
If yes to what? What is the name of the type in cpp? 
Almost by incident I manged to find QDeclarativeProperty which at least helps 
accessing properties from naked 

qobject, scanning manually all QDeclarative entries in the docs...
And even QDeclarative itself is "hard to find", mention in one sentence only
"Using the QtDeclarative C++ module, you can load and interact with QML files 
from your Qt application"
 and that's it.

To cut long story short: "Using QML in C++ Applications"
Must be expanded with sections about accessing QML objects from C++, accessing 
their methods etc. 

I might be obvious, but is not :)

Thank You
MihailNaydenov


      



More information about the Qt-interest-old mailing list