Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

Painting with QPrintPreviewWidget - different results on Windows, Linux and Mac



  • Hi,
    i want to paint a rectangle of 100mm x 100mm on a QPainter (or printer or what else)
    and display it in a QPrintPreviewWidget.

    Somehow the results on the screen differ on Windows, Linux and my MacOS X (Mavericks) machine.

    Same code has different output (same on Mac + Linux) but different on Windows.
    I paint a rectangle at position 0,0... and on Windows there is a white border (margin?) but same code
    on linux and mac works as expected ( rectangle at 0,0 starts direct in top left corner without any margins).

    Printing and PDF export works great only the output of the pages of QPrintPreviewWidget differ.

    See a screenshot attached dispalying the output on Windows and Mac...
    "See image with different results on windows and mac":https://www.dropbox.com/s/vorgq1czurksusd/Mac-Windows-Qt5.2-QPrintPreviewWidget-Bug.png

    Then painting like this:

    @
    void TestSite::paintEvent(QPaintEvent *)
    {
    QPainter painter(this);

    painter.fillRect(0, 0, 500,500, QBrush(Qt::red));
    

    }
    @

    The result differs on each machine. Only some pixels but it's not equal as expected.

    Any ideas whats going on here?

    Greetings
    Nando


Log in to reply