Add MaskedInputField::showErrorNoFocus.

This commit is contained in:
John Preston 2021-03-26 21:05:02 +04:00
parent 52ac632bc4
commit f288c5649c
2 changed files with 16 additions and 1 deletions

View file

@ -3569,6 +3569,10 @@ void InputField::showErrorNoFocus() {
setErrorShown(true);
}
void InputField::hideError() {
setErrorShown(false);
}
void InputField::setErrorShown(bool error) {
if (_error != error) {
_error = error;
@ -3886,12 +3890,20 @@ void MaskedInputField::inputMethodEvent(QInputMethodEvent *e) {
}
void MaskedInputField::showError() {
setErrorShown(true);
showErrorNoFocus();
if (!hasFocus()) {
setFocus();
}
}
void MaskedInputField::showErrorNoFocus() {
setErrorShown(true);
}
void MaskedInputField::hideError() {
setErrorShown(false);
}
void MaskedInputField::setErrorShown(bool error) {
if (_error != error) {
_error = error;

View file

@ -189,6 +189,7 @@ public:
void showError();
void showErrorNoFocus();
void hideError();
void setMaxLength(int maxLength);
void setMinHeight(int minHeight);
@ -557,6 +558,8 @@ public:
const QString &val = QString());
void showError();
void showErrorNoFocus();
void hideError();
QRect getTextRect() const;