I am using Qt Creator 4.0.2 Based on Qt 5.7.0 (GCC 4.9.1 20140922 (Red Hat 4.9.1-10), 64 bit).
I am displaying an image on my widget and placing QButtons and QLabels on top of it.
It looks something like this:
I want to make the button semi-transparent. There isn't any property for it. I tried the answer given on another thread as:
ui->button->setStyleSheet("background-color: rgba(255, 255, 255, 50);");
But it didn't work for me. I also tried setStyleSheet("background:transparent;")
But it didn't work.
Please suggest a way of doing it.
setting the bg color to "transparent" is not enough, you need to set the "border-style: outset;" and nothing else in the main window/widget...
ui->pushButton_7->setStyleSheet("background-color: transparent; style: outset;");
then:
do:
ui->pushButton_7->setStyleSheet("background-color: #FF0011");
auto qgoEffect = new QGraphicsOpacityEffect(this);
qgoEffect->setOpacity(0.15);
ui->pushButton_7->setGraphicsEffect(qgoEffect);
ui->pushButton_7->setAutoFillBackground(true);