Use a QByteArray as the output device for QSvgGenerator and copy it to
the clipboard using QClipboard::setMimeData().

On 09/14/2013 10:12 AM, helfertho...@free.fr wrote:
> Hi,
> 
> I am using the qgraphicsview/qgraphicscene framework. I am able to write file 
> from the drawn scene to multiple file formats, including svg using QtSvg. I 
> want to be able to copy the scene to the clipboard. For a bitmap copy, i am 
> using the following code:
> 
>        // Selections would also render to the file
>       this->scene->clearSelection();
>       // Create the image with the exact size of the shrunk scene
>       QImage image(scene->sceneRect().size().toSize(), QImage::Format_ARGB32);
>       image.fill(Qt::transparent);
>       QPainter painter;
>       painter.begin(&image);
>       painter.setRenderHint(QPainter::Antialiasing);
>       this->scene->render(&painter);
>       painter.end();
>       QApplication::clipboard()->setImage(image,QClipboard::Clipboard);
> 
> which works great. However I wonder if I can do copy the scene as svg data to 
> the clipboard. Does anybody know how to do it ?
> 
> Thanks for any help.
> 
> Helfer Thomas

Attachment: signature.asc
Description: OpenPGP digital signature

_______________________________________________
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest

Reply via email to