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
Contributor
Posts: 14
Registered: ‎11-07-2013
My Device: x
My Carrier: y
Accepted Solution

Layout change in QML

Container{
    layout: StackLayout {
        id: rootLayout
    }
    function initUI() {
        rootLayout.setOrientation(someFlag ? LayoutOrientation.LeftToRight : LayoutOrientation.RightToLeft)
    }
}

 

asset:///screens/components/goal_item.qml:32: Error: Unknown method parameter type: bb::cascades::LayoutOrientation::Type

Type enum is declared inside the LayoutOrientation class, so this should be valid, but somehow it isn't. Any idea why?

 

Thanks in advance

Developer
Posts: 1,524
Registered: ‎12-18-2012
My Device: Z30, Z10 LE, DevAlpha C, PlayBook

Re: Layout change in QML

[ Edited ]

Hi! Could you check if using a property instead of setter works?

rootLayout.orientation = someFlag ? LayoutOrientation.LeftToRight : LayoutOrientation.RightToLeft

 

Some classes aren't registered with Qt type system. I've created a JIRA ticket some time ago:

https://www.blackberry.com/jira/browse/BBTEN-1801

If this issue is related, calling

qmlRegisterType<LayoutOrientation>();  // or qmlRegisterUncreatableType

should fix the problem with the setter.

 


Andrey Fidrya, @zmeyc on twitter
Highlighted
Contributor
Posts: 14
Registered: ‎11-07-2013
My Device: x
My Carrier: y

Re: Layout change in QML

Yeah, the property is working. I was just looking for the explanation why the setter isn't, but your explanation makes perfect sense. Thanks.