qwidgetlinecontrol.cpp

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

Generated by Squish Coco Non-Commercial 4.3.0-BETA-master-30-08-2018-4cb69e9