O.k. now I see: QPrinter/QPrintPreviewDialog redirects to a QPicture - then the picture is replayed/scaled according to the size of the preview window.
But what is the correct solution for record/replay paint devices:
- not rounding while recording means that you run into issues when replaying ( Qt doesn't know how to round ).
- When rounding while recording you run into problems when replaying with a scaling factor
As there is no general solution to this problem it is something that should at least be decidable by the application, that knows more about the plot and the use case. With the current implementation this is possible with QwtPainter::setRoundingAlignment(), where you can disable rounding done by Qwt. When adding QPaintEngine::Picture to QwtPainter::isAligning() rounding would always be disabled and could not be enabled in application code anymore. That's why I don't like this fix.
But for your problem this all is of no imprtance. Texts are never 100% aligned to plot coordinates and the decision for using a cache in QwtPlotTextLabel is made because of performance considerations only. So I changed the implementation of QwtPlotTextLabel::draw() not using the cache for QPaintEngine::Picture and QPaintEngine::User ( usually QwtGraphic ). Fixed in SVN trunk and 6.1 branch.
When working with Qwt 6.1.0 this should be the workaround for your code ( accepting minor rounding errors when replaying images, rectangles or shapes ):
void PixellationMainWindow
::renderPlot(QPrinter *printer
) {
const bool doAlign
= QwtPainter::roundingAlignment();
...
}
void PixellationMainWindow::renderPlot(QPrinter *printer)
{
const bool doAlign = QwtPainter::roundingAlignment();
QwtPainter::setRoundingAlignment( false );
...
QwtPainter::setRoundingAlignment( doAlign );
}
To copy to clipboard, switch view to plain text mode
Uwe
Bookmarks