bugfix: copy to clipboard as image now works better on Windows (before it was not that easy to paste into PowerPoint!)

This commit is contained in:
kriegerj 2015-08-26 16:11:41 +02:00
parent 34631fb66f
commit e1743eb396

View File

@ -3056,8 +3056,14 @@ void JKQtBasePlotter::copyPixelImage() {
//qDebug()<<"clipboard before adding content:\n"<<clipboard->mimeData()->formats(); //qDebug()<<"clipboard before adding content:\n"<<clipboard->mimeData()->formats();
//clipboard->setImage(png); //clipboard->setImage(png);
clipboard->clear(); clipboard->clear();
clipboard->setPixmap(QPixmap::fromImage(png));
QMimeData* mime=new QMimeData(); QMimeData* mime=new QMimeData();
mime->setImageData(png); mime->setImageData(QPixmap::fromImage(png));
QBuffer pngbuf;
png.save(&pngbuf, "png");
mime->setData("image/x-png", pngbuf.data());
png.save(&pngbuf, "bmp");
mime->setData("image/bmp", pngbuf.data());
mime->setData("image/svg+xml", svgdata); mime->setData("image/svg+xml", svgdata);
clipboard->setMimeData(mime); clipboard->setMimeData(mime);
//qDebug()<<"clipboard after adding content:\n"<<clipboard->mimeData()->formats(); //qDebug()<<"clipboard after adding content:\n"<<clipboard->mimeData()->formats();