Fix copy and pasting image from clipboard
If the QMimeData contains an image, it actually has a mime type of application/x-qt-image. At least in some cases accessing the image/* data returns a 0 length array. Accessing the data via ->imageData works however. So we use that as our accessor and pass it to the preview dialog.
This commit is contained in:
parent
512db8c6ff
commit
cefe5fe719
4 changed files with 27 additions and 6 deletions
|
|
@ -306,8 +306,9 @@ FilteredTextEdit::insertFromMimeData(const QMimeData *source)
|
|||
const auto audio = formats.filter("audio/", Qt::CaseInsensitive);
|
||||
const auto video = formats.filter("video/", Qt::CaseInsensitive);
|
||||
|
||||
if (!image.empty()) {
|
||||
showPreview(source, image);
|
||||
if (source->hasImage()) {
|
||||
QImage img = qvariant_cast<QImage>(source->imageData());
|
||||
previewDialog_.setPreview(img, image.front());
|
||||
} else if (!audio.empty()) {
|
||||
showPreview(source, audio);
|
||||
} else if (!video.empty()) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue