Uwe, I'm finishing up Qwt 5.2.0 to Qwt 6.0.2 porting. Everything is looking good so far except that I can't figure out how to print a color portrait QwtChart to portrait paper. Printing in landscape is working fine, but when in try to print in portrait, the bottom of the page is always empty. The Image appears to be compressed into the top half of the portrait print.
Let me try to explain what I'm doing. First I do ...
printer.setOrientation(QPrinter::Portrait);
printer.setPageSize(QPrinter::Letter);
and pop up the QprintDialog
Then after the user accepts the dialog, In Qwt 5.2.0, I used to use:
QwtPlotPrintFilter filter;
if ( printer.colorMode() == QPrinter::GrayScale ) {
filter.setOptions(QwtPlotPrintFilter::PrintAll
& ~QwtPlotPrintFilter::PrintBackground);
}
QPainter painter(&printer);
QRect rect = painter.viewport();
m_plot->print(&painter, rect, filter);
Now, with Qwt 6.0.2 I'm using:
QwtPlotRenderer renderer;
if ( printer.colorMode() == QPrinter::GrayScale )
{
renderer.setDiscardFlag( QwtPlotRenderer:iscardCanvasBackground );
renderer.setLayoutFlag( QwtPlotRenderer::FrameWithScales );
}
renderer.renderTo( m_plot, printer );
I know I'm issing something. Any help is appreciated.
Bookmarks