This is strange. The following code works fine for PNG, BMP and TIF formats, but if I choose the JPG format the image is all black, except for a hint of the frame.
Qt Code:
  1. int w = this->width();
  2. int h = this->height();
  3. QPixmap pixmap(w, h);
  4. pixmap.fill(Qt::white);
  5. int options = QwtPlotPrintFilter::PrintAll;
  6. options &= ~QwtPlotPrintFilter::PrintBackground;
  7. options |= QwtPlotPrintFilter::PrintFrameWithScales;
  8. filter.setOptions(options);
  9. this->print(pixmap, filter);
  10. QString fileName = "zzz.jpg";
  11. if (fileName.isEmpty()) {
  12. return;
  13. }
  14. pixmap.save(fileName,0,-1);
To copy to clipboard, switch view to plain text mode 

I invoke this by detecting rightButtonClick on a QwtPlot.
Is there something special about a JPG?