Unsolved How to add transparency image in QT5.5.1 ?
-
@mrjj Yes it found the image correctly. That's why it is working correctly in qt 4.8.7 version if I change the Kit configuration.
-
Ok so how does it "not work" ?
if i use your code ( with less trans ) i see
-
@Revathi said in How to add transparency image in QT5.5.1 ?:
if I change the Kit configuration.
Do you get any error after changing kit and running the same code with 5.5.1?
-
@Ratzz no. I did not get any error while changing kit.
-
@Revathi
but what do you see ?
"It is not working" is a very poor description of your actual issue. -
I am getting like this only.
-
@Revathi
Ok
Its working here with Qt5.12
Can you try
trans->setGeometry(100, 100, 180, 180);
( make buttons slightly less than yellow label) -
If I have changed geometry , the output will be like the above picture (in qt 5.5.1)
-
@Revathi
Ok. just a test.
Maybe its something in 5.5.1. Can you try a newer version ? -
@mrjj the transparency is working now in qt 5.5.1. The code is given below,
QLabel* bg = new QLabel(&w); bg->setGeometry(100, 100, 200, 200); bg->show(); bg->setText("Hello"); bg->setStyleSheet("background-color: yellow;"); QPushButton* trans = new QPushButton(&w); trans->setGeometry(100, 100, 200, 200); QPixmap pixmap("transparent.png"); QIcon ButtonIcon(pixmap); trans->setIcon(ButtonIcon); trans->setIconSize(trans->size()); trans->setStyleSheet("border: None"); // It will make the image button as transparent trans->show();
If I have changed background color of QLabel, it will transparent to the image button window.
I hope it may help. Thank you all.