Save using a window-modal sheet on Mac OS X.

Change-Id: Icd150787f9ff0878fafd459b3741d1b1e008f8bc
Reviewed-by: Jake Petroules <jake.petroules@petroules.com>
Reviewed-by: Gabriel de Dietrich <gabriel.dedietrich@digia.com>
This commit is contained in:
Morten Johan Sørvig 2014-03-19 20:50:57 +01:00 committed by The Qt Project
parent a791943490
commit d2da291c93

View File

@ -118,11 +118,16 @@ bool MainWindow::save()
bool MainWindow::saveAs() bool MainWindow::saveAs()
//! [11] //! [12] //! [11] //! [12]
{ {
QString fileName = QFileDialog::getSaveFileName(this); QFileDialog dialog(this);
if (fileName.isEmpty()) dialog.setWindowModality(Qt::WindowModal);
dialog.setAcceptMode(QFileDialog::AcceptSave);
dialog.exec();
QStringList files = dialog.selectedFiles();
if (files.isEmpty())
return false; return false;
return saveFile(fileName); return saveFile(files.at(0));
} }
//! [12] //! [12]