PDA

View Full Version : Access instantiated objects from C++



Sunny31
5th December 2010, 16:11
Hey,


how can I access instantiated objects from C++?

e.g.:

I have a .qml file:



MyItem {
task: "doThis"
// ...
}
MyItem {
task: "doThat"
// ...
}
// and further more

How can I now iterate through this file from a C++ application?
I'd like to check the 'task' property from each item.


thanks

wysota
5th December 2010, 16:24
Your items are likely to be available as context properties of the declarative context.

Sunny31
5th December 2010, 16:25
hey wysota,

thanks for your answer, but could you explain that with a little example?

wysota
5th December 2010, 17:25
Take a look at QDeclarativeContext::contextProperty() and also read about making your C++ objects available for QML. What you want is using the same mechanism in the other direction.