Problem with setButtonText on QMessageBox - Android
-
wrote on 14 Dec 2016, 18:08 last edited by joaopagotto
Hi.
I have a problem with QMessageBox, the property setButtonText not change text of default button yes/no to my language, in this case pt_BR.
When execute, applications on all devices Android show [YES] [NO] instead [SIM] [NÃO].This is my code:
QMessageBox *msg = new QMessageBox(this); msg->setText("Deseja cancelar ?"); msg->setStandardButtons(QMessageBox::Yes |QMessageBox::No); msg->setButtonText(QMessageBox::Yes, "Sim"); msg->setButtonText(QMessageBox::No, "Não"); msg->exec();
Thanks.
-
Hi.
I have a problem with QMessageBox, the property setButtonText not change text of default button yes/no to my language, in this case pt_BR.
When execute, applications on all devices Android show [YES] [NO] instead [SIM] [NÃO].This is my code:
QMessageBox *msg = new QMessageBox(this); msg->setText("Deseja cancelar ?"); msg->setStandardButtons(QMessageBox::Yes |QMessageBox::No); msg->setButtonText(QMessageBox::Yes, "Sim"); msg->setButtonText(QMessageBox::No, "Não"); msg->exec();
Thanks.
@joaopagotto See http://doc.qt.io/qt-5/qmessagebox-obsolete.html
The following members of class QMessageBox are obsolete. They are provided to keep old source code working. We strongly advise against using them in new code.
You should use http://doc.qt.io/qt-5/qmessagebox.html#addButton instead.
-
wrote on 15 Dec 2016, 10:41 last edited by
Well. I try follow your tip, but doesn't work.
See my code and screenshots below.
Can it be bug in the Qt libraries for Android ?This my code:
QMessageBox msg; msg.setText("Deseja cancelar ?"); msg.addButton("Sim", QMessageBox::YesRole); msg.addButton("Nao", QMessageBox::NoRole); msg.exec();
This code sample in QMessageBox doc, but button "Connect" doesn't appear, only Abort Button:
QMessageBox msgBox; QPushButton *connectButton = msgBox.addButton(tr("Connect"), QMessageBox::ActionRole); QPushButton *abortButton = msgBox.addButton(QMessageBox::Abort); msgBox.exec();
-
Well. I try follow your tip, but doesn't work.
See my code and screenshots below.
Can it be bug in the Qt libraries for Android ?This my code:
QMessageBox msg; msg.setText("Deseja cancelar ?"); msg.addButton("Sim", QMessageBox::YesRole); msg.addButton("Nao", QMessageBox::NoRole); msg.exec();
On Windows MSVC2015-x32
On Android arm7 6.0
This code sample in QMessageBox doc, but button "Connect" doesn't appear, only Abort Button:
QMessageBox msgBox; QPushButton *connectButton = msgBox.addButton(tr("Connect"), QMessageBox::ActionRole); QPushButton *abortButton = msgBox.addButton(QMessageBox::Abort); msgBox.exec();
@joaopagotto What Qt version do you use?
-
@joaopagotto What Qt version do you use?
wrote on 15 Dec 2016, 11:27 last edited by@jsulm Qt 5.7.0 and Qt 5.7.1 same problem.
-
@jsulm Qt 5.7.0 and Qt 5.7.1 same problem.
@joaopagotto Could be that it is not supported on Android. Maybe anybody else knows?
-
@jsulm Qt 5.7.0 and Qt 5.7.1 same problem.
wrote on 15 Dec 2016, 12:29 last edited byAFAIK, Qt is not provided it on Android native style except default buttons.
If you want to use the Qt style, try this:qputenv("QT_USE_ANDROID_NATIVE_DIALOGS", "0");
-
AFAIK, Qt is not provided it on Android native style except default buttons.
If you want to use the Qt style, try this:qputenv("QT_USE_ANDROID_NATIVE_DIALOGS", "0");
wrote on 15 Dec 2016, 13:23 last edited by@Devopia53 this works very well ! Thank you so much ! =D
1/8