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

Transparent QWindow appears opaque (Windows)

XMLWordPrintable

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

      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.

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

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

              Created:
              Updated:
              Resolved:

                There are no open Gerrit changes