I'm using QFileDialog::getSaveFileName to save a file.

Qt Code:
  1. QString saveFileName = QFileDialog::getSaveFileName(this,"Save As","./untitled.dat",tr("files(*.dat )"));
  2. saveFile(saveFileName);
  3. QMessageBox::StandardButton reply;
  4. reply = QMessageBox::information(this, tr(" "), "File Saved");
To copy to clipboard, switch view to plain text mode 
I cannot understand how to recognize whether Save has been pressed or Cancel button. Currently my application saves the file even if i press cancel.