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

Windows: Semi-transparent foreign window flicker

    XMLWordPrintable

Details

    • Bug
    • Resolution: Out of scope
    • P2: Important
    • None
    • 6.7.1
    • QPA: Windows
    • Visual Studio 2022. Windows 10 (x64) 22H2.
    • Windows

    Description

      I'm experiencing flickering problems when adding semi-transparent "foreign" native Win32 windows to a Qt application using QWindow::fromWinId and QWidget::createWindowContainer.

      The problem seem to be caused by Qt being unable to set the WS_EX_COMPOSITED window style required to enable double-buffering when drawing. I've been unable to achieve this through Qt. Still, I've been able to work around the problem by manually setting SetWindowLongW(wnd, GWL_EXSTYLE, GetWindowLongW(wnd, GWL_EXSTYLE) | WS_EX_COMPOSITED) on the parent Qt window, but this feels like a hack that leads to other drawing artifacts.

      Steps to reproduce:

      • Clone https://github.com/forderud/QtNativeWindow
      • Open solution with Visual Studio.
      • Stop defining AVOID_FLICKERING_WITH_COMPOSITED_WINDOW to deactivate the work-around.
      • Build solution and start QtNativeWindow.
      • Observe that the green and blue circles flicker when the main window is resized.

      See Screen Recording 2024-08-14 160433.mp4 for a video with composition disabled.

      Attachments

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

        Activity

          People

            mecfc Miguel Costa
            forderud Fredrik Orderud
            Votes:
            1 Vote for this issue
            Watchers:
            8 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes