qt popup window 1

qt popup window

 * You can use a QMessageBox like this:
 * 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 title of the message box.
3. The third argument is the text of the message.
4. The fourth argument is the set of buttons to be displayed.
5. The fifth argument is the default button.

The return value is the button that was clicked.

Similar Posts