Details
-
Bug
-
Resolution: Unresolved
-
P2: Important
-
None
-
5.15.2, 6.2.4
-
None
Description
// Windows with alpha: Use blend function to update. QRect r = QHighDpi::toNativePixels(window->frameGeometry(), window); QPoint frameOffset(QHighDpi::toNativePixels(QPoint(window->frameMargins().left(), window->frameMargins().top()), static_cast<const QWindow *>(nullptr))); QRect dirtyRect = br.translated(offset + frameOffset); SIZE size = {r.width(), r.height()}; POINT ptDst = {r.x(), r.y()}; POINT ptSrc = {0, 0}; BLENDFUNCTION blend = {AC_SRC_OVER, 0, BYTE(qRound(255.0 * rw->opacity())), AC_SRC_ALPHA}; RECT dirty = {dirtyRect.x(), dirtyRect.y(), dirtyRect.x() + dirtyRect.width(), dirtyRect.y() + dirtyRect.height()}; UPDATELAYEREDWINDOWINFO info = {sizeof(info), nullptr, &ptDst, &size, m_image->hdc(), &ptSrc, 0, &blend, ULW_ALPHA, &dirty}; const BOOL result = UpdateLayeredWindowIndirect(rw->handle(), &info);
The parameters to UpdateLayeredWindowIndirect are incorrect. Currently, this code only works when the window's position is (0, 0).
When updating the whole HWND:
ptSrc is the top-left in m_image. It should be "offset + frameOffset" instead of "{0, 0}".
dirty is the rectangle in HWND's client area. It's not the rectangle in m_image. It should be "br" instead of "br.translated(offset + frameOffset)".
pptDst should be NULL. The flush method should only update the content of the window, instead of changing the position. The position is computed incorrectly for child window when HDPI is on.
Attachments
Issue Links
- relates to
-
QTBUG-50505 Windows: Qt::WindowTransparentForInput doesn't work on child windows
-
- Reported
-