I have a QPushButton in my application and I simply want to change the opacity (i.e. alpha) of it. What is the best way to do this?
Printable View
I have a QPushButton in my application and I simply want to change the opacity (i.e. alpha) of it. What is the best way to do this?
For general background color use QPalette::Window or QPalette::Text
Code:
color.setAlpha(130); pushButton->setPalette(palette);
There is another way to setup using style sheet
You can subclass the widget and use QPainter::setOpacity() to make it semi transparent.
use this simple code guys it worked for me .....
ui->male_button->setFlat(TRUE);
ui->male_button->setStyleSheet("* { background-color: rgba(0,125,0,0) }");