Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. Layout issue while using Loader

Layout issue while using Loader

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
1 Posts 1 Posters 175 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • J Offline
    J Offline
    jaquilio
    wrote on last edited by
    #1

    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
                }
            }
        }
    
    1 Reply Last reply
    0

    • Login

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Get Qt Extensions
    • Unsolved