views:

223

answers:

2

How can I easily translate standard buttons (Yes, No) from QMessageBox? I can't use self.tr on those arguments, so I would like to achieve it in some other simple way. Do I have to use whole translation system?

+2  A: 

Are you sure you have to translate them yourself? In other toolkits, standard buttons are automatically translated to the language that the user is using.

DoR
No, I would prefer to have them translated automatically. But I have no idea how to achieve this.
gruszczy
What OS are you using? Have you tried logging in using a different language?
DoR
Ubuntu 9.10 I have everything in polish.
gruszczy
+1  A: 

The quickest way is something like this:

mymessagebox.button(mymessagebox.Yes).setText("Yes, please!")
mymessagebox.button(mymessagebox.No).setText("No, thanks.")

See the QMessageBox documentation for all possible standard buttons.

balpha
This seems nice. Thanks.
gruszczy
OK, this isn't really what I need - I am using question method and I can't really access QMessageBox instance to set this text. Can I achieve this in some other way?
gruszczy