[Interest] How to prevent painter from ending() on render()

Igor Mironchik igor.mironchik at gmail.com
Wed Jan 28 19:10:28 CET 2015


Hi.

On Wed, 28 Jan 2015 20:50:11 +0300, Jason H <jhihn at gmx.com> wrote:

> I'm trying to print stuff out, QCharts, text, etc. Widgets basically. I  
> try to render() them to QPdfWiter, but each widget calls end() on  
> painter which then closes the file. This is not acceptable, as you can  
> never have more than one page. You have to call render() then newPage()  
> to create a new page, But thanks to render()'s end(), your file is  
> already closed. I tried using a PaintDeviceProxy to ignore all the  
> closes, but there's some thing amiss with the version I have.
>
> 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...

You can, for example, use QWidget::grab() to grab widget into pixmap and  
then draw pixmaps into QPdfWritter.

-- 
Best Regards,
Igor Mironchik.



More information about the Interest mailing list