How to set icon at different modes?
Mobile and Embedded
4
Posts
3
Posters
5.0k
Views
1
Watching
-
wrote on 24 Sept 2010, 08:18 last edited by
Hi,
I try to change the image of a qpushbutton in disabled mode
This is just editing the Normal mode.
@
setIcon(QIcon(":/images/image.bmp"));
@Thanks
[edit:syntax hihlight added / Denis Kormalev]
-
wrote on 24 Sept 2010, 09:03 last edited by
You should create QIcon object and set additional pixmap for QIcon::Mode==Disabled
-
wrote on 24 Sept 2010, 15:14 last edited by
You can use style sheet:
@
QPushButton {
border-image: url(:/images/bouton-retour.png);
background-color: rgba(255, 255, 255, 0);
}QPushButton::pressed,QPushButton:disabled {
border-image: url(:/images/bouton-retour-desactive.png);
}
@[edit: fixed code / chetankjain]
-
wrote on 24 Sept 2010, 18:44 last edited by
cheng, border-image is not exactly what needed for author. It will fill borders, but not change icon.
1/4