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:
if (!fileName.isEmpty())
{
if (image.isNull())
{
QMessageBox::information(this, tr
("ImageViewer"), tr
("Cannot load %1.").
arg(fileName
));
return;
}
imageLabel
->setPixmap
(QPixmap::fromImage(image
));
QString fileName = QFileDialog::getOpenFileName(this,tr("Open File"), QDir::currentPath());
if (!fileName.isEmpty())
{
QImage image(fileName);
if (image.isNull())
{
QMessageBox::information(this, tr("ImageViewer"), tr("Cannot load %1.").arg(fileName));
return;
}
imageLabel->setPixmap(QPixmap::fromImage(image));
To copy to clipboard, switch view to plain text mode
thx.
Bookmarks