Support pasting image/svg+xml format straight from supporting applications
This commit is contained in:
parent
c4b788917f
commit
94441e68fd
2 changed files with 20 additions and 2 deletions
|
|
@ -158,6 +158,8 @@ PreviewUploadOverlay::setPreview(const QImage &src, const QString &mime)
|
|||
void
|
||||
PreviewUploadOverlay::setPreview(const QByteArray data, const QString &mime)
|
||||
{
|
||||
nhlog::ui()->info("Pasting {} bytes of data, mimetype {}", data.size(), mime.toStdString());
|
||||
|
||||
auto const &split = mime.split('/');
|
||||
auto const &type = split[1];
|
||||
|
||||
|
|
@ -166,6 +168,11 @@ PreviewUploadOverlay::setPreview(const QByteArray data, const QString &mime)
|
|||
filePath_ = "clipboard." + type;
|
||||
isImage_ = false;
|
||||
|
||||
if (mime == "image/svg+xml") {
|
||||
isImage_ = true;
|
||||
image_.loadFromData(data_, mediaType_.toStdString().c_str());
|
||||
}
|
||||
|
||||
setLabels(type, mime, data_.size());
|
||||
init();
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue