qt messagebox 1

qt messagebox

 * int output = QMessageBox::icon(this, tr("Title"), tr("content"),
 *							  QMessageBox::button, QMessageBox::defaultButton);
//for example :
int ret = QMessageBox::warning(this, tr("My Application"),
                               tr("The document has been modified.\n"
                                  "Do you want to save your changes?"),
                               QMessageBox::Save | QMessageBox::Discard
                               | QMessageBox::Cancel,

Here is what the above code is Doing:
1. The first argument is the parent widget.
2. The second argument is the dialog title.
3. The third argument is the dialog text.
4. The fourth argument is the set of buttons to display.
5. The fifth argument is the default button.

The return value is the button that was clicked.

Similar Posts