Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Set transparent to image in frame.
QtWS25 Last Chance

Set transparent to image in frame.

Scheduled Pinned Locked Moved Solved General and Desktop
13 Posts 6 Posters 5.5k 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.
  • VineelaV Offline
    VineelaV Offline
    Vineela
    wrote on last edited by Vineela
    #1

    I have a frame where I've set background image to it and added buttons inside the frame, now I need to decrease my background's image opacity it is two strong in colour. I need to set that in style sheet.

    Please help me out.

    BondrusiekB 1 Reply Last reply
    0
    • VineelaV Vineela

      I have a frame where I've set background image to it and added buttons inside the frame, now I need to decrease my background's image opacity it is two strong in colour. I need to set that in style sheet.

      Please help me out.

      BondrusiekB Offline
      BondrusiekB Offline
      Bondrusiek
      wrote on last edited by
      #2

      @Vineela Hi, can you give code where you set background for frame. It can more help.

      VineelaV 1 Reply Last reply
      0
      • BondrusiekB Bondrusiek

        @Vineela Hi, can you give code where you set background for frame. It can more help.

        VineelaV Offline
        VineelaV Offline
        Vineela
        wrote on last edited by
        #3

        @Bondrusiek
        added this on my edit style sheet for QFrame
        background-image: url(:/images/blue2.jpg);

        BondrusiekB 1 Reply Last reply
        0
        • J Offline
          J Offline
          joshep
          wrote on last edited by
          #4

          It is not a big issue. Go to the settings, there you can change the background. You can take help from a Facebook blog or watch a video about this topic. It will help to solve the problem.

          VineelaV 1 Reply Last reply
          -1
          • VineelaV Vineela

            @Bondrusiek
            added this on my edit style sheet for QFrame
            background-image: url(:/images/blue2.jpg);

            BondrusiekB Offline
            BondrusiekB Offline
            Bondrusiek
            wrote on last edited by
            #5

            @Vineela Maybe try to use opacity property. For example:

            "background-image: url(:/images/blue2.jpg); opacity: 127;"
            

            In docs:
            *The opacity for a widget. Possible values are from 0 (transparent) to 255 (opaque). For the moment, this is only supported for tooltips.

            If this property is not specified, it defaults to the value specified by the current style for the SH_ToolTipLabel_Opacity style hint.

            Example:

            QToolTip { opacity: 223 }*
            https://doc.qt.io/archives/qt-4.8/stylesheet-reference.html

            VineelaV 1 Reply Last reply
            0
            • J joshep

              It is not a big issue. Go to the settings, there you can change the background. You can take help from a Facebook blog or watch a video about this topic. It will help to solve the problem.

              VineelaV Offline
              VineelaV Offline
              Vineela
              wrote on last edited by
              #6

              @joshep if i knew that means y will i ask her, if someone answers here it may help others too.

              1 Reply Last reply
              0
              • BondrusiekB Bondrusiek

                @Vineela Maybe try to use opacity property. For example:

                "background-image: url(:/images/blue2.jpg); opacity: 127;"
                

                In docs:
                *The opacity for a widget. Possible values are from 0 (transparent) to 255 (opaque). For the moment, this is only supported for tooltips.

                If this property is not specified, it defaults to the value specified by the current style for the SH_ToolTipLabel_Opacity style hint.

                Example:

                QToolTip { opacity: 223 }*
                https://doc.qt.io/archives/qt-4.8/stylesheet-reference.html

                VineelaV Offline
                VineelaV Offline
                Vineela
                wrote on last edited by
                #7

                @Bondrusiek nope my image is still like that only it didn't get transparent.

                1 Reply Last reply
                0
                • sankarapandiyanS Offline
                  sankarapandiyanS Offline
                  sankarapandiyan
                  wrote on last edited by sankarapandiyan
                  #8

                  Hii . Try to change the image as transparent in online https://onlinepngtools.com/create-transparent-png
                  and then you may try it here in code

                   setStyleSheet("background:transparent");
                  setAttribute(Qt::WA_TranslucentBackground,true);
                  
                  VineelaV 1 Reply Last reply
                  4
                  • sankarapandiyanS sankarapandiyan

                    Hii . Try to change the image as transparent in online https://onlinepngtools.com/create-transparent-png
                    and then you may try it here in code

                     setStyleSheet("background:transparent");
                    setAttribute(Qt::WA_TranslucentBackground,true);
                    
                    VineelaV Offline
                    VineelaV Offline
                    Vineela
                    wrote on last edited by
                    #9

                    @sankarapandiyan how can i do that in style sheet than in cpp file this is only QT Designer no coding needed so.

                    mrjjM 1 Reply Last reply
                    0
                    • VineelaV Vineela

                      @sankarapandiyan how can i do that in style sheet than in cpp file this is only QT Designer no coding needed so.

                      mrjjM Offline
                      mrjjM Offline
                      mrjj
                      Lifetime Qt Champion
                      wrote on last edited by
                      #10

                      @Vineela
                      Hi
                      The easiest way is as @sankarapandiyan says.
                      Make is semi transparent in online editor and
                      then set on frame.
                      As far as i know, you cannot control transparency for background image using stylesheets.

                      VineelaV 1 Reply Last reply
                      3
                      • mrjjM mrjj

                        @Vineela
                        Hi
                        The easiest way is as @sankarapandiyan says.
                        Make is semi transparent in online editor and
                        then set on frame.
                        As far as i know, you cannot control transparency for background image using stylesheets.

                        VineelaV Offline
                        VineelaV Offline
                        Vineela
                        wrote on last edited by
                        #11

                        @mrjj Sure ill try it. Thank you .

                        1 Reply Last reply
                        0
                        • VineelaV Offline
                          VineelaV Offline
                          Vineela
                          wrote on last edited by
                          #12

                          Thank you all for your responses it worked. :D

                          T 1 Reply Last reply
                          1
                          • VineelaV Vineela

                            Thank you all for your responses it worked. :D

                            T Offline
                            T Offline
                            Tushar46
                            wrote on last edited by
                            #13

                            @Vineela Can please tell how to do it?

                            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