Make background of Quick Controls 2 StackView transparent
-
wrote on 24 Oct 2018, 20:55 last edited by ivarec
I've designed an application that has a background image and a StackView in front of it. Some of those views are simply a few buttons with no background, so I would like to see my app's background in these cases. However, all I see now is a white background that comes from the StackView itself.
Is there a way to make this white background transparent? I've tried setting its color property to Qt.transparent, but then my views disappear as well.
-
I've designed an application that has a background image and a StackView in front of it. Some of those views are simply a few buttons with no background, so I would like to see my app's background in these cases. However, all I see now is a white background that comes from the StackView itself.
Is there a way to make this white background transparent? I've tried setting its color property to Qt.transparent, but then my views disappear as well.
-
wrote on 26 Oct 2018, 02:50 last edited by
You can create an image with the same x,y & dimensions of stackview, before stackview creates. That image will work as background.
-
@ivarec What color property? StackView doesn't have one. Try setting the StackView background to the ApplicationWindow background.
-
StackView
is transparent.
Maybe the items you push onto it are not? -
@Tom_H what do you mean? Something like:
StackView { background: root.background //assuming my ApplicationWindow had id "root" }
I've tried just that and I still get the white background in my StackView.
-
wrote on 23 Nov 2018, 15:36 last edited by
Note: it turns out that setting background to Qt.transparent doesn't make sense. It worked simply because the types are incompatible and background got set to null. It's easier to simply set background to null to get the same result.