QImage image; QApplication::setOverrideCursor(Qt::WaitCursor); bool saved = image.save(fileName, "jpeg"); QApplication::restoreOverrideCursor(); if (saved) { setCurrentFile(fileName); statusBar()->showMessage(tr("File saved"), 2000); } else { QMessageBox::warning(this, tr("Paint 2D"), tr("Error when saving image.")); statusBar()->showMessage(tr("Saving canceled"), 2000); }
QImage image; QImageWriter writer( fileName ); writer.setFormat( "jpeg" ); if ( writer.write( image ) ) { qDebug() << "yes"; } else { qDebug() << writer.errorString(); }
Empty JPEG image (DNL not supported)"Unknown error"