Hello!
I am facing the problem of importing my graph.
In the constructor of my window, I have the following code:
ui->customPlot->saveJpg(graphSName, 520, 520);
ui->customPlot->saveJpg(graphSName, 520, 520);
To copy to clipboard, switch view to plain text mode
This work perfectly, but the image is saved in the same file with my executable.
The idea is to show a path to save the graph.
I have the following code:
void myMainwindow::save()
{
QString graphSName
= QFileDialog::getSaveFileName(this,
"Information",
"Save",
"Picture (*.jpg *.pdf. *png)");
saveGraph->setText(graphSName);
if(!graphSName.isEmpty())
{
saveGraphHere(graphSName);
}
}
void myMainWindow
::saveGraphHere(QString &graphSName
) {
ui->customPlot->saveJpg(graphSName, 520, 520);
}
void myMainwindow::save()
{
QString graphSName = QFileDialog::getSaveFileName(this, "Information", "Save", "Picture (*.jpg *.pdf. *png)");
saveGraph->setText(graphSName);
if(!graphSName.isEmpty())
{
saveGraphHere(graphSName);
}
}
void myMainWindow::saveGraphHere(QString &graphSName)
{
ui->customPlot->saveJpg(graphSName, 520, 520);
}
To copy to clipboard, switch view to plain text mode
My connect is in the constructor of my MainWindow and as followed:
connect(saveButton, SIGNAL(clicked()), this, SLOT(save()));
connect(saveButton, SIGNAL(clicked()), this, SLOT(save()));
To copy to clipboard, switch view to plain text mode
The problem is that when I clicked on the saveButton, the program just crashes down.
I would be grateful to any help.
Many thanks in advance!
Bookmarks