Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

How to set QGraphicsWebView background transparent?



  • I have background video playing or showing another application, then launch webapp which uses QGraphicsWebView. I would like to able to see the background application or video. How could I make QGraphicsWebView to have transparent background? QWebView works in that way, but I have not find a way to set with QGraphicsWebView. Thanks!



  • Something like this should do the job

    view->setStyleSheet("background:transparent");
    view->setAttribute(Qt::WA_TranslucentBackground);
    view->setAttribute(Qt::WA_OpaquePaintEvent, false);
    scene.setBackgroundBrush(QBrush(Qt::transparent));


Log in to reply