-
I want to add an overlay or background that can ignore the parent's layout rules to a VerticalLayout/HorizontalLayout. How can I do that? The original scene is that PopupWindow can only be extended by a sized element like VerticalLayout (a Rectange doesn't work). Therefore, I need my I want to achieve this with the following code: component Content inherits VerticalLayout {
// I want this as a background!
Rectangle {}
// ...items...
}
PopupWindow {
Content {}
} However, I need to change my code to this to make it work. PopupWindow {
Rectangle {}
VerticalLayout {}
} I'm a web developer. Adding an absolutely positioned element to a container with layout rules is a very common scenario. Perhaps I'm missing some slint-ui features that can achieve this? An additional question: How can I create a Rectangle that adjusts its size based on its child elements without filling its parent size? I managed to achieve this by wrapping the Rectangle in a HorizontalLayout and using the |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 3 replies
-
I think the following should work component Content {
// the background!
Rectangle {}
VerticalLayout {
// ...items...
}
}
you can use Rectangle {
background: green;
width: self.preferred-width;
height: self.preferred-height;
// contents
} ==> Demo |
Beta Was this translation helpful? Give feedback.
I think the following should work
you can use
==> Demo