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. Widgets showing the whole background image of the underlying widget
Qt 6.11 is out! See what's new in the release blog

Widgets showing the whole background image of the underlying widget

Scheduled Pinned Locked Moved Solved General and Desktop
widgetbackgroundimage display
4 Posts 3 Posters 3.1k Views 2 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.
  • ? Offline
    ? Offline
    A Former User
    wrote on last edited by A Former User
    #1

    Hi,

    I am facing a problem with background image of widget.
    I have set an image for a widget in QtCreator stylesheet property as below.

    image: url(:/images/remote.jpg);

    Image appears fine on the widget.

    But when I place pushbuttons above this widget the whole image of the underlying widget is shown (fits into) the push button widget. Transparency settings of push button seems to make no difference in the behaviour.
    How can I have a transparent pushbutton which shows the actual part of the widget image under it, rather than the whole image of underyling widget ?

    1 Reply Last reply
    0
    • mrjjM Offline
      mrjjM Offline
      mrjj
      Lifetime Qt Champion
      wrote on last edited by mrjj
      #2

      Hi the QPushbutton inherited the image from the parent widget so as long as you dont give it a new image, it will use parents.

      please see
      https://forum.qt.io/topic/58827/solved-transparent-background-behind-button-layout-on-png/3

      basically, you give your bg widget a name and make sure image is only for that one.
      QWidget #mybox {
      background-image: url(:/Untitled-1.png);
      }

      1 Reply Last reply
      1
      • ? Offline
        ? Offline
        A Former User
        wrote on last edited by
        #3

        That solved it.
        Thank you very much!

        1 Reply Last reply
        0
        • I Offline
          I Offline
          ivantad
          wrote on last edited by
          #4

          Thank you mrjj ! that was it !

          1 Reply Last reply
          1

          • Login

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