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. Qt Designer image background
Forum Updated to NodeBB v4.3 + New Features

Qt Designer image background

Scheduled Pinned Locked Moved General and Desktop
7 Posts 4 Posters 12.5k Views 1 Watching
  • 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.
  • M Offline
    M Offline
    Massinissa
    wrote on last edited by
    #1

    Hello
    I try to put an image as a background of my GUI with change style sheet, the problem it will affects all widgets on the form giving them the same background. Is there an option to set up only the background form?

    Thank you for your help

    Massi

    Massinissa Bandou Ing.jr

    1 Reply Last reply
    0
    • M Offline
      M Offline
      Massinissa
      wrote on last edited by
      #2

      another thing is when I run the application it doesn't show me my background image

      Massinissa Bandou Ing.jr

      1 Reply Last reply
      0
      • C Offline
        C Offline
        clepto
        wrote on last edited by
        #3

        post here the contents of qss file

        1 Reply Last reply
        0
        • M Offline
          M Offline
          Massinissa
          wrote on last edited by
          #4

          Hi, I found a way to fix it but I'm not sure if it's correct or not.
          First, I started by adding a new Qt Resource in the way to get .qrc file. Immediately, in my Qt designer, I added some JPEG images in this new resource.
          I'm learning day by day Qt, so I'm not familiar with it and particularly with qss file. In my edit style sheet, I wrote:
          @
          #ImageCoregistration{
          background-image: url(:/Image/for-business-backgrounds-wallpapers.jpg);
          }
          @
          ImageCoregistration is the name's form.

          Another problem appears when I change the color of any widget like a tabWidget by selecting the color with palette property. It still does nothing when I launch the application? do I need to specify it in the edit style sheet?

          best regards!

          Massi

          Massinissa Bandou Ing.jr

          1 Reply Last reply
          0
          • S Offline
            S Offline
            soundar
            wrote on last edited by
            #5

            Try to use resource file in same directory.Before using this file,you can mention your image file name.
            File Format is resource.qrc
            @
            <RCC>
            <qresource prefix="/images">
            <file>Images/Disk.png</file>
            </qresource>
            </RCC>
            @

            [Edit: Added @ tags around code; mlong]

            Don't Follow Anyone but You Must Learn From Everyone.

            1 Reply Last reply
            0
            • M Offline
              M Offline
              Massinissa
              wrote on last edited by
              #6

              Thank you it works!! by the way do you know how to set QTabWidget (tab) transparent, same as the image background because I'm struggling to find how to do it. I have tried too many way to code it but at the end I always got a white background.
              in the qss:
              @
              form.widget.tab->setStyleSheet("background-color: rgba( 255, 255, 255, 0% );" );
              form.widget.tab->setStyleSheet("background: transparent;" );
              In the main menu I have tried this (ImageCoregistration is the name's form)
              ImageCoregistration form;
              QPalette palette = form.widget.tab->palette();
              palette.setBrush(QPalette::Base, Qt::transparent);
              form.widget.tab->setPalette(palette);
              form.widget.tab->setAttribute(Qt::WA_OpaquePaintEvent, false);
              @
              It does nothing!!
              Thank you for your reply

              Massi

              [Edit: @ tags; mlong]

              Massinissa Bandou Ing.jr

              1 Reply Last reply
              0
              • M Offline
                M Offline
                mlong
                wrote on last edited by
                #7

                When posting code snippets, please wrap them in @ tags. Thanks.

                Software Engineer
                My views and opinions do not necessarily reflect those of anyone -- living or dead, real or fictional -- in this universe or any other similar multiverse node. Void where prohibited. Your mileage may vary. Caveat emptor.

                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