Skip to content
Discussion options

You must be logged in to vote

I think the following should work

component Content {
  // the background!
  Rectangle {}

  VerticalLayout {
      // ...items...
   }
}

How can I create a Rectangle that adjusts its size based on its child elements without filling its parent size?

you can use

        Rectangle {
            background: green;
            width: self.preferred-width;
            height: self.preferred-height;
            // contents
        }

==> Demo

Replies: 1 comment 3 replies

Comment options

You must be logged in to vote
3 replies
@wspl
Comment options

@ogoffart
Comment options

@wspl
Comment options

Answer selected by wspl
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants