[Qt-qml] Accessing resources of item loaded using Loader.

warwick.allison at nokia.com warwick.allison at nokia.com
Wed May 12 09:44:40 CEST 2010


>       I have tried the pageloader.item.running = true , I get the same
> error "Cannot assign to non-existent property "running".

Two issues - firstly, you can't access item properties until the content is loaded (you'll need an onStatusChanged handler in the Loader); secondly, from this code there is no "running" property on the loaded item - you need "property alias running: statustimer.running", is I understand your code correctly.

--
Warwick


> FYI; My \\Test1.qml file is simple
> 
> Item{
>         id: test1Itemid
>         width: 50
>         height: 50
>      Text{
>             id: textItemid
>             text: "test timer"
>             }
> 
> resources:[
> Timer{
>             id:statustimer
>             interval: 1000; running: false; repeat: true;
>             onTriggered: {
>                         textItemid.text = "timer expired"
>                     }
>     }
> ]
> 
> }
> 
> How to set the statustimer as runnining, if this .qml file is loaded by
> test.qml loader "pageloader".
> 
> With best regards,
> Rakesh.M
> 
> ________________________________
> 
> From: qt-qml-bounces at trolltech.com [mailto:qt-qml-
> bounces at trolltech.com] On Behalf Of Rakesh.Mutharaju at tieto.com
> Sent: Tuesday, May 11, 2010 10:11 AM
> To: qt-qml at trolltech.com
> Subject: [Qt-qml] Accessing resources of item loaded using Loader.
> 
> 
> Hi,
> 
>       How to access resources of Item say \\ Test1.qml using Loader{id:
> pageloader; source: "Test1.qml} \\ test.qml file.
> 
> I have a timer in resources of the Item and I want to set "running =
> true"
> 
> I tried pageloader.resources[0].running = true -->>> error message:
> invalid property "running" and also
> pageloader.item.resources[0].running = true -->> No error , but nothing
> happens as noticed in the documentation that Item [Read only]. Neither
> of them serve the purpose.
> 
> 
> Thanks and Regards,
> Rakesh
> 
> 




More information about the Qt-qml mailing list