When I try to set the background to semi transparent or transparent , the background gets black



  • As I mentioned the background goes black when I try to set it to transparent ot semi transparent.

    I tried this:

    @
    QPalette P;
    P.setBrush(QPalette::Background , Qt::transparent);
    setPalette(P);
    @

    and this:

    @
    this->setStyleSheet("QMainWindow {background:transparent}");
    @

    also some other things like using rgba.



  • the only valid way to do this that worked with me is:

    @
    setWindowOpacity(qreal)
    @

    but the problem with this is that I'm using widget that their parents is my mainwindow which I want it to be transparent , so if I set my main window to semi transparent using setWindowOpacity() it'll effect all of my widgets.


Log in to reply
 

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