MCPcopy Create free account
hub / github.com/BTCGPU/BTCGPU / State validate

Method State validate

src/qt/bitcoinamountfield.cpp:20–43  ·  view source on GitHub ↗

QSpinBox that uses fixed-point numbers internally and uses our own * formatting/parsing functions. */

Source from the content-addressed store, hash-verified

18 * formatting/parsing functions.
19 */
20class AmountSpinBox: public QAbstractSpinBox
21{
22 Q_OBJECT
23
24public:
25 explicit AmountSpinBox(QWidget *parent):
26 QAbstractSpinBox(parent),
27 currentUnit(BitcoinUnits::BTG),
28 singleStep(100000) // satoshis
29 {
30 setAlignment(Qt::AlignRight);
31
32 connect(lineEdit(), SIGNAL(textEdited(QString)), this, SIGNAL(valueChanged()));
33 }
34
35 QValidator::State validate(QString &text, int &pos) const
36 {
37 if(text.isEmpty())
38 return QValidator::Intermediate;
39 bool valid = false;
40 parse(text, &valid);
41 /* Make sure we return Intermediate so that fixup() is called on defocus */
42 return valid ? QValidator::Intermediate : QValidator::Invalid;
43 }
44
45 void fixup(QString &input) const
46 {

Callers

nothing calls this directly

Calls 1

parseFunction · 0.85

Tested by

no test coverage detected