Layout issue while using Loader
Moved
Unsolved
QML and Qt Quick
-
I have a layout arranged as follows
Rectangle { id: rectSide width: 400 height: 500 ColumnLayout { anchors.fill: parent ... some elements... Loader { id: loaderMyComp Layout.fillWidth: true Layout.fillHeight: true source: "MyComponent.ui.qml" } } }
With the use of the Loader as above, "MyComponent" doesn't look right at all and has several issues such as (1) Not occupying the full width of the rectangle in spite of Layout.fillWidth: true. (2) Some parts of "MyComponent" don't even appear.
Instead, if I modify the code not to use the Loader and instead directly add "MyComponent" to the layout as shown below, it works right.
Why is that? Why doesn't the layout work right while using the Loader element?
Code that works:
Rectangle { id: rectSide width: 400 height: 500 ColumnLayout { anchors.fill: parent ... some elements... MyComponent { id: myComp Layout.fillWidth: true Layout.fillHeight: true } } }