PDA

View Full Version : Make QPrinter setPrintRange working



rivci
31st May 2011, 07:18
Hi all,

I want to print just some pages from a collection of pages from QPrintPreviewWidget.

I have a QPrinter object (consider as "printer") and a QPrintPreviewWidget object (consider as "printPreviewWidget"). Then I pass printer as my printPreviewWidget's contructor argument.

Code.. code.. and code..

Then I write this code

consider I have 10 pages in my printPreviewWidget



printer->setPrintRange(QPrinter::PageRange);
printer->setFromTo(2,3);
printPreviewWidget.updatePreview();
printPreviewWidget.print();


These codes don't work at all, still all pages is printed. Someone got any solution?

printer->setCopyCount(2) <- doesn't work either

ChrisW67
31st May 2011, 10:01
Does your rendering code, when it responds to the paintRequested() signal, taking any notice of the print range reported by the printer?