Print or take a screen of a QWidget in order to put it in a QTextDocument
-
Hello all,
I need to create a PDF report, so i've managed so far to insert text, header, footer, tables, graphics and images in the document, using QTextDocument/QPrinter/QPainter.
I've been asked to insert a thermometer (with a variable filling rate of course) in the report. First I tried to draw it myself, but i'm not that good of a designer ;)
So i have the idea of using an existing QWidget that can look like what i want (check this for instance http://qt-apps.org/content/show.php/AnalogWidgets?content=87780 ) and like i want to know if it's possible to "print" or "screen" the QWidget so i can put that image in the report.
Thanks in advance !
-
Hi
Have you looked at render() ?
It can make the widget draw it to other surfaces which hopefully would include PDFQPixmap pixmap(widget->size());
widget->render(&pixmap);