Hi,

I updated my project to the latest Qwt version from SVN and encountered some problems with the QwtPlotRenderer. I could reproduce them using the included bode example:

When exporting as PDF document, the plot is not correctly painted on the pdf page:
bode.pdf

I figured out that this problem is due to the fact, that the printer.setResolution() setting seems to get overwritten by the printer.setPaperSize() function. To solve the problem, I just moved the corresponding line 209 to line 216 of the qwt_plot_renderer.cpp file. The resulting pdf output is correctly painted.

Qt Code:
  1. QPrinter printer;
  2. printer.setFullPage( true );
  3. printer.setPaperSize( sizeMM, QPrinter::Millimeter );
  4. printer.setDocName( title );
  5. printer.setOutputFileName( fileName );
  6. printer.setOutputFormat( ( format == "pdf" )
  7. ? QPrinter::PdfFormat : QPrinter::PostScriptFormat );
  8. printer.setResolution( resolution );
  9.  
  10. QPainter painter( &printer );
  11. render( plot, &painter, documentRect );
To copy to clipboard, switch view to plain text mode 

A further problem is that the exported pictures suffer from a resolution dependent size of the plot elements. If the hardcoded resolution of the rendered images is changed to a higher value, the scales are getting too small compared to the plot canvas. The following jpg image was exported from the bode example with this code in line 216 of the mainwindow.cpp:

Qt Code:
  1. renderer.renderDocument(d_plot, fileName, QSizeF(300, 200), 150);
To copy to clipboard, switch view to plain text mode 

bode.jpg

I could not figure out yet how to solve this. I just know that this behaviour did not occur using the print() function from QwtPlot 5.2.

Another problem is concerning the resolution of the produced pdf files if a fitted curve (weeding curve fitter) is used. I use the following code to get my curve fitted:

Qt Code:
  1. par->ftspectrumcurve = new QwtPlotCurve();
  2. par->ftspectrumcurve->setRenderHint(QwtPlotItem::RenderAntialiased, true);
  3. par->ftspectrumcurve->attach(par->spectrum_plot);
  4. par->ftspectrumcurve->setCurveFitter(new QwtWeedingCurveFitter(1));
  5. par->ftspectrumcurve->setCurveAttribute(QwtPlotCurve::Fitted, true);
To copy to clipboard, switch view to plain text mode 

If I now want to export the plot to a pdf document, I use the following code:
Qt Code:
  1. QwtPlotRenderer renderer;
  2. renderer.renderDocument(par->spectrum_plot, fileName, QSizeF(200, 150), 300);
To copy to clipboard, switch view to plain text mode 

No matter what value I use for the resolution, the exported PDF document always has the same file size and the curve only seems to have screen resolution. To get it exported with more points I have to increase the size of the document, but this is, of course, not the way it is intended.

I'd be very thankful for any clues

PS: The encountered problems might be platform specific since I only tested it with Mac OS X 10.6.4.