Line | Source Code | Coverage |
---|
1 | | - |
2 | | - |
3 | | - |
4 | | - |
5 | | - |
6 | | - |
7 | | - |
8 | | - |
9 | | - |
10 | | - |
11 | int QWidgetLineControl::redoTextLayout() const | - |
12 | { | - |
13 | m_textLayout.clearLayout(); | - |
14 | | - |
15 | m_textLayout.beginLayout(); | - |
16 | QTextLine l = m_textLayout.createLine(); | - |
17 | m_textLayout.endLayout(); | - |
18 | | - |
19 | | - |
20 | | - |
21 | | - |
22 | | - |
23 | | - |
24 | return qRound(l.ascent()); executed: return qRound(l.ascent()); Execution Count:10359 | 10359 |
25 | } | - |
26 | | - |
27 | | - |
28 | | - |
29 | | - |
30 | | - |
31 | | - |
32 | | - |
33 | void QWidgetLineControl::updateDisplayText(bool forceUpdate) | - |
34 | { | - |
35 | QString orig = m_textLayout.text(); | - |
36 | QString str; | - |
37 | if (m_echoMode == QLineEdit::NoEcho) evaluated: m_echoMode == QLineEdit::NoEcho yes Evaluation Count:42 | yes Evaluation Count:10317 |
| 42-10317 |
38 | str = QString::fromLatin1(""); executed: str = QString::fromLatin1(""); Execution Count:42 | 42 |
39 | else | - |
40 | str = m_text; executed: str = m_text; Execution Count:10317 | 10317 |
41 | | - |
42 | if (m_echoMode == QLineEdit::Password) { evaluated: m_echoMode == QLineEdit::Password yes Evaluation Count:42 | yes Evaluation Count:10317 |
| 42-10317 |
43 | str.fill(m_passwordCharacter); | - |
44 | if (m_passwordEchoTimer != 0 && m_cursor > 0 && m_cursor <= m_text.length()) { partially evaluated: m_passwordEchoTimer != 0 no Evaluation Count:0 | yes Evaluation Count:42 |
never evaluated: m_cursor > 0 never evaluated: m_cursor <= m_text.length() | 0-42 |
45 | int cursor = m_cursor - 1; | - |
46 | QChar uc = m_text.at(cursor); | - |
47 | str[cursor] = uc; | - |
48 | if (cursor > 0 && uc.isLowSurrogate()) { never evaluated: cursor > 0 never evaluated: uc.isLowSurrogate() | 0 |
49 | | - |
50 | | - |
51 | uc = m_text.at(cursor - 1); | - |
52 | if (uc.isHighSurrogate()) never evaluated: uc.isHighSurrogate() | 0 |
53 | str[cursor - 1] = uc; never executed: str[cursor - 1] = uc; | 0 |
54 | } | 0 |
55 | } | 0 |
56 | } else if (m_echoMode == QLineEdit::PasswordEchoOnEdit && !m_passwordEchoEditing) { evaluated: m_echoMode == QLineEdit::PasswordEchoOnEdit yes Evaluation Count:33 | yes Evaluation Count:10284 |
evaluated: !m_passwordEchoEditing yes Evaluation Count:18 | yes Evaluation Count:15 |
executed: } Execution Count:42 | 15-10284 |
57 | str.fill(m_passwordCharacter); | - |
58 | } executed: } Execution Count:18 | 18 |
59 | | - |
60 | | - |
61 | | - |
62 | | - |
63 | QChar* uc = str.data(); | - |
64 | for (int i = 0; i < (int)str.length(); ++i) { evaluated: i < (int)str.length() yes Evaluation Count:59619 | yes Evaluation Count:10359 |
| 10359-59619 |
65 | if ((uc[i] < 0x20 && uc[i] != 0x09) evaluated: uc[i] < 0x20 yes Evaluation Count:9 | yes Evaluation Count:59610 |
partially evaluated: uc[i] != 0x09 yes Evaluation Count:9 | no Evaluation Count:0 |
| 0-59610 |
66 | || uc[i] == QChar::LineSeparator partially evaluated: uc[i] == QChar::LineSeparator no Evaluation Count:0 | yes Evaluation Count:59610 |
| 0-59610 |
67 | || uc[i] == QChar::ParagraphSeparator partially evaluated: uc[i] == QChar::ParagraphSeparator no Evaluation Count:0 | yes Evaluation Count:59610 |
| 0-59610 |
68 | || uc[i] == QChar::ObjectReplacementCharacter) partially evaluated: uc[i] == QChar::ObjectReplacementCharacter no Evaluation Count:0 | yes Evaluation Count:59610 |
| 0-59610 |
69 | uc[i] = QChar(0x0020); executed: uc[i] = QChar(0x0020); Execution Count:9 | 9 |
70 | } executed: } Execution Count:59619 | 59619 |
71 | | - |
72 | m_textLayout.setText(str); | - |
73 | | - |
74 | QTextOption option = m_textLayout.textOption(); | - |
75 | option.setTextDirection(m_layoutDirection); | - |
76 | option.setFlags(QTextOption::IncludeTrailingSpaces); | - |
77 | m_textLayout.setTextOption(option); | - |
78 | | - |
79 | m_ascent = redoTextLayout(); | - |
80 | | - |
81 | if (str != orig || forceUpdate) evaluated: str != orig yes Evaluation Count:6080 | yes Evaluation Count:4279 |
evaluated: forceUpdate yes Evaluation Count:47 | yes Evaluation Count:4232 |
| 47-6080 |
82 | displayTextChanged(str); executed: displayTextChanged(str); Execution Count:6127 | 6127 |
83 | } executed: } Execution Count:10359 | 10359 |
84 | void QWidgetLineControl::copy(QClipboard::Mode mode) const | - |
85 | { | - |
86 | QString t = selectedText(); | - |
87 | if (!t.isEmpty() && m_echoMode == QLineEdit::Normal) { evaluated: !t.isEmpty() yes Evaluation Count:5 | yes Evaluation Count:11 |
partially evaluated: m_echoMode == QLineEdit::Normal yes Evaluation Count:5 | no Evaluation Count:0 |
| 0-11 |
88 | disconnect(QApplication::clipboard(), "2""selectionChanged()", this, 0); | - |
89 | QApplication::clipboard()->setText(t, mode); | - |
90 | connect(QApplication::clipboard(), "2""selectionChanged()", | - |
91 | this, "1""_q_clipboardChanged()"); | - |
92 | } executed: } Execution Count:5 | 5 |
93 | } executed: } Execution Count:16 | 16 |
94 | void QWidgetLineControl::paste(QClipboard::Mode clipboardMode) | - |
95 | { | - |
96 | QString clip = QApplication::clipboard()->text(clipboardMode); | - |
97 | if (!clip.isEmpty() || hasSelectedText()) { evaluated: !clip.isEmpty() yes Evaluation Count:7 | yes Evaluation Count:1 |
partially evaluated: hasSelectedText() yes Evaluation Count:1 | no Evaluation Count:0 |
| 0-7 |
98 | separate(); | - |
99 | insert(clip); | - |
100 | separate(); | - |
101 | } executed: } Execution Count:8 | 8 |
102 | } executed: } Execution Count:8 | 8 |
103 | | - |
104 | | - |
105 | | - |
106 | | - |
107 | | - |
108 | | - |
109 | void QWidgetLineControl::commitPreedit() | - |
110 | { | - |
111 | if (!composeMode()) partially evaluated: !composeMode() yes Evaluation Count:7490 | no Evaluation Count:0 |
| 0-7490 |
112 | return; executed: return; Execution Count:7490 | 7490 |
113 | | - |
114 | (static_cast<QApplication *>(QCoreApplication::instance()))->inputMethod()->commit(); | - |
115 | if (!composeMode()) never evaluated: !composeMode() | 0 |
116 | return; | 0 |
117 | | - |
118 | m_preeditCursor = 0; | - |
119 | setPreeditArea(-1, QString()); | - |
120 | m_textLayout.clearAdditionalFormats(); | - |
121 | updateDisplayText( true); | - |
122 | } | 0 |
123 | void QWidgetLineControl::backspace() | - |
124 | { | - |
125 | int priorState = m_undoState; | - |
126 | if (hasSelectedText()) { evaluated: hasSelectedText() yes Evaluation Count:10 | yes Evaluation Count:51 |
| 10-51 |
127 | removeSelectedText(); | - |
128 | } else if (m_cursor) { executed: } Execution Count:10 evaluated: m_cursor yes Evaluation Count:43 | yes Evaluation Count:8 |
| 8-43 |
129 | --m_cursor; | - |
130 | if (m_maskData) evaluated: m_maskData yes Evaluation Count:2 | yes Evaluation Count:41 |
| 2-41 |
131 | m_cursor = prevMaskBlank(m_cursor); executed: m_cursor = prevMaskBlank(m_cursor); Execution Count:2 | 2 |
132 | QChar uc = m_text.at(m_cursor); | - |
133 | if (m_cursor > 0 && uc.isLowSurrogate()) { evaluated: m_cursor > 0 yes Evaluation Count:39 | yes Evaluation Count:4 |
partially evaluated: uc.isLowSurrogate() no Evaluation Count:0 | yes Evaluation Count:39 |
| 0-39 |
134 | | - |
135 | | - |
136 | uc = m_text.at(m_cursor - 1); | - |
137 | if (uc.isHighSurrogate()) { never evaluated: uc.isHighSurrogate() | 0 |
138 | internalDelete(true); | - |
139 | --m_cursor; | - |
140 | } | 0 |
141 | } | 0 |
142 | internalDelete(true); | - |
143 | } executed: } Execution Count:43 | 43 |
144 | finishChange(priorState); | - |
145 | } executed: } Execution Count:61 | 61 |
146 | void QWidgetLineControl::del() | - |
147 | { | - |
148 | int priorState = m_undoState; | - |
149 | if (hasSelectedText()) { evaluated: hasSelectedText() yes Evaluation Count:35 | yes Evaluation Count:50 |
| 35-50 |
150 | removeSelectedText(); | - |
151 | } else { executed: } Execution Count:35 | 35 |
152 | int n = textLayout()->nextCursorPosition(m_cursor) - m_cursor; | - |
153 | while (n--) evaluated: n-- yes Evaluation Count:45 | yes Evaluation Count:50 |
| 45-50 |
154 | internalDelete(); executed: internalDelete(); Execution Count:45 | 45 |
155 | } executed: } Execution Count:50 | 50 |
156 | finishChange(priorState); | - |
157 | } executed: } Execution Count:85 | 85 |
158 | void QWidgetLineControl::insert(const QString &newText) | - |
159 | { | - |
160 | int priorState = m_undoState; | - |
161 | removeSelectedText(); | - |
162 | internalInsert(newText); | - |
163 | finishChange(priorState); | - |
164 | } executed: } Execution Count:1664 | 1664 |
165 | | - |
166 | | - |
167 | | - |
168 | | - |
169 | | - |
170 | | - |
171 | void QWidgetLineControl::clear() | - |
172 | { | - |
173 | int priorState = m_undoState; | - |
174 | m_selstart = 0; | - |
175 | m_selend = m_text.length(); | - |
176 | removeSelectedText(); | - |
177 | separate(); | - |
178 | finishChange(priorState, false, false); | - |
179 | } executed: } Execution Count:348 | 348 |
180 | void QWidgetLineControl::setSelection(int start, int length) | - |
181 | { | - |
182 | commitPreedit(); | - |
183 | | - |
184 | if(start < 0 || start > (int)m_text.length()){ partially evaluated: start < 0 no Evaluation Count:0 | yes Evaluation Count:3985 |
partially evaluated: start > (int)m_text.length() no Evaluation Count:0 | yes Evaluation Count:3985 |
| 0-3985 |
185 | QMessageLogger("widgets/qwidgetlinecontrol.cpp", 302, __PRETTY_FUNCTION__).warning("QWidgetLineControl::setSelection: Invalid start position"); | - |
186 | return; | 0 |
187 | } | - |
188 | | - |
189 | if (length > 0) { evaluated: length > 0 yes Evaluation Count:2158 | yes Evaluation Count:1827 |
| 1827-2158 |
190 | if (start == m_selstart && start + length == m_selend && m_cursor == m_selend) evaluated: start == m_selstart yes Evaluation Count:858 | yes Evaluation Count:1300 |
evaluated: start + length == m_selend yes Evaluation Count:144 | yes Evaluation Count:714 |
evaluated: m_cursor == m_selend yes Evaluation Count:73 | yes Evaluation Count:71 |
| 71-1300 |
191 | return; executed: return; Execution Count:73 | 73 |
192 | m_selstart = start; | - |
193 | m_selend = qMin(start + length, (int)m_text.length()); | - |
194 | m_cursor = m_selend; | - |
195 | } else if (length < 0){ executed: } Execution Count:2085 evaluated: length < 0 yes Evaluation Count:1813 | yes Evaluation Count:14 |
| 14-2085 |
196 | if (start == m_selend && start + length == m_selstart && m_cursor == m_selstart) evaluated: start == m_selend yes Evaluation Count:1484 | yes Evaluation Count:329 |
evaluated: start + length == m_selstart yes Evaluation Count:1482 | yes Evaluation Count:2 |
evaluated: m_cursor == m_selstart yes Evaluation Count:92 | yes Evaluation Count:1390 |
| 2-1484 |
197 | return; executed: return; Execution Count:92 | 92 |
198 | m_selstart = qMax(start + length, 0); | - |
199 | m_selend = start; | - |
200 | m_cursor = m_selstart; | - |
201 | } else if (m_selstart != m_selend) { executed: } Execution Count:1721 evaluated: m_selstart != m_selend yes Evaluation Count:4 | yes Evaluation Count:10 |
| 4-1721 |
202 | m_selstart = 0; | - |
203 | m_selend = 0; | - |
204 | m_cursor = start; | - |
205 | } else { executed: } Execution Count:4 | 4 |
206 | m_cursor = start; | - |
207 | emitCursorPositionChanged(); | - |
208 | return; executed: return; Execution Count:10 | 10 |
209 | } | - |
210 | selectionChanged(); | - |
211 | emitCursorPositionChanged(); | - |
212 | } executed: } Execution Count:3810 | 3810 |
213 | | - |
214 | void QWidgetLineControl::_q_clipboardChanged() | - |
215 | { | - |
216 | } | - |
217 | | - |
218 | void QWidgetLineControl::_q_deleteSelected() | - |
219 | { | - |
220 | if (!hasSelectedText()) partially evaluated: !hasSelectedText() no Evaluation Count:0 | yes Evaluation Count:1 |
| 0-1 |
221 | return; | 0 |
222 | | - |
223 | int priorState = m_undoState; | - |
224 | resetInputContext(); | - |
225 | removeSelectedText(); | - |
226 | separate(); | - |
227 | finishChange(priorState); | - |
228 | } executed: } Execution Count:1 | 1 |
229 | | - |
230 | | - |
231 | | - |
232 | | - |
233 | | - |
234 | | - |
235 | void QWidgetLineControl::init(const QString &txt) | - |
236 | { | - |
237 | m_textLayout.setCacheEnabled(true); | - |
238 | m_text = txt; | - |
239 | updateDisplayText(); | - |
240 | m_cursor = m_text.length(); | - |
241 | if (const QPlatformTheme *theme = QGuiApplicationPrivate::platformTheme()) partially evaluated: const QPlatformTheme *theme = QGuiApplicationPrivate::platformTheme() yes Evaluation Count:1077 | no Evaluation Count:0 |
| 0-1077 |
242 | m_keyboardScheme = theme->themeHint(QPlatformTheme::KeyboardScheme).toInt(); executed: m_keyboardScheme = theme->themeHint(QPlatformTheme::KeyboardScheme).toInt(); Execution Count:1077 | 1077 |
243 | | - |
244 | if (m_keyboardScheme == QPlatformTheme::KdeKeyboardScheme partially evaluated: m_keyboardScheme == QPlatformTheme::KdeKeyboardScheme no Evaluation Count:0 | yes Evaluation Count:1077 |
| 0-1077 |
245 | || m_keyboardScheme == QPlatformTheme::GnomeKeyboardScheme partially evaluated: m_keyboardScheme == QPlatformTheme::GnomeKeyboardScheme yes Evaluation Count:1077 | no Evaluation Count:0 |
| 0-1077 |
246 | || m_keyboardScheme == QPlatformTheme::CdeKeyboardScheme) { never evaluated: m_keyboardScheme == QPlatformTheme::CdeKeyboardScheme | 0 |
247 | m_keyboardScheme = QPlatformTheme::X11KeyboardScheme; | - |
248 | } executed: } Execution Count:1077 | 1077 |
249 | } executed: } Execution Count:1077 | 1077 |
250 | void QWidgetLineControl::updatePasswordEchoEditing(bool editing) | - |
251 | { | - |
252 | cancelPasswordEchoTimer(); | - |
253 | m_passwordEchoEditing = editing; | - |
254 | updateDisplayText(); | - |
255 | } executed: } Execution Count:6 | 6 |
256 | int QWidgetLineControl::xToPos(int x, QTextLine::CursorPosition betweenOrOn) const | - |
257 | { | - |
258 | return textLayout()->lineAt(0).xToCursor(x, betweenOrOn); executed: return textLayout()->lineAt(0).xToCursor(x, betweenOrOn); Execution Count:13 | 13 |
259 | } | - |
260 | | - |
261 | | - |
262 | | - |
263 | | - |
264 | | - |
265 | | - |
266 | | - |
267 | QRect QWidgetLineControl::cursorRect() const | - |
268 | { | - |
269 | QTextLine l = textLayout()->lineAt(0); | - |
270 | int c = m_cursor; | - |
271 | if (m_preeditCursor != -1) partially evaluated: m_preeditCursor != -1 yes Evaluation Count:7398 | no Evaluation Count:0 |
| 0-7398 |
272 | c += m_preeditCursor; executed: c += m_preeditCursor; Execution Count:7398 | 7398 |
273 | int cix = qRound(l.cursorToX(c)); | - |
274 | int w = m_cursorWidth; | - |
275 | int ch = l.height() + 1; | - |
276 | | - |
277 | return QRect(cix-5, 0, w+9, ch); executed: return QRect(cix-5, 0, w+9, ch); Execution Count:7398 | 7398 |
278 | } | - |
279 | bool QWidgetLineControl::fixup() | - |
280 | { | - |
281 | | - |
282 | if (m_validator) { evaluated: m_validator yes Evaluation Count:30 | yes Evaluation Count:75 |
| 30-75 |
283 | QString textCopy = m_text; | - |
284 | int cursorCopy = m_cursor; | - |
285 | m_validator->fixup(textCopy); | - |
286 | if (m_validator->validate(textCopy, cursorCopy) == QValidator::Acceptable) { evaluated: m_validator->validate(textCopy, cursorCopy) == QValidator::Acceptable yes Evaluation Count:3 | yes Evaluation Count:27 |
| 3-27 |
287 | if (textCopy != m_text || cursorCopy != m_cursor) partially evaluated: textCopy != m_text yes Evaluation Count:3 | no Evaluation Count:0 |
never evaluated: cursorCopy != m_cursor | 0-3 |
288 | internalSetText(textCopy, cursorCopy); executed: internalSetText(textCopy, cursorCopy); Execution Count:3 | 3 |
289 | return true; executed: return true; Execution Count:3 | 3 |
290 | } | - |
291 | } executed: } Execution Count:27 | 27 |
292 | | - |
293 | return false; executed: return false; Execution Count:102 | 102 |
294 | } | - |
295 | | - |
296 | | - |
297 | | - |
298 | | - |
299 | | - |
300 | | - |
301 | | - |
302 | void QWidgetLineControl::moveCursor(int pos, bool mark) | - |
303 | { | - |
304 | commitPreedit(); | - |
305 | | - |
306 | if (pos != m_cursor) { evaluated: pos != m_cursor yes Evaluation Count:2518 | yes Evaluation Count:987 |
| 987-2518 |
307 | separate(); | - |
308 | if (m_maskData) evaluated: m_maskData yes Evaluation Count:108 | yes Evaluation Count:2410 |
| 108-2410 |
309 | pos = pos > m_cursor ? nextMaskBlank(pos) : prevMaskBlank(pos); executed: pos = pos > m_cursor ? nextMaskBlank(pos) : prevMaskBlank(pos); Execution Count:108 evaluated: pos > m_cursor yes Evaluation Count:1 | yes Evaluation Count:107 |
| 1-108 |
310 | } executed: } Execution Count:2518 | 2518 |
311 | if (mark) { evaluated: mark yes Evaluation Count:453 | yes Evaluation Count:3052 |
| 453-3052 |
312 | int anchor; | - |
313 | if (m_selend > m_selstart && m_cursor == m_selstart) evaluated: m_selend > m_selstart yes Evaluation Count:31 | yes Evaluation Count:422 |
evaluated: m_cursor == m_selstart yes Evaluation Count:17 | yes Evaluation Count:14 |
| 14-422 |
314 | anchor = m_selend; executed: anchor = m_selend; Execution Count:17 | 17 |
315 | else if (m_selend > m_selstart && m_cursor == m_selend) evaluated: m_selend > m_selstart yes Evaluation Count:14 | yes Evaluation Count:422 |
partially evaluated: m_cursor == m_selend yes Evaluation Count:14 | no Evaluation Count:0 |
| 0-422 |
316 | anchor = m_selstart; executed: anchor = m_selstart; Execution Count:14 | 14 |
317 | else | - |
318 | anchor = m_cursor; executed: anchor = m_cursor; Execution Count:422 | 422 |
319 | m_selstart = qMin(anchor, pos); | - |
320 | m_selend = qMax(anchor, pos); | - |
321 | updateDisplayText(); | - |
322 | } else { executed: } Execution Count:453 | 453 |
323 | internalDeselect(); | - |
324 | } executed: } Execution Count:3052 | 3052 |
325 | m_cursor = pos; | - |
326 | if (mark || m_selDirty) { evaluated: mark yes Evaluation Count:453 | yes Evaluation Count:3052 |
evaluated: m_selDirty yes Evaluation Count:66 | yes Evaluation Count:2986 |
| 66-3052 |
327 | m_selDirty = false; | - |
328 | selectionChanged(); | - |
329 | } executed: } Execution Count:519 | 519 |
330 | emitCursorPositionChanged(); | - |
331 | } executed: } Execution Count:3505 | 3505 |
332 | | - |
333 | | - |
334 | | - |
335 | | - |
336 | | - |
337 | | - |
338 | | - |
339 | void QWidgetLineControl::processInputMethodEvent(QInputMethodEvent *event) | - |
340 | { | - |
341 | int priorState = -1; | - |
342 | bool isGettingInput = !event->commitString().isEmpty() evaluated: !event->commitString().isEmpty() yes Evaluation Count:25 | yes Evaluation Count:41 |
| 25-41 |
343 | || event->preeditString() != preeditAreaText() evaluated: event->preeditString() != preeditAreaText() yes Evaluation Count:1 | yes Evaluation Count:40 |
| 1-40 |
344 | || event->replacementLength() > 0; partially evaluated: event->replacementLength() > 0 no Evaluation Count:0 | yes Evaluation Count:40 |
| 0-40 |
345 | bool cursorPositionChanged = false; | - |
346 | bool selectionChange = false; | - |
347 | | - |
348 | if (isGettingInput) { evaluated: isGettingInput yes Evaluation Count:26 | yes Evaluation Count:40 |
| 26-40 |
349 | | - |
350 | priorState = m_undoState; | - |
351 | if (echoMode() == QLineEdit::PasswordEchoOnEdit && !passwordEchoEditing()) { partially evaluated: echoMode() == QLineEdit::PasswordEchoOnEdit no Evaluation Count:0 | yes Evaluation Count:26 |
never evaluated: !passwordEchoEditing() | 0-26 |
352 | updatePasswordEchoEditing(true); | - |
353 | m_selstart = 0; | - |
354 | m_selend = m_text.length(); | - |
355 | } | 0 |
356 | removeSelectedText(); | - |
357 | } executed: } Execution Count:26 | 26 |
358 | | - |
359 | int c = m_cursor; | - |
360 | if (event->replacementStart() <= 0) partially evaluated: event->replacementStart() <= 0 yes Evaluation Count:66 | no Evaluation Count:0 |
| 0-66 |
361 | c += event->commitString().length() - qMin(-event->replacementStart(), event->replacementLength()); executed: c += event->commitString().length() - qMin(-event->replacementStart(), event->replacementLength()); Execution Count:66 | 66 |
362 | | - |
363 | m_cursor += event->replacementStart(); | - |
364 | if (m_cursor < 0) partially evaluated: m_cursor < 0 no Evaluation Count:0 | yes Evaluation Count:66 |
| 0-66 |
365 | m_cursor = 0; never executed: m_cursor = 0; | 0 |
366 | | - |
367 | | - |
368 | if (event->replacementLength()) { evaluated: event->replacementLength() yes Evaluation Count:9 | yes Evaluation Count:57 |
| 9-57 |
369 | m_selstart = m_cursor; | - |
370 | m_selend = m_selstart + event->replacementLength(); | - |
371 | removeSelectedText(); | - |
372 | } executed: } Execution Count:9 | 9 |
373 | if (!event->commitString().isEmpty()) { evaluated: !event->commitString().isEmpty() yes Evaluation Count:25 | yes Evaluation Count:41 |
| 25-41 |
374 | internalInsert(event->commitString()); | - |
375 | cursorPositionChanged = true; | - |
376 | } executed: } Execution Count:25 | 25 |
377 | | - |
378 | m_cursor = qBound(0, c, m_text.length()); | - |
379 | | - |
380 | for (int i = 0; i < event->attributes().size(); ++i) { evaluated: i < event->attributes().size() yes Evaluation Count:2 | yes Evaluation Count:66 |
| 2-66 |
381 | const QInputMethodEvent::Attribute &a = event->attributes().at(i); | - |
382 | if (a.type == QInputMethodEvent::Selection) { partially evaluated: a.type == QInputMethodEvent::Selection yes Evaluation Count:2 | no Evaluation Count:0 |
| 0-2 |
383 | m_cursor = qBound(0, a.start + a.length, m_text.length()); | - |
384 | if (a.length) { evaluated: a.length yes Evaluation Count:1 | yes Evaluation Count:1 |
| 1 |
385 | m_selstart = qMax(0, qMin(a.start, m_text.length())); | - |
386 | m_selend = m_cursor; | - |
387 | if (m_selend < m_selstart) { partially evaluated: m_selend < m_selstart no Evaluation Count:0 | yes Evaluation Count:1 |
| 0-1 |
388 | qSwap(m_selstart, m_selend); | - |
389 | } | 0 |
390 | selectionChange = true; | - |
391 | } else { executed: } Execution Count:1 | 1 |
392 | if (m_selstart != m_selend) partially evaluated: m_selstart != m_selend yes Evaluation Count:1 | no Evaluation Count:0 |
| 0-1 |
393 | selectionChange = true; executed: selectionChange = true; Execution Count:1 | 1 |
394 | m_selstart = m_selend = 0; | - |
395 | } executed: } Execution Count:1 | 1 |
396 | cursorPositionChanged = true; | - |
397 | } executed: } Execution Count:2 | 2 |
398 | } executed: } Execution Count:2 | 2 |
399 | | - |
400 | setPreeditArea(m_cursor, event->preeditString()); | - |
401 | | - |
402 | const int oldPreeditCursor = m_preeditCursor; | - |
403 | m_preeditCursor = event->preeditString().length(); | - |
404 | m_hideCursor = false; | - |
405 | QList<QTextLayout::FormatRange> formats; | - |
406 | for (int i = 0; i < event->attributes().size(); ++i) { evaluated: i < event->attributes().size() yes Evaluation Count:2 | yes Evaluation Count:66 |
| 2-66 |
407 | const QInputMethodEvent::Attribute &a = event->attributes().at(i); | - |
408 | if (a.type == QInputMethodEvent::Cursor) { partially evaluated: a.type == QInputMethodEvent::Cursor no Evaluation Count:0 | yes Evaluation Count:2 |
| 0-2 |
409 | m_preeditCursor = a.start; | - |
410 | m_hideCursor = !a.length; | - |
411 | } else if (a.type == QInputMethodEvent::TextFormat) { partially evaluated: a.type == QInputMethodEvent::TextFormat no Evaluation Count:0 | yes Evaluation Count:2 |
| 0-2 |
412 | QTextCharFormat f = qvariant_cast<QTextFormat>(a.value).toCharFormat(); | - |
413 | if (f.isValid()) { never evaluated: f.isValid() | 0 |
414 | QTextLayout::FormatRange o; | - |
415 | o.start = a.start + m_cursor; | - |
416 | o.length = a.length; | - |
417 | o.format = f; | - |
418 | formats.append(o); | - |
419 | } | 0 |
420 | } | 0 |
421 | } | - |
422 | m_textLayout.setAdditionalFormats(formats); | - |
423 | updateDisplayText( true); | - |
424 | if (cursorPositionChanged) evaluated: cursorPositionChanged yes Evaluation Count:27 | yes Evaluation Count:39 |
| 27-39 |
425 | emitCursorPositionChanged(); executed: emitCursorPositionChanged(); Execution Count:27 | 27 |
426 | else if (m_preeditCursor != oldPreeditCursor) evaluated: m_preeditCursor != oldPreeditCursor yes Evaluation Count:1 | yes Evaluation Count:38 |
| 1-38 |
427 | updateMicroFocus(); executed: updateMicroFocus(); Execution Count:1 | 1 |
428 | | - |
429 | if (isGettingInput) evaluated: isGettingInput yes Evaluation Count:26 | yes Evaluation Count:40 |
| 26-40 |
430 | finishChange(priorState); executed: finishChange(priorState); Execution Count:26 | 26 |
431 | | - |
432 | if (selectionChange) evaluated: selectionChange yes Evaluation Count:2 | yes Evaluation Count:64 |
| 2-64 |
433 | selectionChanged(); executed: selectionChanged(); Execution Count:2 | 2 |
434 | } executed: } Execution Count:66 | 66 |
435 | void QWidgetLineControl::draw(QPainter *painter, const QPoint &offset, const QRect &clip, int flags) | - |
436 | { | - |
437 | QVector<QTextLayout::FormatRange> selections; | - |
438 | if (flags & DrawSelections) { evaluated: flags & DrawSelections yes Evaluation Count:51 | yes Evaluation Count:711 |
| 51-711 |
439 | QTextLayout::FormatRange o; | - |
440 | if (m_selstart < m_selend) { partially evaluated: m_selstart < m_selend yes Evaluation Count:51 | no Evaluation Count:0 |
| 0-51 |
441 | o.start = m_selstart; | - |
442 | o.length = m_selend - m_selstart; | - |
443 | o.format.setBackground(m_palette.brush(QPalette::Highlight)); | - |
444 | o.format.setForeground(m_palette.brush(QPalette::HighlightedText)); | - |
445 | } else { executed: } Execution Count:51 | 51 |
446 | | - |
447 | if(!m_blinkPeriod || m_blinkStatus){ never evaluated: !m_blinkPeriod never evaluated: m_blinkStatus | 0 |
448 | o.start = m_cursor; | - |
449 | o.length = 1; | - |
450 | o.format.setBackground(m_palette.brush(QPalette::Text)); | - |
451 | o.format.setForeground(m_palette.brush(QPalette::Window)); | - |
452 | } | 0 |
453 | } | 0 |
454 | selections.append(o); | - |
455 | } executed: } Execution Count:51 | 51 |
456 | | - |
457 | if (flags & DrawText) partially evaluated: flags & DrawText yes Evaluation Count:762 | no Evaluation Count:0 |
| 0-762 |
458 | textLayout()->draw(painter, offset, selections, clip); executed: textLayout()->draw(painter, offset, selections, clip); Execution Count:762 | 762 |
459 | | - |
460 | if (flags & DrawCursor){ evaluated: flags & DrawCursor yes Evaluation Count:386 | yes Evaluation Count:376 |
| 376-386 |
461 | int cursor = m_cursor; | - |
462 | if (m_preeditCursor != -1) partially evaluated: m_preeditCursor != -1 yes Evaluation Count:386 | no Evaluation Count:0 |
| 0-386 |
463 | cursor += m_preeditCursor; executed: cursor += m_preeditCursor; Execution Count:386 | 386 |
464 | if (!m_hideCursor && (!m_blinkPeriod || m_blinkStatus)) partially evaluated: !m_hideCursor yes Evaluation Count:386 | no Evaluation Count:0 |
evaluated: !m_blinkPeriod yes Evaluation Count:12 | yes Evaluation Count:374 |
evaluated: m_blinkStatus yes Evaluation Count:337 | yes Evaluation Count:37 |
| 0-386 |
465 | textLayout()->drawCursor(painter, offset, cursor, m_cursorWidth); executed: textLayout()->drawCursor(painter, offset, cursor, m_cursorWidth); Execution Count:349 | 349 |
466 | } executed: } Execution Count:386 | 386 |
467 | } executed: } Execution Count:762 | 762 |
468 | void QWidgetLineControl::selectWordAtPos(int cursor) | - |
469 | { | - |
470 | int next = cursor + 1; | - |
471 | if(next > end()) evaluated: next > end() yes Evaluation Count:1 | yes Evaluation Count:1 |
| 1 |
472 | --next; executed: --next; Execution Count:1 | 1 |
473 | int c = textLayout()->previousCursorPosition(next, QTextLayout::SkipWords); | - |
474 | moveCursor(c, false); | - |
475 | | - |
476 | int end = textLayout()->nextCursorPosition(c, QTextLayout::SkipWords); | - |
477 | while (end > cursor && m_text[end-1].isSpace()) evaluated: end > cursor yes Evaluation Count:1 | yes Evaluation Count:1 |
partially evaluated: m_text[end-1].isSpace() no Evaluation Count:0 | yes Evaluation Count:1 |
| 0-1 |
478 | --end; | 0 |
479 | moveCursor(end, true); | - |
480 | } executed: } Execution Count:2 | 2 |
481 | bool QWidgetLineControl::finishChange(int validateFromState, bool update, bool edited) | - |
482 | { | - |
483 | (void)update; | - |
484 | | - |
485 | if (m_textDirty) { evaluated: m_textDirty yes Evaluation Count:6438 | yes Evaluation Count:2194 |
| 2194-6438 |
486 | | - |
487 | bool wasValidInput = m_validInput; | - |
488 | m_validInput = true; | - |
489 | | - |
490 | if (m_validator) { evaluated: m_validator yes Evaluation Count:4333 | yes Evaluation Count:2105 |
| 2105-4333 |
491 | QString textCopy = m_text; | - |
492 | int cursorCopy = m_cursor; | - |
493 | m_validInput = (m_validator->validate(textCopy, cursorCopy) != QValidator::Invalid); | - |
494 | if (m_validInput) { evaluated: m_validInput yes Evaluation Count:4071 | yes Evaluation Count:262 |
| 262-4071 |
495 | if (m_text != textCopy) { evaluated: m_text != textCopy yes Evaluation Count:17 | yes Evaluation Count:4054 |
| 17-4054 |
496 | internalSetText(textCopy, cursorCopy); | - |
497 | return true; executed: return true; Execution Count:17 | 17 |
498 | } | - |
499 | m_cursor = cursorCopy; | - |
500 | } executed: } Execution Count:4054 | 4054 |
501 | } executed: } Execution Count:4316 | 4316 |
502 | | - |
503 | if (validateFromState >= 0 && wasValidInput && !m_validInput) { evaluated: validateFromState >= 0 yes Evaluation Count:2012 | yes Evaluation Count:4409 |
evaluated: wasValidInput yes Evaluation Count:2009 | yes Evaluation Count:3 |
evaluated: !m_validInput yes Evaluation Count:253 | yes Evaluation Count:1756 |
| 3-4409 |
504 | if (m_transactions.count()) partially evaluated: m_transactions.count() no Evaluation Count:0 | yes Evaluation Count:253 |
| 0-253 |
505 | return false; never executed: return false; | 0 |
506 | internalUndo(validateFromState); | - |
507 | m_history.resize(m_undoState); | - |
508 | if (m_modifiedState > m_undoState) partially evaluated: m_modifiedState > m_undoState no Evaluation Count:0 | yes Evaluation Count:253 |
| 0-253 |
509 | m_modifiedState = -1; never executed: m_modifiedState = -1; | 0 |
510 | m_validInput = true; | - |
511 | m_textDirty = false; | - |
512 | } executed: } Execution Count:253 | 253 |
513 | updateDisplayText(); | - |
514 | | - |
515 | if (m_textDirty) { evaluated: m_textDirty yes Evaluation Count:6168 | yes Evaluation Count:253 |
| 253-6168 |
516 | m_textDirty = false; | - |
517 | QString actualText = text(); | - |
518 | if (edited) evaluated: edited yes Evaluation Count:1822 | yes Evaluation Count:4346 |
| 1822-4346 |
519 | textEdited(actualText); executed: textEdited(actualText); Execution Count:1822 | 1822 |
520 | textChanged(actualText); | - |
521 | } executed: } Execution Count:6168 | 6168 |
522 | } executed: } Execution Count:6421 | 6421 |
523 | if (m_selDirty) { evaluated: m_selDirty yes Evaluation Count:2648 | yes Evaluation Count:5967 |
| 2648-5967 |
524 | m_selDirty = false; | - |
525 | selectionChanged(); | - |
526 | } executed: } Execution Count:2648 | 2648 |
527 | if (m_cursor == m_lastCursorPos) evaluated: m_cursor == m_lastCursorPos yes Evaluation Count:2503 | yes Evaluation Count:6112 |
| 2503-6112 |
528 | updateMicroFocus(); executed: updateMicroFocus(); Execution Count:2503 | 2503 |
529 | emitCursorPositionChanged(); | - |
530 | return true; executed: return true; Execution Count:8615 | 8615 |
531 | } | - |
532 | | - |
533 | | - |
534 | | - |
535 | | - |
536 | | - |
537 | | - |
538 | void QWidgetLineControl::internalSetText(const QString &txt, int pos, bool edited) | - |
539 | { | - |
540 | cancelPasswordEchoTimer(); | - |
541 | internalDeselect(); | - |
542 | resetInputContext(); | - |
543 | QString oldText = m_text; | - |
544 | if (m_maskData) { evaluated: m_maskData yes Evaluation Count:414 | yes Evaluation Count:5515 |
| 414-5515 |
545 | m_text = maskString(0, txt, true); | - |
546 | m_text += clearString(m_text.length(), m_maxLength - m_text.length()); | - |
547 | } else { executed: } Execution Count:414 | 414 |
548 | m_text = txt.isEmpty() ? txt : txt.left(m_maxLength); evaluated: txt.isEmpty() yes Evaluation Count:789 | yes Evaluation Count:4726 |
| 789-4726 |
549 | } executed: } Execution Count:5515 | 5515 |
550 | m_history.clear(); | - |
551 | m_modifiedState = m_undoState = 0; | - |
552 | m_cursor = (pos < 0 || pos > m_text.length()) ? m_text.length() : pos; evaluated: pos < 0 yes Evaluation Count:5909 | yes Evaluation Count:20 |
partially evaluated: pos > m_text.length() no Evaluation Count:0 | yes Evaluation Count:20 |
| 0-5909 |
553 | m_textDirty = (oldText != m_text); | - |
554 | const bool changed = finishChange(-1, true, edited); | - |
555 | | - |
556 | | - |
557 | if (changed) { partially evaluated: changed yes Evaluation Count:5929 | no Evaluation Count:0 |
| 0-5929 |
558 | if (oldText.isEmpty()) { evaluated: oldText.isEmpty() yes Evaluation Count:1554 | yes Evaluation Count:4375 |
| 1554-4375 |
559 | QAccessibleTextInsertEvent event(parent(), 0, txt); | - |
560 | event.setCursorPosition(m_cursor); | - |
561 | QAccessible::updateAccessibility(&event); | - |
562 | } else if (txt.isEmpty()) { executed: } Execution Count:1554 evaluated: txt.isEmpty() yes Evaluation Count:197 | yes Evaluation Count:4178 |
| 197-4178 |
563 | QAccessibleTextRemoveEvent event(parent(), 0, oldText); | - |
564 | event.setCursorPosition(m_cursor); | - |
565 | QAccessible::updateAccessibility(&event); | - |
566 | } else { executed: } Execution Count:197 | 197 |
567 | QAccessibleTextUpdateEvent event(parent(), 0, oldText, txt); | - |
568 | event.setCursorPosition(m_cursor); | - |
569 | QAccessible::updateAccessibility(&event); | - |
570 | } executed: } Execution Count:4178 | 4178 |
571 | } | - |
572 | | - |
573 | | - |
574 | | - |
575 | } executed: } Execution Count:5929 | 5929 |
576 | void QWidgetLineControl::addCommand(const Command &cmd) | - |
577 | { | - |
578 | if (m_separator && m_undoState && m_history[m_undoState - 1].type != Separator) { evaluated: m_separator yes Evaluation Count:906 | yes Evaluation Count:7858 |
evaluated: m_undoState yes Evaluation Count:470 | yes Evaluation Count:436 |
evaluated: m_history[m_undoState - 1].type != Separator yes Evaluation Count:466 | yes Evaluation Count:4 |
| 4-7858 |
579 | m_history.resize(m_undoState + 2); | - |
580 | m_history[m_undoState++] = Command(Separator, m_cursor, 0, m_selstart, m_selend); | - |
581 | } else { executed: } Execution Count:466 | 466 |
582 | m_history.resize(m_undoState + 1); | - |
583 | } executed: } Execution Count:8298 | 8298 |
584 | m_separator = false; | - |
585 | m_history[m_undoState++] = cmd; | - |
586 | } executed: } Execution Count:8764 | 8764 |
587 | void QWidgetLineControl::internalInsert(const QString &s) | - |
588 | { | - |
589 | if (m_echoMode == QLineEdit::Password) { evaluated: m_echoMode == QLineEdit::Password yes Evaluation Count:3 | yes Evaluation Count:1686 |
| 3-1686 |
590 | if (m_passwordEchoTimer != 0) partially evaluated: m_passwordEchoTimer != 0 no Evaluation Count:0 | yes Evaluation Count:3 |
| 0-3 |
591 | killTimer(m_passwordEchoTimer); never executed: killTimer(m_passwordEchoTimer); | 0 |
592 | int delay = (static_cast<QGuiApplication *>(QCoreApplication::instance()))->styleHints()->passwordMaskDelay(); | - |
593 | | - |
594 | | - |
595 | | - |
596 | | - |
597 | | - |
598 | if (delay > 0) partially evaluated: delay > 0 no Evaluation Count:0 | yes Evaluation Count:3 |
| 0-3 |
599 | m_passwordEchoTimer = startTimer(delay); never executed: m_passwordEchoTimer = startTimer(delay); | 0 |
600 | } executed: } Execution Count:3 | 3 |
601 | if (hasSelectedText()) evaluated: hasSelectedText() yes Evaluation Count:3 | yes Evaluation Count:1686 |
| 3-1686 |
602 | addCommand(Command(SetSelection, m_cursor, 0, m_selstart, m_selend)); executed: addCommand(Command(SetSelection, m_cursor, 0, m_selstart, m_selend)); Execution Count:3 | 3 |
603 | if (m_maskData) { evaluated: m_maskData yes Evaluation Count:260 | yes Evaluation Count:1429 |
| 260-1429 |
604 | QString ms = maskString(m_cursor, s); | - |
605 | | - |
606 | QAccessibleTextInsertEvent insertEvent(parent(), m_cursor, ms); | - |
607 | QAccessible::updateAccessibility(&insertEvent); | - |
608 | | - |
609 | for (int i = 0; i < (int) ms.length(); ++i) { evaluated: i < (int) ms.length() yes Evaluation Count:451 | yes Evaluation Count:260 |
| 260-451 |
610 | addCommand (Command(DeleteSelection, m_cursor + i, m_text.at(m_cursor + i), -1, -1)); | - |
611 | addCommand(Command(Insert, m_cursor + i, ms.at(i), -1, -1)); | - |
612 | } executed: } Execution Count:451 | 451 |
613 | m_text.replace(m_cursor, ms.length(), ms); | - |
614 | m_cursor += ms.length(); | - |
615 | m_cursor = nextMaskBlank(m_cursor); | - |
616 | m_textDirty = true; | - |
617 | | - |
618 | QAccessibleTextCursorEvent event(parent(), m_cursor); | - |
619 | QAccessible::updateAccessibility(&event); | - |
620 | | - |
621 | } else { executed: } Execution Count:260 | 260 |
622 | int remaining = m_maxLength - m_text.length(); | - |
623 | if (remaining != 0) { evaluated: remaining != 0 yes Evaluation Count:1417 | yes Evaluation Count:12 |
| 12-1417 |
624 | | - |
625 | QAccessibleTextInsertEvent insertEvent(parent(), m_cursor, s); | - |
626 | QAccessible::updateAccessibility(&insertEvent); | - |
627 | | - |
628 | m_text.insert(m_cursor, s.left(remaining)); | - |
629 | for (int i = 0; i < (int) s.left(remaining).length(); ++i) evaluated: i < (int) s.left(remaining).length() yes Evaluation Count:1683 | yes Evaluation Count:1417 |
| 1417-1683 |
630 | addCommand(Command(Insert, m_cursor++, s.at(i), -1, -1)); executed: addCommand(Command(Insert, m_cursor++, s.at(i), -1, -1)); Execution Count:1683 | 1683 |
631 | m_textDirty = true; | - |
632 | } executed: } Execution Count:1417 | 1417 |
633 | } executed: } Execution Count:1429 | 1429 |
634 | } | - |
635 | void QWidgetLineControl::internalDelete(bool wasBackspace) | - |
636 | { | - |
637 | if (m_cursor < (int) m_text.length()) { partially evaluated: m_cursor < (int) m_text.length() yes Evaluation Count:88 | no Evaluation Count:0 |
| 0-88 |
638 | cancelPasswordEchoTimer(); | - |
639 | if (hasSelectedText()) partially evaluated: hasSelectedText() no Evaluation Count:0 | yes Evaluation Count:88 |
| 0-88 |
640 | addCommand(Command(SetSelection, m_cursor, 0, m_selstart, m_selend)); never executed: addCommand(Command(SetSelection, m_cursor, 0, m_selstart, m_selend)); | 0 |
641 | addCommand(Command((CommandType)((m_maskData ? 2 : 0) + (wasBackspace ? Remove : Delete)), | - |
642 | m_cursor, m_text.at(m_cursor), -1, -1)); | - |
643 | | - |
644 | QAccessibleTextRemoveEvent event(parent(), m_cursor, m_text.at(m_cursor)); | - |
645 | QAccessible::updateAccessibility(&event); | - |
646 | | - |
647 | if (m_maskData) { evaluated: m_maskData yes Evaluation Count:3 | yes Evaluation Count:85 |
| 3-85 |
648 | m_text.replace(m_cursor, 1, clearString(m_cursor, 1)); | - |
649 | addCommand(Command(Insert, m_cursor, m_text.at(m_cursor), -1, -1)); | - |
650 | } else { executed: } Execution Count:3 | 3 |
651 | m_text.remove(m_cursor, 1); | - |
652 | } executed: } Execution Count:85 | 85 |
653 | m_textDirty = true; | - |
654 | } executed: } Execution Count:88 | 88 |
655 | } executed: } Execution Count:88 | 88 |
656 | void QWidgetLineControl::removeSelectedText() | - |
657 | { | - |
658 | if (m_selstart < m_selend && m_selend <= (int) m_text.length()) { evaluated: m_selstart < m_selend yes Evaluation Count:636 | yes Evaluation Count:1457 |
evaluated: m_selend <= (int) m_text.length() yes Evaluation Count:630 | yes Evaluation Count:6 |
| 6-1457 |
659 | cancelPasswordEchoTimer(); | - |
660 | separate(); | - |
661 | int i ; | - |
662 | addCommand(Command(SetSelection, m_cursor, 0, m_selstart, m_selend)); | - |
663 | if (m_selstart <= m_cursor && m_cursor < m_selend) { partially evaluated: m_selstart <= m_cursor yes Evaluation Count:630 | no Evaluation Count:0 |
evaluated: m_cursor < m_selend yes Evaluation Count:380 | yes Evaluation Count:250 |
| 0-630 |
664 | | - |
665 | | - |
666 | for (i = m_cursor; i >= m_selstart; --i) evaluated: i >= m_selstart yes Evaluation Count:628 | yes Evaluation Count:380 |
| 380-628 |
667 | addCommand (Command(DeleteSelection, i, m_text.at(i), -1, 1)); executed: addCommand (Command(DeleteSelection, i, m_text.at(i), -1, 1)); Execution Count:628 | 628 |
668 | for (i = m_selend - 1; i > m_cursor; --i) evaluated: i > m_cursor yes Evaluation Count:1017 | yes Evaluation Count:380 |
| 380-1017 |
669 | addCommand (Command(DeleteSelection, i - m_cursor + m_selstart - 1, m_text.at(i), -1, -1)); executed: addCommand (Command(DeleteSelection, i - m_cursor + m_selstart - 1, m_text.at(i), -1, -1)); Execution Count:1017 | 1017 |
670 | } else { executed: } Execution Count:380 | 380 |
671 | for (i = m_selend-1; i >= m_selstart; --i) evaluated: i >= m_selstart yes Evaluation Count:3087 | yes Evaluation Count:250 |
| 250-3087 |
672 | addCommand (Command(RemoveSelection, i, m_text.at(i), -1, -1)); executed: addCommand (Command(RemoveSelection, i, m_text.at(i), -1, -1)); Execution Count:3087 | 3087 |
673 | } executed: } Execution Count:250 | 250 |
674 | | - |
675 | QAccessibleTextRemoveEvent event(parent(), m_selstart, m_text.mid(m_selstart, m_selend - m_selstart)); | - |
676 | QAccessible::updateAccessibility(&event); | - |
677 | | - |
678 | if (m_maskData) { evaluated: m_maskData yes Evaluation Count:95 | yes Evaluation Count:535 |
| 95-535 |
679 | m_text.replace(m_selstart, m_selend - m_selstart, clearString(m_selstart, m_selend - m_selstart)); | - |
680 | for (int i = 0; i < m_selend - m_selstart; ++i) evaluated: i < m_selend - m_selstart yes Evaluation Count:723 | yes Evaluation Count:95 |
| 95-723 |
681 | addCommand(Command(Insert, m_selstart + i, m_text.at(m_selstart + i), -1, -1)); executed: addCommand(Command(Insert, m_selstart + i, m_text.at(m_selstart + i), -1, -1)); Execution Count:723 | 723 |
682 | } else { executed: } Execution Count:95 | 95 |
683 | m_text.remove(m_selstart, m_selend - m_selstart); | - |
684 | } executed: } Execution Count:535 | 535 |
685 | if (m_cursor > m_selstart) evaluated: m_cursor > m_selstart yes Evaluation Count:289 | yes Evaluation Count:341 |
| 289-341 |
686 | m_cursor -= qMin(m_cursor, m_selend) - m_selstart; executed: m_cursor -= qMin(m_cursor, m_selend) - m_selstart; Execution Count:289 | 289 |
687 | internalDeselect(); | - |
688 | m_textDirty = true; | - |
689 | } executed: } Execution Count:630 | 630 |
690 | } executed: } Execution Count:2093 | 2093 |
691 | | - |
692 | | - |
693 | | - |
694 | | - |
695 | | - |
696 | | - |
697 | | - |
698 | void QWidgetLineControl::parseInputMask(const QString &maskFields) | - |
699 | { | - |
700 | int delimiter = maskFields.indexOf(QLatin1Char(';')); | - |
701 | if (maskFields.isEmpty() || delimiter == 0) { evaluated: maskFields.isEmpty() yes Evaluation Count:332 | yes Evaluation Count:104 |
partially evaluated: delimiter == 0 no Evaluation Count:0 | yes Evaluation Count:104 |
| 0-332 |
702 | if (m_maskData) { evaluated: m_maskData yes Evaluation Count:95 | yes Evaluation Count:237 |
| 95-237 |
703 | delete [] m_maskData; | - |
704 | m_maskData = 0; | - |
705 | m_maxLength = 32767; | - |
706 | internalSetText(QString()); | - |
707 | } executed: } Execution Count:95 | 95 |
708 | return; executed: return; Execution Count:332 | 332 |
709 | } | - |
710 | | - |
711 | if (delimiter == -1) { evaluated: delimiter == -1 yes Evaluation Count:80 | yes Evaluation Count:24 |
| 24-80 |
712 | m_blank = QLatin1Char(' '); | - |
713 | m_inputMask = maskFields; | - |
714 | } else { executed: } Execution Count:80 | 80 |
715 | m_inputMask = maskFields.left(delimiter); | - |
716 | m_blank = (delimiter + 1 < maskFields.length()) ? maskFields[delimiter + 1] : QLatin1Char(' '); evaluated: (delimiter + 1 < maskFields.length()) yes Evaluation Count:22 | yes Evaluation Count:2 |
| 2-22 |
717 | } executed: } Execution Count:24 | 24 |
718 | | - |
719 | | - |
720 | m_maxLength = 0; | - |
721 | QChar c = 0; | - |
722 | for (int i=0; i<m_inputMask.length(); i++) { evaluated: i<m_inputMask.length() yes Evaluation Count:928 | yes Evaluation Count:104 |
| 104-928 |
723 | c = m_inputMask.at(i); | - |
724 | if (i > 0 && m_inputMask.at(i-1) == QLatin1Char('\\')) { evaluated: i > 0 yes Evaluation Count:824 | yes Evaluation Count:104 |
evaluated: m_inputMask.at(i-1) == QLatin1Char('\\') yes Evaluation Count:14 | yes Evaluation Count:810 |
| 14-824 |
725 | m_maxLength++; | - |
726 | continue; executed: continue; Execution Count:14 | 14 |
727 | } | - |
728 | if (c != QLatin1Char('\\') && c != QLatin1Char('!') && evaluated: c != QLatin1Char('\\') yes Evaluation Count:902 | yes Evaluation Count:12 |
evaluated: c != QLatin1Char('!') yes Evaluation Count:862 | yes Evaluation Count:40 |
| 12-902 |
729 | c != QLatin1Char('<') && c != QLatin1Char('>') && evaluated: c != QLatin1Char('<') yes Evaluation Count:815 | yes Evaluation Count:47 |
evaluated: c != QLatin1Char('>') yes Evaluation Count:767 | yes Evaluation Count:48 |
| 47-815 |
730 | c != QLatin1Char('{') && c != QLatin1Char('}') && evaluated: c != QLatin1Char('{') yes Evaluation Count:765 | yes Evaluation Count:2 |
evaluated: c != QLatin1Char('}') yes Evaluation Count:763 | yes Evaluation Count:2 |
| 2-765 |
731 | c != QLatin1Char('[') && c != QLatin1Char(']')) evaluated: c != QLatin1Char('[') yes Evaluation Count:761 | yes Evaluation Count:2 |
evaluated: c != QLatin1Char(']') yes Evaluation Count:759 | yes Evaluation Count:2 |
| 2-761 |
732 | m_maxLength++; executed: m_maxLength++; Execution Count:759 | 759 |
733 | } executed: } Execution Count:914 | 914 |
734 | | - |
735 | delete [] m_maskData; | - |
736 | m_maskData = new MaskInputData[m_maxLength]; | - |
737 | | - |
738 | MaskInputData::Casemode m = MaskInputData::NoCaseMode; | - |
739 | c = 0; | - |
740 | bool s; | - |
741 | bool escape = false; | - |
742 | int index = 0; | - |
743 | for (int i = 0; i < m_inputMask.length(); i++) { evaluated: i < m_inputMask.length() yes Evaluation Count:928 | yes Evaluation Count:104 |
| 104-928 |
744 | c = m_inputMask.at(i); | - |
745 | if (escape) { evaluated: escape yes Evaluation Count:12 | yes Evaluation Count:916 |
| 12-916 |
746 | s = true; | - |
747 | m_maskData[index].maskChar = c; | - |
748 | m_maskData[index].separator = s; | - |
749 | m_maskData[index].caseMode = m; | - |
750 | index++; | - |
751 | escape = false; | - |
752 | } else if (c == QLatin1Char('<')) { executed: } Execution Count:12 evaluated: c == QLatin1Char('<') yes Evaluation Count:47 | yes Evaluation Count:869 |
| 12-869 |
753 | m = MaskInputData::Lower; | - |
754 | } else if (c == QLatin1Char('>')) { executed: } Execution Count:47 evaluated: c == QLatin1Char('>') yes Evaluation Count:48 | yes Evaluation Count:821 |
| 47-821 |
755 | m = MaskInputData::Upper; | - |
756 | } else if (c == QLatin1Char('!')) { executed: } Execution Count:48 evaluated: c == QLatin1Char('!') yes Evaluation Count:40 | yes Evaluation Count:781 |
| 40-781 |
757 | m = MaskInputData::NoCaseMode; | - |
758 | } else if (c != QLatin1Char('{') && c != QLatin1Char('}') && c != QLatin1Char('[') && c != QLatin1Char(']')) { executed: } Execution Count:40 evaluated: c != QLatin1Char('{') yes Evaluation Count:779 | yes Evaluation Count:2 |
evaluated: c != QLatin1Char('}') yes Evaluation Count:777 | yes Evaluation Count:2 |
evaluated: c != QLatin1Char('[') yes Evaluation Count:775 | yes Evaluation Count:2 |
evaluated: c != QLatin1Char(']') yes Evaluation Count:773 | yes Evaluation Count:2 |
| 2-779 |
759 | switch (c.unicode()) { | - |
760 | case 'A': | - |
761 | case 'a': | - |
762 | case 'N': | - |
763 | case 'n': | - |
764 | case 'X': | - |
765 | case 'x': | - |
766 | case '9': | - |
767 | case '0': | - |
768 | case 'D': | - |
769 | case 'd': | - |
770 | case '#': | - |
771 | case 'H': | - |
772 | case 'h': | - |
773 | case 'B': | - |
774 | case 'b': | - |
775 | s = false; | - |
776 | break; executed: break; Execution Count:656 | 656 |
777 | case '\\': | - |
778 | escape = true; | - |
779 | default: code before this statement executed: default: Execution Count:12 | 12 |
780 | s = true; | - |
781 | break; executed: break; Execution Count:117 | 117 |
782 | } | - |
783 | | - |
784 | if (!escape) { evaluated: !escape yes Evaluation Count:761 | yes Evaluation Count:12 |
| 12-761 |
785 | m_maskData[index].maskChar = c; | - |
786 | m_maskData[index].separator = s; | - |
787 | m_maskData[index].caseMode = m; | - |
788 | index++; | - |
789 | } executed: } Execution Count:761 | 761 |
790 | } executed: } Execution Count:773 | 773 |
791 | } | - |
792 | internalSetText(m_text); | - |
793 | } executed: } Execution Count:104 | 104 |
794 | | - |
795 | | - |
796 | | - |
797 | | - |
798 | | - |
799 | | - |
800 | | - |
801 | bool QWidgetLineControl::isValidInput(QChar key, QChar mask) const | - |
802 | { | - |
803 | switch (mask.unicode()) { | - |
804 | case 'A': | - |
805 | if (key.isLetter()) evaluated: key.isLetter() yes Evaluation Count:132 | yes Evaluation Count:119 |
| 119-132 |
806 | return true; executed: return true; Execution Count:132 | 132 |
807 | break; executed: break; Execution Count:119 | 119 |
808 | case 'a': | - |
809 | if (key.isLetter() || key == m_blank) evaluated: key.isLetter() yes Evaluation Count:64 | yes Evaluation Count:4 |
partially evaluated: key == m_blank yes Evaluation Count:4 | no Evaluation Count:0 |
| 0-64 |
810 | return true; executed: return true; Execution Count:68 | 68 |
811 | break; | 0 |
812 | case 'N': | - |
813 | if (key.isLetterOrNumber()) evaluated: key.isLetterOrNumber() yes Evaluation Count:18 | yes Evaluation Count:7 |
| 7-18 |
814 | return true; executed: return true; Execution Count:18 | 18 |
815 | break; executed: break; Execution Count:7 | 7 |
816 | case 'n': | - |
817 | if (key.isLetterOrNumber() || key == m_blank) evaluated: key.isLetterOrNumber() yes Evaluation Count:8 | yes Evaluation Count:4 |
partially evaluated: key == m_blank yes Evaluation Count:4 | no Evaluation Count:0 |
| 0-8 |
818 | return true; executed: return true; Execution Count:12 | 12 |
819 | break; | 0 |
820 | case 'X': | - |
821 | if (key.isPrint()) partially evaluated: key.isPrint() yes Evaluation Count:12 | no Evaluation Count:0 |
| 0-12 |
822 | return true; executed: return true; Execution Count:12 | 12 |
823 | break; | 0 |
824 | case 'x': | - |
825 | if (key.isPrint() || key == m_blank) partially evaluated: key.isPrint() yes Evaluation Count:10 | no Evaluation Count:0 |
never evaluated: key == m_blank | 0-10 |
826 | return true; executed: return true; Execution Count:10 | 10 |
827 | break; | 0 |
828 | case '9': | - |
829 | if (key.isNumber()) evaluated: key.isNumber() yes Evaluation Count:55 | yes Evaluation Count:11 |
| 11-55 |
830 | return true; executed: return true; Execution Count:55 | 55 |
831 | break; executed: break; Execution Count:11 | 11 |
832 | case '0': | - |
833 | if (key.isNumber() || key == m_blank) evaluated: key.isNumber() yes Evaluation Count:82 | yes Evaluation Count:73 |
evaluated: key == m_blank yes Evaluation Count:6 | yes Evaluation Count:67 |
| 6-82 |
834 | return true; executed: return true; Execution Count:88 | 88 |
835 | break; executed: break; Execution Count:67 | 67 |
836 | case 'D': | - |
837 | if (key.isNumber() && key.digitValue() > 0) evaluated: key.isNumber() yes Evaluation Count:20 | yes Evaluation Count:7 |
evaluated: key.digitValue() > 0 yes Evaluation Count:18 | yes Evaluation Count:2 |
| 2-20 |
838 | return true; executed: return true; Execution Count:18 | 18 |
839 | break; executed: break; Execution Count:9 | 9 |
840 | case 'd': | - |
841 | if ((key.isNumber() && key.digitValue() > 0) || key == m_blank) evaluated: key.isNumber() yes Evaluation Count:6 | yes Evaluation Count:4 |
partially evaluated: key.digitValue() > 0 yes Evaluation Count:6 | no Evaluation Count:0 |
partially evaluated: key == m_blank yes Evaluation Count:4 | no Evaluation Count:0 |
| 0-6 |
842 | return true; executed: return true; Execution Count:10 | 10 |
843 | break; | 0 |
844 | case '#': | - |
845 | if (key.isNumber() || key == QLatin1Char('+') || key == QLatin1Char('-') || key == m_blank) never evaluated: key.isNumber() never evaluated: key == QLatin1Char('+') never evaluated: key == QLatin1Char('-') never evaluated: key == m_blank | 0 |
846 | return true; never executed: return true; | 0 |
847 | break; | 0 |
848 | case 'B': | - |
849 | if (key == QLatin1Char('0') || key == QLatin1Char('1')) evaluated: key == QLatin1Char('0') yes Evaluation Count:9 | yes Evaluation Count:117 |
evaluated: key == QLatin1Char('1') yes Evaluation Count:13 | yes Evaluation Count:104 |
| 9-117 |
850 | return true; executed: return true; Execution Count:22 | 22 |
851 | break; executed: break; Execution Count:104 | 104 |
852 | case 'b': | - |
853 | if (key == QLatin1Char('0') || key == QLatin1Char('1') || key == m_blank) evaluated: key == QLatin1Char('0') yes Evaluation Count:11 | yes Evaluation Count:157 |
evaluated: key == QLatin1Char('1') yes Evaluation Count:9 | yes Evaluation Count:148 |
evaluated: key == m_blank yes Evaluation Count:68 | yes Evaluation Count:80 |
| 9-157 |
854 | return true; executed: return true; Execution Count:88 | 88 |
855 | break; executed: break; Execution Count:80 | 80 |
856 | case 'H': | - |
857 | if (key.isNumber() || (key >= QLatin1Char('a') && key <= QLatin1Char('f')) || (key >= QLatin1Char('A') && key <= QLatin1Char('F'))) evaluated: key.isNumber() yes Evaluation Count:66 | yes Evaluation Count:191 |
evaluated: key >= QLatin1Char('a') yes Evaluation Count:68 | yes Evaluation Count:123 |
evaluated: key <= QLatin1Char('f') yes Evaluation Count:28 | yes Evaluation Count:40 |
evaluated: key >= QLatin1Char('A') yes Evaluation Count:116 | yes Evaluation Count:47 |
evaluated: key <= QLatin1Char('F') yes Evaluation Count:36 | yes Evaluation Count:80 |
| 28-191 |
858 | return true; executed: return true; Execution Count:130 | 130 |
859 | break; executed: break; Execution Count:127 | 127 |
860 | case 'h': | - |
861 | if (key.isNumber() || (key >= QLatin1Char('a') && key <= QLatin1Char('f')) || (key >= QLatin1Char('A') && key <= QLatin1Char('F')) || key == m_blank) evaluated: key.isNumber() yes Evaluation Count:34 | yes Evaluation Count:208 |
evaluated: key >= QLatin1Char('a') yes Evaluation Count:66 | yes Evaluation Count:142 |
evaluated: key <= QLatin1Char('f') yes Evaluation Count:26 | yes Evaluation Count:40 |
evaluated: key >= QLatin1Char('A') yes Evaluation Count:102 | yes Evaluation Count:80 |
evaluated: key <= QLatin1Char('F') yes Evaluation Count:22 | yes Evaluation Count:80 |
evaluated: key == m_blank yes Evaluation Count:80 | yes Evaluation Count:80 |
| 22-208 |
862 | return true; executed: return true; Execution Count:162 | 162 |
863 | break; executed: break; Execution Count:80 | 80 |
864 | default: | - |
865 | break; | 0 |
866 | } | - |
867 | return false; executed: return false; Execution Count:604 | 604 |
868 | } | - |
869 | bool QWidgetLineControl::hasAcceptableInput(const QString &str) const | - |
870 | { | - |
871 | | - |
872 | QString textCopy = str; | - |
873 | int cursorCopy = m_cursor; | - |
874 | if (m_validator && m_validator->validate(textCopy, cursorCopy) evaluated: m_validator yes Evaluation Count:1615 | yes Evaluation Count:739 |
| 642-1615 |
875 | != QValidator::Acceptable) evaluated: m_validator->validate(textCopy, cursorCopy) != QValidator::Acceptable yes Evaluation Count:642 | yes Evaluation Count:973 |
| 642-973 |
876 | return false; executed: return false; Execution Count:642 | 642 |
877 | | - |
878 | | - |
879 | if (!m_maskData) evaluated: !m_maskData yes Evaluation Count:1366 | yes Evaluation Count:346 |
| 346-1366 |
880 | return true; executed: return true; Execution Count:1366 | 1366 |
881 | | - |
882 | if (str.length() != m_maxLength) partially evaluated: str.length() != m_maxLength no Evaluation Count:0 | yes Evaluation Count:346 |
| 0-346 |
883 | return false; never executed: return false; | 0 |
884 | | - |
885 | for (int i=0; i < m_maxLength; ++i) { evaluated: i < m_maxLength yes Evaluation Count:421 | yes Evaluation Count:267 |
| 267-421 |
886 | if (m_maskData[i].separator) { partially evaluated: m_maskData[i].separator no Evaluation Count:0 | yes Evaluation Count:421 |
| 0-421 |
887 | if (str.at(i) != m_maskData[i].maskChar) never evaluated: str.at(i) != m_maskData[i].maskChar | 0 |
888 | return false; never executed: return false; | 0 |
889 | } else { | 0 |
890 | if (!isValidInput(str.at(i), m_maskData[i].maskChar)) evaluated: !isValidInput(str.at(i), m_maskData[i].maskChar) yes Evaluation Count:79 | yes Evaluation Count:342 |
| 79-342 |
891 | return false; executed: return false; Execution Count:79 | 79 |
892 | } executed: } Execution Count:342 | 342 |
893 | } | - |
894 | return true; executed: return true; Execution Count:267 | 267 |
895 | } | - |
896 | QString QWidgetLineControl::maskString(uint pos, const QString &str, bool clear) const | - |
897 | { | - |
898 | if (pos >= (uint)m_maxLength) evaluated: pos >= (uint)m_maxLength yes Evaluation Count:5 | yes Evaluation Count:669 |
| 5-669 |
899 | return QString::fromLatin1(""); executed: return QString::fromLatin1(""); Execution Count:5 | 5 |
900 | | - |
901 | QString fill; | - |
902 | fill = clear ? clearString(0, m_maxLength) : m_text; evaluated: clear yes Evaluation Count:414 | yes Evaluation Count:255 |
| 255-414 |
903 | | - |
904 | int strIndex = 0; | - |
905 | QString s = QString::fromLatin1(""); | - |
906 | int i = pos; | - |
907 | while (i < m_maxLength) { evaluated: i < m_maxLength yes Evaluation Count:1278 | yes Evaluation Count:103 |
| 103-1278 |
908 | if (strIndex < str.length()) { evaluated: strIndex < str.length() yes Evaluation Count:712 | yes Evaluation Count:566 |
| 566-712 |
909 | if (m_maskData[i].separator) { evaluated: m_maskData[i].separator yes Evaluation Count:23 | yes Evaluation Count:689 |
| 23-689 |
910 | s += m_maskData[i].maskChar; | - |
911 | if (str[(int)strIndex] == m_maskData[i].maskChar) evaluated: str[(int)strIndex] == m_maskData[i].maskChar yes Evaluation Count:7 | yes Evaluation Count:16 |
| 7-16 |
912 | strIndex++; executed: strIndex++; Execution Count:7 | 7 |
913 | ++i; | - |
914 | } else { executed: } Execution Count:23 | 23 |
915 | if (isValidInput(str[(int)strIndex], m_maskData[i].maskChar)) { evaluated: isValidInput(str[(int)strIndex], m_maskData[i].maskChar) yes Evaluation Count:478 | yes Evaluation Count:211 |
| 211-478 |
916 | switch (m_maskData[i].caseMode) { | - |
917 | case MaskInputData::Upper: | - |
918 | s += str[(int)strIndex].toUpper(); | - |
919 | break; executed: break; Execution Count:65 | 65 |
920 | case MaskInputData::Lower: | - |
921 | s += str[(int)strIndex].toLower(); | - |
922 | break; executed: break; Execution Count:64 | 64 |
923 | default: | - |
924 | s += str[(int)strIndex]; | - |
925 | } executed: } Execution Count:349 | 349 |
926 | ++i; | - |
927 | } else { executed: } Execution Count:478 | 478 |
928 | | - |
929 | int n = findInMask(i, true, true, str[(int)strIndex]); | - |
930 | if (n != -1) { evaluated: n != -1 yes Evaluation Count:24 | yes Evaluation Count:187 |
| 24-187 |
931 | if (str.length() != 1 || i == 0 || (i > 0 && (!m_maskData[i-1].separator || m_maskData[i-1].maskChar != str[(int)strIndex]))) { evaluated: str.length() != 1 yes Evaluation Count:8 | yes Evaluation Count:16 |
evaluated: i == 0 yes Evaluation Count:1 | yes Evaluation Count:15 |
partially evaluated: i > 0 yes Evaluation Count:15 | no Evaluation Count:0 |
evaluated: !m_maskData[i-1].separator yes Evaluation Count:9 | yes Evaluation Count:6 |
partially evaluated: m_maskData[i-1].maskChar != str[(int)strIndex] no Evaluation Count:0 | yes Evaluation Count:6 |
| 0-16 |
932 | s += fill.mid(i, n-i+1); | - |
933 | i = n + 1; | - |
934 | } executed: } Execution Count:18 | 18 |
935 | } else { executed: } Execution Count:24 | 24 |
936 | | - |
937 | n = findInMask(i, true, false, str[(int)strIndex]); | - |
938 | if (n != -1) { evaluated: n != -1 yes Evaluation Count:5 | yes Evaluation Count:182 |
| 5-182 |
939 | s += fill.mid(i, n-i); | - |
940 | switch (m_maskData[n].caseMode) { | - |
941 | case MaskInputData::Upper: | - |
942 | s += str[(int)strIndex].toUpper(); | - |
943 | break; executed: break; Execution Count:1 | 1 |
944 | case MaskInputData::Lower: | - |
945 | s += str[(int)strIndex].toLower(); | - |
946 | break; | 0 |
947 | default: | - |
948 | s += str[(int)strIndex]; | - |
949 | } executed: } Execution Count:4 | 4 |
950 | i = n + 1; | - |
951 | } executed: } Execution Count:5 | 5 |
952 | } executed: } Execution Count:187 | 187 |
953 | } | - |
954 | ++strIndex; | - |
955 | } executed: } Execution Count:689 | 689 |
956 | } else | - |
957 | break; executed: break; Execution Count:566 | 566 |
958 | } | - |
959 | | - |
960 | return s; executed: return s; Execution Count:669 | 669 |
961 | } | - |
962 | QString QWidgetLineControl::clearString(uint pos, uint len) const | - |
963 | { | - |
964 | if (pos >= (uint)m_maxLength) evaluated: pos >= (uint)m_maxLength yes Evaluation Count:59 | yes Evaluation Count:867 |
| 59-867 |
965 | return QString(); executed: return QString(); Execution Count:59 | 59 |
966 | | - |
967 | QString s; | - |
968 | int end = qMin((uint)m_maxLength, pos + len); | - |
969 | for (int i = pos; i < end; ++i) evaluated: i < end yes Evaluation Count:4159 | yes Evaluation Count:867 |
| 867-4159 |
970 | if (m_maskData[i].separator) evaluated: m_maskData[i].separator yes Evaluation Count:560 | yes Evaluation Count:3599 |
| 560-3599 |
971 | s += m_maskData[i].maskChar; executed: s += m_maskData[i].maskChar; Execution Count:560 | 560 |
972 | else | - |
973 | s += m_blank; executed: s += m_blank; Execution Count:3599 | 3599 |
974 | | - |
975 | return s; executed: return s; Execution Count:867 | 867 |
976 | } | - |
977 | | - |
978 | | - |
979 | | - |
980 | | - |
981 | | - |
982 | | - |
983 | | - |
984 | QString QWidgetLineControl::stripString(const QString &str) const | - |
985 | { | - |
986 | if (!m_maskData) partially evaluated: !m_maskData no Evaluation Count:0 | yes Evaluation Count:786 |
| 0-786 |
987 | return str; never executed: return str; | 0 |
988 | | - |
989 | QString s; | - |
990 | int end = qMin(m_maxLength, (int)str.length()); | - |
991 | for (int i = 0; i < end; ++i) evaluated: i < end yes Evaluation Count:4974 | yes Evaluation Count:786 |
| 786-4974 |
992 | if (m_maskData[i].separator) evaluated: m_maskData[i].separator yes Evaluation Count:657 | yes Evaluation Count:4317 |
| 657-4317 |
993 | s += m_maskData[i].maskChar; executed: s += m_maskData[i].maskChar; Execution Count:657 | 657 |
994 | else | - |
995 | if (str[i] != m_blank) evaluated: str[i] != m_blank yes Evaluation Count:1621 | yes Evaluation Count:2696 |
| 1621-2696 |
996 | s += str[i]; executed: s += str[i]; Execution Count:1621 | 1621 |
997 | | - |
998 | return s; executed: return s; Execution Count:786 | 786 |
999 | } | - |
1000 | | - |
1001 | | - |
1002 | | - |
1003 | | - |
1004 | | - |
1005 | int QWidgetLineControl::findInMask(int pos, bool forward, bool findSeparator, QChar searchChar) const | - |
1006 | { | - |
1007 | if (pos >= m_maxLength || pos < 0) evaluated: pos >= m_maxLength yes Evaluation Count:49 | yes Evaluation Count:823 |
partially evaluated: pos < 0 no Evaluation Count:0 | yes Evaluation Count:823 |
| 0-823 |
1008 | return -1; executed: return -1; Execution Count:49 | 49 |
1009 | | - |
1010 | int end = forward ? m_maxLength : -1; evaluated: forward yes Evaluation Count:714 | yes Evaluation Count:109 |
| 109-714 |
1011 | int step = forward ? 1 : -1; evaluated: forward yes Evaluation Count:714 | yes Evaluation Count:109 |
| 109-714 |
1012 | int i = pos; | - |
1013 | | - |
1014 | while (i != end) { evaluated: i != end yes Evaluation Count:1215 | yes Evaluation Count:372 |
| 372-1215 |
1015 | if (findSeparator) { evaluated: findSeparator yes Evaluation Count:428 | yes Evaluation Count:787 |
| 428-787 |
1016 | if (m_maskData[i].separator && m_maskData[i].maskChar == searchChar) evaluated: m_maskData[i].separator yes Evaluation Count:45 | yes Evaluation Count:383 |
evaluated: m_maskData[i].maskChar == searchChar yes Evaluation Count:24 | yes Evaluation Count:21 |
| 21-383 |
1017 | return i; executed: return i; Execution Count:24 | 24 |
1018 | } else { executed: } Execution Count:404 | 404 |
1019 | if (!m_maskData[i].separator) { evaluated: !m_maskData[i].separator yes Evaluation Count:741 | yes Evaluation Count:46 |
| 46-741 |
1020 | if (searchChar.isNull()) evaluated: searchChar.isNull() yes Evaluation Count:422 | yes Evaluation Count:319 |
| 319-422 |
1021 | return i; executed: return i; Execution Count:422 | 422 |
1022 | else if (isValidInput(searchChar, m_maskData[i].maskChar)) evaluated: isValidInput(searchChar, m_maskData[i].maskChar) yes Evaluation Count:5 | yes Evaluation Count:314 |
| 5-314 |
1023 | return i; executed: return i; Execution Count:5 | 5 |
1024 | } | - |
1025 | } executed: } Execution Count:360 | 360 |
1026 | i += step; | - |
1027 | } executed: } Execution Count:764 | 764 |
1028 | return -1; executed: return -1; Execution Count:372 | 372 |
1029 | } | - |
1030 | | - |
1031 | void QWidgetLineControl::internalUndo(int until) | - |
1032 | { | - |
1033 | if (!isUndoAvailable()) evaluated: !isUndoAvailable() yes Evaluation Count:3 | yes Evaluation Count:312 |
| 3-312 |
1034 | return; executed: return; Execution Count:3 | 3 |
1035 | cancelPasswordEchoTimer(); | - |
1036 | internalDeselect(); | - |
1037 | | - |
1038 | | - |
1039 | if (m_echoMode != QLineEdit::Normal) { evaluated: m_echoMode != QLineEdit::Normal yes Evaluation Count:3 | yes Evaluation Count:309 |
| 3-309 |
1040 | clear(); | - |
1041 | return; executed: return; Execution Count:3 | 3 |
1042 | } | - |
1043 | | - |
1044 | while (m_undoState && m_undoState > until) { evaluated: m_undoState yes Evaluation Count:1391 | yes Evaluation Count:76 |
evaluated: m_undoState > until yes Evaluation Count:1195 | yes Evaluation Count:196 |
| 76-1391 |
1045 | Command& cmd = m_history[--m_undoState]; | - |
1046 | switch (cmd.type) { | - |
1047 | case Insert: | - |
1048 | m_text.remove(cmd.pos, 1); | - |
1049 | m_cursor = cmd.pos; | - |
1050 | break; executed: break; Execution Count:460 | 460 |
1051 | case SetSelection: | - |
1052 | m_selstart = cmd.selStart; | - |
1053 | m_selend = cmd.selEnd; | - |
1054 | m_cursor = cmd.pos; | - |
1055 | break; executed: break; Execution Count:160 | 160 |
1056 | case Remove: | - |
1057 | case RemoveSelection: | - |
1058 | m_text.insert(cmd.pos, cmd.uc); | - |
1059 | m_cursor = cmd.pos + 1; | - |
1060 | break; executed: break; Execution Count:50 | 50 |
1061 | case Delete: | - |
1062 | case DeleteSelection: | - |
1063 | m_text.insert(cmd.pos, cmd.uc); | - |
1064 | m_cursor = cmd.pos; | - |
1065 | break; executed: break; Execution Count:354 | 354 |
1066 | case Separator: | - |
1067 | continue; executed: continue; Execution Count:171 | 171 |
1068 | } | - |
1069 | if (until < 0 && m_undoState) { evaluated: until < 0 yes Evaluation Count:273 | yes Evaluation Count:751 |
evaluated: m_undoState yes Evaluation Count:254 | yes Evaluation Count:19 |
| 19-751 |
1070 | Command& next = m_history[m_undoState-1]; | - |
1071 | if (next.type != cmd.type && next.type < RemoveSelection evaluated: next.type != cmd.type yes Evaluation Count:61 | yes Evaluation Count:193 |
evaluated: next.type < RemoveSelection yes Evaluation Count:37 | yes Evaluation Count:24 |
| 24-193 |
1072 | && (cmd.type < RemoveSelection || next.type == Separator)) evaluated: cmd.type < RemoveSelection yes Evaluation Count:26 | yes Evaluation Count:11 |
partially evaluated: next.type == Separator yes Evaluation Count:11 | no Evaluation Count:0 |
| 0-26 |
1073 | break; executed: break; Execution Count:37 | 37 |
1074 | } executed: } Execution Count:217 | 217 |
1075 | } executed: } Execution Count:987 | 987 |
1076 | m_textDirty = true; | - |
1077 | emitCursorPositionChanged(); | - |
1078 | } executed: } Execution Count:309 | 309 |
1079 | | - |
1080 | void QWidgetLineControl::internalRedo() | - |
1081 | { | - |
1082 | if (!isRedoAvailable()) evaluated: !isRedoAvailable() yes Evaluation Count:7 | yes Evaluation Count:9 |
| 7-9 |
1083 | return; executed: return; Execution Count:7 | 7 |
1084 | internalDeselect(); | - |
1085 | while (m_undoState < (int)m_history.size()) { evaluated: m_undoState < (int)m_history.size() yes Evaluation Count:41 | yes Evaluation Count:6 |
| 6-41 |
1086 | Command& cmd = m_history[m_undoState++]; | - |
1087 | switch (cmd.type) { | - |
1088 | case Insert: | - |
1089 | m_text.insert(cmd.pos, cmd.uc); | - |
1090 | m_cursor = cmd.pos + 1; | - |
1091 | break; executed: break; Execution Count:22 | 22 |
1092 | case SetSelection: | - |
1093 | m_selstart = cmd.selStart; | - |
1094 | m_selend = cmd.selEnd; | - |
1095 | m_cursor = cmd.pos; | - |
1096 | break; executed: break; Execution Count:5 | 5 |
1097 | case Remove: | - |
1098 | case Delete: | - |
1099 | case RemoveSelection: | - |
1100 | case DeleteSelection: | - |
1101 | m_text.remove(cmd.pos, 1); | - |
1102 | m_selstart = cmd.selStart; | - |
1103 | m_selend = cmd.selEnd; | - |
1104 | m_cursor = cmd.pos; | - |
1105 | break; executed: break; Execution Count:11 | 11 |
1106 | case Separator: | - |
1107 | m_selstart = cmd.selStart; | - |
1108 | m_selend = cmd.selEnd; | - |
1109 | m_cursor = cmd.pos; | - |
1110 | break; executed: break; Execution Count:3 | 3 |
1111 | } | - |
1112 | if (m_undoState < (int)m_history.size()) { evaluated: m_undoState < (int)m_history.size() yes Evaluation Count:35 | yes Evaluation Count:6 |
| 6-35 |
1113 | Command& next = m_history[m_undoState]; | - |
1114 | if (next.type != cmd.type && cmd.type < RemoveSelection && next.type != Separator evaluated: next.type != cmd.type yes Evaluation Count:14 | yes Evaluation Count:21 |
evaluated: cmd.type < RemoveSelection yes Evaluation Count:6 | yes Evaluation Count:8 |
evaluated: next.type != Separator yes Evaluation Count:3 | yes Evaluation Count:3 |
| 3-21 |
1115 | && (next.type < RemoveSelection || cmd.type == Separator)) partially evaluated: next.type < RemoveSelection yes Evaluation Count:3 | no Evaluation Count:0 |
never evaluated: cmd.type == Separator | 0-3 |
1116 | break; executed: break; Execution Count:3 | 3 |
1117 | } executed: } Execution Count:32 | 32 |
1118 | } executed: } Execution Count:38 | 38 |
1119 | m_textDirty = true; | - |
1120 | emitCursorPositionChanged(); | - |
1121 | } executed: } Execution Count:9 | 9 |
1122 | | - |
1123 | | - |
1124 | | - |
1125 | | - |
1126 | | - |
1127 | | - |
1128 | | - |
1129 | void QWidgetLineControl::emitCursorPositionChanged() | - |
1130 | { | - |
1131 | if (m_cursor != m_lastCursorPos) { evaluated: m_cursor != m_lastCursorPos yes Evaluation Count:11650 | yes Evaluation Count:4635 |
| 4635-11650 |
1132 | const int oldLast = m_lastCursorPos; | - |
1133 | m_lastCursorPos = m_cursor; | - |
1134 | cursorPositionChanged(oldLast, m_cursor); | - |
1135 | | - |
1136 | | - |
1137 | if (!hasSelectedText()) { evaluated: !hasSelectedText() yes Evaluation Count:8710 | yes Evaluation Count:2940 |
| 2940-8710 |
1138 | QAccessibleTextCursorEvent event(parent(), m_cursor); | - |
1139 | QAccessible::updateAccessibility(&event); | - |
1140 | } executed: } Execution Count:8710 | 8710 |
1141 | | - |
1142 | } executed: } Execution Count:11650 | 11650 |
1143 | } executed: } Execution Count:16285 | 16285 |
1144 | | - |
1145 | | - |
1146 | | - |
1147 | | - |
1148 | bool QWidgetLineControl::advanceToEnabledItem(int dir) | - |
1149 | { | - |
1150 | int start = m_completer->currentRow(); | - |
1151 | if (start == -1) evaluated: start == -1 yes Evaluation Count:4 | yes Evaluation Count:15 |
| 4-15 |
1152 | return false; executed: return false; Execution Count:4 | 4 |
1153 | int i = start + dir; | - |
1154 | if (dir == 0) dir = 1; executed: dir = 1; Execution Count:8 evaluated: dir == 0 yes Evaluation Count:8 | yes Evaluation Count:7 |
| 7-8 |
1155 | do { | - |
1156 | if (!m_completer->setCurrentRow(i)) { evaluated: !m_completer->setCurrentRow(i) yes Evaluation Count:4 | yes Evaluation Count:24 |
| 4-24 |
1157 | if (!m_completer->wrapAround()) evaluated: !m_completer->wrapAround() yes Evaluation Count:2 | yes Evaluation Count:2 |
| 2 |
1158 | break; executed: break; Execution Count:2 | 2 |
1159 | i = i > 0 ? 0 : m_completer->completionCount() - 1; evaluated: i > 0 yes Evaluation Count:1 | yes Evaluation Count:1 |
| 1 |
1160 | } else { executed: } Execution Count:2 | 2 |
1161 | QModelIndex currentIndex = m_completer->currentIndex(); | - |
1162 | if (m_completer->completionModel()->flags(currentIndex) & Qt::ItemIsEnabled) evaluated: m_completer->completionModel()->flags(currentIndex) & Qt::ItemIsEnabled yes Evaluation Count:13 | yes Evaluation Count:11 |
| 11-13 |
1163 | return true; executed: return true; Execution Count:13 | 13 |
1164 | i += dir; | - |
1165 | } executed: } Execution Count:11 | 11 |
1166 | } while (i != start); partially evaluated: i != start yes Evaluation Count:13 | no Evaluation Count:0 |
| 0-13 |
1167 | | - |
1168 | m_completer->setCurrentRow(start); | - |
1169 | return false; executed: return false; Execution Count:2 | 2 |
1170 | } | - |
1171 | | - |
1172 | void QWidgetLineControl::complete(int key) | - |
1173 | { | - |
1174 | if (!m_completer || isReadOnly() || echoMode() != QLineEdit::Normal) evaluated: !m_completer yes Evaluation Count:1554 | yes Evaluation Count:121 |
partially evaluated: isReadOnly() no Evaluation Count:0 | yes Evaluation Count:121 |
partially evaluated: echoMode() != QLineEdit::Normal no Evaluation Count:0 | yes Evaluation Count:121 |
| 0-1554 |
1175 | return; executed: return; Execution Count:1554 | 1554 |
1176 | | - |
1177 | QString text = this->text(); | - |
1178 | if (m_completer->completionMode() == QCompleter::InlineCompletion) { evaluated: m_completer->completionMode() == QCompleter::InlineCompletion yes Evaluation Count:20 | yes Evaluation Count:101 |
| 20-101 |
1179 | if (key == Qt::Key_Backspace) partially evaluated: key == Qt::Key_Backspace no Evaluation Count:0 | yes Evaluation Count:20 |
| 0-20 |
1180 | return; | 0 |
1181 | int n = 0; | - |
1182 | if (key == Qt::Key_Up || key == Qt::Key_Down) { evaluated: key == Qt::Key_Up yes Evaluation Count:4 | yes Evaluation Count:16 |
evaluated: key == Qt::Key_Down yes Evaluation Count:8 | yes Evaluation Count:8 |
| 4-16 |
1183 | if (textAfterSelection().length()) evaluated: textAfterSelection().length() yes Evaluation Count:1 | yes Evaluation Count:11 |
| 1-11 |
1184 | return; executed: return; Execution Count:1 | 1 |
1185 | QString prefix = hasSelectedText() ? textBeforeSelection() evaluated: hasSelectedText() yes Evaluation Count:6 | yes Evaluation Count:5 |
| 5-6 |
1186 | : text; | - |
1187 | if (text.compare(m_completer->currentCompletion(), m_completer->caseSensitivity()) != 0 evaluated: text.compare(m_completer->currentCompletion(), m_completer->caseSensitivity()) != 0 yes Evaluation Count:3 | yes Evaluation Count:8 |
| 3-8 |
1188 | || prefix.compare(m_completer->completionPrefix(), m_completer->caseSensitivity()) != 0) { evaluated: prefix.compare(m_completer->completionPrefix(), m_completer->caseSensitivity()) != 0 yes Evaluation Count:1 | yes Evaluation Count:7 |
| 1-7 |
1189 | m_completer->setCompletionPrefix(prefix); | - |
1190 | } else { executed: } Execution Count:4 | 4 |
1191 | n = (key == Qt::Key_Up) ? -1 : +1; evaluated: (key == Qt::Key_Up) yes Evaluation Count:3 | yes Evaluation Count:4 |
| 3-4 |
1192 | } executed: } Execution Count:7 | 7 |
1193 | } else { | - |
1194 | m_completer->setCompletionPrefix(text); | - |
1195 | } executed: } Execution Count:8 | 8 |
1196 | if (!advanceToEnabledItem(n)) evaluated: !advanceToEnabledItem(n) yes Evaluation Count:6 | yes Evaluation Count:13 |
| 6-13 |
1197 | return; executed: return; Execution Count:6 | 6 |
1198 | } else { executed: } Execution Count:13 | 13 |
1199 | | - |
1200 | if (text.isEmpty()) { partially evaluated: text.isEmpty() no Evaluation Count:0 | yes Evaluation Count:101 |
| 0-101 |
1201 | m_completer->popup()->hide(); | - |
1202 | return; | 0 |
1203 | } | - |
1204 | | - |
1205 | m_completer->setCompletionPrefix(text); | - |
1206 | } executed: } Execution Count:101 | 101 |
1207 | | - |
1208 | m_completer->complete(); | - |
1209 | } executed: } Execution Count:114 | 114 |
1210 | | - |
1211 | | - |
1212 | void QWidgetLineControl::setReadOnly(bool enable) | - |
1213 | { | - |
1214 | m_readOnly = enable; | - |
1215 | if (enable) evaluated: enable yes Evaluation Count:15 | yes Evaluation Count:7 |
| 7-15 |
1216 | setCursorBlinkPeriod(0); executed: setCursorBlinkPeriod(0); Execution Count:15 | 15 |
1217 | else | - |
1218 | setCursorBlinkPeriod(QApplication::cursorFlashTime()); executed: setCursorBlinkPeriod(QApplication::cursorFlashTime()); Execution Count:7 | 7 |
1219 | } | - |
1220 | | - |
1221 | void QWidgetLineControl::setCursorBlinkPeriod(int msec) | - |
1222 | { | - |
1223 | if (msec == m_blinkPeriod) evaluated: msec == m_blinkPeriod yes Evaluation Count:1979 | yes Evaluation Count:4882 |
| 1979-4882 |
1224 | return; executed: return; Execution Count:1979 | 1979 |
1225 | if (m_blinkTimer) { evaluated: m_blinkTimer yes Evaluation Count:2355 | yes Evaluation Count:2527 |
| 2355-2527 |
1226 | killTimer(m_blinkTimer); | - |
1227 | } executed: } Execution Count:2355 | 2355 |
1228 | if (msec && !m_readOnly) { evaluated: msec yes Evaluation Count:2525 | yes Evaluation Count:2357 |
evaluated: !m_readOnly yes Evaluation Count:2519 | yes Evaluation Count:6 |
| 6-2525 |
1229 | m_blinkTimer = startTimer(msec / 2); | - |
1230 | m_blinkStatus = 1; | - |
1231 | } else { executed: } Execution Count:2519 | 2519 |
1232 | m_blinkTimer = 0; | - |
1233 | if (m_blinkStatus == 1) evaluated: m_blinkStatus == 1 yes Evaluation Count:2351 | yes Evaluation Count:12 |
| 12-2351 |
1234 | updateNeeded(inputMask().isEmpty() ? cursorRect() : QRect()); executed: updateNeeded(inputMask().isEmpty() ? cursorRect() : QRect()); Execution Count:2351 | 2351 |
1235 | } executed: } Execution Count:2363 | 2363 |
1236 | m_blinkPeriod = msec; | - |
1237 | } executed: } Execution Count:4882 | 4882 |
1238 | | - |
1239 | | - |
1240 | void QWidgetLineControl::resetCursorBlinkTimer() | - |
1241 | { | - |
1242 | if (m_blinkPeriod == 0 || m_blinkTimer == 0) never evaluated: m_blinkPeriod == 0 never evaluated: m_blinkTimer == 0 | 0 |
1243 | return; | 0 |
1244 | killTimer(m_blinkTimer); | - |
1245 | m_blinkTimer = startTimer(m_blinkPeriod / 2); | - |
1246 | m_blinkStatus = 1; | - |
1247 | } | 0 |
1248 | | - |
1249 | void QWidgetLineControl::timerEvent(QTimerEvent *event) | - |
1250 | { | - |
1251 | if (event->timerId() == m_blinkTimer) { partially evaluated: event->timerId() == m_blinkTimer yes Evaluation Count:63 | no Evaluation Count:0 |
| 0-63 |
1252 | m_blinkStatus = !m_blinkStatus; | - |
1253 | updateNeeded(inputMask().isEmpty() ? cursorRect() : QRect()); | - |
1254 | } else if (event->timerId() == m_deleteAllTimer) { executed: } Execution Count:63 never evaluated: event->timerId() == m_deleteAllTimer | 0-63 |
1255 | killTimer(m_deleteAllTimer); | - |
1256 | m_deleteAllTimer = 0; | - |
1257 | clear(); | - |
1258 | } else if (event->timerId() == m_tripleClickTimer) { never evaluated: event->timerId() == m_tripleClickTimer | 0 |
1259 | killTimer(m_tripleClickTimer); | - |
1260 | m_tripleClickTimer = 0; | - |
1261 | } else if (event->timerId() == m_passwordEchoTimer) { never evaluated: event->timerId() == m_passwordEchoTimer | 0 |
1262 | killTimer(m_passwordEchoTimer); | - |
1263 | m_passwordEchoTimer = 0; | - |
1264 | updateDisplayText(); | - |
1265 | } | 0 |
1266 | } | - |
1267 | | - |
1268 | | - |
1269 | void QWidgetLineControl::processShortcutOverrideEvent(QKeyEvent *ke) | - |
1270 | { | - |
1271 | if (isReadOnly()) evaluated: isReadOnly() yes Evaluation Count:39 | yes Evaluation Count:3762 |
| 39-3762 |
1272 | return; executed: return; Execution Count:39 | 39 |
1273 | | - |
1274 | if (ke == QKeySequence::Copy partially evaluated: ke == QKeySequence::Copy no Evaluation Count:0 | yes Evaluation Count:3762 |
| 0-3762 |
1275 | || ke == QKeySequence::Paste partially evaluated: ke == QKeySequence::Paste no Evaluation Count:0 | yes Evaluation Count:3762 |
| 0-3762 |
1276 | || ke == QKeySequence::Cut partially evaluated: ke == QKeySequence::Cut no Evaluation Count:0 | yes Evaluation Count:3762 |
| 0-3762 |
1277 | || ke == QKeySequence::Redo evaluated: ke == QKeySequence::Redo yes Evaluation Count:2 | yes Evaluation Count:3760 |
| 2-3760 |
1278 | || ke == QKeySequence::Undo evaluated: ke == QKeySequence::Undo yes Evaluation Count:4 | yes Evaluation Count:3756 |
| 4-3756 |
1279 | || ke == QKeySequence::MoveToNextWord evaluated: ke == QKeySequence::MoveToNextWord yes Evaluation Count:2 | yes Evaluation Count:3754 |
| 2-3754 |
1280 | || ke == QKeySequence::MoveToPreviousWord evaluated: ke == QKeySequence::MoveToPreviousWord yes Evaluation Count:2 | yes Evaluation Count:3752 |
| 2-3752 |
1281 | || ke == QKeySequence::MoveToStartOfDocument partially evaluated: ke == QKeySequence::MoveToStartOfDocument no Evaluation Count:0 | yes Evaluation Count:3752 |
| 0-3752 |
1282 | || ke == QKeySequence::MoveToEndOfDocument partially evaluated: ke == QKeySequence::MoveToEndOfDocument no Evaluation Count:0 | yes Evaluation Count:3752 |
| 0-3752 |
1283 | || ke == QKeySequence::SelectNextWord partially evaluated: ke == QKeySequence::SelectNextWord no Evaluation Count:0 | yes Evaluation Count:3752 |
| 0-3752 |
1284 | || ke == QKeySequence::SelectPreviousWord partially evaluated: ke == QKeySequence::SelectPreviousWord no Evaluation Count:0 | yes Evaluation Count:3752 |
| 0-3752 |
1285 | || ke == QKeySequence::SelectStartOfLine partially evaluated: ke == QKeySequence::SelectStartOfLine no Evaluation Count:0 | yes Evaluation Count:3752 |
| 0-3752 |
1286 | || ke == QKeySequence::SelectEndOfLine evaluated: ke == QKeySequence::SelectEndOfLine yes Evaluation Count:4 | yes Evaluation Count:3748 |
| 4-3748 |
1287 | || ke == QKeySequence::SelectStartOfBlock partially evaluated: ke == QKeySequence::SelectStartOfBlock no Evaluation Count:0 | yes Evaluation Count:3748 |
| 0-3748 |
1288 | || ke == QKeySequence::SelectEndOfBlock partially evaluated: ke == QKeySequence::SelectEndOfBlock no Evaluation Count:0 | yes Evaluation Count:3748 |
| 0-3748 |
1289 | || ke == QKeySequence::SelectStartOfDocument partially evaluated: ke == QKeySequence::SelectStartOfDocument no Evaluation Count:0 | yes Evaluation Count:3748 |
| 0-3748 |
1290 | || ke == QKeySequence::SelectAll partially evaluated: ke == QKeySequence::SelectAll no Evaluation Count:0 | yes Evaluation Count:3748 |
| 0-3748 |
1291 | || ke == QKeySequence::SelectEndOfDocument) { partially evaluated: ke == QKeySequence::SelectEndOfDocument no Evaluation Count:0 | yes Evaluation Count:3748 |
| 0-3748 |
1292 | ke->accept(); | - |
1293 | } else if (ke->modifiers() == Qt::NoModifier || ke->modifiers() == Qt::ShiftModifier executed: } Execution Count:14 evaluated: ke->modifiers() == Qt::NoModifier yes Evaluation Count:3591 | yes Evaluation Count:157 |
evaluated: ke->modifiers() == Qt::ShiftModifier yes Evaluation Count:110 | yes Evaluation Count:47 |
| 14-3591 |
1294 | || ke->modifiers() == Qt::KeypadModifier) { evaluated: ke->modifiers() == Qt::KeypadModifier yes Evaluation Count:2 | yes Evaluation Count:45 |
| 2-45 |
1295 | if (ke->key() < Qt::Key_Escape) { evaluated: ke->key() < Qt::Key_Escape yes Evaluation Count:1516 | yes Evaluation Count:2187 |
| 1516-2187 |
1296 | ke->accept(); | - |
1297 | } else { executed: } Execution Count:1516 | 1516 |
1298 | switch (ke->key()) { | - |
1299 | case Qt::Key_Delete: | - |
1300 | case Qt::Key_Home: | - |
1301 | case Qt::Key_End: | - |
1302 | case Qt::Key_Backspace: | - |
1303 | case Qt::Key_Left: | - |
1304 | case Qt::Key_Right: | - |
1305 | ke->accept(); | - |
1306 | default: | - |
1307 | break; executed: break; Execution Count:2187 | 2187 |
1308 | } | - |
1309 | } executed: } Execution Count:2187 | 2187 |
1310 | } | - |
1311 | } | - |
1312 | | - |
1313 | | - |
1314 | void QWidgetLineControl::processKeyEvent(QKeyEvent* event) | - |
1315 | { | - |
1316 | bool inlineCompletionAccepted = false; | - |
1317 | | - |
1318 | | - |
1319 | if (m_completer) { evaluated: m_completer yes Evaluation Count:78 | yes Evaluation Count:2344 |
| 78-2344 |
1320 | QCompleter::CompletionMode completionMode = m_completer->completionMode(); | - |
1321 | if ((completionMode == QCompleter::PopupCompletion evaluated: completionMode == QCompleter::PopupCompletion yes Evaluation Count:39 | yes Evaluation Count:39 |
| 39 |
1322 | || completionMode == QCompleter::UnfilteredPopupCompletion) evaluated: completionMode == QCompleter::UnfilteredPopupCompletion yes Evaluation Count:2 | yes Evaluation Count:37 |
| 2-37 |
1323 | && m_completer->popup() partially evaluated: m_completer->popup() yes Evaluation Count:41 | no Evaluation Count:0 |
| 0-41 |
1324 | && m_completer->popup()->isVisible()) { evaluated: m_completer->popup()->isVisible() yes Evaluation Count:17 | yes Evaluation Count:24 |
| 17-24 |
1325 | | - |
1326 | | - |
1327 | switch (event->key()) { | - |
1328 | case Qt::Key_Escape: | - |
1329 | event->ignore(); | - |
1330 | return; executed: return; Execution Count:1 | 1 |
1331 | case Qt::Key_Enter: | - |
1332 | case Qt::Key_Return: | - |
1333 | case Qt::Key_F4: | - |
1334 | | - |
1335 | | - |
1336 | | - |
1337 | | - |
1338 | | - |
1339 | m_completer->popup()->hide(); | - |
1340 | default: | - |
1341 | break; executed: break; Execution Count:16 | 16 |
1342 | } | - |
1343 | } else if (completionMode == QCompleter::InlineCompletion) { executed: } Execution Count:16 evaluated: completionMode == QCompleter::InlineCompletion yes Evaluation Count:37 | yes Evaluation Count:24 |
| 16-37 |
1344 | switch (event->key()) { | - |
1345 | case Qt::Key_Enter: | - |
1346 | case Qt::Key_Return: | - |
1347 | case Qt::Key_F4: | - |
1348 | | - |
1349 | | - |
1350 | | - |
1351 | | - |
1352 | | - |
1353 | if (!m_completer->currentCompletion().isEmpty() && hasSelectedText() evaluated: !m_completer->currentCompletion().isEmpty() yes Evaluation Count:2 | yes Evaluation Count:1 |
partially evaluated: hasSelectedText() yes Evaluation Count:2 | no Evaluation Count:0 |
| 0-2 |
1354 | && textAfterSelection().isEmpty()) { partially evaluated: textAfterSelection().isEmpty() yes Evaluation Count:2 | no Evaluation Count:0 |
| 0-2 |
1355 | setText(m_completer->currentCompletion()); | - |
1356 | inlineCompletionAccepted = true; | - |
1357 | } executed: } Execution Count:2 | 2 |
1358 | default: | - |
1359 | break; executed: break; Execution Count:37 | 37 |
1360 | } | - |
1361 | } executed: } Execution Count:37 | 37 |
1362 | } | - |
1363 | | - |
1364 | | - |
1365 | if (event->key() == Qt::Key_Enter || event->key() == Qt::Key_Return) { evaluated: event->key() == Qt::Key_Enter yes Evaluation Count:24 | yes Evaluation Count:2397 |
evaluated: event->key() == Qt::Key_Return yes Evaluation Count:45 | yes Evaluation Count:2352 |
| 24-2397 |
1366 | if (hasAcceptableInput() || fixup()) { evaluated: hasAcceptableInput() yes Evaluation Count:40 | yes Evaluation Count:29 |
evaluated: fixup() yes Evaluation Count:2 | yes Evaluation Count:27 |
| 2-40 |
1367 | accepted(); | - |
1368 | editingFinished(); | - |
1369 | } executed: } Execution Count:42 | 42 |
1370 | if (inlineCompletionAccepted) evaluated: inlineCompletionAccepted yes Evaluation Count:2 | yes Evaluation Count:67 |
| 2-67 |
1371 | event->accept(); executed: event->accept(); Execution Count:2 | 2 |
1372 | else | - |
1373 | event->ignore(); executed: event->ignore(); Execution Count:67 | 67 |
1374 | return; executed: return; Execution Count:69 | 69 |
1375 | } | - |
1376 | | - |
1377 | if (echoMode() == QLineEdit::PasswordEchoOnEdit evaluated: echoMode() == QLineEdit::PasswordEchoOnEdit yes Evaluation Count:8 | yes Evaluation Count:2344 |
| 8-2344 |
1378 | && !passwordEchoEditing() evaluated: !passwordEchoEditing() yes Evaluation Count:4 | yes Evaluation Count:4 |
| 4 |
1379 | && !isReadOnly() partially evaluated: !isReadOnly() yes Evaluation Count:4 | no Evaluation Count:0 |
| 0-4 |
1380 | && !event->text().isEmpty() partially evaluated: !event->text().isEmpty() yes Evaluation Count:4 | no Evaluation Count:0 |
| 0-4 |
1381 | | - |
1382 | | - |
1383 | | - |
1384 | | - |
1385 | | - |
1386 | | - |
1387 | && !(event->modifiers() & Qt::ControlModifier)) { partially evaluated: !(event->modifiers() & Qt::ControlModifier) yes Evaluation Count:4 | no Evaluation Count:0 |
| 0-4 |
1388 | | - |
1389 | | - |
1390 | | - |
1391 | | - |
1392 | | - |
1393 | updatePasswordEchoEditing(true); | - |
1394 | clear(); | - |
1395 | } executed: } Execution Count:4 | 4 |
1396 | | - |
1397 | bool unknown = false; | - |
1398 | bool visual = cursorMoveStyle() == Qt::VisualMoveStyle; | - |
1399 | | - |
1400 | if (false) { partially evaluated: false no Evaluation Count:0 | yes Evaluation Count:2352 |
| 0-2352 |
1401 | } | 0 |
1402 | | - |
1403 | else if (event == QKeySequence::Undo) { evaluated: event == QKeySequence::Undo yes Evaluation Count:4 | yes Evaluation Count:2348 |
| 4-2348 |
1404 | if (!isReadOnly()) partially evaluated: !isReadOnly() yes Evaluation Count:4 | no Evaluation Count:0 |
| 0-4 |
1405 | undo(); executed: undo(); Execution Count:4 | 4 |
1406 | } executed: } Execution Count:4 | 4 |
1407 | else if (event == QKeySequence::Redo) { evaluated: event == QKeySequence::Redo yes Evaluation Count:2 | yes Evaluation Count:2346 |
| 2-2346 |
1408 | if (!isReadOnly()) partially evaluated: !isReadOnly() yes Evaluation Count:2 | no Evaluation Count:0 |
| 0-2 |
1409 | redo(); executed: redo(); Execution Count:2 | 2 |
1410 | } executed: } Execution Count:2 | 2 |
1411 | else if (event == QKeySequence::SelectAll) { partially evaluated: event == QKeySequence::SelectAll no Evaluation Count:0 | yes Evaluation Count:2346 |
| 0-2346 |
1412 | selectAll(); | - |
1413 | } | 0 |
1414 | | - |
1415 | else if (event == QKeySequence::Copy) { partially evaluated: event == QKeySequence::Copy no Evaluation Count:0 | yes Evaluation Count:2346 |
| 0-2346 |
1416 | copy(); | - |
1417 | } | 0 |
1418 | else if (event == QKeySequence::Paste) { partially evaluated: event == QKeySequence::Paste no Evaluation Count:0 | yes Evaluation Count:2346 |
| 0-2346 |
1419 | if (!isReadOnly()) { never evaluated: !isReadOnly() | 0 |
1420 | QClipboard::Mode mode = QClipboard::Clipboard; | - |
1421 | if (m_keyboardScheme == QPlatformTheme::X11KeyboardScheme never evaluated: m_keyboardScheme == QPlatformTheme::X11KeyboardScheme | 0 |
1422 | && event->modifiers() == (Qt::CTRL | Qt::SHIFT) never evaluated: event->modifiers() == (Qt::CTRL | Qt::SHIFT) | 0 |
1423 | && event->key() == Qt::Key_Insert) { never evaluated: event->key() == Qt::Key_Insert | 0 |
1424 | mode = QClipboard::Selection; | - |
1425 | } | 0 |
1426 | paste(mode); | - |
1427 | } | 0 |
1428 | } | 0 |
1429 | else if (event == QKeySequence::Cut) { partially evaluated: event == QKeySequence::Cut no Evaluation Count:0 | yes Evaluation Count:2346 |
| 0-2346 |
1430 | if (!isReadOnly()) { never evaluated: !isReadOnly() | 0 |
1431 | copy(); | - |
1432 | del(); | - |
1433 | } | 0 |
1434 | } | 0 |
1435 | else if (event == QKeySequence::DeleteEndOfLine) { partially evaluated: event == QKeySequence::DeleteEndOfLine no Evaluation Count:0 | yes Evaluation Count:2346 |
| 0-2346 |
1436 | if (!isReadOnly()) { never evaluated: !isReadOnly() | 0 |
1437 | setSelection(cursor(), end()); | - |
1438 | copy(); | - |
1439 | del(); | - |
1440 | } | 0 |
1441 | } | 0 |
1442 | | - |
1443 | else if (event == QKeySequence::MoveToStartOfLine || event == QKeySequence::MoveToStartOfBlock) { evaluated: event == QKeySequence::MoveToStartOfLine yes Evaluation Count:84 | yes Evaluation Count:2262 |
partially evaluated: event == QKeySequence::MoveToStartOfBlock no Evaluation Count:0 | yes Evaluation Count:2262 |
| 0-2262 |
1444 | home(0); | - |
1445 | } executed: } Execution Count:84 | 84 |
1446 | else if (event == QKeySequence::MoveToEndOfLine || event == QKeySequence::MoveToEndOfBlock) { evaluated: event == QKeySequence::MoveToEndOfLine yes Evaluation Count:35 | yes Evaluation Count:2227 |
partially evaluated: event == QKeySequence::MoveToEndOfBlock no Evaluation Count:0 | yes Evaluation Count:2227 |
| 0-2227 |
1447 | end(0); | - |
1448 | } executed: } Execution Count:35 | 35 |
1449 | else if (event == QKeySequence::SelectStartOfLine || event == QKeySequence::SelectStartOfBlock) { partially evaluated: event == QKeySequence::SelectStartOfLine no Evaluation Count:0 | yes Evaluation Count:2227 |
partially evaluated: event == QKeySequence::SelectStartOfBlock no Evaluation Count:0 | yes Evaluation Count:2227 |
| 0-2227 |
1450 | home(1); | - |
1451 | } | 0 |
1452 | else if (event == QKeySequence::SelectEndOfLine || event == QKeySequence::SelectEndOfBlock) { evaluated: event == QKeySequence::SelectEndOfLine yes Evaluation Count:4 | yes Evaluation Count:2223 |
partially evaluated: event == QKeySequence::SelectEndOfBlock no Evaluation Count:0 | yes Evaluation Count:2223 |
| 0-2223 |
1453 | end(1); | - |
1454 | } executed: } Execution Count:4 | 4 |
1455 | else if (event == QKeySequence::MoveToNextChar) { evaluated: event == QKeySequence::MoveToNextChar yes Evaluation Count:227 | yes Evaluation Count:1996 |
| 227-1996 |
1456 | | - |
1457 | | - |
1458 | | - |
1459 | const bool inlineCompletion = m_completer && m_completer->completionMode() == QCompleter::InlineCompletion; partially evaluated: m_completer no Evaluation Count:0 | yes Evaluation Count:227 |
never evaluated: m_completer->completionMode() == QCompleter::InlineCompletion | 0-227 |
1460 | | - |
1461 | if (hasSelectedText() evaluated: hasSelectedText() yes Evaluation Count:1 | yes Evaluation Count:226 |
| 1-226 |
1462 | && (m_keyboardScheme != QPlatformTheme::WindowsKeyboardScheme partially evaluated: m_keyboardScheme != QPlatformTheme::WindowsKeyboardScheme yes Evaluation Count:1 | no Evaluation Count:0 |
| 0-1 |
1463 | || inlineCompletion)) { never evaluated: inlineCompletion | 0 |
1464 | moveCursor(selectionEnd(), false); | - |
1465 | } else { executed: } Execution Count:1 | 1 |
1466 | cursorForward(0, visual ? 1 : (layoutDirection() == Qt::LeftToRight ? 1 : -1)); | - |
1467 | } executed: } Execution Count:226 | 226 |
1468 | } | - |
1469 | else if (event == QKeySequence::SelectNextChar) { evaluated: event == QKeySequence::SelectNextChar yes Evaluation Count:20 | yes Evaluation Count:1976 |
| 20-1976 |
1470 | cursorForward(1, visual ? 1 : (layoutDirection() == Qt::LeftToRight ? 1 : -1)); | - |
1471 | } executed: } Execution Count:20 | 20 |
1472 | else if (event == QKeySequence::MoveToPreviousChar) { evaluated: event == QKeySequence::MoveToPreviousChar yes Evaluation Count:168 | yes Evaluation Count:1808 |
| 168-1808 |
1473 | | - |
1474 | | - |
1475 | | - |
1476 | const bool inlineCompletion = m_completer && m_completer->completionMode() == QCompleter::InlineCompletion; partially evaluated: m_completer no Evaluation Count:0 | yes Evaluation Count:168 |
never evaluated: m_completer->completionMode() == QCompleter::InlineCompletion | 0-168 |
1477 | | - |
1478 | if (hasSelectedText() evaluated: hasSelectedText() yes Evaluation Count:2 | yes Evaluation Count:166 |
| 2-166 |
1479 | && (m_keyboardScheme != QPlatformTheme::WindowsKeyboardScheme partially evaluated: m_keyboardScheme != QPlatformTheme::WindowsKeyboardScheme yes Evaluation Count:2 | no Evaluation Count:0 |
| 0-2 |
1480 | || inlineCompletion)) { never evaluated: inlineCompletion | 0 |
1481 | moveCursor(selectionStart(), false); | - |
1482 | } else { executed: } Execution Count:2 | 2 |
1483 | cursorForward(0, visual ? -1 : (layoutDirection() == Qt::LeftToRight ? -1 : 1)); | - |
1484 | } executed: } Execution Count:166 | 166 |
1485 | } | - |
1486 | else if (event == QKeySequence::SelectPreviousChar) { evaluated: event == QKeySequence::SelectPreviousChar yes Evaluation Count:21 | yes Evaluation Count:1787 |
| 21-1787 |
1487 | cursorForward(1, visual ? -1 : (layoutDirection() == Qt::LeftToRight ? -1 : 1)); | - |
1488 | } executed: } Execution Count:21 | 21 |
1489 | else if (event == QKeySequence::MoveToNextWord) { evaluated: event == QKeySequence::MoveToNextWord yes Evaluation Count:1 | yes Evaluation Count:1786 |
| 1-1786 |
1490 | if (echoMode() == QLineEdit::Normal) partially evaluated: echoMode() == QLineEdit::Normal yes Evaluation Count:1 | no Evaluation Count:0 |
| 0-1 |
1491 | layoutDirection() == Qt::LeftToRight ? cursorWordForward(0) : cursorWordBackward(0); executed: layoutDirection() == Qt::LeftToRight ? cursorWordForward(0) : cursorWordBackward(0); Execution Count:1 | 1 |
1492 | else | - |
1493 | layoutDirection() == Qt::LeftToRight ? end(0) : home(0); never executed: layoutDirection() == Qt::LeftToRight ? end(0) : home(0); | 0 |
1494 | } | - |
1495 | else if (event == QKeySequence::MoveToPreviousWord) { evaluated: event == QKeySequence::MoveToPreviousWord yes Evaluation Count:1 | yes Evaluation Count:1785 |
| 1-1785 |
1496 | if (echoMode() == QLineEdit::Normal) partially evaluated: echoMode() == QLineEdit::Normal yes Evaluation Count:1 | no Evaluation Count:0 |
| 0-1 |
1497 | layoutDirection() == Qt::LeftToRight ? cursorWordBackward(0) : cursorWordForward(0); executed: layoutDirection() == Qt::LeftToRight ? cursorWordBackward(0) : cursorWordForward(0); Execution Count:1 | 1 |
1498 | else if (!isReadOnly()) { never evaluated: !isReadOnly() | 0 |
1499 | layoutDirection() == Qt::LeftToRight ? home(0) : end(0); | - |
1500 | } | 0 |
1501 | } | - |
1502 | else if (event == QKeySequence::SelectNextWord) { partially evaluated: event == QKeySequence::SelectNextWord no Evaluation Count:0 | yes Evaluation Count:1785 |
| 0-1785 |
1503 | if (echoMode() == QLineEdit::Normal) never evaluated: echoMode() == QLineEdit::Normal | 0 |
1504 | layoutDirection() == Qt::LeftToRight ? cursorWordForward(1) : cursorWordBackward(1); never executed: layoutDirection() == Qt::LeftToRight ? cursorWordForward(1) : cursorWordBackward(1); | 0 |
1505 | else | - |
1506 | layoutDirection() == Qt::LeftToRight ? end(1) : home(1); never executed: layoutDirection() == Qt::LeftToRight ? end(1) : home(1); | 0 |
1507 | } | - |
1508 | else if (event == QKeySequence::SelectPreviousWord) { partially evaluated: event == QKeySequence::SelectPreviousWord no Evaluation Count:0 | yes Evaluation Count:1785 |
| 0-1785 |
1509 | if (echoMode() == QLineEdit::Normal) never evaluated: echoMode() == QLineEdit::Normal | 0 |
1510 | layoutDirection() == Qt::LeftToRight ? cursorWordBackward(1) : cursorWordForward(1); never executed: layoutDirection() == Qt::LeftToRight ? cursorWordBackward(1) : cursorWordForward(1); | 0 |
1511 | else | - |
1512 | layoutDirection() == Qt::LeftToRight ? home(1) : end(1); never executed: layoutDirection() == Qt::LeftToRight ? home(1) : end(1); | 0 |
1513 | } | - |
1514 | else if (event == QKeySequence::Delete) { evaluated: event == QKeySequence::Delete yes Evaluation Count:80 | yes Evaluation Count:1705 |
| 80-1705 |
1515 | if (!isReadOnly()) evaluated: !isReadOnly() yes Evaluation Count:79 | yes Evaluation Count:1 |
| 1-79 |
1516 | del(); executed: del(); Execution Count:79 | 79 |
1517 | } executed: } Execution Count:80 | 80 |
1518 | else if (event == QKeySequence::DeleteEndOfWord) { partially evaluated: event == QKeySequence::DeleteEndOfWord no Evaluation Count:0 | yes Evaluation Count:1705 |
| 0-1705 |
1519 | if (!isReadOnly()) { never evaluated: !isReadOnly() | 0 |
1520 | cursorWordForward(true); | - |
1521 | del(); | - |
1522 | } | 0 |
1523 | } | 0 |
1524 | else if (event == QKeySequence::DeleteStartOfWord) { partially evaluated: event == QKeySequence::DeleteStartOfWord no Evaluation Count:0 | yes Evaluation Count:1705 |
| 0-1705 |
1525 | if (!isReadOnly()) { never evaluated: !isReadOnly() | 0 |
1526 | cursorWordBackward(true); | - |
1527 | del(); | - |
1528 | } | 0 |
1529 | } | 0 |
1530 | | - |
1531 | else { | - |
1532 | bool handled = false; | - |
1533 | if (m_keyboardScheme == QPlatformTheme::MacKeyboardScheme partially evaluated: m_keyboardScheme == QPlatformTheme::MacKeyboardScheme no Evaluation Count:0 | yes Evaluation Count:1705 |
| 0-1705 |
1534 | && (event->key() == Qt::Key_Up || event->key() == Qt::Key_Down)) { never evaluated: event->key() == Qt::Key_Up never evaluated: event->key() == Qt::Key_Down | 0 |
1535 | Qt::KeyboardModifiers myModifiers = (event->modifiers() & ~Qt::KeypadModifier); | - |
1536 | if (myModifiers & Qt::ShiftModifier) { never evaluated: myModifiers & Qt::ShiftModifier | 0 |
1537 | if (myModifiers == (Qt::ControlModifier|Qt::ShiftModifier) never evaluated: myModifiers == (Qt::ControlModifier|Qt::ShiftModifier) | 0 |
1538 | || myModifiers == (Qt::AltModifier|Qt::ShiftModifier) never evaluated: myModifiers == (Qt::AltModifier|Qt::ShiftModifier) | 0 |
1539 | || myModifiers == Qt::ShiftModifier) { never evaluated: myModifiers == Qt::ShiftModifier | 0 |
1540 | | - |
1541 | event->key() == Qt::Key_Up ? home(1) : end(1); | - |
1542 | } | 0 |
1543 | } else { | 0 |
1544 | if ((myModifiers == Qt::ControlModifier never evaluated: myModifiers == Qt::ControlModifier | 0 |
1545 | || myModifiers == Qt::AltModifier never evaluated: myModifiers == Qt::AltModifier | 0 |
1546 | || myModifiers == Qt::NoModifier)) { never evaluated: myModifiers == Qt::NoModifier | 0 |
1547 | event->key() == Qt::Key_Up ? home(0) : end(0); | - |
1548 | } | 0 |
1549 | } | 0 |
1550 | handled = true; | - |
1551 | } | 0 |
1552 | if (event->modifiers() & Qt::ControlModifier) { evaluated: event->modifiers() & Qt::ControlModifier yes Evaluation Count:40 | yes Evaluation Count:1665 |
| 40-1665 |
1553 | switch (event->key()) { | - |
1554 | case Qt::Key_Backspace: | - |
1555 | if (!isReadOnly()) { never evaluated: !isReadOnly() | 0 |
1556 | cursorWordBackward(true); | - |
1557 | del(); | - |
1558 | } | 0 |
1559 | break; | 0 |
1560 | | - |
1561 | case Qt::Key_Up: | - |
1562 | case Qt::Key_Down: | - |
1563 | complete(event->key()); | - |
1564 | break; executed: break; Execution Count:12 | 12 |
1565 | | - |
1566 | case Qt::Key_E: | - |
1567 | if (m_keyboardScheme == QPlatformTheme::X11KeyboardScheme) never evaluated: m_keyboardScheme == QPlatformTheme::X11KeyboardScheme | 0 |
1568 | end(0); | 0 |
1569 | break; | 0 |
1570 | | - |
1571 | case Qt::Key_U: | - |
1572 | if (m_keyboardScheme == QPlatformTheme::X11KeyboardScheme && !isReadOnly()) { never evaluated: m_keyboardScheme == QPlatformTheme::X11KeyboardScheme never evaluated: !isReadOnly() | 0 |
1573 | setSelection(0, text().size()); | - |
1574 | | - |
1575 | copy(); | - |
1576 | | - |
1577 | del(); | - |
1578 | } | 0 |
1579 | break; | 0 |
1580 | default: | - |
1581 | if (!handled) partially evaluated: !handled yes Evaluation Count:28 | no Evaluation Count:0 |
| 0-28 |
1582 | unknown = true; executed: unknown = true; Execution Count:28 | 28 |
1583 | } executed: } Execution Count:28 | 28 |
1584 | } else { executed: } Execution Count:40 | 40 |
1585 | switch (event->key()) { | - |
1586 | case Qt::Key_Backspace: | - |
1587 | if (!isReadOnly()) { partially evaluated: !isReadOnly() yes Evaluation Count:53 | no Evaluation Count:0 |
| 0-53 |
1588 | backspace(); | - |
1589 | | - |
1590 | complete(Qt::Key_Backspace); | - |
1591 | | - |
1592 | } executed: } Execution Count:53 | 53 |
1593 | break; executed: break; Execution Count:53 | 53 |
1594 | default: | - |
1595 | if (!handled) partially evaluated: !handled yes Evaluation Count:1612 | no Evaluation Count:0 |
| 0-1612 |
1596 | unknown = true; executed: unknown = true; Execution Count:1612 | 1612 |
1597 | } executed: } Execution Count:1612 | 1612 |
1598 | } executed: } Execution Count:1665 | 1665 |
1599 | } | - |
1600 | | - |
1601 | if (event->key() == Qt::Key_Direction_L || event->key() == Qt::Key_Direction_R) { partially evaluated: event->key() == Qt::Key_Direction_L no Evaluation Count:0 | yes Evaluation Count:2352 |
partially evaluated: event->key() == Qt::Key_Direction_R no Evaluation Count:0 | yes Evaluation Count:2352 |
| 0-2352 |
1602 | setLayoutDirection((event->key() == Qt::Key_Direction_L) ? Qt::LeftToRight : Qt::RightToLeft); | - |
1603 | unknown = false; | - |
1604 | } | 0 |
1605 | | - |
1606 | if (unknown && !isReadOnly()) { evaluated: unknown yes Evaluation Count:1640 | yes Evaluation Count:712 |
evaluated: !isReadOnly() yes Evaluation Count:1606 | yes Evaluation Count:34 |
| 34-1640 |
1607 | QString t = event->text(); | - |
1608 | if (!t.isEmpty() && t.at(0).isPrint()) { evaluated: !t.isEmpty() yes Evaluation Count:1519 | yes Evaluation Count:87 |
evaluated: t.at(0).isPrint() yes Evaluation Count:1517 | yes Evaluation Count:2 |
| 2-1519 |
1609 | insert(t); | - |
1610 | | - |
1611 | complete(event->key()); | - |
1612 | | - |
1613 | event->accept(); | - |
1614 | return; executed: return; Execution Count:1517 | 1517 |
1615 | } | - |
1616 | } executed: } Execution Count:89 | 89 |
1617 | | - |
1618 | if (unknown) evaluated: unknown yes Evaluation Count:123 | yes Evaluation Count:712 |
| 123-712 |
1619 | event->ignore(); executed: event->ignore(); Execution Count:123 | 123 |
1620 | else | - |
1621 | event->accept(); executed: event->accept(); Execution Count:712 | 712 |
1622 | } | - |
1623 | | - |
1624 | bool QWidgetLineControl::isUndoAvailable() const | - |
1625 | { | - |
1626 | | - |
1627 | | - |
1628 | return !m_readOnly && m_undoState | 376 |
1629 | && (m_echoMode == QLineEdit::Normal || m_history[m_undoState - 1].type == QWidgetLineControl::Insert); executed: return !m_readOnly && m_undoState && (m_echoMode == QLineEdit::Normal || m_history[m_undoState - 1].type == QWidgetLineControl::Insert); Execution Count:376 | 376 |
1630 | } | - |
1631 | | - |
1632 | bool QWidgetLineControl::isRedoAvailable() const | - |
1633 | { | - |
1634 | | - |
1635 | return !m_readOnly | 44 |
1636 | && m_echoMode == QLineEdit::Normal | 44 |
1637 | && m_undoState < m_history.size(); executed: return !m_readOnly && m_echoMode == QLineEdit::Normal && m_undoState < m_history.size(); Execution Count:44 | 44 |
1638 | } | - |
1639 | | - |
1640 | | - |
1641 | | - |
| | |