How to translate the OK and Cancel buttons of the static QMessageBox functions

I’m using the static QMessageBox functions for a small download tool I wrote. Unfortunately, I struggled a little bit with the translation of the OK and Cancel buttons. There is some information available by asking uncle google, but the information revealed seems not 100% correct for Qt 5.3.

What you need to do is to load the Qt translation file in addition to your original .qm file(s) at the same time you load your own translation file(s). The file is located in the translation sub-folder of your Qt installation folder. For the OK and Cancel buttons you would need to load the “qtbase_XX” where XX should be replaced with your locale:

Original Qt FAQ:


Hope this is of some help. I appreciate all comments, just use the comment box below.

The following two tabs change content below.

Mike Bergmann

Technical software developer loving low level, bit peeking, embedded development as well as GUI, OO, and X-platform development.


Have your say