Bug 242932

Summary: x11-toolkits/qt5-gui: QClipboard sometimes fails to paste the image
Product: Ports & Packages Reporter: Yuri Victorovich <yuri>
Component: Individual Port(s)Assignee: freebsd-kde (group) <kde>
Status: Closed Unable to Reproduce    
Severity: Affects Only Me CC: anythingwithawire, tcberner
Priority: --- Flags: tcberner: maintainer-feedback+
Version: Latest   
Hardware: Any   
OS: Any   
Attachments:
Description Flags
testcase.shar none

Description Yuri Victorovich freebsd_committer freebsd_triage 2019-12-28 03:32:25 UTC
Created attachment 210273 [details]
testcase.shar

QClipboard sometimes fails to paste the image that is present in the clipboard.

How to reproduce:
1. Compile the executable 'test' from the attached shar by running 'sh mk.sh'
2. In the Chromium browser go to https://wooda.co/wp-content/uploads/2018/02/Log-Type-E-Designer-Wooden-Chair-1.png It should display the picture of a wooden chair. With right mouse button open the menu, and select the "Copy image" item
3. Run the executable 'test'
4. It will most likely fail like this:
> $ ./test 
> has image: mime= "TIMESTAMP, TARGETS, SAVE_TARGETS, MULTIPLE, image/png, text/html, application/x-qt-image"
> INVALID! height=0!

Qt says that the image in the clipboared is zero-sized. However, this X11 command pastes it without a problem:
> xclip -selection clipboard -t image/png -o > x.png

For a comparison, when I do the same in the Firefox browser Qt pastes the image fine:
> $ ./test 
> has image: mime= "TIMESTAMP, TARGETS, MULTIPLE, SAVE_TARGETS, text/html, text/_moz_htmlinfo, text/_moz_htmlcontext, image/png, image/bmp, image/x-bmp, image/x-MS-bmp, image/x-icon, image/x-ico, image/x-win-bitmap, image/vnd.microsoft.icon, application/ico, image/ico, image/icon, text/ico, image/jpeg, image/tiff, application/x-qt-image"
> Valid: size= 427 x 600


Curiously, sometimes, every once in 15-20+ times, Qt is able to paste the image even when Chromium copied it into the clipboard.
Comment 1 Tobias C. Berner freebsd_committer freebsd_triage 2022-03-18 20:29:45 UTC
Hi Yuri


Can you still reporoduce this?


mfg Toibas
Comment 2 Yuri Victorovich freebsd_committer freebsd_triage 2022-03-18 21:29:57 UTC
No, can't reproduce it any more.
Comment 3 Impish 2022-10-19 10:53:52 UTC
Based on my experience the image you got from Firefox was a base64 encoded inline image, which is recognised for the paste, and images that don't work were some other mime type.

It's frustrating, if this is the case, because it appears randomish until you realise. 

You can even copy from one mime image type that won't paste, paste that into Firefox, which converts it to base64 and then copy that image from Firefox and paste that in successfully.