Skip to content

Commit d451246

Browse files
committed
merge bitcoin-core/gui#404: Fix various edge case bugs in QValidatedLineEdit
1 parent c02483c commit d451246

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

src/qt/qvalidatedlineedit.cpp

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,12 @@ QValidatedLineEdit::QValidatedLineEdit(QWidget *parent) :
1414
connect(this, &QValidatedLineEdit::textChanged, this, &QValidatedLineEdit::markValid);
1515
}
1616

17+
void QValidatedLineEdit::setText(const QString& text)
18+
{
19+
QLineEdit::setText(text);
20+
checkValidity();
21+
}
22+
1723
void QValidatedLineEdit::setValid(bool _valid)
1824
{
1925
if(_valid == this->valid)
@@ -27,7 +33,7 @@ void QValidatedLineEdit::setValid(bool _valid)
2733
}
2834
else
2935
{
30-
setStyleSheet(GUIUtil::getThemedStyleQString(GUIUtil::ThemedStyle::TS_INVALID));
36+
setStyleSheet("QValidatedLineEdit { " + GUIUtil::getThemedStyleQString(GUIUtil::ThemedStyle::TS_INVALID) + " }");
3137
}
3238
this->valid = _valid;
3339
}
@@ -105,6 +111,7 @@ void QValidatedLineEdit::checkValidity()
105111
void QValidatedLineEdit::setCheckValidator(const QValidator *v)
106112
{
107113
checkValidator = v;
114+
checkValidity();
108115
}
109116

110117
bool QValidatedLineEdit::isValid()

src/qt/qvalidatedlineedit.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ class QValidatedLineEdit : public QLineEdit
2929
const QValidator *checkValidator;
3030

3131
public Q_SLOTS:
32+
void setText(const QString&);
3233
void setValid(bool valid);
3334
void setEnabled(bool enabled);
3435

0 commit comments

Comments
 (0)