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
Developer
Posts: 181
Registered: ‎07-19-2012
My Device: Q5, Q10, Z10, Z30, PlayBook
My Carrier: Carrier
Accepted Solution

Change container quota in QML

This does not seem to work:

 

Container {
    layout: StackLayout { orientation: LayoutOrientation.LeftToRight }
	
	Container { id: cnLeft
	    property int quota : 50
	    layoutProperties: StackLayoutProperties { spaceQuota: quota }
	    background: Color.Red
	    Label { 
	        text: "Left"
	    }
	}
	Container { id: cnRight
	    property int quota : 50
	    layoutProperties: StackLayoutProperties { spaceQuota: quota }
	    background: Color.Blue
	    Label { 
	        text: "Right"
	    }
	}
}

 Basically it ignores the quota.... unless I hard code the values in spaceQuota property.

Is there any way to change the quota AFTER qml has been loaded. (for example if the text length changes i will want to readjust the quota settings accordingly).

thanks

---
If you find my post helpful please "like" it and "accept as a solution"
Developer
Posts: 207
Registered: ‎02-10-2011
My Device: Playbook 16GB and Z10
My Carrier: Verizon

Re: Change container quota in QML

If you are going to implement the readjust logic in QML I would think it would be something like this:

 

function readjustContainers() {
    // whatever logic
    if (cnRight.needsToBeAdjusted()) {
         cnRight.layoutProperties.spaceQuota = newQuota;
    }
}

 See if that works.

_________________________________________________
Apps
Go Music
Flashlight Fast Free/Pro
Fitbit for BlackBerry PlayBook
Developer
Posts: 181
Registered: ‎07-19-2012
My Device: Q5, Q10, Z10, Z30, PlayBook
My Carrier: Carrier

Re: Change container quota in QML

Works. Thanks.

---
If you find my post helpful please "like" it and "accept as a solution"