Widgets showing the whole background image of the underlying widget



  • 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 ?


  • Qt Champions 2016

    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);
    }



  • That solved it.
    Thank you very much!


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.