QString str
= m_ui
->lineEdit
->text
();
if (c.isNumber()) {
// one of the characters in string is a digit
}
}
QString str = m_ui->lineEdit->text();
foreach (QChar c, str) {
if (c.isNumber()) {
// one of the characters in string is a digit
}
}
To copy to clipboard, switch view to plain text mode
And this doesn't have sense. It will be always true as you are checking if "-" is non zero value, and in ASCII it's not.
if (isNumber == "+" || "-")
if (isNumber == "+" || "-")
To copy to clipboard, switch view to plain text mode
You can also use QValidator which will let user enter only specified characters into text box.
Bookmarks