Important: Please read the Qt Code of Conduct -

QWebEngineView with transparent bg always on top

  • What I expect:

    • QWebEngineView with a translucent background

    • QWidget overlay on QWebEngineView

    Codes are:

    int main(int argc, char *argv[])
        QApplication app(argc, argv);
        QMainWindow mainWindow;
        QWebEngineView view(&mainWindow);
        view.setGeometry(50, 50, 300, 300);
   >setBackgroundColor(Qt::transparent); /// <- #1 make web engine view bg transparent
        QWidget overlay(&mainWindow);
        overlay.setGeometry(0, 0, 100, 100);
        overlay.raise(); /// <- #2 make overlay widget on top
        mainWindow.resize(400, 400);;
        return app.exec();

    Result is:

    Problem is:
    QWebEngineView overlayed on QWidget.
    QWidget cannot overlay on QWebEngineView when QWebEngineView has transparent bg.

    How to solve it?

    ps: problem appears on Windows 10, Qt 5.15.0 with msvc2019

  • This post is deleted!

Log in to reply