diff --git a/src/utils/screenshotsaver.cpp b/src/utils/screenshotsaver.cpp index 95f8d3d3..8f26795f 100644 --- a/src/utils/screenshotsaver.cpp +++ b/src/utils/screenshotsaver.cpp @@ -21,6 +21,7 @@ #include "src/utils/filenamehandler.h" #include "src/utils/systemnotification.h" #include +#include #include #include #include @@ -51,8 +52,22 @@ void ScreenshotSaver::saveToClipboard(const QPixmap& capture) // Otherwise only save to clipboard else { SystemNotification().sendMessage( - QObject::tr("Capture saved to clipboard")); - QApplication::clipboard()->setPixmap(capture); + QObject::tr("Capture saved to clipboard")); + + QByteArray array; + QBuffer buffer{&array}; + QImageWriter imageWriter{&buffer, "JPG"}; + imageWriter.write(capture.toImage()); + + QPixmap jpgPixmap; + bool isLoaded = jpgPixmap.loadFromData( + reinterpret_cast(array.data()), array.size(), "JPG"); + if(isLoaded) { + QApplication::clipboard()->setPixmap(jpgPixmap); + } + else { + QApplication::clipboard()->setPixmap(capture); + } } }