Details
-
Bug
-
Resolution: Done
-
P2: Important
-
6.3.1
-
Device model: Dell Inspiron 5593 (15")
CPU: Intel i7-1065G7
GPU: Intel Iris Plus + NVIDIA GeForce MX230
OS: Windows 11 Home 21H2 (build 22000.856)
Compiler: MSVC 2019 x64
-
-
8cb78647e3 (qt/qtbase/dev) 8cb78647e3 (qt/tqtc-qtbase/dev) 8edb27d7df (qt/qtbase/6.4) 8edb27d7df (qt/tqtc-qtbase/6.4) 8edb27d7df (qt/tqtc-qtbase/6.4.0) 6d3f165c9f (qt/tqtc-qtbase/6.2)
Description
I'm unsure if the issue lies in Qt or in Windows.
Code
#include <QtGui> int main(int argc, char *argv[]) { QGuiApplication app(argc, argv); QImage img = app.clipboard()->image(); img.save("output.bmp"); // Removing this line does not change the outcome }
Steps to reproduce
- Use the Windows Snipping Tool ([Win]+[Shift]+S) to snip anything on screen. For maximum effect, ensure that the left edge of the snipped area has very different colours to the right edge.
- Build and run the code above.
- Open Microsoft Paint and paste the clipboard contents into Microsoft Paint.
Outcome
While output.bmp looks OK (like snip-ok.png), the pasted image is corrupted (like snip-corrupted.png).
It's as if a few columns from the right edge were transferred to the left edge; notice also the 3 red, green, and blue pixels at the bottom-left of the image.
Scope of issue
- This has been reproduced on a Windows 11 machine, but not Windows 10.
- If the call to QClipboard::image() and QImage::save() are deleted, then Step #3 doesn't produce a corrupted result. (This suggests it's an issue in Qt)
- This issue affects images pasted into Microsoft Paint and Microsoft OneNote, but it does not affect images pasted into Microsoft Word or written by img.save("output.bmp"). (This suggests it's an issue in Windows)
- This issue only affects images captured by the Windows Snipping Tool. It does not affect images copied from Microsoft Paint, and does not affect images put in the clipboard via QClipboard::setImage().
Attachments
Issue Links
- duplicates
-
QTBUG-100351 [REG 5.12 -> 6.2] Pasting an image in Windows is not converted to a QImage correctly.
- Closed
-
QTBUG-98786 QMimeData: wrong image pasted from clipboard
- Closed
- is duplicated by
-
QTBUG-105319 Saving a picture from a clipboard using QImage::save corrupt the picture
- Closed
For Gerrit Dashboard: QTBUG-104872 | ||||||
---|---|---|---|---|---|---|
# | Subject | Branch | Project | Status | CR | V |
429765,5 | Windows: avoid losing transparency when pasting images into Qt apps | dev | qt/qtbase | Status: MERGED | +2 | 0 |
430462,2 | Windows: avoid losing transparency when pasting images into Qt apps | 6.4 | qt/qtbase | Status: MERGED | +2 | 0 |
430465,2 | Windows: avoid losing transparency when pasting images into Qt apps | tqtc/lts-6.2 | qt/tqtc-qtbase | Status: MERGED | +2 | 0 |