Bitcoin Core  22.99.0
P2P Digital Currency
qvalidatedlineedit.h
Go to the documentation of this file.
1 // Copyright (c) 2011-2020 The Bitcoin Core developers
2 // Distributed under the MIT software license, see the accompanying
3 // file COPYING or http://www.opensource.org/licenses/mit-license.php.
4 
5 #ifndef BITCOIN_QT_QVALIDATEDLINEEDIT_H
6 #define BITCOIN_QT_QVALIDATEDLINEEDIT_H
7 
8 #include <QLineEdit>
9 
13 class QValidatedLineEdit : public QLineEdit
14 {
15  Q_OBJECT
16 
17 public:
18  explicit QValidatedLineEdit(QWidget *parent);
19  void clear();
20  void setCheckValidator(const QValidator *v);
21  bool isValid();
22 
23 protected:
24  void focusInEvent(QFocusEvent *evt) override;
25  void focusOutEvent(QFocusEvent *evt) override;
26 
27 private:
28  bool valid;
29  const QValidator *checkValidator;
30 
31 public Q_SLOTS:
32  void setText(const QString&);
33  void setValid(bool valid);
34  void setEnabled(bool enabled);
35 
36 Q_SIGNALS:
37  void validationDidChange(QValidatedLineEdit *validatedLineEdit);
38 
39 private Q_SLOTS:
40  void markValid();
41  void checkValidity();
42 };
43 
44 #endif // BITCOIN_QT_QVALIDATEDLINEEDIT_H
QValidatedLineEdit::setCheckValidator
void setCheckValidator(const QValidator *v)
Definition: qvalidatedlineedit.cpp:112
QValidatedLineEdit::isValid
bool isValid()
Definition: qvalidatedlineedit.cpp:118
QValidatedLineEdit::focusInEvent
void focusInEvent(QFocusEvent *evt) override
Definition: qvalidatedlineedit.cpp:42
QValidatedLineEdit::setText
void setText(const QString &)
Definition: qvalidatedlineedit.cpp:18
QValidatedLineEdit::markValid
void markValid()
Definition: qvalidatedlineedit.cpp:57
QValidatedLineEdit::setEnabled
void setEnabled(bool enabled)
Definition: qvalidatedlineedit.cpp:69
QValidatedLineEdit
Line edit that can be marked as "invalid" to show input validation feedback.
Definition: qvalidatedlineedit.h:13
QValidatedLineEdit::validationDidChange
void validationDidChange(QValidatedLineEdit *validatedLineEdit)
QValidatedLineEdit::setValid
void setValid(bool valid)
Definition: qvalidatedlineedit.cpp:24
QValidatedLineEdit::checkValidator
const QValidator * checkValidator
Definition: qvalidatedlineedit.h:29
QValidatedLineEdit::QValidatedLineEdit
QValidatedLineEdit(QWidget *parent)
Definition: qvalidatedlineedit.cpp:10
QValidatedLineEdit::clear
void clear()
Definition: qvalidatedlineedit.cpp:63
QValidatedLineEdit::checkValidity
void checkValidity()
Definition: qvalidatedlineedit.cpp:85
QValidatedLineEdit::focusOutEvent
void focusOutEvent(QFocusEvent *evt) override
Definition: qvalidatedlineedit.cpp:50
QValidatedLineEdit::valid
bool valid
Definition: qvalidatedlineedit.h:28