07-22-2013 03:36 AM - edited 07-22-2013 03:38 AM
It should work on other pages as well (in the same context). In some situations it'll become inaccessible, for example if there is a ListItemComponent in hierarchy - they have a different context.
Also, I recall that showing a Sheet from TabbedPane can lead to issues with accessing outer variables from the sheet (this is a bug).
For ListItemComponent use topItemOfListItemComponent.ListItem.view.yourJavaS
If you have many pages and traversing the parents is undesirable, probably another workaround can be created. For example, creating and registering an instantiable C++ class which can return a singleton object, and declaring that class on every page where the access to singleton is needed as attached object. I haven't tried this approach, but I think it should work.
07-22-2013 03:36 AM
setProperty method is working fine when we are pushing a qml page from a cpp file. But how do we set the singleton instance property to a qml page if its being pushed from another qml page.
The qml pages that have a common root share its context, so if you set it on your main.qml (probably the navigationPane) all pages created from there will have access to it, too (and all other properties, functions etc).