void Plot::printPlot() { #if 1 QPrinter printer; #else QPrinter printer(QPrinter::HighResolution); #endif printer.setOrientation(QPrinter::Landscape); printer.setOutputFileName("spectrogram.pdf"); QPrintDialog dialog(&printer); if ( dialog.exec() ) { QwtPlotRenderer renderer; renderer.setDiscardFlag(QwtPlotRenderer::DiscardBackground, false); renderer.setLayoutFlag(QwtPlotRenderer::KeepFrames, true); renderer.renderTo(this, printer); } }
void Plot::printPlot() { QPrinter printer( QPrinter::HighResolution ); printer.setOrientation( QPrinter::Landscape ); printer.setOutputFileName( "spectrogram.pdf" ); QPrintDialog dialog( &printer ); if ( dialog.exec() ) { QwtPlotRenderer renderer; if ( printer.colorMode() == QPrinter::GrayScale ) { renderer.setDiscardFlag( QwtPlotRenderer::DiscardBackground ); renderer.setDiscardFlag( QwtPlotRenderer::DiscardCanvasBackground ); renderer.setDiscardFlag( QwtPlotRenderer::DiscardCanvasFrame ); renderer.setLayoutFlag( QwtPlotRenderer::FrameWithScales ); } renderer.renderTo( this, printer ); } }
// Get canvas and print in the output file void DataPlot::saveAsSVG() { Q_EMIT disconnectUpdateDynamicsView(); #if 1 QPrinter printer; #else QPrinter printer(QPrinter::HighResolution); #endif printer.setOrientation(QPrinter::Landscape); printer.setOutputFileName("iarc_simulation01.pdf"); QPrintDialog dialog(&printer); if ( dialog.exec() ) { QwtPlotRenderer renderer; renderer.setDiscardFlag(QwtPlotRenderer::DiscardBackground, false); renderer.setLayoutFlag(QwtPlotRenderer::KeepFrames, true); renderer.renderTo(this, printer); } Q_EMIT connectUpdateDynamicsView(); }