From 1fb43025f288f8eb002db6e5754c9552a8c4184b Mon Sep 17 00:00:00 2001 From: Mika Salmela Date: Tue, 16 Sep 2014 16:54:20 +0300 Subject: [PATCH] Fix cancel operation for example "Application" On the save dialog the cancel option is detected now from exec() method. Change-Id: I977626b83fe770ddc148b57551becd04e5fd9dd5 Task-number: QTBUG-41020 Reviewed-by: Alessandro Portale --- examples/widgets/mainwindows/application/mainwindow.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/examples/widgets/mainwindows/application/mainwindow.cpp b/examples/widgets/mainwindows/application/mainwindow.cpp index a5a0def0a6..dd8751973d 100644 --- a/examples/widgets/mainwindows/application/mainwindow.cpp +++ b/examples/widgets/mainwindows/application/mainwindow.cpp @@ -121,10 +121,10 @@ bool MainWindow::saveAs() QFileDialog dialog(this); dialog.setWindowModality(Qt::WindowModal); dialog.setAcceptMode(QFileDialog::AcceptSave); - dialog.exec(); - QStringList files = dialog.selectedFiles(); - - if (files.isEmpty()) + QStringList files; + if (dialog.exec()) + files = dialog.selectedFiles(); + else return false; return saveFile(files.at(0));