QT pushbutton with image how to transparent/opacity

1.8k Views Asked by At

I have a pushbutton and was styled in QSS to assign an image like this

QPushButton[type="buttonImgType"] {
    image: url(:images/svg/myIcon.svg);
    image-position: center;
    min-height: 42px;
    min-width: 130px;
}

I want this button to display as if it is faded or like say 50% transparent when it is not checked and show full image when it is. But I cant find a way how to using the properties in QT for buttons.

Anyone have idea how to?

1

There are 1 best solutions below

0
Parisa.H.R On

Try This Style :

QPushButton
{
   background-color: transparent;
   border: none;

}
QPushButton:pressed
{
   background-color:rgba(239, 41, 41,50);
   border:2px solid black;
}

until QPushButton has border it didn't transparent .