D_stranz, thank you for your answer. This makes it very clear to me. The way it is used in this book is indeed an obsolete method and I think it was by accident that after exchanges the text of the buttons it works.
I tried your solution and it works fine, see the figure:
Screenshot from 2014-12-17 22:12:36.png
As you see the Discard button has a default text: close without saving.

I am learning Qt with this book because I thought this book is useful to learn the basics of Qt 4.8 and besides some errors, this book is very helpful for me. After this book I will start with Qt 5.4. Do you know a good book for learning this latest version and some advanced topics?