Question

I used QSS to style a QPushButton. I wanted to use two images to be set as the background-image. One for normal state & one when the button is pressed. But image shows with a border around it.

My code:

QPushButton{
background-image: url();
border-image: url(images/back/up.png);
color:rgb(255,255,255);
border-width: 2px;
border-radius:  22px;
}
QPushButton::pressed {
border-image:url(images/back/up1.png);
border-width: 2px;
background-image: url();
color:rgb(255,255,255);
}

enter image description here

Was it helpful?

Solution

Try following style snippet. You only need to change the background-image during the :pressed state.

QPushButton{
background-image: url(images/back/up.png);
color:rgb(255,255,255);
border-width: 2px;
border-radius: 22px;
}

QPushButton::pressed {
background-image:url(images/back/up1.png);
}
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top