diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/widgets/dialogs/qmessagebox.cpp | 4 | ||||
-rw-r--r-- | src/widgets/doc/snippets/code/src_gui_dialogs_qmessagebox.cpp | 6 |
2 files changed, 7 insertions, 3 deletions
diff --git a/src/widgets/dialogs/qmessagebox.cpp b/src/widgets/dialogs/qmessagebox.cpp index f9d58e4d906..acb63c4aa9b 100644 --- a/src/widgets/dialogs/qmessagebox.cpp +++ b/src/widgets/dialogs/qmessagebox.cpp @@ -562,6 +562,10 @@ void QMessageBoxPrivate::helperClicked(QPlatformDialogHelper::StandardButton hel and \l{QMessageBox::standardButtons} {standard buttons} for accepting a user response. + While the parent parameter is optional, specifying it gives a hint + to the window manager, which can then take care of positioning, and + maintain a proper stacking order of the dialog window. + Two APIs for using QMessageBox are provided, the property-based API, and the static functions. Calling one of the static functions is the simpler approach, but it is less flexible than using the diff --git a/src/widgets/doc/snippets/code/src_gui_dialogs_qmessagebox.cpp b/src/widgets/doc/snippets/code/src_gui_dialogs_qmessagebox.cpp index ebc07025ec0..062e2e5142a 100644 --- a/src/widgets/doc/snippets/code/src_gui_dialogs_qmessagebox.cpp +++ b/src/widgets/doc/snippets/code/src_gui_dialogs_qmessagebox.cpp @@ -12,7 +12,7 @@ int ret = QMessageBox::warning(this, tr("My Application"), //! [2] -QMessageBox msgBox; +QMessageBox msgBox(this); QPushButton *connectButton = msgBox.addButton(tr("Connect"), QMessageBox::ActionRole); QPushButton *abortButton = msgBox.addButton(QMessageBox::Abort); @@ -53,13 +53,13 @@ int main(int argc, char *argv[]) //! [4] //! [5] -QMessageBox msgBox; +QMessageBox msgBox(this); msgBox.setText("The document has been modified."); msgBox.exec(); //! [5] //! [6] -QMessageBox msgBox; +QMessageBox msgBox(this); msgBox.setText("The document has been modified."); msgBox.setInformativeText("Do you want to save your changes?"); msgBox.setStandardButtons(QMessageBox::Save | QMessageBox::Discard | QMessageBox::Cancel); |