QCustomPlot Discussion and Comments

saveJpg creates empty jpg file on one computer, but on other comp it worksReturn to overview


I use the following code to export my diagram into a .jpg file.

    QString fileName = QFileDialog::getSaveFileName(this, tr("Export diagram"), QDir::currentPath(), "Images (*.jpg; *.jpeg)");
    QFile file(fileName);
    if (!file.open(QIODevice::WriteOnly|QFile::WriteOnly)){
        QMessageBox::warning(0,tr("File could not be saved"), tr("\n File could not be written to drive."));
        ui->dia_simulation->saveJpg(fileName,  0, 0, 2.0, 100, 100, QCP::ruDotsPerInch);

On my computer it works, but on a friends computer (same model) the exported file has a length of 0 bytes.
What am I doing wrong?


Hi Thomas,

Normally this is because you are missing the "imageformats" folder for Qt. Look into windeployqt which will automatically copy in the folder with the EXE all the pieces you need to run the program.