QCustomPlot Discussion and Comments

Save Plot Image to Defined PathReturn to overview

Greetings,
I am building an application for android in Qt.
How can I save the plot image file using bool QCustomPlot::saveJpg(const QString &fileName, int width, int height, double scale, int quality, int resolution, QCP::ResolutionUnit resolutionUnit) to a specific path/location?
I've skimmed through the old posts but couldn't find any help.

That's what fileName is for, like all file/dir related classes in Qt.

I have made some unsuccessful attempts. Can anyone please provide some sample code? I will be grateful.

sorry for such basic questions. but I have made it.

void MainWindow::on_pushButton_clicked()
{
    QString Date=QDate::currentDate().toString("yyyy_MM_dd");
    createFolderPath();
    QString filename="C:/plots/"+Date+"_plot.jpg";
    ui->custom_plot->savePng(filename,500,500,1,-1);
}

void MainWindow::createFolderPath()
{

    QDir createfolder("C:/plots");
       if(!createfolder.exists())
         {
           createfolder.mkpath("C:/plots");
         }
}