Hello,
I am just started with Qt Programming with help of the book "The Book of Qt4" by Daniel Molkentin.
In chapter 4, there's an example of cuteeditor a simple texteditor.
I use the example and when I try the next line:
tr("You want to create a new document, but the "
"changes in the current document '%1' have not "
"been saved. How do you want to proceed?"),
tr("Save Document"), tr("Discard Changes") ))
if (QMessageBox::question(this, tr("Save Document?"),
tr("You want to create a new document, but the "
"changes in the current document '%1' have not "
"been saved. How do you want to proceed?"),
tr("Save Document"), tr("Discard Changes") ))
To copy to clipboard, switch view to plain text mode
The resulting Box:
Screenshot from 2014-12-16 21:57:51.png
The text "Save Document" is in the left button and the text "Discard Changes" in the right button. When I click on the right button, the save document dialog appears. It is easily to change the order of the text of the buttons, but how do I know what is the yes-button and what is the no-button. And second question: how can I check what's the return value of MessageBox::question for a button. It seems that is a boolean (yes button true and no button false?) but I cannot find a static method question of MessageBox with a boolean return value.
Bookmarks