I use PlotRescaler to get my axis displayed proportionally, regardless of the plot size (currently I'm using the X-Axis as reference):

Qt Code:
  1. PlotRescaler::PlotRescaler(QwtPlot * chart) :
  2. QwtPlotRescaler(chart->canvas())
  3. {
  4. setRescalePolicy(QwtPlotRescaler::Fitting);
  5. setAspectRatio(0.0);
  6. setAspectRatio(QwtPlot::yLeft, 1.0);
  7. }
To copy to clipboard, switch view to plain text mode 

When I resize my chart widget, the y-axis limits get updated accordingly to keep the aspect ratio.

However, when I render my chart to bitmap/vector via QwtPlotRenderer, for example with:

Qt Code:
  1. QPdfWriter pdfWriter( fname );
  2. pdfWriter.setPageSizeMM( sizeMM );
  3. pdfWriter.setTitle( title );
  4. pdfWriter.setPageMargins( QMarginsF() );
  5. pdfWriter.setResolution( resolution );
  7. QPainter painter( &pdfWriter );
  8. renderer.render( m_chart, &painter, documentRect );
To copy to clipboard, switch view to plain text mode 

hereby using arbitrary target sizes that differ from the current screen ratio, the aspect ratio is not maintained. Apparently, the rescaler is not notified of the chart/plot layout dimension change during the rendering.

Is there a workaround/easy fix for that or do I have to modify QwtPlotRenderer to manually apply the rescaling after the plot layout update?