diff options
author | Eirik Aavitsland <eirik.aavitsland@qt.io> | 2022-08-31 10:29:25 +0200 |
---|---|---|
committer | Eirik Aavitsland <eirik.aavitsland@qt.io> | 2022-09-02 19:22:32 +0000 |
commit | 8cb78647e3d210e73a6dd4f0ca744b2887c482b7 (patch) | |
tree | 6c076a35377ba6dbc50491f8fdb5d0c1fdcaa0e3 /tests | |
parent | cf3461bab3507e834dbcaaefe59961102583675e (diff) |
Windows: avoid losing transparency when pasting images into Qt apps
Before Qt6, we would only request a DIBV5 format image from the
clipboard if that format was available without synthesizing. Then, in
commit 8fa91c75ad that check was believed to be needless, and
removed. However, it turns out that it is needed to avoid loosing
transparency information, so we revert that part and bring back the
check against synthesized DIBV5.
The logic is that some widely used apps will provide images in both
PNG and DIB on the clipboard, and only the former can have an alpha
channel. When we request a synthesized DIBV5 rather than a PNG, it
seems we only get the (opaque) DIB image repackaged as a DIBV5.
On Windows 11, there even seems to be an issue (possibly a Windows
bug) where, after asking for a synthesized DIBV5, the clipboard
contents is somehow changed in a way so that pasting again into other
(non-Qt) apps later will yield a corrupted (pixel-shifted) image. (It
looks like they get a DIBV5 when they expect a DIB). So avoiding
requests for synthesized DIBV5 also avoids triggering that issue.
Also add some logging outout to help future debugging.
Fixes: QTBUG-104872
Fixes: QTBUG-105338
Pick-to: 6.4 6.2
Change-Id: I33ffa2b50870b887a083e9bbb1b2234604e4d8ab
Reviewed-by: André de la Rocha <andre.rocha@qt.io>
Diffstat (limited to 'tests')
0 files changed, 0 insertions, 0 deletions