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

QQuickWidget background is black instead of transparent in a full-screen display

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • P2: Important
    • None
    • 5.6.0, 5.15.0
    • Quick: Widget
    • None
    • Windows 7
      Windows 10
    • Windows

    Description

      With the following code, the QWebEngineView window's background is not displayed transparently but in black when the window is set in full-screen display.

          QWebEngineView view;
          view.page()->setBackgroundColor(Qt::transparent);
          view.setHtml("<html><div><p>Hello</p></div>"
                   "<style type=\"text\/css\">body {font-size: 7em;color: red;}"
                   "div {width: 100%;height: 100%;border: 25px solid blue;"
                   "text-align: center;background-color: transparent;pointer-events: none;}"
                   "</style></html>", QUrl("http://localhost"));
      
          view.setAttribute(Qt::WA_TranslucentBackground);
      
          view.setWindowState(Qt::WindowFullScreen);
          view.setWindowFlags(Qt::FramelessWindowHint | Qt::BypassWindowManagerHint);
          view.show();
      

      If you comment out the line of "view.setWindowState(Qt::WindowFullScreen);", the transparent background was displayed correctly.

      The issue is the same with QQuickWidget ( quickwidget.zip ):

          QQuickWidget view;                                                                                                                                                                
          view.setAttribute(Qt::WA_TranslucentBackground);                                                                                                                                  
          view.setClearColor(Qt::transparent);                                                                                                                                              
          view.setWindowFlags(Qt::FramelessWindowHint);                                                                                                                                     
          view.setWindowState(Qt::WindowFullScreen);                                                                                                                                        
          view.setResizeMode(QQuickWidget::SizeRootObjectToView);                                                                                                                           
          view.setSource(QUrl("qrc:/test.qml"));                                                                                                                                            
          view.show(); 
      

      Switching window by alt-tab makes it work. Probably refresh/repaint issue. It is not reproducible on Linux.

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            tvete Paul Olav Tvete
            dongmei Dongmei Wang
            Votes:
            1 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:

              Gerrit Reviews

                There are no open Gerrit changes