[Qt-interest] QPrinter & QPainter

David Boddie david.boddie at nokia.com
Fri Mar 27 17:29:03 CET 2009


Rick Vernam wrote:

> I'm thinking I should be able to define the printer & the painter like so:
> 
> class ReceiveLoadDialog : public QDialog
> {
> Q_OBJECT
> public:
> [ ... ]
> 
> private:
> [ ... ]
> QPrinter printer;
> QPainter painter;
> 
> [ ... ]
> };

[...]

> At the printer, I get nothing.  Not a blinking light, nothing.
> Cups says everything is just fine - if I print a test page, it comes out
> just great.
> So, I'm thinking it must be possible to do what I'm trying to do here -
> any ideas?

Just a couple of things to try:

 1. Call newPage() after painting, but before you close the painter.
 2. Create the QPrinter object on the heap when you start printing
    and delete it when you have finished.

Do either of these approaches work for you?

David
-- 
David Boddie
Senior Technical Writer
Nokia, Qt Software



More information about the Qt-interest-old mailing list