QT push button style sheet issue
Hi,
I have a push button and i want to set its style for normal, hover and pressed state. The style sheet code i used is-
QPushButton#myButton {
background-image: url(:/image/normal.bmp);
border: none;
}
QPushButton#myButton:pressed {
background-image: url(:/image/pressed.bmp);
border: none;
}
QPushButton#myButton:hover{
background-image: url(:/image/hover.bmp);
border: none;
}
with this style sheet, normal and hover images are displayed but when i pressed button then button is not showing image for pressed state. Image for hover state is not changed in the pressed state image.
Any suggestion what i am doing wrong?
Re: QT push button style sheet issue
You have to change the order of pressed and hover. Then it works.
Re: QT push button style sheet issue
Re: QT push button style sheet issue
it doesn't work for me .
I used this
QPushButton#pushButton {
background-color: red;
border-style: outset;
border-width: 2px;
border-radius: 10px;
border-color: beige;
font: bold 14px;
min-width: 10em;
padding: 6px;
}
QPushButton#pushButton:pressed {
background-color: rgb(224, 0, 0);
border-style: inset;
}
QPushButton#pushButton:hover {
background-color: rgb(224, 255, 0);
border-style: inset;
}
Re: QT push button style sheet issue
Well, aslo you have to change the order...
Code:
background-color: rgb(224, 255, 0);
border-style: inset;
}
background-color: rgb(224, 0, 0);
border-style: inset;
}