Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Render existing Qt Widget into SVG

Tags:

qt

I have an exisiting Graph displayed as QWidget which I can already save to a bitmap using grab():

QPixmap image = grab();

Is there a Possibility to save that widget also to .svg?

Thanks!

like image 613
wuschelhase Avatar asked Oct 20 '25 01:10

wuschelhase


1 Answers

QSvgGenerator generator;
generator.setFileName(path);
generator.setSize(widget->size());
generator.setViewBox(widget->rect());
generator.setTitle(tr("Your title"));
generator.setDescription(tr("some desscription"));
widget->render(&generator);
like image 124
Marek R Avatar answered Oct 22 '25 03:10

Marek R



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!