Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-41960

QtWebEngine is not able to render transparent backgrounds.

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • P4: Low
    • 5.6.0 RC
    • 5.4.0 Beta, 5.4.1, 5.5.0 Alpha
    • WebEngine
    • None
    • OSX 10.10 and Ubuntu 14.04.
    • 99e98f7bf6aec78fe0d647fb898e65d13ff522e4

    Description

      Consider the following simple case:

        QWidget *root = new QWidget(this);
        root->setStyleSheet("background:red");
        root->setAutoFillBackground(true);
      
        setCentralWidget(root);
      
        QWebView* web = new QWebView(root);
      
        web->setHtml("<html><head><style>body {background-color: transparent;}"
                     "h1 {background-color: #00ff00;}</style></head>"
                     "<body><h1>This is heading 1</h1></body></html>", 
                     QUrl("http://localhost"));
        web->move(0, 0);
        web->show();
      

      This works just fine with WebView, now do the same with WebEngine:

        QWidget *root = new QWidget(this);
        root->setStyleSheet("background:red");
        root->setAutoFillBackground(true);
      
        setCentralWidget(root);
      
        QWebEngineView* web = new QWebEngineView(root);
      
        web->setHtml("<html><head><style>body {background-color: transparent;}"
                     "h1 {background-color: #00ff00;}</style></head>"
                     "<body><h1>This is heading 1</h1></body></html>", 
                     QUrl("http://localhost"));
        web->move(0, 0);
        web->show();
      

      It renders a white block as background instead. This seems like a regression with webengine.

      I did some commit spelunking and found this:

      https://qt.gitorious.org/qt/qtwebengine/commit/622f613bc4d41f9d3784fc0249e71ce0d3102a97

      So I reverted that change and recompiled Qt to try. But that didn't seem to help, I still get the same white background block.

      At this point I am not concerned about having a local change with Qt so if there is a workaround that can be easily applied to WebEngine locally I would be happy to try that.

      Attachments

        For Gerrit Dashboard: QTBUG-41960
        # Subject Branch Project Status CR V

        Activity

          People

            jturcott Jocelyn Turcotte
            tobiashieta Tobias Hieta
            Votes:
            12 Vote for this issue
            Watchers:
            26 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes