setStyleSheet with background image and custom alpha level



  • I have a panel which i setStyleSheet("background-image...") and it displays my image nicely. But what i want to do now is to be able to set the alpha level for the image, so that i can see (there is another image below the panel) what is below the image. I know that i can set the alpha level using background-colour, but right now i am using background-image, if i set background color(0,0,0,100), it will turn my panel to alpha 100, but my image will also be gone as it will be set to color RGB(0,0,0).

    So is there any way i can continue using setStyleSheet background-image and set the alpha level for the image? Maybe load my image into QImage or something, set the alpha level, then set it as my stylesheet background?



  • Try with this setting

    setAttribute(Qt::WA_TranslucentBackground);
    

    http://doc.qt.io/qt-4.8/qwidget.html#transparency-and-double-buffering


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.