Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void MainWindow::on_actionSave_triggered()
- {
- // Opens a saving browser for the user to choose where he wants to save the file and its name.
- QString fileName = QFileDialog::getSaveFileName(this, tr("Save Picture"), "", tr("Files (*.*)"));
- QPixmap picture = *ui->label->pixmap();
- // Checks if the user added an extension to the picture, if he didn't, the default saving is .jpg.
- if(!(fileName.contains(".png") || fileName.contains(".jpg") || fileName.contains(".bmp"))) fileName.append(".jpg");
- picture.save(fileName);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement