Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Native Development

Reply
New Developer
silajim
Posts: 23
Registered: ‎10-14-2013
My Device: Z10
My Carrier: Cosmote
Accepted Solution

QML createObject property binding

Hello there, i am using the createObject command to create dynamically  objects on a qml page, i can do this, but now i want some properties of the dynamically objects to bind on some properties of the parent object, how this is possible?

 

Greetings silajm 

Please use plain text.
Developer
BBSJdev
Posts: 6,094
Registered: ‎07-05-2012
My Device: Playbook, Dev Alpha C, Z10 LE, Z30
My Carrier: Orange

Re: QML createObject property binding

You can use signals and slots, you may like to take a look at this KB article I wrote for an example of how to do this...

 

http://supportforums.blackberry.com/t5/Native-Development-Knowledge/How-to-pass-data-to-and-from-a-Q...


If you've been helped click on Like Button, if you've been saved buy the app. :smileyhappy:

Developer of stokLocker, Sympatico and Super Sentences.
Please use plain text.
New Developer
silajim
Posts: 23
Registered: ‎10-14-2013
My Device: Z10
My Carrier: Cosmote

Re: QML createObject property binding

is there anything without delegates?

Please use plain text.
Developer
Zmey
Posts: 1,512
Registered: ‎12-18-2012
My Device: PlayBook, Z10, DAC

Re: QML createObject property binding

Hi,

 

I haven't tried this in Cascades, but in Qt Quick Qt.binding() can be used for dynamically binding to properties, this might work in Cascades as well:

 

legendItem = legendComponent.createObject()
legendItem.color = Qt.binding(function() { return row.legendColor })

Row is id of another component (or a variable).

 

 Component can also bind to it's own properties using 'this' keyword:

 

rect.height = Qt.binding(function() { return this.width * 2 })

 


Andrey Fidrya, @zmeyc on twitter
Please use plain text.
New Developer
silajim
Posts: 23
Registered: ‎10-14-2013
My Device: Z10
My Carrier: Cosmote

Re: QML createObject property binding

There is no Qt.binding in cascades :smileysad:

Please use plain text.
Developer
NicoBB
Posts: 36
Registered: ‎05-31-2013
My Device: Z10, Q10

Re: QML createObject property binding

Try the following detour :smileywink:

 

1. make sure you have your parent properties ready (try also to declare them as aliases just to be sure)

2. use parent properties during the construction of the object in the format: parent.property (or even parent.parent ...)

3. createObject(explicit parent id)

 

This should work. In case it doesn't try to initiate your actions onCreationCompleted where I'm sure you will get parent.property.

 

Try and let us know.

If you find an answer helpful hit Like. If your problem was solved hit Accept as Solution.

My Apps: SanQuiz
Please use plain text.
New Developer
silajim
Posts: 23
Registered: ‎10-14-2013
My Device: Z10
My Carrier: Cosmote

Re: QML createObject property binding

Thank you, that last worked!! :smileyvery-happy:
Please use plain text.
Developer
NicoBB
Posts: 36
Registered: ‎05-31-2013
My Device: Z10, Q10

Re: QML createObject property binding

Cheers!

If you find an answer helpful hit Like. If your problem was solved hit Accept as Solution.

My Apps: SanQuiz
Please use plain text.