widgets/qwidgetlinecontrol.cpp

Switch to Source codePreprocessed file
LineSource CodeCoverage
1 -
2 -
3 -
4 -
5 -
6 -
7 -
8 -
9 -
10 -
11int 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:7594
7594
25} -
26 -
27 -
28 -
29 -
30 -
31 -
32 -
33void QWidgetLineControl::updateDisplayText(bool forceUpdate) -
34{ -
35 QString orig = m_textLayout.text(); -
36 QString str; -
37 if (m_echoMode == QLineEdit::NoEcho)
partially evaluated: m_echoMode == QLineEdit::NoEcho
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:7594
0-7594
38 str = QString::fromLatin1("");
never executed: str = QString::fromLatin1("");
0
39 else -
40 str = m_text;
executed: str = m_text;
Execution Count:7594
7594
41 -
42 if (m_echoMode == QLineEdit::Password) {
partially evaluated: m_echoMode == QLineEdit::Password
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:7594
0-7594
43 str.fill(m_passwordCharacter); -
44 if (m_passwordEchoTimer != 0 && m_cursor > 0 && m_cursor <= m_text.length()) {
never evaluated: m_passwordEchoTimer != 0
never evaluated: m_cursor > 0
never evaluated: m_cursor <= m_text.length()
0
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 }
never executed: }
0
55 }
never executed: }
0
56 } else if (m_echoMode == QLineEdit::PasswordEchoOnEdit && !m_passwordEchoEditing) {
partially evaluated: m_echoMode == QLineEdit::PasswordEchoOnEdit
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:7594
never evaluated: !m_passwordEchoEditing
never executed: }
0-7594
57 str.fill(m_passwordCharacter); -
58 }
never executed: }
0
59 -
60 -
61 -
62 -
63 QChar* uc = str.data(); -
64 for (int i = 0; i < (int)str.length(); ++i) {
evaluated: i < (int)str.length()
TRUEFALSE
yes
Evaluation Count:44933
yes
Evaluation Count:7594
7594-44933
65 if ((uc[i] < 0x20 && uc[i] != 0x09)
partially evaluated: uc[i] < 0x20
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:44933
never evaluated: uc[i] != 0x09
0-44933
66 || uc[i] == QChar::LineSeparator
partially evaluated: uc[i] == QChar::LineSeparator
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:44933
0-44933
67 || uc[i] == QChar::ParagraphSeparator
partially evaluated: uc[i] == QChar::ParagraphSeparator
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:44933
0-44933
68 || uc[i] == QChar::ObjectReplacementCharacter)
partially evaluated: uc[i] == QChar::ObjectReplacementCharacter
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:44933
0-44933
69 uc[i] = QChar(0x0020);
never executed: uc[i] = QChar(0x0020);
0
70 }
executed: }
Execution Count:44933
44933
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
TRUEFALSE
yes
Evaluation Count:4532
yes
Evaluation Count:3062
partially evaluated: forceUpdate
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:3062
0-4532
82 displayTextChanged(str);
executed: displayTextChanged(str);
Execution Count:4532
4532
83}
executed: }
Execution Count:7594
7594
84void QWidgetLineControl::copy(QClipboard::Mode mode) const -
85{ -
86 QString t = selectedText(); -
87 if (!t.isEmpty() && m_echoMode == QLineEdit::Normal) {
partially evaluated: !t.isEmpty()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1
never evaluated: m_echoMode == QLineEdit::Normal
0-1
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 }
never executed: }
0
93}
executed: }
Execution Count:1
1
94void QWidgetLineControl::paste(QClipboard::Mode clipboardMode) -
95{ -
96 QString clip = QApplication::clipboard()->text(clipboardMode); -
97 if (!clip.isEmpty() || hasSelectedText()) {
never evaluated: !clip.isEmpty()
never evaluated: hasSelectedText()
0
98 separate(); -
99 insert(clip); -
100 separate(); -
101 }
never executed: }
0
102}
never executed: }
0
103 -
104 -
105 -
106 -
107 -
108 -
109void QWidgetLineControl::commitPreedit() -
110{ -
111 if (!composeMode())
partially evaluated: !composeMode()
TRUEFALSE
yes
Evaluation Count:6586
no
Evaluation Count:0
0-6586
112 return;
executed: return;
Execution Count:6586
6586
113 -
114 (static_cast<QApplication *>(QCoreApplication::instance()))->inputMethod()->commit(); -
115 if (!composeMode())
never evaluated: !composeMode()
0
116 return;
never executed: return;
0
117 -
118 m_preeditCursor = 0; -
119 setPreeditArea(-1, QString()); -
120 m_textLayout.clearAdditionalFormats(); -
121 updateDisplayText( true); -
122}
never executed: }
0
123void QWidgetLineControl::backspace() -
124{ -
125 int priorState = m_undoState; -
126 if (hasSelectedText()) {
evaluated: hasSelectedText()
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:43
2-43
127 removeSelectedText(); -
128 } else if (m_cursor) {
executed: }
Execution Count:2
evaluated: m_cursor
TRUEFALSE
yes
Evaluation Count:35
yes
Evaluation Count:8
2-35
129 --m_cursor; -
130 if (m_maskData)
partially evaluated: m_maskData
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:35
0-35
131 m_cursor = prevMaskBlank(m_cursor);
never executed: m_cursor = prevMaskBlank(m_cursor);
0
132 QChar uc = m_text.at(m_cursor); -
133 if (m_cursor > 0 && uc.isLowSurrogate()) {
evaluated: m_cursor > 0
TRUEFALSE
yes
Evaluation Count:31
yes
Evaluation Count:4
partially evaluated: uc.isLowSurrogate()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:31
0-31
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 }
never executed: }
0
141 }
never executed: }
0
142 internalDelete(true); -
143 }
executed: }
Execution Count:35
35
144 finishChange(priorState); -
145}
executed: }
Execution Count:45
45
146void QWidgetLineControl::del() -
147{ -
148 int priorState = m_undoState; -
149 if (hasSelectedText()) {
evaluated: hasSelectedText()
TRUEFALSE
yes
Evaluation Count:22
yes
Evaluation Count:46
22-46
150 removeSelectedText(); -
151 } else {
executed: }
Execution Count:22
22
152 int n = textLayout()->nextCursorPosition(m_cursor) - m_cursor; -
153 while (n--)
evaluated: n--
TRUEFALSE
yes
Evaluation Count:42
yes
Evaluation Count:46
42-46
154 internalDelete();
executed: internalDelete();
Execution Count:42
42
155 }
executed: }
Execution Count:46
46
156 finishChange(priorState); -
157}
executed: }
Execution Count:68
68
158void QWidgetLineControl::insert(const QString &newText) -
159{ -
160 int priorState = m_undoState; -
161 removeSelectedText(); -
162 internalInsert(newText); -
163 finishChange(priorState); -
164}
executed: }
Execution Count:852
852
165 -
166 -
167 -
168 -
169 -
170 -
171void 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:3
3
180void QWidgetLineControl::setSelection(int start, int length) -
181{ -
182 commitPreedit(); -
183 -
184 if(start < 0 || start > (int)m_text.length()){
partially evaluated: start < 0
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:3931
partially evaluated: start > (int)m_text.length()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:3931
0-3931
185 QMessageLogger("widgets/qwidgetlinecontrol.cpp", 302, __PRETTY_FUNCTION__).warning("QWidgetLineControl::setSelection: Invalid start position"); -
186 return;
never executed: return;
0
187 } -
188 -
189 if (length > 0) {
evaluated: length > 0
TRUEFALSE
yes
Evaluation Count:2130
yes
Evaluation Count:1801
1801-2130
190 if (start == m_selstart && start + length == m_selend && m_cursor == m_selend)
evaluated: start == m_selstart
TRUEFALSE
yes
Evaluation Count:838
yes
Evaluation Count:1292
evaluated: start + length == m_selend
TRUEFALSE
yes
Evaluation Count:144
yes
Evaluation Count:694
evaluated: m_cursor == m_selend
TRUEFALSE
yes
Evaluation Count:73
yes
Evaluation Count:71
71-1292
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:2057
evaluated: length < 0
TRUEFALSE
yes
Evaluation Count:1788
yes
Evaluation Count:13
13-2057
196 if (start == m_selend && start + length == m_selstart && m_cursor == m_selstart)
evaluated: start == m_selend
TRUEFALSE
yes
Evaluation Count:1472
yes
Evaluation Count:316
partially evaluated: start + length == m_selstart
TRUEFALSE
yes
Evaluation Count:1472
no
Evaluation Count:0
evaluated: m_cursor == m_selstart
TRUEFALSE
yes
Evaluation Count:88
yes
Evaluation Count:1384
0-1472
197 return;
executed: return;
Execution Count:88
88
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:1700
evaluated: m_selstart != m_selend
TRUEFALSE
yes
Evaluation Count:4
yes
Evaluation Count:9
4-1700
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:9
9
209 } -
210 selectionChanged(); -
211 emitCursorPositionChanged(); -
212}
executed: }
Execution Count:3761
3761
213 -
214void QWidgetLineControl::_q_clipboardChanged() -
215{ -
216} -
217 -
218void QWidgetLineControl::_q_deleteSelected() -
219{ -
220 if (!hasSelectedText())
never evaluated: !hasSelectedText()
0
221 return;
never executed: return;
0
222 -
223 int priorState = m_undoState; -
224 resetInputContext(); -
225 removeSelectedText(); -
226 separate(); -
227 finishChange(priorState); -
228}
never executed: }
0
229 -
230 -
231 -
232 -
233 -
234 -
235void 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()
TRUEFALSE
yes
Evaluation Count:814
no
Evaluation Count:0
0-814
242 m_keyboardScheme = theme->themeHint(QPlatformTheme::KeyboardScheme).toInt();
executed: m_keyboardScheme = theme->themeHint(QPlatformTheme::KeyboardScheme).toInt();
Execution Count:814
814
243 -
244 if (m_keyboardScheme == QPlatformTheme::KdeKeyboardScheme
partially evaluated: m_keyboardScheme == QPlatformTheme::KdeKeyboardScheme
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:814
0-814
245 || m_keyboardScheme == QPlatformTheme::GnomeKeyboardScheme
partially evaluated: m_keyboardScheme == QPlatformTheme::GnomeKeyboardScheme
TRUEFALSE
yes
Evaluation Count:814
no
Evaluation Count:0
0-814
246 || m_keyboardScheme == QPlatformTheme::CdeKeyboardScheme) {
never evaluated: m_keyboardScheme == QPlatformTheme::CdeKeyboardScheme
0
247 m_keyboardScheme = QPlatformTheme::X11KeyboardScheme; -
248 }
executed: }
Execution Count:814
814
249}
executed: }
Execution Count:814
814
250void QWidgetLineControl::updatePasswordEchoEditing(bool editing) -
251{ -
252 cancelPasswordEchoTimer(); -
253 m_passwordEchoEditing = editing; -
254 updateDisplayText(); -
255}
never executed: }
0
256int 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:2
2
259} -
260 -
261 -
262 -
263 -
264 -
265 -
266 -
267QRect 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
TRUEFALSE
yes
Evaluation Count:5917
no
Evaluation Count:0
0-5917
272 c += m_preeditCursor;
executed: c += m_preeditCursor;
Execution Count:5917
5917
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:5917
5917
278} -
279bool QWidgetLineControl::fixup() -
280{ -
281 -
282 if (m_validator) {
partially evaluated: m_validator
TRUEFALSE
yes
Evaluation Count:21
no
Evaluation Count:0
0-21
283 QString textCopy = m_text; -
284 int cursorCopy = m_cursor; -
285 m_validator->fixup(textCopy); -
286 if (m_validator->validate(textCopy, cursorCopy) == QValidator::Acceptable) {
partially evaluated: m_validator->validate(textCopy, cursorCopy) == QValidator::Acceptable
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:21
0-21
287 if (textCopy != m_text || cursorCopy != m_cursor)
never evaluated: textCopy != m_text
never evaluated: cursorCopy != m_cursor
0
288 internalSetText(textCopy, cursorCopy);
never executed: internalSetText(textCopy, cursorCopy);
0
289 return true;
never executed: return true;
0
290 } -
291 }
executed: }
Execution Count:21
21
292 -
293 return false;
executed: return false;
Execution Count:21
21
294} -
295 -
296 -
297 -
298 -
299 -
300 -
301 -
302void QWidgetLineControl::moveCursor(int pos, bool mark) -
303{ -
304 commitPreedit(); -
305 -
306 if (pos != m_cursor) {
evaluated: pos != m_cursor
TRUEFALSE
yes
Evaluation Count:1887
yes
Evaluation Count:768
768-1887
307 separate(); -
308 if (m_maskData)
evaluated: m_maskData
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:1885
2-1885
309 pos = pos > m_cursor ? nextMaskBlank(pos) : prevMaskBlank(pos);
executed: pos = pos > m_cursor ? nextMaskBlank(pos) : prevMaskBlank(pos);
Execution Count:2
partially evaluated: pos > m_cursor
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:2
0-2
310 }
executed: }
Execution Count:1887
1887
311 if (mark) {
evaluated: mark
TRUEFALSE
yes
Evaluation Count:269
yes
Evaluation Count:2386
269-2386
312 int anchor; -
313 if (m_selend > m_selstart && m_cursor == m_selstart)
evaluated: m_selend > m_selstart
TRUEFALSE
yes
Evaluation Count:24
yes
Evaluation Count:245
evaluated: m_cursor == m_selstart
TRUEFALSE
yes
Evaluation Count:13
yes
Evaluation Count:11
11-245
314 anchor = m_selend;
executed: anchor = m_selend;
Execution Count:13
13
315 else if (m_selend > m_selstart && m_cursor == m_selend)
evaluated: m_selend > m_selstart
TRUEFALSE
yes
Evaluation Count:11
yes
Evaluation Count:245
partially evaluated: m_cursor == m_selend
TRUEFALSE
yes
Evaluation Count:11
no
Evaluation Count:0
0-245
316 anchor = m_selstart;
executed: anchor = m_selstart;
Execution Count:11
11
317 else -
318 anchor = m_cursor;
executed: anchor = m_cursor;
Execution Count:245
245
319 m_selstart = qMin(anchor, pos); -
320 m_selend = qMax(anchor, pos); -
321 updateDisplayText(); -
322 } else {
executed: }
Execution Count:269
269
323 internalDeselect(); -
324 }
executed: }
Execution Count:2386
2386
325 m_cursor = pos; -
326 if (mark || m_selDirty) {
evaluated: mark
TRUEFALSE
yes
Evaluation Count:269
yes
Evaluation Count:2386
evaluated: m_selDirty
TRUEFALSE
yes
Evaluation Count:61
yes
Evaluation Count:2325
61-2386
327 m_selDirty = false; -
328 selectionChanged(); -
329 }
executed: }
Execution Count:330
330
330 emitCursorPositionChanged(); -
331}
executed: }
Execution Count:2655
2655
332 -
333 -
334 -
335 -
336 -
337 -
338 -
339void QWidgetLineControl::processInputMethodEvent(QInputMethodEvent *event) -
340{ -
341 int priorState = -1; -
342 bool isGettingInput = !event->commitString().isEmpty()
never evaluated: !event->commitString().isEmpty()
0
343 || event->preeditString() != preeditAreaText()
never evaluated: event->preeditString() != preeditAreaText()
0
344 || event->replacementLength() > 0;
never evaluated: event->replacementLength() > 0
0
345 bool cursorPositionChanged = false; -
346 bool selectionChange = false; -
347 -
348 if (isGettingInput) {
never evaluated: isGettingInput
0
349 -
350 priorState = m_undoState; -
351 if (echoMode() == QLineEdit::PasswordEchoOnEdit && !passwordEchoEditing()) {
never evaluated: echoMode() == QLineEdit::PasswordEchoOnEdit
never evaluated: !passwordEchoEditing()
0
352 updatePasswordEchoEditing(true); -
353 m_selstart = 0; -
354 m_selend = m_text.length(); -
355 }
never executed: }
0
356 removeSelectedText(); -
357 }
never executed: }
0
358 -
359 int c = m_cursor; -
360 if (event->replacementStart() <= 0)
never evaluated: event->replacementStart() <= 0
0
361 c += event->commitString().length() - qMin(-event->replacementStart(), event->replacementLength());
never executed: c += event->commitString().length() - qMin(-event->replacementStart(), event->replacementLength());
0
362 -
363 m_cursor += event->replacementStart(); -
364 if (m_cursor < 0)
never evaluated: m_cursor < 0
0
365 m_cursor = 0;
never executed: m_cursor = 0;
0
366 -
367 -
368 if (event->replacementLength()) {
never evaluated: event->replacementLength()
0
369 m_selstart = m_cursor; -
370 m_selend = m_selstart + event->replacementLength(); -
371 removeSelectedText(); -
372 }
never executed: }
0
373 if (!event->commitString().isEmpty()) {
never evaluated: !event->commitString().isEmpty()
0
374 internalInsert(event->commitString()); -
375 cursorPositionChanged = true; -
376 }
never executed: }
0
377 -
378 m_cursor = qBound(0, c, m_text.length()); -
379 -
380 for (int i = 0; i < event->attributes().size(); ++i) {
never evaluated: i < event->attributes().size()
0
381 const QInputMethodEvent::Attribute &a = event->attributes().at(i); -
382 if (a.type == QInputMethodEvent::Selection) {
never evaluated: a.type == QInputMethodEvent::Selection
0
383 m_cursor = qBound(0, a.start + a.length, m_text.length()); -
384 if (a.length) {
never evaluated: a.length
0
385 m_selstart = qMax(0, qMin(a.start, m_text.length())); -
386 m_selend = m_cursor; -
387 if (m_selend < m_selstart) {
never evaluated: m_selend < m_selstart
0
388 qSwap(m_selstart, m_selend); -
389 }
never executed: }
0
390 selectionChange = true; -
391 } else {
never executed: }
0
392 if (m_selstart != m_selend)
never evaluated: m_selstart != m_selend
0
393 selectionChange = true;
never executed: selectionChange = true;
0
394 m_selstart = m_selend = 0; -
395 }
never executed: }
0
396 cursorPositionChanged = true; -
397 }
never executed: }
0
398 }
never executed: }
0
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) {
never evaluated: i < event->attributes().size()
0
407 const QInputMethodEvent::Attribute &a = event->attributes().at(i); -
408 if (a.type == QInputMethodEvent::Cursor) {
never evaluated: a.type == QInputMethodEvent::Cursor
0
409 m_preeditCursor = a.start; -
410 m_hideCursor = !a.length; -
411 } else if (a.type == QInputMethodEvent::TextFormat) {
never evaluated: a.type == QInputMethodEvent::TextFormat
never executed: }
0
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 }
never executed: }
0
420 }
never executed: }
0
421 } -
422 m_textLayout.setAdditionalFormats(formats); -
423 updateDisplayText( true); -
424 if (cursorPositionChanged)
never evaluated: cursorPositionChanged
0
425 emitCursorPositionChanged();
never executed: emitCursorPositionChanged();
0
426 else if (m_preeditCursor != oldPreeditCursor)
never evaluated: m_preeditCursor != oldPreeditCursor
0
427 updateMicroFocus();
never executed: updateMicroFocus();
0
428 -
429 if (isGettingInput)
never evaluated: isGettingInput
0
430 finishChange(priorState);
never executed: finishChange(priorState);
0
431 -
432 if (selectionChange)
never evaluated: selectionChange
0
433 selectionChanged();
never executed: selectionChanged();
0
434}
never executed: }
0
435void 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
TRUEFALSE
yes
Evaluation Count:37
yes
Evaluation Count:329
37-329
439 QTextLayout::FormatRange o; -
440 if (m_selstart < m_selend) {
partially evaluated: m_selstart < m_selend
TRUEFALSE
yes
Evaluation Count:37
no
Evaluation Count:0
0-37
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:37
37
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 }
never executed: }
0
453 }
never executed: }
0
454 selections.append(o); -
455 }
executed: }
Execution Count:37
37
456 -
457 if (flags & DrawText)
partially evaluated: flags & DrawText
TRUEFALSE
yes
Evaluation Count:366
no
Evaluation Count:0
0-366
458 textLayout()->draw(painter, offset, selections, clip);
executed: textLayout()->draw(painter, offset, selections, clip);
Execution Count:366
366
459 -
460 if (flags & DrawCursor){
evaluated: flags & DrawCursor
TRUEFALSE
yes
Evaluation Count:184
yes
Evaluation Count:182
182-184
461 int cursor = m_cursor; -
462 if (m_preeditCursor != -1)
partially evaluated: m_preeditCursor != -1
TRUEFALSE
yes
Evaluation Count:184
no
Evaluation Count:0
0-184
463 cursor += m_preeditCursor;
executed: cursor += m_preeditCursor;
Execution Count:184
184
464 if (!m_hideCursor && (!m_blinkPeriod || m_blinkStatus))
partially evaluated: !m_hideCursor
TRUEFALSE
yes
Evaluation Count:184
no
Evaluation Count:0
evaluated: !m_blinkPeriod
TRUEFALSE
yes
Evaluation Count:8
yes
Evaluation Count:176
evaluated: m_blinkStatus
TRUEFALSE
yes
Evaluation Count:162
yes
Evaluation Count:14
0-184
465 textLayout()->drawCursor(painter, offset, cursor, m_cursorWidth);
executed: textLayout()->drawCursor(painter, offset, cursor, m_cursorWidth);
Execution Count:170
170
466 }
executed: }
Execution Count:184
184
467}
executed: }
Execution Count:366
366
468void QWidgetLineControl::selectWordAtPos(int cursor) -
469{ -
470 int next = cursor + 1; -
471 if(next > end())
partially evaluated: next > end()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1
0-1
472 --next;
never executed: --next;
0
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())
partially evaluated: end > cursor
TRUEFALSE
yes
Evaluation Count:1
no
Evaluation Count:0
partially evaluated: m_text[end-1].isSpace()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1
0-1
478 --end;
never executed: --end;
0
479 moveCursor(end, true); -
480}
executed: }
Execution Count:1
1
481bool QWidgetLineControl::finishChange(int validateFromState, bool update, bool edited) -
482{ -
483 (void)update; -
484 -
485 if (m_textDirty) {
evaluated: m_textDirty
TRUEFALSE
yes
Evaluation Count:4786
yes
Evaluation Count:984
984-4786
486 -
487 bool wasValidInput = m_validInput; -
488 m_validInput = true; -
489 -
490 if (m_validator) {
evaluated: m_validator
TRUEFALSE
yes
Evaluation Count:4154
yes
Evaluation Count:632
632-4154
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
TRUEFALSE
yes
Evaluation Count:3921
yes
Evaluation Count:233
233-3921
495 if (m_text != textCopy) {
evaluated: m_text != textCopy
TRUEFALSE
yes
Evaluation Count:16
yes
Evaluation Count:3905
16-3905
496 internalSetText(textCopy, cursorCopy); -
497 return true;
executed: return true;
Execution Count:16
16
498 } -
499 m_cursor = cursorCopy; -
500 }
executed: }
Execution Count:3905
3905
501 }
executed: }
Execution Count:4138
4138
502 -
503 if (validateFromState >= 0 && wasValidInput && !m_validInput) {
evaluated: validateFromState >= 0
TRUEFALSE
yes
Evaluation Count:940
yes
Evaluation Count:3830
partially evaluated: wasValidInput
TRUEFALSE
yes
Evaluation Count:940
no
Evaluation Count:0
evaluated: !m_validInput
TRUEFALSE
yes
Evaluation Count:231
yes
Evaluation Count:709
0-3830
504 if (m_transactions.count())
partially evaluated: m_transactions.count()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:231
0-231
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
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:231
0-231
509 m_modifiedState = -1;
never executed: m_modifiedState = -1;
0
510 m_validInput = true; -
511 m_textDirty = false; -
512 }
executed: }
Execution Count:231
231
513 updateDisplayText(); -
514 -
515 if (m_textDirty) {
evaluated: m_textDirty
TRUEFALSE
yes
Evaluation Count:4539
yes
Evaluation Count:231
231-4539
516 m_textDirty = false; -
517 QString actualText = text(); -
518 if (edited)
evaluated: edited
TRUEFALSE
yes
Evaluation Count:727
yes
Evaluation Count:3812
727-3812
519 textEdited(actualText);
executed: textEdited(actualText);
Execution Count:727
727
520 textChanged(actualText); -
521 }
executed: }
Execution Count:4538
4538
522 }
executed: }
Execution Count:4769
4769
523 if (m_selDirty) {
evaluated: m_selDirty
TRUEFALSE
yes
Evaluation Count:2338
yes
Evaluation Count:3415
2338-3415
524 m_selDirty = false; -
525 selectionChanged(); -
526 }
executed: }
Execution Count:2338
2338
527 if (m_cursor == m_lastCursorPos)
evaluated: m_cursor == m_lastCursorPos
TRUEFALSE
yes
Evaluation Count:1231
yes
Evaluation Count:4522
1231-4522
528 updateMicroFocus();
executed: updateMicroFocus();
Execution Count:1231
1231
529 emitCursorPositionChanged(); -
530 return true;
executed: return true;
Execution Count:5753
5753
531} -
532 -
533 -
534 -
535 -
536 -
537 -
538void 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
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:4620
2-4620
545 m_text = maskString(0, txt, true); -
546 m_text += clearString(m_text.length(), m_maxLength - m_text.length()); -
547 } else {
executed: }
Execution Count:2
2
548 m_text = txt.isEmpty() ? txt : txt.left(m_maxLength);
evaluated: txt.isEmpty()
TRUEFALSE
yes
Evaluation Count:172
yes
Evaluation Count:4448
172-4448
549 }
executed: }
Execution Count:4620
4620
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
TRUEFALSE
yes
Evaluation Count:4606
yes
Evaluation Count:16
partially evaluated: pos > m_text.length()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:16
0-4606
553 m_textDirty = (oldText != m_text); -
554 const bool changed = finishChange(-1, true, edited); -
555 -
556 -
557 if (changed) {
partially evaluated: changed
TRUEFALSE
yes
Evaluation Count:4622
no
Evaluation Count:0
0-4622
558 if (oldText.isEmpty()) {
evaluated: oldText.isEmpty()
TRUEFALSE
yes
Evaluation Count:759
yes
Evaluation Count:3863
759-3863
559 QAccessibleTextInsertEvent event(parent(), 0, txt); -
560 event.setCursorPosition(m_cursor); -
561 QAccessible::updateAccessibility(&event); -
562 } else if (txt.isEmpty()) {
executed: }
Execution Count:759
evaluated: txt.isEmpty()
TRUEFALSE
yes
Evaluation Count:4
yes
Evaluation Count:3859
4-3859
563 QAccessibleTextRemoveEvent event(parent(), 0, oldText); -
564 event.setCursorPosition(m_cursor); -
565 QAccessible::updateAccessibility(&event); -
566 } else {
executed: }
Execution Count:4
4
567 QAccessibleTextUpdateEvent event(parent(), 0, oldText, txt); -
568 event.setCursorPosition(m_cursor); -
569 QAccessible::updateAccessibility(&event); -
570 }
executed: }
Execution Count:3859
3859
571 } -
572 -
573 -
574 -
575}
executed: }
Execution Count:4622
4622
576void QWidgetLineControl::addCommand(const Command &cmd) -
577{ -
578 if (m_separator && m_undoState && m_history[m_undoState - 1].type != Separator) {
evaluated: m_separator
TRUEFALSE
yes
Evaluation Count:441
yes
Evaluation Count:1981
evaluated: m_undoState
TRUEFALSE
yes
Evaluation Count:263
yes
Evaluation Count:178
partially evaluated: m_history[m_undoState - 1].type != Separator
TRUEFALSE
yes
Evaluation Count:263
no
Evaluation Count:0
0-1981
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:263
263
582 m_history.resize(m_undoState + 1); -
583 }
executed: }
Execution Count:2159
2159
584 m_separator = false; -
585 m_history[m_undoState++] = cmd; -
586}
executed: }
Execution Count:2422
2422
587void QWidgetLineControl::internalInsert(const QString &s) -
588{ -
589 if (m_echoMode == QLineEdit::Password) {
partially evaluated: m_echoMode == QLineEdit::Password
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:853
0-853
590 if (m_passwordEchoTimer != 0)
never evaluated: m_passwordEchoTimer != 0
0
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)
never evaluated: delay > 0
0
599 m_passwordEchoTimer = startTimer(delay);
never executed: m_passwordEchoTimer = startTimer(delay);
0
600 }
never executed: }
0
601 if (hasSelectedText())
partially evaluated: hasSelectedText()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:853
0-853
602 addCommand(Command(SetSelection, m_cursor, 0, m_selstart, m_selend));
never executed: addCommand(Command(SetSelection, m_cursor, 0, m_selstart, m_selend));
0
603 if (m_maskData) {
partially evaluated: m_maskData
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:853
0-853
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) {
never evaluated: i < (int) ms.length()
0
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 }
never executed: }
0
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 {
never executed: }
0
622 int remaining = m_maxLength - m_text.length(); -
623 if (remaining != 0) {
partially evaluated: remaining != 0
TRUEFALSE
yes
Evaluation Count:853
no
Evaluation Count:0
0-853
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()
TRUEFALSE
yes
Evaluation Count:923
yes
Evaluation Count:853
853-923
630 addCommand(Command(Insert, m_cursor++, s.at(i), -1, -1));
executed: addCommand(Command(Insert, m_cursor++, s.at(i), -1, -1));
Execution Count:923
923
631 m_textDirty = true; -
632 }
executed: }
Execution Count:853
853
633 }
executed: }
Execution Count:853
853
634} -
635void QWidgetLineControl::internalDelete(bool wasBackspace) -
636{ -
637 if (m_cursor < (int) m_text.length()) {
partially evaluated: m_cursor < (int) m_text.length()
TRUEFALSE
yes
Evaluation Count:77
no
Evaluation Count:0
0-77
638 cancelPasswordEchoTimer(); -
639 if (hasSelectedText())
partially evaluated: hasSelectedText()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:77
0-77
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) {
partially evaluated: m_maskData
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:77
0-77
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 {
never executed: }
0
651 m_text.remove(m_cursor, 1); -
652 }
executed: }
Execution Count:77
77
653 m_textDirty = true; -
654 }
executed: }
Execution Count:77
77
655}
executed: }
Execution Count:77
77
656void QWidgetLineControl::removeSelectedText() -
657{ -
658 if (m_selstart < m_selend && m_selend <= (int) m_text.length()) {
evaluated: m_selstart < m_selend
TRUEFALSE
yes
Evaluation Count:376
yes
Evaluation Count:504
partially evaluated: m_selend <= (int) m_text.length()
TRUEFALSE
yes
Evaluation Count:376
no
Evaluation Count:0
0-504
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
TRUEFALSE
yes
Evaluation Count:376
no
Evaluation Count:0
evaluated: m_cursor < m_selend
TRUEFALSE
yes
Evaluation Count:309
yes
Evaluation Count:67
0-376
664 -
665 -
666 for (i = m_cursor; i >= m_selstart; --i)
evaluated: i >= m_selstart
TRUEFALSE
yes
Evaluation Count:312
yes
Evaluation Count:309
309-312
667 addCommand (Command(DeleteSelection, i, m_text.at(i), -1, 1));
executed: addCommand (Command(DeleteSelection, i, m_text.at(i), -1, 1));
Execution Count:312
312
668 for (i = m_selend - 1; i > m_cursor; --i)
evaluated: i > m_cursor
TRUEFALSE
yes
Evaluation Count:487
yes
Evaluation Count:309
309-487
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:487
487
670 } else {
executed: }
Execution Count:309
309
671 for (i = m_selend-1; i >= m_selstart; --i)
evaluated: i >= m_selstart
TRUEFALSE
yes
Evaluation Count:247
yes
Evaluation Count:67
67-247
672 addCommand (Command(RemoveSelection, i, m_text.at(i), -1, -1));
executed: addCommand (Command(RemoveSelection, i, m_text.at(i), -1, -1));
Execution Count:247
247
673 }
executed: }
Execution Count:67
67
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) {
partially evaluated: m_maskData
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:376
0-376
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)
never evaluated: i < m_selend - m_selstart
0
681 addCommand(Command(Insert, m_selstart + i, m_text.at(m_selstart + i), -1, -1));
never executed: addCommand(Command(Insert, m_selstart + i, m_text.at(m_selstart + i), -1, -1));
0
682 } else {
never executed: }
0
683 m_text.remove(m_selstart, m_selend - m_selstart); -
684 }
executed: }
Execution Count:376
376
685 if (m_cursor > m_selstart)
evaluated: m_cursor > m_selstart
TRUEFALSE
yes
Evaluation Count:68
yes
Evaluation Count:308
68-308
686 m_cursor -= qMin(m_cursor, m_selend) - m_selstart;
executed: m_cursor -= qMin(m_cursor, m_selend) - m_selstart;
Execution Count:68
68
687 internalDeselect(); -
688 m_textDirty = true; -
689 }
executed: }
Execution Count:376
376
690}
executed: }
Execution Count:880
880
691 -
692 -
693 -
694 -
695 -
696 -
697 -
698void QWidgetLineControl::parseInputMask(const QString &maskFields) -
699{ -
700 int delimiter = maskFields.indexOf(QLatin1Char(';')); -
701 if (maskFields.isEmpty() || delimiter == 0) {
partially evaluated: maskFields.isEmpty()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:2
partially evaluated: delimiter == 0
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:2
0-2
702 if (m_maskData) {
never evaluated: m_maskData
0
703 delete [] m_maskData; -
704 m_maskData = 0; -
705 m_maxLength = 32767; -
706 internalSetText(QString()); -
707 }
never executed: }
0
708 return;
never executed: return;
0
709 } -
710 -
711 if (delimiter == -1) {
partially evaluated: delimiter == -1
TRUEFALSE
yes
Evaluation Count:2
no
Evaluation Count:0
0-2
712 m_blank = QLatin1Char(' '); -
713 m_inputMask = maskFields; -
714 } else {
executed: }
Execution Count:2
2
715 m_inputMask = maskFields.left(delimiter); -
716 m_blank = (delimiter + 1 < maskFields.length()) ? maskFields[delimiter + 1] : QLatin1Char(' ');
never evaluated: (delimiter + 1 < maskFields.length())
0
717 }
never executed: }
0
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()
TRUEFALSE
yes
Evaluation Count:8
yes
Evaluation Count:2
2-8
723 c = m_inputMask.at(i); -
724 if (i > 0 && m_inputMask.at(i-1) == QLatin1Char('\\')) {
evaluated: i > 0
TRUEFALSE
yes
Evaluation Count:6
yes
Evaluation Count:2
partially evaluated: m_inputMask.at(i-1) == QLatin1Char('\\')
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:6
0-6
725 m_maxLength++; -
726 continue;
never executed: continue;
0
727 } -
728 if (c != QLatin1Char('\\') && c != QLatin1Char('!') &&
partially evaluated: c != QLatin1Char('\\')
TRUEFALSE
yes
Evaluation Count:8
no
Evaluation Count:0
partially evaluated: c != QLatin1Char('!')
TRUEFALSE
yes
Evaluation Count:8
no
Evaluation Count:0
0-8
729 c != QLatin1Char('<') && c != QLatin1Char('>') &&
partially evaluated: c != QLatin1Char('<')
TRUEFALSE
yes
Evaluation Count:8
no
Evaluation Count:0
partially evaluated: c != QLatin1Char('>')
TRUEFALSE
yes
Evaluation Count:8
no
Evaluation Count:0
0-8
730 c != QLatin1Char('{') && c != QLatin1Char('}') &&
partially evaluated: c != QLatin1Char('{')
TRUEFALSE
yes
Evaluation Count:8
no
Evaluation Count:0
partially evaluated: c != QLatin1Char('}')
TRUEFALSE
yes
Evaluation Count:8
no
Evaluation Count:0
0-8
731 c != QLatin1Char('[') && c != QLatin1Char(']'))
partially evaluated: c != QLatin1Char('[')
TRUEFALSE
yes
Evaluation Count:8
no
Evaluation Count:0
partially evaluated: c != QLatin1Char(']')
TRUEFALSE
yes
Evaluation Count:8
no
Evaluation Count:0
0-8
732 m_maxLength++;
executed: m_maxLength++;
Execution Count:8
8
733 }
executed: }
Execution Count:8
8
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()
TRUEFALSE
yes
Evaluation Count:8
yes
Evaluation Count:2
2-8
744 c = m_inputMask.at(i); -
745 if (escape) {
partially evaluated: escape
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:8
0-8
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('<')) {
never executed: }
partially evaluated: c == QLatin1Char('<')
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:8
0-8
753 m = MaskInputData::Lower; -
754 } else if (c == QLatin1Char('>')) {
never executed: }
partially evaluated: c == QLatin1Char('>')
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:8
0-8
755 m = MaskInputData::Upper; -
756 } else if (c == QLatin1Char('!')) {
never executed: }
partially evaluated: c == QLatin1Char('!')
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:8
0-8
757 m = MaskInputData::NoCaseMode; -
758 } else if (c != QLatin1Char('{') && c != QLatin1Char('}') && c != QLatin1Char('[') && c != QLatin1Char(']')) {
never executed: }
partially evaluated: c != QLatin1Char('{')
TRUEFALSE
yes
Evaluation Count:8
no
Evaluation Count:0
partially evaluated: c != QLatin1Char('}')
TRUEFALSE
yes
Evaluation Count:8
no
Evaluation Count:0
partially evaluated: c != QLatin1Char('[')
TRUEFALSE
yes
Evaluation Count:8
no
Evaluation Count:0
partially evaluated: c != QLatin1Char(']')
TRUEFALSE
yes
Evaluation Count:8
no
Evaluation Count:0
0-8
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:3
3
777 case '\\': -
778 escape = true; -
779 default:
code before this statement never executed: default:
0
780 s = true; -
781 break;
executed: break;
Execution Count:5
5
782 } -
783 -
784 if (!escape) {
partially evaluated: !escape
TRUEFALSE
yes
Evaluation Count:8
no
Evaluation Count:0
0-8
785 m_maskData[index].maskChar = c; -
786 m_maskData[index].separator = s; -
787 m_maskData[index].caseMode = m; -
788 index++; -
789 }
executed: }
Execution Count:8
8
790 }
executed: }
Execution Count:8
8
791 } -
792 internalSetText(m_text); -
793}
executed: }
Execution Count:2
2
794 -
795 -
796 -
797 -
798 -
799 -
800 -
801bool QWidgetLineControl::isValidInput(QChar key, QChar mask) const -
802{ -
803 switch (mask.unicode()) { -
804 case 'A': -
805 if (key.isLetter())
never evaluated: key.isLetter()
0
806 return true;
never executed: return true;
0
807 break;
never executed: break;
0
808 case 'a': -
809 if (key.isLetter() || key == m_blank)
partially evaluated: key.isLetter()
TRUEFALSE
yes
Evaluation Count:2
no
Evaluation Count:0
never evaluated: key == m_blank
0-2
810 return true;
executed: return true;
Execution Count:2
2
811 break;
never executed: break;
0
812 case 'N': -
813 if (key.isLetterOrNumber())
never evaluated: key.isLetterOrNumber()
0
814 return true;
never executed: return true;
0
815 break;
never executed: break;
0
816 case 'n': -
817 if (key.isLetterOrNumber() || key == m_blank)
never evaluated: key.isLetterOrNumber()
never evaluated: key == m_blank
0
818 return true;
never executed: return true;
0
819 break;
never executed: break;
0
820 case 'X': -
821 if (key.isPrint())
never evaluated: key.isPrint()
0
822 return true;
never executed: return true;
0
823 break;
never executed: break;
0
824 case 'x': -
825 if (key.isPrint() || key == m_blank)
never evaluated: key.isPrint()
never evaluated: key == m_blank
0
826 return true;
never executed: return true;
0
827 break;
never executed: break;
0
828 case '9': -
829 if (key.isNumber())
never evaluated: key.isNumber()
0
830 return true;
never executed: return true;
0
831 break;
never executed: break;
0
832 case '0': -
833 if (key.isNumber() || key == m_blank)
never evaluated: key.isNumber()
never evaluated: key == m_blank
0
834 return true;
never executed: return true;
0
835 break;
never executed: break;
0
836 case 'D': -
837 if (key.isNumber() && key.digitValue() > 0)
never evaluated: key.isNumber()
never evaluated: key.digitValue() > 0
0
838 return true;
never executed: return true;
0
839 break;
never executed: break;
0
840 case 'd': -
841 if ((key.isNumber() && key.digitValue() > 0) || key == m_blank)
never evaluated: key.isNumber()
never evaluated: key.digitValue() > 0
never evaluated: key == m_blank
0
842 return true;
never executed: return true;
0
843 break;
never executed: 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;
never executed: break;
0
848 case 'B': -
849 if (key == QLatin1Char('0') || key == QLatin1Char('1'))
partially evaluated: key == QLatin1Char('0')
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:2
partially evaluated: key == QLatin1Char('1')
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:2
0-2
850 return true;
never executed: return true;
0
851 break;
executed: break;
Execution Count:2
2
852 case 'b': -
853 if (key == QLatin1Char('0') || key == QLatin1Char('1') || key == m_blank)
never evaluated: key == QLatin1Char('0')
never evaluated: key == QLatin1Char('1')
never evaluated: key == m_blank
0
854 return true;
never executed: return true;
0
855 break;
never executed: break;
0
856 case 'H': -
857 if (key.isNumber() || (key >= QLatin1Char('a') && key <= QLatin1Char('f')) || (key >= QLatin1Char('A') && key <= QLatin1Char('F')))
never evaluated: key.isNumber()
never evaluated: key >= QLatin1Char('a')
never evaluated: key <= QLatin1Char('f')
never evaluated: key >= QLatin1Char('A')
never evaluated: key <= QLatin1Char('F')
0
858 return true;
never executed: return true;
0
859 break;
never executed: break;
0
860 case 'h': -
861 if (key.isNumber() || (key >= QLatin1Char('a') && key <= QLatin1Char('f')) || (key >= QLatin1Char('A') && key <= QLatin1Char('F')) || key == m_blank)
never evaluated: key.isNumber()
never evaluated: key >= QLatin1Char('a')
never evaluated: key <= QLatin1Char('f')
never evaluated: key >= QLatin1Char('A')
never evaluated: key <= QLatin1Char('F')
never evaluated: key == m_blank
0
862 return true;
never executed: return true;
0
863 break;
never executed: break;
0
864 default: -
865 break;
never executed: break;
0
866 } -
867 return false;
executed: return false;
Execution Count:2
2
868} -
869bool 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
TRUEFALSE
yes
Evaluation Count:1565
yes
Evaluation Count:195
195-1565
875 != QValidator::Acceptable)
evaluated: m_validator->validate(textCopy, cursorCopy) != QValidator::Acceptable
TRUEFALSE
yes
Evaluation Count:632
yes
Evaluation Count:933
632-933
876 return false;
executed: return false;
Execution Count:632
632
877 -
878 -
879 if (!m_maskData)
partially evaluated: !m_maskData
TRUEFALSE
yes
Evaluation Count:1128
no
Evaluation Count:0
0-1128
880 return true;
executed: return true;
Execution Count:1128
1128
881 -
882 if (str.length() != m_maxLength)
never evaluated: str.length() != m_maxLength
0
883 return false;
never executed: return false;
0
884 -
885 for (int i=0; i < m_maxLength; ++i) {
never evaluated: i < m_maxLength
0
886 if (m_maskData[i].separator) {
never evaluated: m_maskData[i].separator
0
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 {
never executed: }
0
890 if (!isValidInput(str.at(i), m_maskData[i].maskChar))
never evaluated: !isValidInput(str.at(i), m_maskData[i].maskChar)
0
891 return false;
never executed: return false;
0
892 }
never executed: }
0
893 } -
894 return true;
never executed: return true;
0
895} -
896QString QWidgetLineControl::maskString(uint pos, const QString &str, bool clear) const -
897{ -
898 if (pos >= (uint)m_maxLength)
partially evaluated: pos >= (uint)m_maxLength
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:2
0-2
899 return QString::fromLatin1("");
never executed: return QString::fromLatin1("");
0
900 -
901 QString fill; -
902 fill = clear ? clearString(0, m_maxLength) : m_text;
partially evaluated: clear
TRUEFALSE
yes
Evaluation Count:2
no
Evaluation Count:0
0-2
903 -
904 int strIndex = 0; -
905 QString s = QString::fromLatin1(""); -
906 int i = pos; -
907 while (i < m_maxLength) {
evaluated: i < m_maxLength
TRUEFALSE
yes
Evaluation Count:5
yes
Evaluation Count:2
2-5
908 if (strIndex < str.length()) {
partially evaluated: strIndex < str.length()
TRUEFALSE
yes
Evaluation Count:5
no
Evaluation Count:0
0-5
909 if (m_maskData[i].separator) {
evaluated: m_maskData[i].separator
TRUEFALSE
yes
Evaluation Count:3
yes
Evaluation Count:2
2-3
910 s += m_maskData[i].maskChar; -
911 if (str[(int)strIndex] == m_maskData[i].maskChar)
partially evaluated: str[(int)strIndex] == m_maskData[i].maskChar
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:3
0-3
912 strIndex++;
never executed: strIndex++;
0
913 ++i; -
914 } else {
executed: }
Execution Count:3
3
915 if (isValidInput(str[(int)strIndex], m_maskData[i].maskChar)) {
evaluated: isValidInput(str[(int)strIndex], m_maskData[i].maskChar)
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:1
1
916 switch (m_maskData[i].caseMode) { -
917 case MaskInputData::Upper: -
918 s += str[(int)strIndex].toUpper(); -
919 break;
never executed: break;
0
920 case MaskInputData::Lower: -
921 s += str[(int)strIndex].toLower(); -
922 break;
never executed: break;
0
923 default: -
924 s += str[(int)strIndex]; -
925 }
executed: }
Execution Count:1
1
926 ++i; -
927 } else {
executed: }
Execution Count:1
1
928 -
929 int n = findInMask(i, true, true, str[(int)strIndex]); -
930 if (n != -1) {
partially evaluated: n != -1
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1
0-1
931 if (str.length() != 1 || i == 0 || (i > 0 && (!m_maskData[i-1].separator || m_maskData[i-1].maskChar != str[(int)strIndex]))) {
never evaluated: str.length() != 1
never evaluated: i == 0
never evaluated: i > 0
never evaluated: !m_maskData[i-1].separator
never evaluated: m_maskData[i-1].maskChar != str[(int)strIndex]
0
932 s += fill.mid(i, n-i+1); -
933 i = n + 1; -
934 }
never executed: }
0
935 } else {
never executed: }
0
936 -
937 n = findInMask(i, true, false, str[(int)strIndex]); -
938 if (n != -1) {
partially evaluated: n != -1
TRUEFALSE
yes
Evaluation Count:1
no
Evaluation Count:0
0-1
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;
never executed: break;
0
944 case MaskInputData::Lower: -
945 s += str[(int)strIndex].toLower(); -
946 break;
never executed: break;
0
947 default: -
948 s += str[(int)strIndex]; -
949 }
executed: }
Execution Count:1
1
950 i = n + 1; -
951 }
executed: }
Execution Count:1
1
952 }
executed: }
Execution Count:1
1
953 } -
954 ++strIndex; -
955 }
executed: }
Execution Count:2
2
956 } else -
957 break;
never executed: break;
0
958 } -
959 -
960 return s;
executed: return s;
Execution Count:2
2
961} -
962QString QWidgetLineControl::clearString(uint pos, uint len) const -
963{ -
964 if (pos >= (uint)m_maxLength)
evaluated: pos >= (uint)m_maxLength
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:2
2
965 return QString();
executed: return QString();
Execution Count:2
2
966 -
967 QString s; -
968 int end = qMin((uint)m_maxLength, pos + len); -
969 for (int i = pos; i < end; ++i)
evaluated: i < end
TRUEFALSE
yes
Evaluation Count:8
yes
Evaluation Count:2
2-8
970 if (m_maskData[i].separator)
evaluated: m_maskData[i].separator
TRUEFALSE
yes
Evaluation Count:5
yes
Evaluation Count:3
3-5
971 s += m_maskData[i].maskChar;
executed: s += m_maskData[i].maskChar;
Execution Count:5
5
972 else -
973 s += m_blank;
executed: s += m_blank;
Execution Count:3
3
974 -
975 return s;
executed: return s;
Execution Count:2
2
976} -
977 -
978 -
979 -
980 -
981 -
982 -
983 -
984QString QWidgetLineControl::stripString(const QString &str) const -
985{ -
986 if (!m_maskData)
partially evaluated: !m_maskData
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:2
0-2
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
TRUEFALSE
yes
Evaluation Count:8
yes
Evaluation Count:2
2-8
992 if (m_maskData[i].separator)
evaluated: m_maskData[i].separator
TRUEFALSE
yes
Evaluation Count:5
yes
Evaluation Count:3
3-5
993 s += m_maskData[i].maskChar;
executed: s += m_maskData[i].maskChar;
Execution Count:5
5
994 else -
995 if (str[i] != m_blank)
evaluated: str[i] != m_blank
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:1
1-2
996 s += str[i];
executed: s += str[i];
Execution Count:2
2
997 -
998 return s;
executed: return s;
Execution Count:2
2
999} -
1000 -
1001 -
1002 -
1003 -
1004 -
1005int QWidgetLineControl::findInMask(int pos, bool forward, bool findSeparator, QChar searchChar) const -
1006{ -
1007 if (pos >= m_maxLength || pos < 0)
partially evaluated: pos >= m_maxLength
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:6
partially evaluated: pos < 0
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:6
0-6
1008 return -1;
never executed: return -1;
0
1009 -
1010 int end = forward ? m_maxLength : -1;
evaluated: forward
TRUEFALSE
yes
Evaluation Count:4
yes
Evaluation Count:2
2-4
1011 int step = forward ? 1 : -1;
evaluated: forward
TRUEFALSE
yes
Evaluation Count:4
yes
Evaluation Count:2
2-4
1012 int i = pos; -
1013 -
1014 while (i != end) {
evaluated: i != end
TRUEFALSE
yes
Evaluation Count:13
yes
Evaluation Count:1
1-13
1015 if (findSeparator) {
evaluated: findSeparator
TRUEFALSE
yes
Evaluation Count:4
yes
Evaluation Count:9
4-9
1016 if (m_maskData[i].separator && m_maskData[i].maskChar == searchChar)
evaluated: m_maskData[i].separator
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:2
partially evaluated: m_maskData[i].maskChar == searchChar
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:2
0-2
1017 return i;
never executed: return i;
0
1018 } else {
executed: }
Execution Count:4
4
1019 if (!m_maskData[i].separator) {
evaluated: !m_maskData[i].separator
TRUEFALSE
yes
Evaluation Count:6
yes
Evaluation Count:3
3-6
1020 if (searchChar.isNull())
evaluated: searchChar.isNull()
TRUEFALSE
yes
Evaluation Count:4
yes
Evaluation Count:2
2-4
1021 return i;
executed: return i;
Execution Count:4
4
1022 else if (isValidInput(searchChar, m_maskData[i].maskChar))
evaluated: isValidInput(searchChar, m_maskData[i].maskChar)
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:1
1
1023 return i;
executed: return i;
Execution Count:1
1
1024 } -
1025 }
executed: }
Execution Count:4
4
1026 i += step; -
1027 }
executed: }
Execution Count:8
8
1028 return -1;
executed: return -1;
Execution Count:1
1
1029} -
1030 -
1031void QWidgetLineControl::internalUndo(int until) -
1032{ -
1033 if (!isUndoAvailable())
partially evaluated: !isUndoAvailable()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:232
0-232
1034 return;
never executed: return;
0
1035 cancelPasswordEchoTimer(); -
1036 internalDeselect(); -
1037 -
1038 -
1039 if (m_echoMode != QLineEdit::Normal) {
partially evaluated: m_echoMode != QLineEdit::Normal
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:232
0-232
1040 clear(); -
1041 return;
never executed: return;
0
1042 } -
1043 -
1044 while (m_undoState && m_undoState > until) {
evaluated: m_undoState
TRUEFALSE
yes
Evaluation Count:1047
yes
Evaluation Count:43
evaluated: m_undoState > until
TRUEFALSE
yes
Evaluation Count:858
yes
Evaluation Count:189
43-1047
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:232
232
1051 case SetSelection: -
1052 m_selstart = cmd.selStart; -
1053 m_selend = cmd.selEnd; -
1054 m_cursor = cmd.pos; -
1055 break;
executed: break;
Execution Count:144
144
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:4
4
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:336
336
1066 case Separator: -
1067 continue;
executed: continue;
Execution Count:142
142
1068 } -
1069 if (until < 0 && m_undoState) {
evaluated: until < 0
TRUEFALSE
yes
Evaluation Count:6
yes
Evaluation Count:710
evaluated: m_undoState
TRUEFALSE
yes
Evaluation Count:5
yes
Evaluation Count:1
1-710
1070 Command& next = m_history[m_undoState-1]; -
1071 if (next.type != cmd.type && next.type < RemoveSelection
evaluated: next.type != cmd.type
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:3
partially evaluated: next.type < RemoveSelection
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:2
0-3
1072 && (cmd.type < RemoveSelection || next.type == Separator))
never evaluated: cmd.type < RemoveSelection
never evaluated: next.type == Separator
0
1073 break;
never executed: break;
0
1074 }
executed: }
Execution Count:5
5
1075 }
executed: }
Execution Count:716
716
1076 m_textDirty = true; -
1077 emitCursorPositionChanged(); -
1078}
executed: }
Execution Count:232
232
1079 -
1080void QWidgetLineControl::internalRedo() -
1081{ -
1082 if (!isRedoAvailable())
partially evaluated: !isRedoAvailable()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1
0-1
1083 return;
never executed: return;
0
1084 internalDeselect(); -
1085 while (m_undoState < (int)m_history.size()) {
evaluated: m_undoState < (int)m_history.size()
TRUEFALSE
yes
Evaluation Count:6
yes
Evaluation Count:1
1-6
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:1
1
1092 case SetSelection: -
1093 m_selstart = cmd.selStart; -
1094 m_selend = cmd.selEnd; -
1095 m_cursor = cmd.pos; -
1096 break;
executed: break;
Execution Count:1
1
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:4
4
1106 case Separator: -
1107 m_selstart = cmd.selStart; -
1108 m_selend = cmd.selEnd; -
1109 m_cursor = cmd.pos; -
1110 break;
never executed: break;
0
1111 } -
1112 if (m_undoState < (int)m_history.size()) {
evaluated: m_undoState < (int)m_history.size()
TRUEFALSE
yes
Evaluation Count:5
yes
Evaluation Count:1
1-5
1113 Command& next = m_history[m_undoState]; -
1114 if (next.type != cmd.type && cmd.type < RemoveSelection && next.type != Separator
evaluated: next.type != cmd.type
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:3
partially evaluated: cmd.type < RemoveSelection
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:2
never evaluated: next.type != Separator
0-3
1115 && (next.type < RemoveSelection || cmd.type == Separator))
never evaluated: next.type < RemoveSelection
never evaluated: cmd.type == Separator
0
1116 break;
never executed: break;
0
1117 }
executed: }
Execution Count:5
5
1118 }
executed: }
Execution Count:6
6
1119 m_textDirty = true; -
1120 emitCursorPositionChanged(); -
1121}
executed: }
Execution Count:1
1
1122 -
1123 -
1124 -
1125 -
1126 -
1127 -
1128 -
1129void QWidgetLineControl::emitCursorPositionChanged() -
1130{ -
1131 if (m_cursor != m_lastCursorPos) {
evaluated: m_cursor != m_lastCursorPos
TRUEFALSE
yes
Evaluation Count:9292
yes
Evaluation Count:3119
3119-9292
1132 const int oldLast = m_lastCursorPos; -
1133 m_lastCursorPos = m_cursor; -
1134 cursorPositionChanged(oldLast, m_cursor); -
1135 -
1136 -
1137 if (!hasSelectedText()) {
evaluated: !hasSelectedText()
TRUEFALSE
yes
Evaluation Count:6437
yes
Evaluation Count:2855
2855-6437
1138 QAccessibleTextCursorEvent event(parent(), m_cursor); -
1139 QAccessible::updateAccessibility(&event); -
1140 }
executed: }
Execution Count:6437
6437
1141 -
1142 }
executed: }
Execution Count:9292
9292
1143}
executed: }
Execution Count:12411
12411
1144 -
1145 -
1146 -
1147 -
1148bool QWidgetLineControl::advanceToEnabledItem(int dir) -
1149{ -
1150 int start = m_completer->currentRow(); -
1151 if (start == -1)
partially evaluated: start == -1
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:2
0-2
1152 return false;
never executed: return false;
0
1153 int i = start + dir; -
1154 if (dir == 0) dir = 1;
executed: dir = 1;
Execution Count:2
partially evaluated: dir == 0
TRUEFALSE
yes
Evaluation Count:2
no
Evaluation Count:0
0-2
1155 do { -
1156 if (!m_completer->setCurrentRow(i)) {
partially evaluated: !m_completer->setCurrentRow(i)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:2
0-2
1157 if (!m_completer->wrapAround())
never evaluated: !m_completer->wrapAround()
0
1158 break;
never executed: break;
0
1159 i = i > 0 ? 0 : m_completer->completionCount() - 1;
never evaluated: i > 0
0
1160 } else {
never executed: }
0
1161 QModelIndex currentIndex = m_completer->currentIndex(); -
1162 if (m_completer->completionModel()->flags(currentIndex) & Qt::ItemIsEnabled)
partially evaluated: m_completer->completionModel()->flags(currentIndex) & Qt::ItemIsEnabled
TRUEFALSE
yes
Evaluation Count:2
no
Evaluation Count:0
0-2
1163 return true;
executed: return true;
Execution Count:2
2
1164 i += dir; -
1165 }
never executed: }
0
1166 } while (i != start);
never evaluated: i != start
0
1167 -
1168 m_completer->setCurrentRow(start); -
1169 return false;
never executed: return false;
0
1170} -
1171 -
1172void QWidgetLineControl::complete(int key) -
1173{ -
1174 if (!m_completer || isReadOnly() || echoMode() != QLineEdit::Normal)
evaluated: !m_completer
TRUEFALSE
yes
Evaluation Count:849
yes
Evaluation Count:60
partially evaluated: isReadOnly()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:60
partially evaluated: echoMode() != QLineEdit::Normal
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:60
0-849
1175 return;
executed: return;
Execution Count:849
849
1176 -
1177 QString text = this->text(); -
1178 if (m_completer->completionMode() == QCompleter::InlineCompletion) {
evaluated: m_completer->completionMode() == QCompleter::InlineCompletion
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:58
2-58
1179 if (key == Qt::Key_Backspace)
partially evaluated: key == Qt::Key_Backspace
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:2
0-2
1180 return;
never executed: return;
0
1181 int n = 0; -
1182 if (key == Qt::Key_Up || key == Qt::Key_Down) {
partially evaluated: key == Qt::Key_Up
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:2
partially evaluated: key == Qt::Key_Down
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:2
0-2
1183 if (textAfterSelection().length())
never evaluated: textAfterSelection().length()
0
1184 return;
never executed: return;
0
1185 QString prefix = hasSelectedText() ? textBeforeSelection()
never evaluated: hasSelectedText()
0
1186 : text; -
1187 if (text.compare(m_completer->currentCompletion(), m_completer->caseSensitivity()) != 0
never evaluated: text.compare(m_completer->currentCompletion(), m_completer->caseSensitivity()) != 0
0
1188 || prefix.compare(m_completer->completionPrefix(), m_completer->caseSensitivity()) != 0) {
never evaluated: prefix.compare(m_completer->completionPrefix(), m_completer->caseSensitivity()) != 0
0
1189 m_completer->setCompletionPrefix(prefix); -
1190 } else {
never executed: }
0
1191 n = (key == Qt::Key_Up) ? -1 : +1;
never evaluated: (key == Qt::Key_Up)
0
1192 }
never executed: }
0
1193 } else { -
1194 m_completer->setCompletionPrefix(text); -
1195 }
executed: }
Execution Count:2
2
1196 if (!advanceToEnabledItem(n))
partially evaluated: !advanceToEnabledItem(n)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:2
0-2
1197 return;
never executed: return;
0
1198 } else {
executed: }
Execution Count:2
2
1199 -
1200 if (text.isEmpty()) {
partially evaluated: text.isEmpty()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:58
0-58
1201 m_completer->popup()->hide(); -
1202 return;
never executed: return;
0
1203 } -
1204 -
1205 m_completer->setCompletionPrefix(text); -
1206 }
executed: }
Execution Count:58
58
1207 -
1208 m_completer->complete(); -
1209}
executed: }
Execution Count:59
59
1210 -
1211 -
1212void QWidgetLineControl::setReadOnly(bool enable) -
1213{ -
1214 m_readOnly = enable; -
1215 if (enable)
evaluated: enable
TRUEFALSE
yes
Evaluation Count:10
yes
Evaluation Count:3
3-10
1216 setCursorBlinkPeriod(0);
executed: setCursorBlinkPeriod(0);
Execution Count:10
10
1217 else -
1218 setCursorBlinkPeriod(QApplication::cursorFlashTime());
executed: setCursorBlinkPeriod(QApplication::cursorFlashTime());
Execution Count:3
3
1219} -
1220 -
1221void QWidgetLineControl::setCursorBlinkPeriod(int msec) -
1222{ -
1223 if (msec == m_blinkPeriod)
evaluated: msec == m_blinkPeriod
TRUEFALSE
yes
Evaluation Count:1574
yes
Evaluation Count:2343
1574-2343
1224 return;
executed: return;
Execution Count:1574
1574
1225 if (m_blinkTimer) {
evaluated: m_blinkTimer
TRUEFALSE
yes
Evaluation Count:1108
yes
Evaluation Count:1235
1108-1235
1226 killTimer(m_blinkTimer); -
1227 }
executed: }
Execution Count:1108
1108
1228 if (msec && !m_readOnly) {
evaluated: msec
TRUEFALSE
yes
Evaluation Count:1235
yes
Evaluation Count:1108
evaluated: !m_readOnly
TRUEFALSE
yes
Evaluation Count:1232
yes
Evaluation Count:3
3-1235
1229 m_blinkTimer = startTimer(msec / 2); -
1230 m_blinkStatus = 1; -
1231 } else {
executed: }
Execution Count:1232
1232
1232 m_blinkTimer = 0; -
1233 if (m_blinkStatus == 1)
evaluated: m_blinkStatus == 1
TRUEFALSE
yes
Evaluation Count:1104
yes
Evaluation Count:7
7-1104
1234 updateNeeded(inputMask().isEmpty() ? cursorRect() : QRect());
executed: updateNeeded(inputMask().isEmpty() ? cursorRect() : QRect());
Execution Count:1104
1104
1235 }
executed: }
Execution Count:1111
1111
1236 m_blinkPeriod = msec; -
1237}
executed: }
Execution Count:2343
2343
1238 -
1239 -
1240void QWidgetLineControl::resetCursorBlinkTimer() -
1241{ -
1242 if (m_blinkPeriod == 0 || m_blinkTimer == 0)
never evaluated: m_blinkPeriod == 0
never evaluated: m_blinkTimer == 0
0
1243 return;
never executed: return;
0
1244 killTimer(m_blinkTimer); -
1245 m_blinkTimer = startTimer(m_blinkPeriod / 2); -
1246 m_blinkStatus = 1; -
1247}
never executed: }
0
1248 -
1249void QWidgetLineControl::timerEvent(QTimerEvent *event) -
1250{ -
1251 if (event->timerId() == m_blinkTimer) {
partially evaluated: event->timerId() == m_blinkTimer
TRUEFALSE
yes
Evaluation Count:21
no
Evaluation Count:0
0-21
1252 m_blinkStatus = !m_blinkStatus; -
1253 updateNeeded(inputMask().isEmpty() ? cursorRect() : QRect()); -
1254 } else if (event->timerId() == m_deleteAllTimer) {
executed: }
Execution Count:21
never evaluated: event->timerId() == m_deleteAllTimer
0-21
1255 killTimer(m_deleteAllTimer); -
1256 m_deleteAllTimer = 0; -
1257 clear(); -
1258 } else if (event->timerId() == m_tripleClickTimer) {
never executed: }
never evaluated: event->timerId() == m_tripleClickTimer
0
1259 killTimer(m_tripleClickTimer); -
1260 m_tripleClickTimer = 0; -
1261 } else if (event->timerId() == m_passwordEchoTimer) {
never executed: }
never evaluated: event->timerId() == m_passwordEchoTimer
0
1262 killTimer(m_passwordEchoTimer); -
1263 m_passwordEchoTimer = 0; -
1264 updateDisplayText(); -
1265 }
never executed: }
0
1266} -
1267 -
1268 -
1269void QWidgetLineControl::processShortcutOverrideEvent(QKeyEvent *ke) -
1270{ -
1271 if (isReadOnly())
evaluated: isReadOnly()
TRUEFALSE
yes
Evaluation Count:3
yes
Evaluation Count:2536
3-2536
1272 return;
executed: return;
Execution Count:3
3
1273 -
1274 if (ke == QKeySequence::Copy
partially evaluated: ke == QKeySequence::Copy
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:2536
0-2536
1275 || ke == QKeySequence::Paste
partially evaluated: ke == QKeySequence::Paste
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:2536
0-2536
1276 || ke == QKeySequence::Cut
partially evaluated: ke == QKeySequence::Cut
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:2536
0-2536
1277 || ke == QKeySequence::Redo
evaluated: ke == QKeySequence::Redo
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:2535
1-2535
1278 || ke == QKeySequence::Undo
evaluated: ke == QKeySequence::Undo
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:2534
1-2534
1279 || ke == QKeySequence::MoveToNextWord
evaluated: ke == QKeySequence::MoveToNextWord
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:2533
1-2533
1280 || ke == QKeySequence::MoveToPreviousWord
evaluated: ke == QKeySequence::MoveToPreviousWord
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:2532
1-2532
1281 || ke == QKeySequence::MoveToStartOfDocument
partially evaluated: ke == QKeySequence::MoveToStartOfDocument
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:2532
0-2532
1282 || ke == QKeySequence::MoveToEndOfDocument
partially evaluated: ke == QKeySequence::MoveToEndOfDocument
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:2532
0-2532
1283 || ke == QKeySequence::SelectNextWord
partially evaluated: ke == QKeySequence::SelectNextWord
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:2532
0-2532
1284 || ke == QKeySequence::SelectPreviousWord
partially evaluated: ke == QKeySequence::SelectPreviousWord
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:2532
0-2532
1285 || ke == QKeySequence::SelectStartOfLine
partially evaluated: ke == QKeySequence::SelectStartOfLine
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:2532
0-2532
1286 || ke == QKeySequence::SelectEndOfLine
evaluated: ke == QKeySequence::SelectEndOfLine
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:2531
1-2531
1287 || ke == QKeySequence::SelectStartOfBlock
partially evaluated: ke == QKeySequence::SelectStartOfBlock
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:2531
0-2531
1288 || ke == QKeySequence::SelectEndOfBlock
partially evaluated: ke == QKeySequence::SelectEndOfBlock
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:2531
0-2531
1289 || ke == QKeySequence::SelectStartOfDocument
partially evaluated: ke == QKeySequence::SelectStartOfDocument
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:2531
0-2531
1290 || ke == QKeySequence::SelectAll
partially evaluated: ke == QKeySequence::SelectAll
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:2531
0-2531
1291 || ke == QKeySequence::SelectEndOfDocument) {
partially evaluated: ke == QKeySequence::SelectEndOfDocument
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:2531
0-2531
1292 ke->accept(); -
1293 } else if (ke->modifiers() == Qt::NoModifier || ke->modifiers() == Qt::ShiftModifier
executed: }
Execution Count:5
evaluated: ke->modifiers() == Qt::NoModifier
TRUEFALSE
yes
Evaluation Count:2439
yes
Evaluation Count:92
evaluated: ke->modifiers() == Qt::ShiftModifier
TRUEFALSE
yes
Evaluation Count:82
yes
Evaluation Count:10
5-2439
1294 || ke->modifiers() == Qt::KeypadModifier) {
evaluated: ke->modifiers() == Qt::KeypadModifier
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:8
2-8
1295 if (ke->key() < Qt::Key_Escape) {
evaluated: ke->key() < Qt::Key_Escape
TRUEFALSE
yes
Evaluation Count:820
yes
Evaluation Count:1703
820-1703
1296 ke->accept(); -
1297 } else {
executed: }
Execution Count:820
820
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:1703
1703
1308 } -
1309 }
executed: }
Execution Count:1703
1703
1310 } -
1311} -
1312 -
1313 -
1314void QWidgetLineControl::processKeyEvent(QKeyEvent* event) -
1315{ -
1316 bool inlineCompletionAccepted = false; -
1317 -
1318 -
1319 if (m_completer) {
evaluated: m_completer
TRUEFALSE
yes
Evaluation Count:14
yes
Evaluation Count:1165
14-1165
1320 QCompleter::CompletionMode completionMode = m_completer->completionMode(); -
1321 if ((completionMode == QCompleter::PopupCompletion
evaluated: completionMode == QCompleter::PopupCompletion
TRUEFALSE
yes
Evaluation Count:12
yes
Evaluation Count:2
2-12
1322 || completionMode == QCompleter::UnfilteredPopupCompletion)
partially evaluated: completionMode == QCompleter::UnfilteredPopupCompletion
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:2
0-2
1323 && m_completer->popup()
partially evaluated: m_completer->popup()
TRUEFALSE
yes
Evaluation Count:12
no
Evaluation Count:0
0-12
1324 && m_completer->popup()->isVisible()) {
evaluated: m_completer->popup()->isVisible()
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:10
2-10
1325 -
1326 -
1327 switch (event->key()) { -
1328 case Qt::Key_Escape: -
1329 event->ignore(); -
1330 return;
never executed: return;
0
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:2
2
1342 } -
1343 } else if (completionMode == QCompleter::InlineCompletion) {
executed: }
Execution Count:2
evaluated: completionMode == QCompleter::InlineCompletion
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:10
2-10
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()
never evaluated: !m_completer->currentCompletion().isEmpty()
never evaluated: hasSelectedText()
0
1354 && textAfterSelection().isEmpty()) {
never evaluated: textAfterSelection().isEmpty()
0
1355 setText(m_completer->currentCompletion()); -
1356 inlineCompletionAccepted = true; -
1357 }
never executed: }
0
1358 default: -
1359 break;
executed: break;
Execution Count:2
2
1360 } -
1361 }
executed: }
Execution Count:2
2
1362 } -
1363 -
1364 -
1365 if (event->key() == Qt::Key_Enter || event->key() == Qt::Key_Return) {
evaluated: event->key() == Qt::Key_Enter
TRUEFALSE
yes
Evaluation Count:12
yes
Evaluation Count:1167
evaluated: event->key() == Qt::Key_Return
TRUEFALSE
yes
Evaluation Count:21
yes
Evaluation Count:1146
12-1167
1366 if (hasAcceptableInput() || fixup()) {
evaluated: hasAcceptableInput()
TRUEFALSE
yes
Evaluation Count:12
yes
Evaluation Count:21
partially evaluated: fixup()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:21
0-21
1367 accepted(); -
1368 editingFinished(); -
1369 }
executed: }
Execution Count:12
12
1370 if (inlineCompletionAccepted)
partially evaluated: inlineCompletionAccepted
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:33
0-33
1371 event->accept();
never executed: event->accept();
0
1372 else -
1373 event->ignore();
executed: event->ignore();
Execution Count:33
33
1374 return;
executed: return;
Execution Count:33
33
1375 } -
1376 -
1377 if (echoMode() == QLineEdit::PasswordEchoOnEdit
partially evaluated: echoMode() == QLineEdit::PasswordEchoOnEdit
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1146
0-1146
1378 && !passwordEchoEditing()
never evaluated: !passwordEchoEditing()
0
1379 && !isReadOnly()
never evaluated: !isReadOnly()
0
1380 && !event->text().isEmpty()
never evaluated: !event->text().isEmpty()
0
1381 -
1382 -
1383 -
1384 -
1385 -
1386 -
1387 && !(event->modifiers() & Qt::ControlModifier)) {
never evaluated: !(event->modifiers() & Qt::ControlModifier)
0
1388 -
1389 -
1390 -
1391 -
1392 -
1393 updatePasswordEchoEditing(true); -
1394 clear(); -
1395 }
never executed: }
0
1396 -
1397 bool unknown = false; -
1398 bool visual = cursorMoveStyle() == Qt::VisualMoveStyle; -
1399 -
1400 if (false) {
partially evaluated: false
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1146
0-1146
1401 }
never executed: }
0
1402 -
1403 else if (event == QKeySequence::Undo) {
evaluated: event == QKeySequence::Undo
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:1145
1-1145
1404 if (!isReadOnly())
partially evaluated: !isReadOnly()
TRUEFALSE
yes
Evaluation Count:1
no
Evaluation Count:0
0-1
1405 undo();
executed: undo();
Execution Count:1
1
1406 }
executed: }
Execution Count:1
1
1407 else if (event == QKeySequence::Redo) {
evaluated: event == QKeySequence::Redo
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:1144
1-1144
1408 if (!isReadOnly())
partially evaluated: !isReadOnly()
TRUEFALSE
yes
Evaluation Count:1
no
Evaluation Count:0
0-1
1409 redo();
executed: redo();
Execution Count:1
1
1410 }
executed: }
Execution Count:1
1
1411 else if (event == QKeySequence::SelectAll) {
partially evaluated: event == QKeySequence::SelectAll
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1144
0-1144
1412 selectAll(); -
1413 }
never executed: }
0
1414 -
1415 else if (event == QKeySequence::Copy) {
partially evaluated: event == QKeySequence::Copy
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1144
0-1144
1416 copy(); -
1417 }
never executed: }
0
1418 else if (event == QKeySequence::Paste) {
partially evaluated: event == QKeySequence::Paste
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1144
0-1144
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 }
never executed: }
0
1426 paste(mode); -
1427 }
never executed: }
0
1428 }
never executed: }
0
1429 else if (event == QKeySequence::Cut) {
partially evaluated: event == QKeySequence::Cut
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1144
0-1144
1430 if (!isReadOnly()) {
never evaluated: !isReadOnly()
0
1431 copy(); -
1432 del(); -
1433 }
never executed: }
0
1434 }
never executed: }
0
1435 else if (event == QKeySequence::DeleteEndOfLine) {
partially evaluated: event == QKeySequence::DeleteEndOfLine
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1144
0-1144
1436 if (!isReadOnly()) {
never evaluated: !isReadOnly()
0
1437 setSelection(cursor(), end()); -
1438 copy(); -
1439 del(); -
1440 }
never executed: }
0
1441 }
never executed: }
0
1442 -
1443 else if (event == QKeySequence::MoveToStartOfLine || event == QKeySequence::MoveToStartOfBlock) {
evaluated: event == QKeySequence::MoveToStartOfLine
TRUEFALSE
yes
Evaluation Count:24
yes
Evaluation Count:1120
partially evaluated: event == QKeySequence::MoveToStartOfBlock
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1120
0-1120
1444 home(0); -
1445 }
executed: }
Execution Count:24
24
1446 else if (event == QKeySequence::MoveToEndOfLine || event == QKeySequence::MoveToEndOfBlock) {
evaluated: event == QKeySequence::MoveToEndOfLine
TRUEFALSE
yes
Evaluation Count:26
yes
Evaluation Count:1094
partially evaluated: event == QKeySequence::MoveToEndOfBlock
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1094
0-1094
1447 end(0); -
1448 }
executed: }
Execution Count:26
26
1449 else if (event == QKeySequence::SelectStartOfLine || event == QKeySequence::SelectStartOfBlock) {
partially evaluated: event == QKeySequence::SelectStartOfLine
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1094
partially evaluated: event == QKeySequence::SelectStartOfBlock
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1094
0-1094
1450 home(1); -
1451 }
never executed: }
0
1452 else if (event == QKeySequence::SelectEndOfLine || event == QKeySequence::SelectEndOfBlock) {
evaluated: event == QKeySequence::SelectEndOfLine
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:1093
partially evaluated: event == QKeySequence::SelectEndOfBlock
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1093
0-1093
1453 end(1); -
1454 }
executed: }
Execution Count:1
1
1455 else if (event == QKeySequence::MoveToNextChar) {
evaluated: event == QKeySequence::MoveToNextChar
TRUEFALSE
yes
Evaluation Count:75
yes
Evaluation Count:1018
75-1018
1456 -
1457 -
1458 -
1459 const bool inlineCompletion = m_completer && m_completer->completionMode() == QCompleter::InlineCompletion;
partially evaluated: m_completer
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:75
never evaluated: m_completer->completionMode() == QCompleter::InlineCompletion
0-75
1460 -
1461 if (hasSelectedText()
partially evaluated: hasSelectedText()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:75
0-75
1462 && (m_keyboardScheme != QPlatformTheme::WindowsKeyboardScheme
never evaluated: m_keyboardScheme != QPlatformTheme::WindowsKeyboardScheme
0
1463 || inlineCompletion)) {
never evaluated: inlineCompletion
0
1464 moveCursor(selectionEnd(), false); -
1465 } else {
never executed: }
0
1466 cursorForward(0, visual ? 1 : (layoutDirection() == Qt::LeftToRight ? 1 : -1)); -
1467 }
executed: }
Execution Count:75
75
1468 } -
1469 else if (event == QKeySequence::SelectNextChar) {
evaluated: event == QKeySequence::SelectNextChar
TRUEFALSE
yes
Evaluation Count:14
yes
Evaluation Count:1004
14-1004
1470 cursorForward(1, visual ? 1 : (layoutDirection() == Qt::LeftToRight ? 1 : -1)); -
1471 }
executed: }
Execution Count:14
14
1472 else if (event == QKeySequence::MoveToPreviousChar) {
evaluated: event == QKeySequence::MoveToPreviousChar
TRUEFALSE
yes
Evaluation Count:10
yes
Evaluation Count:994
10-994
1473 -
1474 -
1475 -
1476 const bool inlineCompletion = m_completer && m_completer->completionMode() == QCompleter::InlineCompletion;
partially evaluated: m_completer
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:10
never evaluated: m_completer->completionMode() == QCompleter::InlineCompletion
0-10
1477 -
1478 if (hasSelectedText()
evaluated: hasSelectedText()
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:9
1-9
1479 && (m_keyboardScheme != QPlatformTheme::WindowsKeyboardScheme
partially evaluated: m_keyboardScheme != QPlatformTheme::WindowsKeyboardScheme
TRUEFALSE
yes
Evaluation Count:1
no
Evaluation Count:0
0-1
1480 || inlineCompletion)) {
never evaluated: inlineCompletion
0
1481 moveCursor(selectionStart(), false); -
1482 } else {
executed: }
Execution Count:1
1
1483 cursorForward(0, visual ? -1 : (layoutDirection() == Qt::LeftToRight ? -1 : 1)); -
1484 }
executed: }
Execution Count:9
9
1485 } -
1486 else if (event == QKeySequence::SelectPreviousChar) {
evaluated: event == QKeySequence::SelectPreviousChar
TRUEFALSE
yes
Evaluation Count:15
yes
Evaluation Count:979
15-979
1487 cursorForward(1, visual ? -1 : (layoutDirection() == Qt::LeftToRight ? -1 : 1)); -
1488 }
executed: }
Execution Count:15
15
1489 else if (event == QKeySequence::MoveToNextWord) {
partially evaluated: event == QKeySequence::MoveToNextWord
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:979
0-979
1490 if (echoMode() == QLineEdit::Normal)
never evaluated: echoMode() == QLineEdit::Normal
0
1491 layoutDirection() == Qt::LeftToRight ? cursorWordForward(0) : cursorWordBackward(0);
never executed: layoutDirection() == Qt::LeftToRight ? cursorWordForward(0) : cursorWordBackward(0);
0
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) {
partially evaluated: event == QKeySequence::MoveToPreviousWord
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:979
0-979
1496 if (echoMode() == QLineEdit::Normal)
never evaluated: echoMode() == QLineEdit::Normal
0
1497 layoutDirection() == Qt::LeftToRight ? cursorWordBackward(0) : cursorWordForward(0);
never executed: layoutDirection() == Qt::LeftToRight ? cursorWordBackward(0) : cursorWordForward(0);
0
1498 else if (!isReadOnly()) {
never evaluated: !isReadOnly()
0
1499 layoutDirection() == Qt::LeftToRight ? home(0) : end(0); -
1500 }
never executed: }
0
1501 } -
1502 else if (event == QKeySequence::SelectNextWord) {
partially evaluated: event == QKeySequence::SelectNextWord
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:979
0-979
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
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:979
0-979
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
TRUEFALSE
yes
Evaluation Count:68
yes
Evaluation Count:911
68-911
1515 if (!isReadOnly())
partially evaluated: !isReadOnly()
TRUEFALSE
yes
Evaluation Count:68
no
Evaluation Count:0
0-68
1516 del();
executed: del();
Execution Count:68
68
1517 }
executed: }
Execution Count:68
68
1518 else if (event == QKeySequence::DeleteEndOfWord) {
partially evaluated: event == QKeySequence::DeleteEndOfWord
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:911
0-911
1519 if (!isReadOnly()) {
never evaluated: !isReadOnly()
0
1520 cursorWordForward(true); -
1521 del(); -
1522 }
never executed: }
0
1523 }
never executed: }
0
1524 else if (event == QKeySequence::DeleteStartOfWord) {
partially evaluated: event == QKeySequence::DeleteStartOfWord
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:911
0-911
1525 if (!isReadOnly()) {
never evaluated: !isReadOnly()
0
1526 cursorWordBackward(true); -
1527 del(); -
1528 }
never executed: }
0
1529 }
never executed: }
0
1530 -
1531 else { -
1532 bool handled = false; -
1533 if (m_keyboardScheme == QPlatformTheme::MacKeyboardScheme
partially evaluated: m_keyboardScheme == QPlatformTheme::MacKeyboardScheme
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:911
0-911
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 }
never executed: }
0
1543 } else {
never executed: }
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 }
never executed: }
0
1549 }
never executed: }
0
1550 handled = true; -
1551 }
never executed: }
0
1552 if (event->modifiers() & Qt::ControlModifier) {
evaluated: event->modifiers() & Qt::ControlModifier
TRUEFALSE
yes
Evaluation Count:5
yes
Evaluation Count:906
5-906
1553 switch (event->key()) { -
1554 case Qt::Key_Backspace: -
1555 if (!isReadOnly()) {
never evaluated: !isReadOnly()
0
1556 cursorWordBackward(true); -
1557 del(); -
1558 }
never executed: }
0
1559 break;
never executed: break;
0
1560 -
1561 case Qt::Key_Up: -
1562 case Qt::Key_Down: -
1563 complete(event->key()); -
1564 break;
never executed: break;
0
1565 -
1566 case Qt::Key_E: -
1567 if (m_keyboardScheme == QPlatformTheme::X11KeyboardScheme)
never evaluated: m_keyboardScheme == QPlatformTheme::X11KeyboardScheme
0
1568 end(0);
never executed: end(0);
0
1569 break;
never executed: 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 }
never executed: }
0
1579 break;
never executed: break;
0
1580 default: -
1581 if (!handled)
partially evaluated: !handled
TRUEFALSE
yes
Evaluation Count:5
no
Evaluation Count:0
0-5
1582 unknown = true;
executed: unknown = true;
Execution Count:5
5
1583 }
executed: }
Execution Count:5
5
1584 } else {
executed: }
Execution Count:5
5
1585 switch (event->key()) { -
1586 case Qt::Key_Backspace: -
1587 if (!isReadOnly()) {
partially evaluated: !isReadOnly()
TRUEFALSE
yes
Evaluation Count:45
no
Evaluation Count:0
0-45
1588 backspace(); -
1589 -
1590 complete(Qt::Key_Backspace); -
1591 -
1592 }
executed: }
Execution Count:45
45
1593 break;
executed: break;
Execution Count:45
45
1594 default: -
1595 if (!handled)
partially evaluated: !handled
TRUEFALSE
yes
Evaluation Count:861
no
Evaluation Count:0
0-861
1596 unknown = true;
executed: unknown = true;
Execution Count:861
861
1597 }
executed: }
Execution Count:861
861
1598 }
executed: }
Execution Count:906
906
1599 } -
1600 -
1601 if (event->key() == Qt::Key_Direction_L || event->key() == Qt::Key_Direction_R) {
partially evaluated: event->key() == Qt::Key_Direction_L
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1146
partially evaluated: event->key() == Qt::Key_Direction_R
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1146
0-1146
1602 setLayoutDirection((event->key() == Qt::Key_Direction_L) ? Qt::LeftToRight : Qt::RightToLeft); -
1603 unknown = false; -
1604 }
never executed: }
0
1605 -
1606 if (unknown && !isReadOnly()) {
evaluated: unknown
TRUEFALSE
yes
Evaluation Count:866
yes
Evaluation Count:280
partially evaluated: !isReadOnly()
TRUEFALSE
yes
Evaluation Count:866
no
Evaluation Count:0
0-866
1607 QString t = event->text(); -
1608 if (!t.isEmpty() && t.at(0).isPrint()) {
evaluated: !t.isEmpty()
TRUEFALSE
yes
Evaluation Count:818
yes
Evaluation Count:48
partially evaluated: t.at(0).isPrint()
TRUEFALSE
yes
Evaluation Count:818
no
Evaluation Count:0
0-818
1609 insert(t); -
1610 -
1611 complete(event->key()); -
1612 -
1613 event->accept(); -
1614 return;
executed: return;
Execution Count:817
817
1615 } -
1616 }
executed: }
Execution Count:48
48
1617 -
1618 if (unknown)
evaluated: unknown
TRUEFALSE
yes
Evaluation Count:48
yes
Evaluation Count:280
48-280
1619 event->ignore();
executed: event->ignore();
Execution Count:48
48
1620 else -
1621 event->accept();
executed: event->accept();
Execution Count:280
280
1622} -
1623 -
1624bool QWidgetLineControl::isUndoAvailable() const -
1625{ -
1626 -
1627 -
1628 return !m_readOnly && m_undoState 239
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:239
239
1630} -
1631 -
1632bool QWidgetLineControl::isRedoAvailable() const -
1633{ -
1634 -
1635 return !m_readOnly 5
1636 && m_echoMode == QLineEdit::Normal 5
1637 && m_undoState < m_history.size();
executed: return !m_readOnly && m_echoMode == QLineEdit::Normal && m_undoState < m_history.size();
Execution Count:5
5
1638} -
1639 -
1640 -
1641 -
Switch to Source codePreprocessed file

Generated by Squish Coco Non-Commercial