Changeset View
Changeset View
Standalone View
Standalone View
src/qt/qvalidatedlineedit.cpp
Show First 20 Lines • Show All 66 Lines • ▼ Show 20 Lines | void QValidatedLineEdit::checkValidity() { | ||||
} else if (hasAcceptableInput()) { | } else if (hasAcceptableInput()) { | ||||
setValid(true); | setValid(true); | ||||
// Check contents on focus out | // Check contents on focus out | ||||
if (checkValidator) { | if (checkValidator) { | ||||
QString address = text(); | QString address = text(); | ||||
int pos = 0; | int pos = 0; | ||||
if (checkValidator->validate(address, pos) == | if (checkValidator->validate(address, pos) == | ||||
QValidator::Acceptable) | QValidator::Acceptable) { | ||||
setValid(true); | setValid(true); | ||||
else | } else { | ||||
setValid(false); | setValid(false); | ||||
} | } | ||||
} else | } | ||||
} else { | |||||
setValid(false); | setValid(false); | ||||
} | |||||
Q_EMIT validationDidChange(this); | Q_EMIT validationDidChange(this); | ||||
} | } | ||||
void QValidatedLineEdit::setCheckValidator(const QValidator *v) { | void QValidatedLineEdit::setCheckValidator(const QValidator *v) { | ||||
checkValidator = v; | checkValidator = v; | ||||
} | } | ||||
bool QValidatedLineEdit::isValid() { | bool QValidatedLineEdit::isValid() { | ||||
// use checkValidator in case the QValidatedLineEdit is disabled | // use checkValidator in case the QValidatedLineEdit is disabled | ||||
if (checkValidator) { | if (checkValidator) { | ||||
QString address = text(); | QString address = text(); | ||||
int pos = 0; | int pos = 0; | ||||
if (checkValidator->validate(address, pos) == QValidator::Acceptable) | if (checkValidator->validate(address, pos) == QValidator::Acceptable) { | ||||
return true; | return true; | ||||
} | } | ||||
} | |||||
return valid; | return valid; | ||||
} | } |