1 Attachment(s)
Q3Canvas Printing Problem on Windows XP, but OK on Solaris
On Windows, Q3Canvas Printing to a PDF file or to an actual printer is not working. Canvas items are printed with reasonable font sizes, but the positions are very broken -- all overlapping in the top-left corner. It looks to be a scaling problem -- the relative positions of text (relative to each other) seem to be correct. On Solaris though, printing is working properly.
SEE IMAGES: http://cadswes2.colorado.edu/~philw/...Q3CanvPrtProb/
http://cadswes2.colorado.edu/~philw/...Bad-Detail.gif
Qt4 Version: 4.3.3
Windows Platform: Microsoft Windows XP, Service Pack 2
Simplified code snippet (similar results):
Code:
const int userResp = printDlg.exec();
{
Q3Canvas* actQCanvas = _activeCanvas->canvas();
QRect actQCanvasRect
= actQCanvas
->rect
();
actQCanvas->drawArea (actQCanvasRect, &pPainter, false);
}
1 Attachment(s)
Re: Q3Canvas Printing Problem on Windows XP, but OK on Solaris
Update: We are having a similar problem with printing Q3Tables. OK on Solaris, Bad graphics on Windows XP.
SEE: http://cadswes2.colorado.edu/~philw/...3TableToo.html
Qt4 Version: 4.3.3
Windows Platform: Microsoft Windows XP, Service Pack 2
http://cadswes2.colorado.edu/~philw/...Bad-Detail.gif
Q3Canvas and Q3Table Printing Problem on Windows XP, but OK on Solaris
Trolltech Support was able to reproduce these printing problems with Q3Canvas and Q3Table, apparently in Qt 4.4. See Bug Number 216354 on http://trolltech.com/developer/task-tracker/ .
Re: Q3Canvas Printing Problem on Windows XP, but OK on Solaris
As I now understand ... A QPrinter should NEVER be created with QPrinter::HighResolution if it is to be used to print (i.e. "draw" to a QPrinter) any widgets (e.g. Q3Canvas or Q3Table) that are displayed on the screen.
Unfortunately, the deprecated Qt3 QPrinter::PrinterResolution value is interpreted as QPrinter::HighResolution ON WINDOWS. (On Solaris, it is instead interpreted as QPrinter::ScreenResolution -- so use of that deprecated value didn't have any problems).
Part of my confusion was that there is no indication that QPrinter::HighResolution is not to be used for printing widgets (not stated in the documentation). AND the documentation for "ScreenResolution" states that that "should only be used for drafts". [It needs to be used for printing ALL widgets created within the GUI].
An additional source of confusion was that, using the sample code shown for Q3Canvas::drawArea, with the printer configured with "ScreenResolution" the output is just one page, and is generally blank if the canvas size is large, as ours is. But as it turns out, when using our slightly substantial application code designed to create multiple output pages with only the portion of the canvas containing actual objects, printing works -- when the deprecated "PrinterResolution" value is replaced with "ScreenResolution" (needed on Windows; effectively automatic on Solaris).
Ref: http://doc.trolltech.com/4.3/qprinte...interMode-enum