mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-04-21 14:05:06 +02:00
Merge bitcoin-core/gui#404: Fix various edge case bugs in QValidatedLineEdit
aeb18b665c616c3326671b4c7e9d6421306564f0 Bugfix: GUI: Check validity when QValidatedLineEdit::setText is called (Luke Dashjr) b1a544be109d336c0b53722e3f8b51687972c94e Bugfix: GUI: Re-check validity after QValidatedLineEdit::setCheckValidator (Luke Dashjr) 2385b508d5f2db118513c3e0b343d2309cdfdcd8 Bugfix: GUI: Only apply invalid style to QValidatedLineEdit, not its tooltip (Luke Dashjr) Pull request description: 1. Use a CSS selector to avoid changing the background colour of the tooltip. 2. Re-check validity of input when we first set the validator (probably a no-op in practice). 3. Check validity of input when it is set programmatically via `setText` (eg, via the address book). Probably no-op in practice UNTIL merging https://github.com/bitcoin/bitcoin/pull/15987 or any other PR that adds a warning for valid addresses. Moved from https://github.com/bitcoin/bitcoin/pull/18133 (just concept ACKs) ACKs for top commit: Sjors: tACK aeb18b665c616c3326671b4c7e9d6421306564f0 hebasto: ACK aeb18b665c616c3326671b4c7e9d6421306564f0, tested on Linux Mint 20.3 (Qt 5.12.8). Tree-SHA512: b6fa8ee4dec76e1c759095721240e6fa5071a02993cb28406e96a0fa2e819f5dddc03d2e7c9073354d7865c2b09eb263afaf853ecba42e9fc4f50ef4ae20bf0f
This commit is contained in:
commit
b7942c9482
@ -15,6 +15,12 @@ QValidatedLineEdit::QValidatedLineEdit(QWidget *parent) :
|
||||
connect(this, &QValidatedLineEdit::textChanged, this, &QValidatedLineEdit::markValid);
|
||||
}
|
||||
|
||||
void QValidatedLineEdit::setText(const QString& text)
|
||||
{
|
||||
QLineEdit::setText(text);
|
||||
checkValidity();
|
||||
}
|
||||
|
||||
void QValidatedLineEdit::setValid(bool _valid)
|
||||
{
|
||||
if(_valid == this->valid)
|
||||
@ -28,7 +34,7 @@ void QValidatedLineEdit::setValid(bool _valid)
|
||||
}
|
||||
else
|
||||
{
|
||||
setStyleSheet(STYLE_INVALID);
|
||||
setStyleSheet("QValidatedLineEdit { " STYLE_INVALID "}");
|
||||
}
|
||||
this->valid = _valid;
|
||||
}
|
||||
@ -106,6 +112,7 @@ void QValidatedLineEdit::checkValidity()
|
||||
void QValidatedLineEdit::setCheckValidator(const QValidator *v)
|
||||
{
|
||||
checkValidator = v;
|
||||
checkValidity();
|
||||
}
|
||||
|
||||
bool QValidatedLineEdit::isValid()
|
||||
|
@ -29,6 +29,7 @@ private:
|
||||
const QValidator *checkValidator;
|
||||
|
||||
public Q_SLOTS:
|
||||
void setText(const QString&);
|
||||
void setValid(bool valid);
|
||||
void setEnabled(bool enabled);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user