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

Jason H jhihn at gmx.com
Wed Jan 28 18:50:11 CET 2015


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...






More information about the Interest mailing list