[solved] QInputDialog - change Cancel button text
-
i have here a code to display inptut dialog, what should i add to change Cancel button text?
@
bool ok = false;
QString input = QInputDialog::getText(0,Strings::uasNewUser,Strings::uasLoginName,QLineEdit::Normal,"",&ok);
if (ok) {
if (input != "") {
bool insert = true;
Sql sql;
if (sql.connect()) {
usernames = sql.getUsernames();
for (int i = 0; i < usernames.length(); ++i) {
if (usernames[i] == input) insert = false;
}
if (insert) {
sql.insertUser(input);
loadData();
showUserData(ui->users->count()-1);
} else {
QMessageBox::warning(0,Strings::uasUserExist,Strings::uasUserWithName + " '"+input+"' "+ Strings::uasExist );
}
}
} else {
QMessageBox::warning(0,Strings::uasEmptyUsernameTitle,Strings::uasEmptyUsername);
}
}@ -
Hi,
Using exec and checking its return value
-
exec doesn't return a boolean value, it's a QDialog::DialogCode which can be in this case mapped to a boolean value.
For the second part, yes.
-
You're welcome !
Since you have all running now, please update the thread title prepending [solved] so other forum users may know a solution has been found :)