I made a simple image viewer, now how do i save that image with save and also save as ? Can you paste me some code example how to do that.

I have read the image with:

Qt Code:
  1. QString fileName = QFileDialog::getOpenFileName(this,tr("Open File"), QDir::currentPath());
  2. if (!fileName.isEmpty())
  3. {
  4. QImage image(fileName);
  5. if (image.isNull())
  6. {
  7. QMessageBox::information(this, tr("ImageViewer"), tr("Cannot load %1.").arg(fileName));
  8. return;
  9. }
  10. imageLabel->setPixmap(QPixmap::fromImage(image));
To copy to clipboard, switch view to plain text mode 

thx.