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. Make background of Quick Controls 2 StackView transparent
Forum Update on Monday, May 27th 2025

Make background of Quick Controls 2 StackView transparent

Scheduled Pinned Locked Moved Solved QML and Qt Quick
qmlstackviewquick controlscontrols 2
8 Posts 4 Posters 2.6k 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.
  • I Offline
    I Offline
    ivarec
    wrote on 24 Oct 2018, 20:55 last edited by ivarec
    #1

    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.

    T 1 Reply Last reply 25 Oct 2018, 22:57
    1
    • I ivarec
      24 Oct 2018, 20:55

      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.

      T Offline
      T Offline
      Tom_H
      wrote on 25 Oct 2018, 22:57 last edited by
      #2

      @ivarec What color property? StackView doesn't have one. Try setting the StackView background to the ApplicationWindow background.

      I 1 Reply Last reply 26 Oct 2018, 13:59
      0
      • Y Offline
        Y Offline
        Yaswanth
        wrote on 26 Oct 2018, 02:50 last edited by
        #3

        You can create an image with the same x,y & dimensions of stackview, before stackview creates. That image will work as background.

        1 Reply Last reply
        0
        • T Tom_H
          25 Oct 2018, 22:57

          @ivarec What color property? StackView doesn't have one. Try setting the StackView background to the ApplicationWindow background.

          I Offline
          I Offline
          ivarec
          wrote on 26 Oct 2018, 13:59 last edited by
          #4

          @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.

          T 1 Reply Last reply 26 Oct 2018, 14:43
          0
          • G Offline
            G Offline
            GrecKo
            Qt Champions 2018
            wrote on 26 Oct 2018, 14:20 last edited by
            #5

            StackView is transparent.
            Maybe the items you push onto it are not?

            I 1 Reply Last reply 26 Oct 2018, 23:16
            2
            • I ivarec
              26 Oct 2018, 13:59

              @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.

              T Offline
              T Offline
              Tom_H
              wrote on 26 Oct 2018, 14:43 last edited by
              #6

              @ivarec Yes, but then each Page you push onto StackView has a background property that you would also need to set. If that works then you probably wouldn't need to set the StackView background.

              1 Reply Last reply
              0
              • G GrecKo
                26 Oct 2018, 14:20

                StackView is transparent.
                Maybe the items you push onto it are not?

                I Offline
                I Offline
                ivarec
                wrote on 26 Oct 2018, 23:16 last edited by
                #7

                @GrecKo you are right. I was adding a pane, and after setting its background to transparent like this:

                Pane {
                ...
                  background: Qt.transparent
                ...
                }
                

                I got the desired result. Thanks :)

                1 Reply Last reply
                0
                • I Offline
                  I Offline
                  ivarec
                  wrote on 23 Nov 2018, 15:36 last edited by
                  #8

                  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.

                  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