QPixmap originalPixmap = QPixmap::grabWindow(QApplication::desktop()->winId()); QString format = "png"; QString initialPath = QDir::currentPath() + tr("/untitled.") + format; QString fileName = QFileDialog::getSaveFileName(this, tr("Save As"), initialPath, tr("%1 Files (*.%2);;All Files (*)") .arg(format.toUpper()) .arg(format)); if (!fileName.isEmpty()) originalPixmap.save(fileName, format.toAscii());