Esempio n. 1
1
void MainWindow::print()
{
    QPrinter printer( QPrinter::HighResolution );

    QString docName = d_plot->title().text();
    if ( !docName.isEmpty() )
    {
        docName.replace ( QRegExp ( QString::fromLatin1 ( "\n" ) ), tr ( " -- " ) );
        printer.setDocName ( docName );
    }

    printer.setCreator( "Bode example" );
    printer.setOrientation( QPrinter::Landscape );

    QPrintDialog dialog( &printer );
    if ( dialog.exec() )
    {
        QwtPlotRenderer renderer;

        if ( printer.colorMode() == QPrinter::GrayScale )
        {
            renderer.setDiscardFlag( QwtPlotRenderer::DiscardCanvasBackground );
            renderer.setLayoutFlag( QwtPlotRenderer::FrameWithScales );
        }

        renderer.renderTo( d_plot, printer );
    }
}
Esempio n. 2
0
void MainWindow::printsvg()
{

//    QString fileName(_record->name2display().append(".svg").c_str());
    QString fileName("bfviewer.svg");
    const QList<QByteArray> imageFormats =
        QImageWriter::supportedImageFormats();

    QStringList filter;
    filter += "SVG Documents (*.svg)";

    fileName = QFileDialog::getSaveFileName(
        this, "Export File Name", fileName,
        filter.join(";;"), NULL, QFileDialog::DontConfirmOverwrite);

    if (!fileName.isEmpty())
    {
        QSvgGenerator generator;
        QwtPlotRenderer plotrender;

        generator.setFileName( fileName );
        generator.setSize(_gridPlot->size());

        plotrender.renderTo(_gridPlot->p,generator);
    }
}
Esempio n. 3
0
/* ------- Экспорт ЗОЗ ------- */
void ViewPlot::plotExport()
{
    QStringList filter;
    filter << "Image (*.jpg)" << "Image (*.png)" << "PDF Documents (*.pdf)" << "SVG Documents (*.svg)" << "Postscript Documents (*.ps)" ;
    QString fileName = QFileDialog::getSaveFileName(this, "Export File Name", "", filter.join( ";;" ), NULL, QFileDialog::DontConfirmOverwrite );

    if ( !fileName.isEmpty() ) {
        QwtPlotRenderer renderer;
        renderer.renderDocument( ui->qwtPlot_spectrogram, fileName, QSizeF( 300, 300 ), 85 );
    }
}
Esempio n. 4
0
//-----------------------------------------------------------------------------------------
//-----------------------------------------------------------------------------------------
void Plot::mousePressEvent (QMouseEvent *event) {
	event->accept();
	if (event->button() == Qt::RightButton) {
		QString fileName = getImageFile();
		if (fileName.isEmpty()) {
			return;
		}
        QSizeF size(120,120);
        QwtPlotRenderer renderer;
        renderer.renderDocument(this,fileName,size,85);
    }
}
Esempio n. 5
0
void SaxsviewImage::exportAs(const QString& fileName, const QString& format) {
  if (fileName.isEmpty())
    return;

  QString ext = format.isEmpty() ? QFileInfo(fileName).completeSuffix() : format;

  if (ext == "ps" || ext == "pdf" || ext == "svg") {
    QwtPlotRenderer renderer;
    renderer.renderDocument(this, fileName, ext, size()*25.4/85, 600);

  } else
    QPixmap::grabWidget(this).save(fileName, qPrintable(ext));
}
Esempio n. 6
0
void MainWindow::exportDocument()
{
#ifndef QT_NO_PRINTER
    QString fileName = "bode.pdf";
#else
    QString fileName = "bode.png";
#endif

#ifndef QT_NO_FILEDIALOG
    const QList<QByteArray> imageFormats =
        QImageWriter::supportedImageFormats();

    QStringList filter;
    filter += "PDF Documents (*.pdf)";
#ifndef QWT_NO_SVG
    filter += "SVG Documents (*.svg)";
#endif
    filter += "Postscript Documents (*.ps)";

    if ( imageFormats.size() > 0 )
    {
        QString imageFilter( "Images (" );
        for ( int i = 0; i < imageFormats.size(); i++ )
        {
            if ( i > 0 )
                imageFilter += " ";
            imageFilter += "*.";
            imageFilter += imageFormats[i];
        }
        imageFilter += ")";

        filter += imageFilter;
    }

    fileName = QFileDialog::getSaveFileName(
        this, "Export File Name", fileName,
        filter.join( ";;" ), NULL, QFileDialog::DontConfirmOverwrite );
#endif

    if ( !fileName.isEmpty() )
    {
        QwtPlotRenderer renderer;

        // flags to make the document look like the widget
        renderer.setDiscardFlag( QwtPlotRenderer::DiscardBackground, false );
        renderer.setLayoutFlag( QwtPlotRenderer::KeepFrames, true );

        renderer.renderDocument( d_plot, fileName, QSizeF( 300, 200 ), 85 );
    }
}
Esempio n. 7
0
void SaxsviewImage::print() {
  QString printerName = config().recentPrinter();

  QPrinter printer(QPrinter::HighResolution);
  printer.setOrientation(QPrinter::Landscape);
  if (!printerName.isEmpty())
    printer.setPrinterName(printerName);

  QPrintDialog dlg(&printer, this);
  if (dlg.exec() == QDialog::Accepted) {
    QwtPlotRenderer renderer;
    renderer.renderTo(this, printer);
  }

  config().setRecentPrinter(printer.printerName());
}
Esempio n. 8
0
void LevelOneMuChart::exportLevelOnePlotToImage()
{

#ifndef QT_NO_PRINTER
    QString fileName = "MuChartOneLevel.pdf";
#else
    QString fileName = "MuChartOneLevel.png";
#endif

#ifndef QT_NO_FILEDIALOG
    const QList<QByteArray> imageFormats =
            QImageWriter::supportedImageFormats();

    QStringList filter;
    filter += tr("PDF Documents (*.pdf)");
#ifndef QWT_NO_SVG
    filter += tr("SVG Documents (*.svg)");
#endif
    filter += tr("Postscript Documents (*.ps)");

    if (imageFormats.size() > 0)
    {
        QString imageFilter(tr("Images ("));
        for (int i = 0; i < imageFormats.size(); i++)
        {
            if (i > 0)
                imageFilter += " ";
            imageFilter += "*.";
            imageFilter += imageFormats[i];
        }
        imageFilter += ")";

        filter += imageFilter;
    }

    fileName = QFileDialog::getSaveFileName(
                this, tr("Export File Name"), fileName,
                filter.join(";;"), NULL, QFileDialog::DontConfirmOverwrite);
#endif
    if (!fileName.isEmpty())
    {
        QwtPlotRenderer renderer;
        renderer.setDiscardFlag(QwtPlotRenderer::DiscardBackground, false);

        renderer.renderDocument(this, fileName, QSizeF(300, 200), 85);
    }
}
Esempio n. 9
0
void
MSPeaksWnd::handlePrintCurrentView( const QString& pdfname )
{
	// A4 := 210mm x 297mm (8.27 x 11.69 inch)
	QSizeF sizeMM( 260, 160 ); // 260x160mm 

    int resolution = 300;
	const double mmToInch = 1.0 / 25.4;
    const QSizeF size = sizeMM * mmToInch * resolution;
    double margin_left = 0.2 /* inch */ * resolution;
    //double margin_right = ( 8.27 - 0.2 ) * resolution;
    //double margin_center = (margin_right - margin_left) / 2 + margin_left;

	QPrinter printer;
    printer.setColorMode( QPrinter::Color );
    printer.setPaperSize( QPrinter::A4 );
    printer.setFullPage( false );
	printer.setOrientation( QPrinter::Landscape );
    
    printer.setDocName( "QtPlatz MS Peaks" );
    printer.setOutputFileName( pdfname );
    printer.setResolution( resolution );

    //-------------------- 
    QPainter painter( &printer );
    int n = 0;
    for ( auto& plot: plots_ ) {
        QRectF boundingRect;
        QRectF drawRect( margin_left, 0.0, printer.width() / 2.0, printer.height() );
        if ( n++ & 01 ) {
			drawRect.moveLeft( printer.width() / 2.0 );
            painter.drawText( drawRect, Qt::TextWordWrap, "Relationship between time and flight length", &boundingRect );
        } else {
            painter.drawText( drawRect, Qt::TextWordWrap, "Relationship between time and m/z", &boundingRect );
        }
        QwtPlotRenderer renderer;
        renderer.setDiscardFlag( QwtPlotRenderer::DiscardCanvasBackground, true );
        renderer.setDiscardFlag( QwtPlotRenderer::DiscardCanvasFrame, true );
        renderer.setDiscardFlag( QwtPlotRenderer::DiscardBackground, true );
        
        drawRect.setTop( boundingRect.bottom() );
        drawRect.setHeight( size.height() );
        drawRect.setWidth( size.width() / 2 );
        renderer.render( plot.get(), &painter, drawRect ); // render plot
    }
}
Esempio n. 10
0
void
ChartView::saveImage( bool clipboard )
{
    QSvgGenerator generator;
    QByteArray svg;
    QBuffer buffer( &svg );
    
    generator.setTitle( "QtPlatz Generated SVG" );
    generator.setDescription( "Copyright (C) 2013-2017 MS-Cheminformataics, All rights reserved" );
    auto sz = this->size();
    QRectF rc( 0, 0, sz.width(), sz.height() );
    generator.setViewBox( rc );

    if ( clipboard ) {

        generator.setOutputDevice( &buffer );        

    } else {
        auto name = QFileDialog::getSaveFileName( this, tr( "Save SVG File" )
                                                  , "chart.svg"
                                                  , tr( "SVG (*.svg)" ) );
        if ( ! name.isEmpty() )
            generator.setFileName( name );
    }

    QwtPlotRenderer renderer;

    renderer.setDiscardFlag( QwtPlotRenderer::DiscardCanvasBackground, true );
    renderer.setDiscardFlag( QwtPlotRenderer::DiscardCanvasFrame, true );
    renderer.setDiscardFlag( QwtPlotRenderer::DiscardBackground, true );

    QPainter painter;
    painter.begin( &generator );
    renderer.render( this, &painter, rc );
    painter.end();

    if ( clipboard ) {
        QMimeData * mime = new QMimeData();
        mime->setData( "image/svg+xml", svg );
        QApplication::clipboard()->setMimeData( mime, QClipboard::Clipboard );
    }
}
Esempio n. 11
0
void QcepPlot::printGraph()
{
  QPrinter printer( QPrinter::HighResolution );

  QString docName = this->title().text();
  if ( !docName.isEmpty() )
  {
    docName.replace ( QRegExp ( QString::fromLatin1 ( "\n" ) ), tr ( " -- " ) );
    printer.setDocName ( docName );
  }

//  printer.setCreator( "Bode example" );
  printer.setOrientation( QPrinter::Landscape );

  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 );
    }

    double gw = this->width();
    double gh = this->height();
    double pw = printer.width();
    double ph = printer.height();
    double scal = qMin( pw/gw, ph/gh);

    pw = gw*scal;
    ph = gh*scal;

    QRectF rect(0,0, pw,ph);

    QPainter p(&printer);

    renderer.render( this, &p, rect);
  }
}
Esempio n. 12
0
//---------------------------------------------------------------------------
void MainWindow::Export_PDF()
{
    if (Files_CurrentPos>=Files.size() || !Files[Files_CurrentPos])
        return;

    QString SaveFileName=QFileDialog::getSaveFileName(this, "Acrobat Reader file (PDF)", Files[Files_CurrentPos]->FileName+".qctools.pdf", "PDF (*.pdf)", 0, QFileDialog::DontUseNativeDialog);

    if (SaveFileName.isEmpty())
        return;

    /*QPrinter printer(QPrinter::HighResolution);
    printer.setOutputFormat(QPrinter::PdfFormat);
    printer.setOutputFileName(FileName);
    printer.setPageMargins(8,3,3,5,QPrinter::Millimeter);
    QPainter painter(&printer);  */

    QwtPlotRenderer PlotRenderer;
    PlotRenderer.renderDocument(PlotsArea->plots[0], SaveFileName, "PDF", QSizeF(210, 297), 150);
    QDesktopServices::openUrl(QUrl("file:///"+SaveFileName, QUrl::TolerantMode));
}
Esempio n. 13
0
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);
    }
}
bool HistogramWindow::saveImage(QString filename)
{
    QImage redPlotImage(2*plotRed->size(), QImage::Format_RGBA8888);
    QImage greenPlotImage(2*plotGreen->size(), QImage::Format_RGBA8888);
    QImage bluePlotImage(2*plotBlue->size(), QImage::Format_RGBA8888);
    QwtPlotRenderer renderer;
    renderer.renderTo(plotRed, redPlotImage);
    renderer.renderTo(plotGreen, greenPlotImage);
    renderer.renderTo(plotBlue, bluePlotImage);

    QImage result(redPlotImage.width(),
                  redPlotImage.height()+greenPlotImage.height()+bluePlotImage.height(),
                  QImage::Format_RGBA8888);
    QPainter painter(&result);
    painter.drawImage(0, 0, redPlotImage);
    painter.drawImage(0, redPlotImage.height(), greenPlotImage);
    painter.drawImage(0, redPlotImage.height()+greenPlotImage.height(), bluePlotImage);

    return result.save(filename);
}
Esempio n. 15
0
void BarChart::render( QPainter* painter, const QRectF & targetRect )
{
    const int r = 20;
    const QRectF plotRect = targetRect.adjusted( 0.5 * r, 0.5 * r, -0.5 * r, -0.5 * r );

    QwtPlotRenderer renderer;

    if ( qApp->styleSheet().isEmpty() )
    {
        renderer.setDiscardFlag( QwtPlotRenderer::DiscardBackground, true );

        painter->save();
        painter->setRenderHint( QPainter::Antialiasing, true );
        painter->setPen( QPen( Qt::darkGray, 1 ) );
        painter->setBrush( QColor( "WhiteSmoke" ) );
        painter->drawRoundedRect( targetRect, r, r );
        painter->restore();
    }

    renderer.render( this, painter, plotRect );
}
Esempio n. 16
0
void plotsDialog::print()
{
    QPrinter printer( QPrinter::HighResolution );

    Plot* currentPlot = dynamic_cast<Plot*>(tabs->currentWidget());
    QString docName = currentPlot->title().text();
    if ( !docName.isEmpty() )
    {
        docName.replace ( QRegExp ( QString::fromLatin1 ( "\n" ) ), tr ( " -- " ) );
        printer.setDocName ( docName );
    }

    printer.setCreator( currentPlot->title().text());
    printer.setOrientation( QPrinter::Landscape );

    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( currentPlot, 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();
}
Esempio n. 18
0
void
SpectrogramWnd::handlePrintCurrentView( const QString& pdfname )
{
	// A4 := 210mm x 297mm (8.27 x 11.69 inch)

    QPrinter printer( QPrinter::HighResolution );

    printer.setOutputFileName( pdfname );
    printer.setOrientation( QPrinter::Landscape );
    printer.setDocName( "QtPlatz Spectrogram" );
    printer.setColorMode( QPrinter::Color );
    printer.setPaperSize( QPrinter::A4 );
    printer.setFullPage( false );
    printer.setResolution( 300 );

    QPainter painter( &printer );
    QRectF drawRect( printer.resolution()/2, printer.resolution()/2, printer.width() - printer.resolution(), (12.0/72)*printer.resolution() );
    
    QRectF boundingRect;
    printer.setDocName( "QtPlatz Process Report" );
    painter.drawText( drawRect, Qt::TextWordWrap, fullpath_.c_str(), &boundingRect );

    drawRect.setTop( boundingRect.bottom() + printer.resolution() / 4 );
    drawRect.setHeight( printer.height() - boundingRect.top() - printer.resolution()/2 );
    // drawRect.setWidth( printer.width() );
    
    QwtPlotRenderer renderer;
    renderer.setDiscardFlag( QwtPlotRenderer::DiscardBackground, true );
    renderer.setDiscardFlag( QwtPlotRenderer::DiscardCanvasBackground, true );
    renderer.setDiscardFlag( QwtPlotRenderer::DiscardCanvasFrame, true );
    
    if ( printer.colorMode() == QPrinter::GrayScale )
        renderer.setLayoutFlag( QwtPlotRenderer::FrameWithScales );

    QRectF rc1( drawRect );
    rc1.setHeight( drawRect.height() * 0.60 );
    renderer.render( plot_.get(), &painter, rc1 );

    QRectF rc2( drawRect );
    rc2.setTop( rc1.bottom() + printer.resolution() / 4 );
	rc2.setHeight( drawRect.height() * 0.30 );
    rc2.setRight( drawRect.width() / 2 );
    renderer.render( sp_.get(), &painter, rc2 );
    
    rc2.moveLeft( rc2.right() + printer.resolution() / 4 );
    renderer.render( chromatogr_.get(), &painter, rc2 );
}
Esempio n. 19
0
void
ChartView::copyToClipboard()
{
    auto sz = this->size();

    QImage img( sz, QImage::Format_ARGB32 );
    img.fill( qRgba( 0, 0, 0, 0 ) );
    
    QRectF rc( 0, 0, sz.width(), sz.height() );
    
    QwtPlotRenderer renderer;
    renderer.setDiscardFlag( QwtPlotRenderer::DiscardCanvasBackground, false );
    renderer.setDiscardFlag( QwtPlotRenderer::DiscardCanvasFrame, true );
    renderer.setDiscardFlag( QwtPlotRenderer::DiscardBackground, true );
    
    QPainter painter;

    painter.begin(&img);
    renderer.render( this, &painter, this->rect() );
    painter.end();

    if ( auto clipboard = QApplication::clipboard() )
        clipboard->setImage( img );
}
Esempio n. 20
0
void plotter::save()
{
	QString fileName = "distrib.svg";
	const QList<QByteArray> imageFormats =
		 QImageWriter::supportedImageFormats();

	QStringList filter;
	filter += "SVG Documents (*.svg)";
	filter += "PDF Documents (*.pdf)";
	filter += "Postscript Documents (*.ps)";
	if ( imageFormats.size() > 0 )
	{
		 QString imageFilter("Images (");
		 for ( int i = 0; i < imageFormats.size(); i++ )
		 {
			 if ( i > 0 )
					imageFilter += " ";
			 imageFilter += "*.";
			 imageFilter += imageFormats[i];
		 }
		 imageFilter += ")";

		 filter += imageFilter;
	}

	fileName = QFileDialog::getSaveFileName(
					this, "Export File Name", fileName,
					filter.join(";;"), NULL, QFileDialog::DontConfirmOverwrite);

	if ( !fileName.isEmpty() )
	{
		 QwtPlotRenderer renderer;
		 renderer.setDiscardFlag(QwtPlotRenderer::DiscardBackground, false);
		 renderer.renderDocument(&plot, fileName, plot.size(), 85);//QSizeF(300, 200)
	}
}
Esempio n. 21
0
/* ------- Копировать в буфер ЗОЗ ------- */
void ViewPlot::copyToBuffer()
{
    QBuffer b;
    QClipboard *clipboard = QApplication::clipboard();
    QSvgGenerator p;
    p.setOutputDevice(&b);
    p.setSize(QSize(800,800));
    p.setViewBox(QRect(0,0,800,800));

    QPainter painter;
    QwtPlotRenderer renderer;

    painter.begin(&p);
    painter.setRenderHint(QPainter::Antialiasing);
    renderer.render(ui->qwtPlot_spectrogram,&painter,QRect(0,0,800,800));
    painter.end();

    QMimeData * d = new QMimeData();
    d->setData("image/svg+xml",b.buffer());
    d->setData("image/svg+xml-compressed", b.buffer());
    d->setImageData(QPixmap::grabWidget(ui->qwtPlot_spectrogram, 0,0,-1,-1));

    clipboard->setMimeData(d,QClipboard::Clipboard);
}
Esempio n. 22
0
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 );
    }
}
Esempio n. 23
0
void BarChart::exportChart()
{
    QwtPlotRenderer renderer;
    renderer.exportTo( this, "distrowatch.pdf" );
}
Esempio n. 24
0
void Plot::exportPlot()
{
    QwtPlotRenderer renderer;
    renderer.exportTo( this, "shapes.pdf" );
}
Esempio n. 25
0
void plotsDialog::exportDocument()
{
    Plot* currentPlot = dynamic_cast<Plot*>(tabs->currentWidget());
    QwtPlotRenderer renderer;
    renderer.exportTo( currentPlot, currentPlot->title().text()/*+".jpg"*/ );
}
void SweepInspector::save(QString filename) {
  QwtPlotRenderer renderer;
  renderer.exportTo( this, filename);
}
Esempio n. 27
0
void Plot::exportPlot()
{
    QwtPlotRenderer renderer;
    renderer.exportTo( this, "stockchart.pdf" );
}
Esempio n. 28
0
void TVPlot::exportPlot()
{
    QwtPlotRenderer renderer;
    renderer.exportTo( this, "tvplot.pdf" );
}
Esempio n. 29
0
void BarChart::exportChart()
{
    QwtPlotRenderer renderer;
    renderer.exportTo( this, "barchart.pdf" );
}
Esempio n. 30
-1
void qfit::savePlot()
{
    QString imageFilter;
    const QList<QByteArray> imageFormats = QImageWriter::supportedImageFormats();
    if(imageFormats.size() > 0) {
        for(int i = 0; i < imageFormats.size(); i++) {
            imageFilter += "Image ";
            imageFilter += imageFormats[i];
            imageFilter += " (*.";
            imageFilter += imageFormats[i];
            imageFilter += ");;";
        }
    }
#ifndef QWT_NO_SVG
    imageFilter += "File SVG (*.svg)";
#endif
    imageFilter += ";;File PDF (*.pdf);;File Postscript (*.ps)";
    QString fileName = QFileDialog::getSaveFileName(this, trUtf8("Export"), "",
                       imageFilter, NULL, QFileDialog::DontConfirmOverwrite);
    if(!fileName.isEmpty()) {
        QwtPlotRenderer renderer;
        renderer.setDiscardFlag(QwtPlotRenderer::DiscardBackground, false);
        renderer.renderDocument(qwtPlot, fileName, QSizeF(300, 200), 85);
    }
}