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. Avoiding background image of Main window in child widgets
Forum Updated to NodeBB v4.3 + New Features

Avoiding background image of Main window in child widgets

Scheduled Pinned Locked Moved Solved General and Desktop
10 Posts 3 Posters 2.1k 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.
  • V Offline
    V Offline
    Vineela
    wrote on 11 Mar 2020, 09:33 last edited by Vineela 3 Dec 2020, 09:03
    #1

    I've set border image for main window and added frame to the main window, but the image of main window is repeated to the frame too. To this i gave background:transparent to the frame even though not working.
    Therefore my need is to fit image to main window where the image shud not repeat in any other fileds.

    image.png (image url)

    S 1 Reply Last reply 11 Mar 2020, 09:39
    0
    • V Vineela
      11 Mar 2020, 09:33

      I've set border image for main window and added frame to the main window, but the image of main window is repeated to the frame too. To this i gave background:transparent to the frame even though not working.
      Therefore my need is to fit image to main window where the image shud not repeat in any other fileds.

      image.png (image url)

      S Offline
      S Offline
      sankarapandiyan
      wrote on 11 Mar 2020, 09:39 last edited by
      #2

      @Vineela .. You want to transparent the background image !

      V 1 Reply Last reply 11 Mar 2020, 09:40
      0
      • S sankarapandiyan
        11 Mar 2020, 09:39

        @Vineela .. You want to transparent the background image !

        V Offline
        V Offline
        Vineela
        wrote on 11 Mar 2020, 09:40 last edited by
        #3

        @sankarapandiyan nope not working i did that too.

        S 1 Reply Last reply 11 Mar 2020, 09:43
        0
        • V Vineela
          11 Mar 2020, 09:40

          @sankarapandiyan nope not working i did that too.

          S Offline
          S Offline
          sankarapandiyan
          wrote on 11 Mar 2020, 09:43 last edited by sankarapandiyan 3 Nov 2020, 09:45
          #4

          @Vineela I think here the frame is in transparent . So, You first need to change the frame nature and then fix the frame in Mainwindow.
          May be try this , I dont know this one is work or not . but try this method

          frame->setAttribute(Qt::WA_NoSystemBackground);
          frame->setAttribute(Qt::WA_OpaquePaintEvent);
          frame->setStyleSheet("background-color: transparent");
          frame->setStyleSheet("opacity: 0");
          
          V 2 Replies Last reply 11 Mar 2020, 09:46
          0
          • S sankarapandiyan
            11 Mar 2020, 09:43

            @Vineela I think here the frame is in transparent . So, You first need to change the frame nature and then fix the frame in Mainwindow.
            May be try this , I dont know this one is work or not . but try this method

            frame->setAttribute(Qt::WA_NoSystemBackground);
            frame->setAttribute(Qt::WA_OpaquePaintEvent);
            frame->setStyleSheet("background-color: transparent");
            frame->setStyleSheet("opacity: 0");
            
            V Offline
            V Offline
            Vineela
            wrote on 11 Mar 2020, 09:46 last edited by
            #5
            This post is deleted!
            1 Reply Last reply
            0
            • S sankarapandiyan
              11 Mar 2020, 09:43

              @Vineela I think here the frame is in transparent . So, You first need to change the frame nature and then fix the frame in Mainwindow.
              May be try this , I dont know this one is work or not . but try this method

              frame->setAttribute(Qt::WA_NoSystemBackground);
              frame->setAttribute(Qt::WA_OpaquePaintEvent);
              frame->setStyleSheet("background-color: transparent");
              frame->setStyleSheet("opacity: 0");
              
              V Offline
              V Offline
              Vineela
              wrote on 11 Mar 2020, 09:48 last edited by
              #6

              @sankarapandiyan nope this didn't work too

              S 1 Reply Last reply 11 Mar 2020, 10:00
              0
              • V Vineela
                11 Mar 2020, 09:48

                @sankarapandiyan nope this didn't work too

                S Offline
                S Offline
                sankarapandiyan
                wrote on 11 Mar 2020, 10:00 last edited by sankarapandiyan 3 Nov 2020, 10:05
                #7

                @Vineela

                click and see the link link text by this , you may get some idea ... The Topic is about overriding background image of child components

                And my point is we can change the setting of the frame (REMOVING BACKGROUND) through the code itself only.

                    QFrame* plbl = new QFrame("foobar");
                    plbl->setGeometry(210, 0, 26, 16);
                    plbl->setAlignment(Qt::AlignRight);
                    plbl->setAlignment(Qt::AlignVCenter);
                    plbl->setWindowFlag(Qt::FramelessWindowHint); // No frame
                    plbl->setAttribute(Qt::WA_NoSystemBackground); // No background
                    plbl->setAttribute(Qt::WA_TranslucentBackground);
                    plbl->show();
                

                Like this we can remove the background colour or we can change the background colour

                V 1 Reply Last reply 11 Mar 2020, 10:14
                0
                • S sankarapandiyan
                  11 Mar 2020, 10:00

                  @Vineela

                  click and see the link link text by this , you may get some idea ... The Topic is about overriding background image of child components

                  And my point is we can change the setting of the frame (REMOVING BACKGROUND) through the code itself only.

                      QFrame* plbl = new QFrame("foobar");
                      plbl->setGeometry(210, 0, 26, 16);
                      plbl->setAlignment(Qt::AlignRight);
                      plbl->setAlignment(Qt::AlignVCenter);
                      plbl->setWindowFlag(Qt::FramelessWindowHint); // No frame
                      plbl->setAttribute(Qt::WA_NoSystemBackground); // No background
                      plbl->setAttribute(Qt::WA_TranslucentBackground);
                      plbl->show();
                  

                  Like this we can remove the background colour or we can change the background colour

                  V Offline
                  V Offline
                  Vineela
                  wrote on 11 Mar 2020, 10:14 last edited by
                  #8

                  @sankarapandiyan ahhhhh non helping......

                  1 Reply Last reply
                  1
                  • V Offline
                    V Offline
                    VRonin
                    wrote on 11 Mar 2020, 11:09 last edited by VRonin 3 Nov 2020, 11:12
                    #9

                    Give your central widget an object name (e.g. widget->setObjectName("MyWindow");). This allows you to set the border image in the stylesheet for that specific object without having it cascading (e.g. #MyWindow { border-image: url(:/images/background.png) })

                    "La mort n'est rien, mais vivre vaincu et sans gloire, c'est mourir tous les jours"
                    ~Napoleon Bonaparte

                    On a crusade to banish setIndexWidget() from the holy land of Qt

                    1 Reply Last reply
                    3
                    • V Offline
                      V Offline
                      Vineela
                      wrote on 12 Mar 2020, 04:31 last edited by
                      #10

                      Well thank you all, I figured it out that is if i give border-image to main window i should give border-image:transparent to all child widgets . :)

                      1 Reply Last reply
                      1

                      1/10

                      11 Mar 2020, 09:33

                      • Login

                      • Login or register to search.
                      1 out of 10
                      • First post
                        1/10
                        Last post
                      0
                      • Categories
                      • Recent
                      • Tags
                      • Popular
                      • Users
                      • Groups
                      • Search
                      • Get Qt Extensions
                      • Unsolved