Hi,

i wrote a class PrintPreview to show a preview of of our data.
It could be a Plot or a Report (with more data and the plot).

I modified the QPrintPreviewDialog and add two QCheckBoxes

PreviewPlotReport.png

The QCheckboxes are autoexclusive and with

Qt Code:
  1. checkPlot.setChecked( false or true );
  2. checkReport.setChecked( true or false );
To copy to clipboard, switch view to plain text mode 
i can set the initial render style and everthing works fine.
I can see on first exec() either the "Plot" or the "Report".


When i switch between "Plot" and "Report" style using the
QCheckboxes inside the QToolBar during the QPrintPreviewDialog
is executed, it doesn't work.

If i click on "Report" my debug shows:
Qt Code:
  1. void PrintPreview::render(QPrinter*)
  2. void PrintPreview::renderReport(QPrinter*)
To copy to clipboard, switch view to plain text mode 

If i click on "Plot" my debug shows:
Qt Code:
  1. void PrintPreview::render(QPrinter*)
  2. void PrintPreview::renderPlot(QPrinter*)
To copy to clipboard, switch view to plain text mode 

Both rendering slots are called, but the preview itself is not updated.

Qt Code:
  1. // connection paintReqnested
  2. connect( pPreview, SIGNAL(paintRequested(QPrinter*)), this, SLOT(render(QPrinter*)));
  3.  
  4. void PrintPreview::render(QPrinter *printer)
  5. {
  6. qDebug() << Q_FUNC_INFO;
  7. if( checkPlot.isChecked() )
  8. renderPlot( printer );
  9.  
  10. if( checkReport.isChecked() )
  11. renderReport( printer );
  12. }
To copy to clipboard, switch view to plain text mode 

Can anybody help why QPrintPreviewDialog doesn't update preview?
Thx