QMessagebox buttons in local language
-
wrote on 26 Dec 2019, 00:50 last edited by
Hello friends!
Is there any way to configure the buttons of a QMessagebox for the local language? Example: The "Yes" and "No" buttons contain these same words in Brazilian Portuguese.
-
Hello friends!
Is there any way to configure the buttons of a QMessagebox for the local language? Example: The "Yes" and "No" buttons contain these same words in Brazilian Portuguese.
wrote on 26 Dec 2019, 09:07 last edited by@Alexandre-Camelo
https://stackoverflow.com/questions/31533019/how-to-translate-the-buttons-in-qmessagebox should show you how to do this correctly. -
You have to load the Qt translations, see e.g. here: https://wiki.qt.io/How_to_create_a_multi_language_application
-
wrote on 31 Dec 2019, 06:32 last edited by
QMessageBox messageBox(QMessageBox::Question,
tr("Sure want to quit?"),
tr("Sure to quit?"),
QMessageBox::Yes | QMessageBox::No,
this);
messageBox.setButtonText(QMessageBox::Yes, tr("Yes"));
messageBox.setButtonText(QMessageBox::No, tr("No"));
1/4