Qt: Make the checkSaveAsWithComment dialog box appear.

Set the parent of the QMessageBox in the constructor instead of calling
QMessageBox::setParent(). The latter inherits from QDialog, and it
"clear[s] the window flags specifying the window-system properties for
the widget (in particular it will reset the Qt::Dialog flag)."
(See https://doc.qt.io/qt-5/qdialog.html#details )
This makes the dialog properly appear instead of attempting to save a file
with comments to a file type that does not support comments silently failing.
Fixes #17146.


(cherry picked from commit fb422bed91)
This commit is contained in:
John Thacker 2021-01-12 00:11:52 +00:00
parent 0bb6c70189
commit a666035948
1 changed files with 1 additions and 2 deletions

View File

@ -117,11 +117,10 @@ check_savability_t CaptureFileDialog::checkSaveAsWithComments(QWidget *parent, c
return SAVE;
}
QMessageBox msg_dialog;
QMessageBox msg_dialog(parent);
QPushButton *save_button;
QPushButton *discard_button;
msg_dialog.setParent(parent);
msg_dialog.setIcon(QMessageBox::Question);
msg_dialog.setText(tr("This capture file contains comments."));
msg_dialog.setStandardButtons(QMessageBox::Cancel);