refactor: LineEditValidator only call errorMessage::isEmpty once
This commit is contained in:
parent
530bcad8a6
commit
9976caafab
1 changed files with 4 additions and 2 deletions
|
|
@ -40,7 +40,9 @@ QValidator::State LineEditValidator::validate(QString &input, int &) const
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (errorMessage.isEmpty()) {
|
const bool isEmpty = errorMessage.isEmpty();
|
||||||
|
|
||||||
|
if (isEmpty) {
|
||||||
m_pLineEdit->setStyleSheet({});
|
m_pLineEdit->setStyleSheet({});
|
||||||
} else { // The values here are for fusion style
|
} else { // The values here are for fusion style
|
||||||
int radius = 3;
|
int radius = 3;
|
||||||
|
|
@ -70,7 +72,7 @@ QValidator::State LineEditValidator::validate(QString &input, int &) const
|
||||||
m_pError->setMessage(errorMessage);
|
m_pError->setMessage(errorMessage);
|
||||||
}
|
}
|
||||||
|
|
||||||
return errorMessage.isEmpty() ? Acceptable : Intermediate;
|
return isEmpty ? Acceptable : Intermediate;
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace validators
|
} // namespace validators
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue