setCancelButtonText not working
-
Hi,
I've tried to change text of Cancel button in a QInputDialog, but this is not working.
My code is:
QInputDialog iD1;
iD1.setCancelButtonText(tr("&Cancel"));
m_host.username = iD1.getText(this, tr("Login error"),
tr("Invalid user account. Type username:"),
QLineEdit::Normal, m_host.username, &ok);
Cancel button is still the same like default after this code.
Do you have an idea for help me?
Thanks. -
Hi and welcome to devnet,
As stated in its documentation, getText is a static method therefore it won't make use of the instance you modified.
-
Hi and welcome to devnet,
As stated in its documentation, getText is a static method therefore it won't make use of the instance you modified.
-
@SGaist Thanks for your quick answer. But, in this case, I can't change name of a button and in the mean time use gettext function?
I've read documentation but I've find nothing interesting :(@Oreonan Don't use the static getText method, use your QInputDialog instance:
QInputDialog iD1; iD1.setCancelButtonText(tr("&Cancel")); iD1.setInputMode(QInputDialog::TextInput); iD1.exec(); m_host.username = iD1.textValue();