> Sent: Wednesday, January 28, 2015 at 1:23 PM > From: "Giuseppe D'Angelo" <giuseppe.dang...@kdab.com> > To: interest@qt-project.org > Subject: Re: [Interest] How to prevent painter from ending() on render() > > Il 28/01/2015 18:50, Jason H ha scritto: > > So how can someone render multiple widgets on multiple pages? It seems the > > only option is manual draw***() commands on the painter, but that is > > tedious, and Qt has a nice Layout manager system... > > 1) Have you tried first opening a QFile, then using QPDFWriter's ctor > that takes a QIODevice? I would be really annoyed if closing the painter > would close the device on my back. Annoyed to the point to call it a Qt bug. > > 2) Have you tried painting the widget on a QPicture, then replaying the > QPicture on the PDF?
I got on IRC, and got a suggestion to have it work by wrapping the render call in an QPainter wrapping the QPdfWriter. _printer = new QPdfWriter (filename); _printer->setResolution(150); QPainter widgetRenderer(_printer); section->render(&widgetRenderer, QPoint(0, verticalOffset), QRegion(),QWidget::DrawChildren); The intermediary widgetRenderer doesn't end the painting on the PDF. :-) _______________________________________________ Interest mailing list Interest@qt-project.org http://lists.qt-project.org/mailman/listinfo/interest