Results 1 to 4 of 4

Thread: Q3Canvas Printing Problem on Windows XP, but OK on Solaris

  1. #1
    Join Date
    Jun 2008
    Location
    Boulder, Colorado, USA
    Posts
    70
    Thanks
    16
    Thanked 1 Time in 1 Post
    Qt products
    Qt5
    Platforms
    Unix/X11 Windows

    Default 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/




    Qt4 Version: 4.3.3
    Windows Platform: Microsoft Windows XP, Service Pack 2

    Simplified code snippet (similar results):

    Qt Code:
    1. QPrinter printer (QPrinter::HighResolution);
    2. QPrintDialog printDlg (&printer, this);
    3. const int userResp = printDlg.exec();
    4. if (userResp != QDialog::Rejected)
    5. {
    6. QPainter pPainter (&printer);
    7. Q3Canvas* actQCanvas = _activeCanvas->canvas();
    8. QRect actQCanvasRect = actQCanvas->rect();
    9. actQCanvas->drawArea (actQCanvasRect, &pPainter, false);
    10. }
    To copy to clipboard, switch view to plain text mode 
    Attached Images Attached Images

  2. #2
    Join Date
    Jun 2008
    Location
    Boulder, Colorado, USA
    Posts
    70
    Thanks
    16
    Thanked 1 Time in 1 Post
    Qt products
    Qt5
    Platforms
    Unix/X11 Windows

    Default 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

    Attached Images Attached Images

  3. #3
    Join Date
    Jun 2008
    Location
    Boulder, Colorado, USA
    Posts
    70
    Thanks
    16
    Thanked 1 Time in 1 Post
    Qt products
    Qt5
    Platforms
    Unix/X11 Windows

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

  4. #4
    Join Date
    Jun 2008
    Location
    Boulder, Colorado, USA
    Posts
    70
    Thanks
    16
    Thanked 1 Time in 1 Post
    Qt products
    Qt5
    Platforms
    Unix/X11 Windows

    Default 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

Similar Threads

  1. Printing problem in windows
    By joseph in forum Qt Programming
    Replies: 6
    Last Post: 12th July 2007, 08:04

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.