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

Transparent QWindow appears opaque (Windows)

    XMLWordPrintable

Details

    • Bug
    • Resolution: Invalid
    • Not Evaluated
    • None
    • 6.5, 6.6
    • GUI: Window management
    • None
    • Tested with Windows11
    • Windows

    Description

      Since Qt 6.5 we have top level windows showing incorrectly opaque in our application.

      Here's a minimal repro:

      QWindow window;
      // implicitly required windows platform window to be layered 
      window.setColor(Qt::transparent); 
      window.setFlags(Qt::FramelessWindowHint);
      window.setFlags(Qt::NoDropShadowHint);
      window.setFlags(Qt::WindowStaysOnTop);
      window.show();
      

      When we build against Qt 6.3 this window show totally transparent, as intended. Since Qt 6.5 the window shows an opaque white. Some debugging reveals that the windows platform window is no longer created without the `WS_EX_LAYERED` style, although I haven't got to the bottom of why this is.

      The following change fixes the issue:

      QWindow window;
      // implicitly required windows platform window to be layered 
      window.setColor(Qt::transparent); 
      window.setFlags(Qt::FramelessWindowHint);
      // window.setFlags(Qt::NoDropShadowHint);
      // window.setFlags(Qt::WindowStaysOnTop);
      window.show();
      

      Thanks.

      Attachments

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

        Activity

          People

            vestbo Tor Arne Vestbø
            leadbelly Ben Leadbetter
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes