0

Is it possible to make the background of the button transparent, but at the same time to add an icon?

As I understood I should use:

button -> setStyleSheet("background-color: rgba(255, 255, 255, 0); ");

It works fine, but I want to add an icon too. I have a nice window's background and want to see it through my buttons, but buttons should have icon - black arrow.

Kuba hasn't forgotten Monica
  • 95,931
  • 16
  • 151
  • 313
sb69lg
  • 15
  • 1
  • 7

1 Answers1

0

It is possible using Qt 6 C++. I found a way how to do it:

QPixmap buttonImage("/*path*/");
QIcon buttonIcon(buttonImage);
// make the button transparent
button->setStyleSheet("background-color: rgba(255, 255, 255, 0); ");
// add icon
button->setIcon(buttonIcon);
sb69lg
  • 15
  • 1
  • 7