isis/src/qisis/objs/PlotWindow/PlotWindow.cpp
void PlotWindow::printPlot() {
    QPixmap pixmap;
    /* Initialize a printer*/
    static QPrinter *printer = NULL;
    if (printer == NULL) printer = new QPrinter;
    printer->setPageSize(QPrinter::Letter);
    printer->setColorMode(QPrinter::Color);

    QPrintDialog printDialog(printer, (QWidget *)parent());

    if (printDialog.exec() == QDialog::Accepted) {
      /* Get display widget as a pixmap and convert to an image*/
      pixmap = m_plot->grab();
      QImage img = pixmap.toImage();
      /* C++ Gui Programming with Qt, page 201*/
      QPainter painter(printer);
      QRect rect = painter.viewport();
      QSize size = img.size();
      size.scale(rect.size(), Qt::KeepAspectRatio);
      painter.setViewport(rect.x(), rect.y(),
                          size.width(), size.height());
      painter.setWindow(img.rect());
      painter.drawImage(0, 0, img);
    }

  }
/**
   * Provides printing support of the plot image.
   */
Provides printing support of the plot image.
Provides printing support of the plot image .
void PlotWindow::printPlot() {
    QPixmap pixmap;
    static QPrinter *printer = NULL;
    if (printer == NULL) printer = new QPrinter;
    printer->setPageSize(QPrinter::Letter);
    printer->setColorMode(QPrinter::Color);
    QPrintDialog printDialog(printer, (QWidget *)parent());
    if (printDialog.exec() == QDialog::Accepted) {
      pixmap = m_plot->grab();
      QImage img = pixmap.toImage();
      QPainter painter(printer);
      QRect rect = painter.viewport();
      QSize size = img.size();
      size.scale(rect.size(), Qt::KeepAspectRatio);
      painter.setViewport(rect.x(), rect.y(),
                          size.width(), size.height());
      painter.setWindow(img.rect());
      painter.drawImage(0, 0, img);
    }
  }
void PlotWindow :: printPlot ( ) { QPixmap pixmap ; static QPrinter * printer = NULL ; if ( printer == NULL ) printer = new QPrinter ; printer -> setPageSize ( QPrinter :: Letter ) ; printer -> setColorMode ( QPrinter :: Color ) ; QPrintDialog printDialog ( printer , ( QWidget * ) parent ( ) ) ; if ( printDialog . exec ( ) == QDialog :: Accepted ) { pixmap = m_plot -> grab ( ) ; QImage img = pixmap . toImage ( ) ; QPainter painter ( printer ) ; QRect rect = painter . viewport ( ) ; QSize size = img . size ( ) ; size . scale ( rect . size ( ) , Qt :: KeepAspectRatio ) ; painter . setViewport ( rect . x ( ) , rect . y ( ) , size . width ( ) , size . height ( ) ) ; painter . setWindow ( img . rect ( ) ) ; painter . drawImage ( 0 , 0 , img ) ; } }
Provides printing support of the plot image.
Provides printing support of the plot image .
/* Initialize a printer*/ /* Get display widget as a pixmap and convert to an image*/ /* C++ Gui Programming with Qt, page 201*/