KPrinter::pageSize() never changes in 3.1.4

Michael Goffioul goffioul at imec.be
Fri Oct 10 14:06:22 CEST 2003


For internal reasons you have first to build a QPainter object
on KPrinter. This will trigger the synchronization between
the KPrinter object and the selected options.

if (kprinter.setup())
{
    QPainter painter(&kprinter);
    /* now kprinter.pageSize() should return the correct value */
}


Todd Shoemaker wrote:
> Hello-
> 
> It appears that KPrinter::pageSize() will always return the same value
> no matter what is selected in KPrinter::setup().  So if I choose A4 in
> setup(), pageSize() always remains Letter on my machine.  This occurs
> on several different installs of KDE 3.1.4.  I built my version from
> source.  I tested this code on a previous version (3.1-15 RH9) and the
> pageSize did update.  QPrinter works fine.  And, this doesn't appear to
> affect the printing at all.  I can print 3x5 pages in Kate, and it
> looks OK in the preview, so it must just be the wrapper call
> pageSize().  Here's the code snippet:
> 
> -----------------------------------------
> 
> KPrinter kprinter;
> if (kprinter.setup())
> {
>   cerr << "KPrinter name: " << kprinter.printerName() << "\n";
>   cerr << "KPrinter page size: " <<
> pageSizeToPageName(kprinter.pageSize()) << "\n";
> }
> 
> QPrinter qprinter;
> if (qprinter.setup())
> {
>   cerr << "QPrinter name: " << qprinter.printerName() << "\n";
>   cerr << "QPrinter page size: " <<
> pageSizeToPageName((KPrinter::PageSize)qprinter.pageSize()) << "\n";
> }
> 
> -----------------------------------------
> 
> I always get the same pageSize() with the kprinter code block in 3.1.4.
>  Looking at the kprinter.cpp code, it appears that what may be
> happening is that the QMap does not have the key value it is asking
> for, so the default is always returned.  


-- 
------------------------------------------------------------------
Michael Goffioul		IMEC-DESICS-MIRA
e-mail: goffioul at imec.be	(Mixed-Signal and RF Applications)
Tel:    +32/16/28-8510		Kapeldreef, 75
Fax:    +32/16/28-1515		3001 HEVERLEE, BELGIUM
------------------------------------------------------------------




More information about the kde-print mailing list