PDA

View Full Version : Drag and drop an image on a QTextEdit



somebob
16th March 2020, 11:56
I'm following the example from https://www.learnpyqt.com/examples/megasolid-idiom-rich-text-editor/

When I drag&drop an image from a web browser instead of getting the image I typically get this:

13355

I say typically, because from some web pages (like a google image search results) I get the actual image instead. I noticed while playing around with it that the former is giving me the QUrl (and thus triggering the if source.hasUrls(): code) instead of giving me a way to access the image data. The latter just returns the data for the image from the browser directly which drops in fine.

Do I need to manually download the image myself using the QUrl or is there some way to get the image data itself when this happens?