示例#1
0
文件: featureplot.cpp 项目: DBPP/grt
bool FeaturePlot::ctrlSShortcut(){

    if( !initialized ) return false;

    QCustomPlot *plot = ui->plot;

    QString filename = QFileDialog::getSaveFileName();

    if( filename == "" ){
        return false;
    }
    if( filename.endsWith(".png") ){
        return plot->savePng( filename, plot->width(), plot->height() );
    }
    if( filename.endsWith(".jpg") ){
        return plot->saveJpg( filename, plot->width(), plot->height() );
    }
    if( filename.endsWith(".jpeg") ){
        return plot->saveJpg( filename, plot->width(), plot->height() );
    }
    if( filename.endsWith(".pdf") ){
        return plot->savePdf( filename, plot->width(), plot->height() );
    }

    //If we get this far then save as a png
    return plot->savePng( filename, plot->width(), plot->height() );
}
void viewGVpropertieslayout::actionSavePng_triggered() {

    // first get a pointer to the current plot!
    QCustomPlot * currPlot = (QCustomPlot *) currentSubWindow->widget();
    QString fileName = QFileDialog::getSaveFileName(this, tr("Save graph as png"), "", tr("Png (*.png)"));

    if (!fileName.isEmpty())
        currPlot->savePng(fileName);

}