| 83 | } |
| 84 | |
| 85 | void QValidatedLineEdit::checkValidity() |
| 86 | { |
| 87 | if (text().isEmpty()) |
| 88 | { |
| 89 | setValid(true); |
| 90 | } |
| 91 | else if (hasAcceptableInput()) |
| 92 | { |
| 93 | setValid(true); |
| 94 | |
| 95 | // Check contents on focus out |
| 96 | if (checkValidator) |
| 97 | { |
| 98 | QString address = text(); |
| 99 | int pos = 0; |
| 100 | if (checkValidator->validate(address, pos) == QValidator::Acceptable) |
| 101 | setValid(true); |
| 102 | else |
| 103 | setValid(false); |
| 104 | } |
| 105 | } |
| 106 | else |
| 107 | setValid(false); |
| 108 | |
| 109 | Q_EMIT validationDidChange(this); |
| 110 | } |
| 111 | |
| 112 | void QValidatedLineEdit::setCheckValidator(const QValidator *v) |
| 113 | { |