[Interest] QML, Layouts and Dynamic Objects
Lorne Sturtevant
dragor at shaw.ca
Thu Mar 17 20:58:18 CET 2016
I am dynamically creating an object which is working fine. I set the
parent of the object to a GridLayout. That also works fine. I want to
set the Layout's attached properties of my object, but it's not working.
Here's a small sample
|var component; var button; component =
Qt.createComponent("CustomButton.qml"); button =
component.createObject(gridLayout); button.Layout.maximumWidth = 10;
button.Layout.maximumHeight = 10; |
I get the error "TypeError: Type error" when accessing
button.Layout.maximimWidth. The button is properly created and I can see
it and use it in the gui. If I comment out setting the maximum width and
height, everything works except the size is not what I want.
It looks like the button is not getting the Layout attached property
when I dynamically create it. When I create it statically in a qml file,
everything works fine.
Any help would be greatly appreciated.
--
Lorne Sturtevant
Sum Ergo Cogito
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20160317/c3f00634/attachment.html>
More information about the Interest
mailing list