1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
crate::ix!();
//-------------------------------------------[.cpp/bitcoin/src/qt/qvalidatedlineedit.h]
/**
| Line edit that can be marked as "invalid"
| to show input validation feedback.
| When marked as invalid, it will get a
| red background until it is focused.
|
*/
#[Q_OBJECT]
pub struct QValidatedLineEdit {
base: QLineEdit,
valid: bool,
check_validator: *const QValidator,
}
//-------------------------------------------[.cpp/bitcoin/src/qt/qvalidatedlineedit.cpp]
impl QValidatedLineEdit {
#[Q_SIGNAL]
pub fn validation_did_change(&mut self, validated_line_edit: *mut QValidatedLineEdit) { }
pub fn new(parent: *mut QWidget) -> Self {
todo!();
/*
: q_line_edit(parent),
: valid(true),
: check_validator(nullptr),
connect(this, &QValidatedLineEdit::textChanged, this, &QValidatedLineEdit::markValid);
*/
}
#[Q_SLOT]
pub fn set_valid(&mut self, valid: bool) {
todo!();
/*
if(_valid == this->valid)
{
return;
}
if(_valid)
{
setStyleSheet("");
}
else
{
setStyleSheet(STYLE_INVALID);
}
this->valid = _valid;
*/
}
pub fn focus_in_event(&mut self, evt: *mut QFocusEvent) {
todo!();
/*
// Clear invalid flag on focus
setValid(true);
QLineEdit::focusInEvent(evt);
*/
}
pub fn focus_out_event(&mut self, evt: *mut QFocusEvent) {
todo!();
/*
checkValidity();
QLineEdit::focusOutEvent(evt);
*/
}
#[Q_SLOT]
pub fn mark_valid(&mut self) {
todo!();
/*
// As long as a user is typing ensure we display state as valid
setValid(true);
*/
}
pub fn clear(&mut self) {
todo!();
/*
setValid(true);
QLineEdit::clear();
*/
}
#[Q_SLOT]
pub fn set_enabled(&mut self, enabled: bool) {
todo!();
/*
if (!enabled)
{
// A disabled QValidatedLineEdit should be marked valid
setValid(true);
}
else
{
// Recheck validity when QValidatedLineEdit gets enabled
checkValidity();
}
QLineEdit::setEnabled(enabled);
*/
}
#[Q_SLOT]
pub fn check_validity(&mut self) {
todo!();
/*
if (text().isEmpty())
{
setValid(true);
}
else if (hasAcceptableInput())
{
setValid(true);
// Check contents on focus out
if (checkValidator)
{
QString address = text();
int pos = 0;
if (checkValidator->validate(address, pos) == QValidatorAcceptable)
setValid(true);
else
setValid(false);
}
}
else
setValid(false);
Q_EMIT validationDidChange(this);
*/
}
pub fn set_check_validator(&mut self, v: *const QValidator) {
todo!();
/*
checkValidator = v;
*/
}
pub fn is_valid(&mut self) -> bool {
todo!();
/*
// use checkValidator in case the QValidatedLineEdit is disabled
if (checkValidator)
{
QString address = text();
int pos = 0;
if (checkValidator->validate(address, pos) == QValidatorAcceptable)
return true;
}
return valid;
*/
}
}