I have a QwtPlot in which i add multiple Histograms (Histogram is the class from the "tvplot" example). When i try to print the plot to a QPrinter ( i tried with a pdf and jpeg file), i get the axes, labels, title and legend printed. But no data. What should i do to get the bars also printed?
Qt Code:
  1. class HistogramPlot: public QwtPlot
To copy to clipboard, switch view to plain text mode 

Qt Code:
  1. void HistogramPlot::writeToPrinter(QPrinter* printer)
  2. {
  3. QwtPlotRenderer rend;
  4. QPainter painter(printer);
  5.  
  6. rend.setDiscardFlag(QwtPlotRenderer::DiscardNone, true);
  7. rend.setDiscardFlag(QwtPlotRenderer::DiscardBackground, true);
  8.  
  9. QwtScaleMap *maps = new QwtScaleMap[this->axisCnt];
  10. for(int axis = 0; axis< this->axisCnt; axis++)
  11. maps[axis].setTransformation(xx);
  12. rend.render(this, &painter, printer->pageRect());
  13.  
  14. painter.end();
  15. }
To copy to clipboard, switch view to plain text mode 

Qt Code:
  1. HistogramPlot *qp = new HistogramPlot;
  2. //...(Other Code Here)
  3. QPrinter printer;
  4. printer.setOrientation(QPrinter::Portrait);
  5. printer.setOutputFormat(QPrinter::PdfFormat);
  6. printer.setOutputFileName("temp.pdf");
  7. printer.setPageSize(QPrinter::A4);
  8. qp->writeToPrinter(&printer);
To copy to clipboard, switch view to plain text mode 

I use Qt 4.7.1 and Qwt 6.0.0