widgets/qwidgetlinecontrol.cpp

Source codeSwitch to Preprocessed file
LineSource CodeCoverage
1/**************************************************************************** -
2** -
3** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -
4** Contact: http://www.qt-project.org/legal -
5** -
6** This file is part of the QtGui module of the Qt Toolkit. -
7** -
8** $QT_BEGIN_LICENSE:LGPL$ -
9** Commercial License Usage -
10** Licensees holding valid commercial Qt licenses may use this file in -
11** accordance with the commercial license agreement provided with the -
12** Software or, alternatively, in accordance with the terms contained in -
13** a written agreement between you and Digia. For licensing terms and -
14** conditions see http://qt.digia.com/licensing. For further information -
15** use the contact form at http://qt.digia.com/contact-us. -
16** -
17** GNU Lesser General Public License Usage -
18** Alternatively, this file may be used under the terms of the GNU Lesser -
19** General Public License version 2.1 as published by the Free Software -
20** Foundation and appearing in the file LICENSE.LGPL included in the -
21** packaging of this file. Please review the following information to -
22** ensure the GNU Lesser General Public License version 2.1 requirements -
23** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -
24** -
25** In addition, as a special exception, Digia gives you certain additional -
26** rights. These rights are described in the Digia Qt LGPL Exception -
27** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -
28** -
29** GNU General Public License Usage -
30** Alternatively, this file may be used under the terms of the GNU -
31** General Public License version 3.0 as published by the Free Software -
32** Foundation and appearing in the file LICENSE.GPL included in the -
33** packaging of this file. Please review the following information to -
34** ensure the GNU General Public License version 3.0 requirements will be -
35** met: http://www.gnu.org/copyleft/gpl.html. -
36** -
37** -
38** $QT_END_LICENSE$ -
39** -
40****************************************************************************/ -
41 -
42#include "qwidgetlinecontrol_p.h" -
43 -
44#ifndef QT_NO_LINEEDIT -
45 -
46#include "qabstractitemview.h" -
47#include "qclipboard.h" -
48#include <private/qguiapplication_p.h> -
49#include <qpa/qplatformtheme.h> -
50#include <qstylehints.h> -
51#ifndef QT_NO_ACCESSIBILITY -
52#include "qaccessible.h" -
53#endif -
54 -
55#include "qapplication.h" -
56#ifndef QT_NO_GRAPHICSVIEW -
57#include "qgraphicssceneevent.h" -
58#endif -
59 -
60QT_BEGIN_NAMESPACE -
61 -
62 -
63/*! -
64 \internal -
65 -
66 Updates the internal text layout. Returns the ascent of the -
67 created QTextLine. -
68*/ -
69int QWidgetLineControl::redoTextLayout() const -
70{ -
71 m_textLayout.clearLayout();
executed (the execution status of this line is deduced): m_textLayout.clearLayout();
-
72 -
73 m_textLayout.beginLayout();
executed (the execution status of this line is deduced): m_textLayout.beginLayout();
-
74 QTextLine l = m_textLayout.createLine();
executed (the execution status of this line is deduced): QTextLine l = m_textLayout.createLine();
-
75 m_textLayout.endLayout();
executed (the execution status of this line is deduced): m_textLayout.endLayout();
-
76 -
77#if defined(Q_WS_MAC) -
78 if (m_threadChecks) -
79 m_textLayoutThread = QThread::currentThread(); -
80#endif -
81 -
82 return qRound(l.ascent());
executed: return qRound(l.ascent());
Execution Count:7594
7594
83} -
84 -
85/*! -
86 \internal -
87 -
88 Updates the display text based of the current edit text -
89 If the text has changed will emit displayTextChanged() -
90*/ -
91void QWidgetLineControl::updateDisplayText(bool forceUpdate) -
92{ -
93 QString orig = m_textLayout.text();
executed (the execution status of this line is deduced): QString orig = m_textLayout.text();
-
94 QString str;
executed (the execution status of this line is deduced): QString str;
-
95 if (m_echoMode == QLineEdit::NoEcho)
partially evaluated: m_echoMode == QLineEdit::NoEcho
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:7594
0-7594
96 str = QString::fromLatin1("");
never executed: str = QString::fromLatin1("");
0
97 else -
98 str = m_text;
executed: str = m_text;
Execution Count:7594
7594
99 -
100 if (m_echoMode == QLineEdit::Password) {
partially evaluated: m_echoMode == QLineEdit::Password
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:7594
0-7594
101 str.fill(m_passwordCharacter);
never executed (the execution status of this line is deduced): str.fill(m_passwordCharacter);
-
102 if (m_passwordEchoTimer != 0 && m_cursor > 0 && m_cursor <= m_text.length()) {
never evaluated: m_passwordEchoTimer != 0
never evaluated: m_cursor > 0
never evaluated: m_cursor <= m_text.length()
0
103 int cursor = m_cursor - 1;
never executed (the execution status of this line is deduced): int cursor = m_cursor - 1;
-
104 QChar uc = m_text.at(cursor);
never executed (the execution status of this line is deduced): QChar uc = m_text.at(cursor);
-
105 str[cursor] = uc;
never executed (the execution status of this line is deduced): str[cursor] = uc;
-
106 if (cursor > 0 && uc.isLowSurrogate()) {
never evaluated: cursor > 0
never evaluated: uc.isLowSurrogate()
0
107 // second half of a surrogate, check if we have the first half as well, -
108 // if yes restore both at once -
109 uc = m_text.at(cursor - 1);
never executed (the execution status of this line is deduced): uc = m_text.at(cursor - 1);
-
110 if (uc.isHighSurrogate())
never evaluated: uc.isHighSurrogate()
0
111 str[cursor - 1] = uc;
never executed: str[cursor - 1] = uc;
0
112 }
never executed: }
0
113 }
never executed: }
0
114 } else if (m_echoMode == QLineEdit::PasswordEchoOnEdit && !m_passwordEchoEditing) {
never executed: }
partially evaluated: m_echoMode == QLineEdit::PasswordEchoOnEdit
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:7594
never evaluated: !m_passwordEchoEditing
0-7594
115 str.fill(m_passwordCharacter);
never executed (the execution status of this line is deduced): str.fill(m_passwordCharacter);
-
116 }
never executed: }
0
117 -
118 // replace certain non-printable characters with spaces (to avoid -
119 // drawing boxes when using fonts that don't have glyphs for such -
120 // characters) -
121 QChar* uc = str.data();
executed (the execution status of this line is deduced): QChar* uc = str.data();
-
122 for (int i = 0; i < (int)str.length(); ++i) {
evaluated: i < (int)str.length()
TRUEFALSE
yes
Evaluation Count:44933
yes
Evaluation Count:7594
7594-44933
123 if ((uc[i] < 0x20 && uc[i] != 0x09)
partially evaluated: uc[i] < 0x20
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:44933
never evaluated: uc[i] != 0x09
0-44933
124 || uc[i] == QChar::LineSeparator
partially evaluated: uc[i] == QChar::LineSeparator
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:44933
0-44933
125 || uc[i] == QChar::ParagraphSeparator
partially evaluated: uc[i] == QChar::ParagraphSeparator
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:44933
0-44933
126 || uc[i] == QChar::ObjectReplacementCharacter)
partially evaluated: uc[i] == QChar::ObjectReplacementCharacter
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:44933
0-44933
127 uc[i] = QChar(0x0020);
never executed: uc[i] = QChar(0x0020);
0
128 }
executed: }
Execution Count:44933
44933
129 -
130 m_textLayout.setText(str);
executed (the execution status of this line is deduced): m_textLayout.setText(str);
-
131 -
132 QTextOption option = m_textLayout.textOption();
executed (the execution status of this line is deduced): QTextOption option = m_textLayout.textOption();
-
133 option.setTextDirection(m_layoutDirection);
executed (the execution status of this line is deduced): option.setTextDirection(m_layoutDirection);
-
134 option.setFlags(QTextOption::IncludeTrailingSpaces);
executed (the execution status of this line is deduced): option.setFlags(QTextOption::IncludeTrailingSpaces);
-
135 m_textLayout.setTextOption(option);
executed (the execution status of this line is deduced): m_textLayout.setTextOption(option);
-
136 -
137 m_ascent = redoTextLayout();
executed (the execution status of this line is deduced): m_ascent = redoTextLayout();
-
138 -
139 if (str != orig || forceUpdate)
evaluated: str != orig
TRUEFALSE
yes
Evaluation Count:4532
yes
Evaluation Count:3062
partially evaluated: forceUpdate
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:3062
0-4532
140 emit displayTextChanged(str);
executed: displayTextChanged(str);
Execution Count:4532
4532
141}
executed: }
Execution Count:7594
7594
142 -
143#ifndef QT_NO_CLIPBOARD -
144/*! -
145 \internal -
146 -
147 Copies the currently selected text into the clipboard using the given -
148 \a mode. -
149 -
150 \note If the echo mode is set to a mode other than Normal then copy -
151 will not work. This is to prevent using copy as a method of bypassing -
152 password features of the line control. -
153*/ -
154void QWidgetLineControl::copy(QClipboard::Mode mode) const -
155{ -
156 QString t = selectedText();
executed (the execution status of this line is deduced): QString t = selectedText();
-
157 if (!t.isEmpty() && m_echoMode == QLineEdit::Normal) {
partially evaluated: !t.isEmpty()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1
never evaluated: m_echoMode == QLineEdit::Normal
0-1
158 disconnect(QApplication::clipboard(), SIGNAL(selectionChanged()), this, 0);
never executed (the execution status of this line is deduced): disconnect(QApplication::clipboard(), "2""selectionChanged()", this, 0);
-
159 QApplication::clipboard()->setText(t, mode);
never executed (the execution status of this line is deduced): QApplication::clipboard()->setText(t, mode);
-
160 connect(QApplication::clipboard(), SIGNAL(selectionChanged()),
never executed (the execution status of this line is deduced): connect(QApplication::clipboard(), "2""selectionChanged()",
-
161 this, SLOT(_q_clipboardChanged()));
never executed (the execution status of this line is deduced): this, "1""_q_clipboardChanged()");
-
162 }
never executed: }
0
163}
executed: }
Execution Count:1
1
164 -
165/*! -
166 \internal -
167 -
168 Inserts the text stored in the application clipboard into the line -
169 control. -
170 -
171 \sa insert() -
172*/ -
173void QWidgetLineControl::paste(QClipboard::Mode clipboardMode) -
174{ -
175 QString clip = QApplication::clipboard()->text(clipboardMode);
never executed (the execution status of this line is deduced): QString clip = QApplication::clipboard()->text(clipboardMode);
-
176 if (!clip.isEmpty() || hasSelectedText()) {
never evaluated: !clip.isEmpty()
never evaluated: hasSelectedText()
0
177 separate(); //make it a separate undo/redo command
never executed (the execution status of this line is deduced): separate();
-
178 insert(clip);
never executed (the execution status of this line is deduced): insert(clip);
-
179 separate();
never executed (the execution status of this line is deduced): separate();
-
180 }
never executed: }
0
181}
never executed: }
0
182 -
183#endif // !QT_NO_CLIPBOARD -
184 -
185/*! -
186 \internal -
187*/ -
188void QWidgetLineControl::commitPreedit() -
189{ -
190 if (!composeMode())
partially evaluated: !composeMode()
TRUEFALSE
yes
Evaluation Count:6586
no
Evaluation Count:0
0-6586
191 return;
executed: return;
Execution Count:6586
6586
192 -
193 qApp->inputMethod()->commit();
never executed (the execution status of this line is deduced): (static_cast<QApplication *>(QCoreApplication::instance()))->inputMethod()->commit();
-
194 if (!composeMode())
never evaluated: !composeMode()
0
195 return;
never executed: return;
0
196 -
197 m_preeditCursor = 0;
never executed (the execution status of this line is deduced): m_preeditCursor = 0;
-
198 setPreeditArea(-1, QString());
never executed (the execution status of this line is deduced): setPreeditArea(-1, QString());
-
199 m_textLayout.clearAdditionalFormats();
never executed (the execution status of this line is deduced): m_textLayout.clearAdditionalFormats();
-
200 updateDisplayText(/*force*/ true);
never executed (the execution status of this line is deduced): updateDisplayText( true);
-
201}
never executed: }
0
202 -
203 -
204/*! -
205 \internal -
206 -
207 Handles the behavior for the backspace key or function. -
208 Removes the current selection if there is a selection, otherwise -
209 removes the character prior to the cursor position. -
210 -
211 \sa del() -
212*/ -
213void QWidgetLineControl::backspace() -
214{ -
215 int priorState = m_undoState;
executed (the execution status of this line is deduced): int priorState = m_undoState;
-
216 if (hasSelectedText()) {
evaluated: hasSelectedText()
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:43
2-43
217 removeSelectedText();
executed (the execution status of this line is deduced): removeSelectedText();
-
218 } else if (m_cursor) {
executed: }
Execution Count:2
evaluated: m_cursor
TRUEFALSE
yes
Evaluation Count:35
yes
Evaluation Count:8
2-35
219 --m_cursor;
executed (the execution status of this line is deduced): --m_cursor;
-
220 if (m_maskData)
partially evaluated: m_maskData
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:35
0-35
221 m_cursor = prevMaskBlank(m_cursor);
never executed: m_cursor = prevMaskBlank(m_cursor);
0
222 QChar uc = m_text.at(m_cursor);
executed (the execution status of this line is deduced): QChar uc = m_text.at(m_cursor);
-
223 if (m_cursor > 0 && uc.isLowSurrogate()) {
evaluated: m_cursor > 0
TRUEFALSE
yes
Evaluation Count:31
yes
Evaluation Count:4
partially evaluated: uc.isLowSurrogate()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:31
0-31
224 // second half of a surrogate, check if we have the first half as well, -
225 // if yes delete both at once -
226 uc = m_text.at(m_cursor - 1);
never executed (the execution status of this line is deduced): uc = m_text.at(m_cursor - 1);
-
227 if (uc.isHighSurrogate()) {
never evaluated: uc.isHighSurrogate()
0
228 internalDelete(true);
never executed (the execution status of this line is deduced): internalDelete(true);
-
229 --m_cursor;
never executed (the execution status of this line is deduced): --m_cursor;
-
230 }
never executed: }
0
231 }
never executed: }
0
232 internalDelete(true);
executed (the execution status of this line is deduced): internalDelete(true);
-
233 }
executed: }
Execution Count:35
35
234 finishChange(priorState);
executed (the execution status of this line is deduced): finishChange(priorState);
-
235}
executed: }
Execution Count:45
45
236 -
237/*! -
238 \internal -
239 -
240 Handles the behavior for the delete key or function. -
241 Removes the current selection if there is a selection, otherwise -
242 removes the character after the cursor position. -
243 -
244 \sa del() -
245*/ -
246void QWidgetLineControl::del() -
247{ -
248 int priorState = m_undoState;
executed (the execution status of this line is deduced): int priorState = m_undoState;
-
249 if (hasSelectedText()) {
evaluated: hasSelectedText()
TRUEFALSE
yes
Evaluation Count:22
yes
Evaluation Count:46
22-46
250 removeSelectedText();
executed (the execution status of this line is deduced): removeSelectedText();
-
251 } else {
executed: }
Execution Count:22
22
252 int n = textLayout()->nextCursorPosition(m_cursor) - m_cursor;
executed (the execution status of this line is deduced): int n = textLayout()->nextCursorPosition(m_cursor) - m_cursor;
-
253 while (n--)
evaluated: n--
TRUEFALSE
yes
Evaluation Count:42
yes
Evaluation Count:46
42-46
254 internalDelete();
executed: internalDelete();
Execution Count:42
42
255 }
executed: }
Execution Count:46
46
256 finishChange(priorState);
executed (the execution status of this line is deduced): finishChange(priorState);
-
257}
executed: }
Execution Count:68
68
258 -
259/*! -
260 \internal -
261 -
262 Inserts the given \a newText at the current cursor position. -
263 If there is any selected text it is removed prior to insertion of -
264 the new text. -
265*/ -
266void QWidgetLineControl::insert(const QString &newText) -
267{ -
268 int priorState = m_undoState;
executed (the execution status of this line is deduced): int priorState = m_undoState;
-
269 removeSelectedText();
executed (the execution status of this line is deduced): removeSelectedText();
-
270 internalInsert(newText);
executed (the execution status of this line is deduced): internalInsert(newText);
-
271 finishChange(priorState);
executed (the execution status of this line is deduced): finishChange(priorState);
-
272}
executed: }
Execution Count:852
852
273 -
274/*! -
275 \internal -
276 -
277 Clears the line control text. -
278*/ -
279void QWidgetLineControl::clear() -
280{ -
281 int priorState = m_undoState;
executed (the execution status of this line is deduced): int priorState = m_undoState;
-
282 m_selstart = 0;
executed (the execution status of this line is deduced): m_selstart = 0;
-
283 m_selend = m_text.length();
executed (the execution status of this line is deduced): m_selend = m_text.length();
-
284 removeSelectedText();
executed (the execution status of this line is deduced): removeSelectedText();
-
285 separate();
executed (the execution status of this line is deduced): separate();
-
286 finishChange(priorState, /*update*/false, /*edited*/false);
executed (the execution status of this line is deduced): finishChange(priorState, false, false);
-
287}
executed: }
Execution Count:3
3
288 -
289/*! -
290 \internal -
291 -
292 Sets \a length characters from the given \a start position as selected. -
293 The given \a start position must be within the current text for -
294 the line control. If \a length characters cannot be selected, then -
295 the selection will extend to the end of the current text. -
296*/ -
297void QWidgetLineControl::setSelection(int start, int length) -
298{ -
299 commitPreedit();
executed (the execution status of this line is deduced): commitPreedit();
-
300 -
301 if(start < 0 || start > (int)m_text.length()){
partially evaluated: start < 0
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:3931
partially evaluated: start > (int)m_text.length()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:3931
0-3931
302 qWarning("QWidgetLineControl::setSelection: Invalid start position");
never executed (the execution status of this line is deduced): QMessageLogger("widgets/qwidgetlinecontrol.cpp", 302, __PRETTY_FUNCTION__).warning("QWidgetLineControl::setSelection: Invalid start position");
-
303 return;
never executed: return;
0
304 } -
305 -
306 if (length > 0) {
evaluated: length > 0
TRUEFALSE
yes
Evaluation Count:2130
yes
Evaluation Count:1801
1801-2130
307 if (start == m_selstart && start + length == m_selend && m_cursor == m_selend)
evaluated: start == m_selstart
TRUEFALSE
yes
Evaluation Count:838
yes
Evaluation Count:1292
evaluated: start + length == m_selend
TRUEFALSE
yes
Evaluation Count:144
yes
Evaluation Count:694
evaluated: m_cursor == m_selend
TRUEFALSE
yes
Evaluation Count:73
yes
Evaluation Count:71
71-1292
308 return;
executed: return;
Execution Count:73
73
309 m_selstart = start;
executed (the execution status of this line is deduced): m_selstart = start;
-
310 m_selend = qMin(start + length, (int)m_text.length());
executed (the execution status of this line is deduced): m_selend = qMin(start + length, (int)m_text.length());
-
311 m_cursor = m_selend;
executed (the execution status of this line is deduced): m_cursor = m_selend;
-
312 } else if (length < 0){
executed: }
Execution Count:2057
evaluated: length < 0
TRUEFALSE
yes
Evaluation Count:1788
yes
Evaluation Count:13
13-2057
313 if (start == m_selend && start + length == m_selstart && m_cursor == m_selstart)
evaluated: start == m_selend
TRUEFALSE
yes
Evaluation Count:1472
yes
Evaluation Count:316
partially evaluated: start + length == m_selstart
TRUEFALSE
yes
Evaluation Count:1472
no
Evaluation Count:0
evaluated: m_cursor == m_selstart
TRUEFALSE
yes
Evaluation Count:88
yes
Evaluation Count:1384
0-1472
314 return;
executed: return;
Execution Count:88
88
315 m_selstart = qMax(start + length, 0);
executed (the execution status of this line is deduced): m_selstart = qMax(start + length, 0);
-
316 m_selend = start;
executed (the execution status of this line is deduced): m_selend = start;
-
317 m_cursor = m_selstart;
executed (the execution status of this line is deduced): m_cursor = m_selstart;
-
318 } else if (m_selstart != m_selend) {
executed: }
Execution Count:1700
evaluated: m_selstart != m_selend
TRUEFALSE
yes
Evaluation Count:4
yes
Evaluation Count:9
4-1700
319 m_selstart = 0;
executed (the execution status of this line is deduced): m_selstart = 0;
-
320 m_selend = 0;
executed (the execution status of this line is deduced): m_selend = 0;
-
321 m_cursor = start;
executed (the execution status of this line is deduced): m_cursor = start;
-
322 } else {
executed: }
Execution Count:4
4
323 m_cursor = start;
executed (the execution status of this line is deduced): m_cursor = start;
-
324 emitCursorPositionChanged();
executed (the execution status of this line is deduced): emitCursorPositionChanged();
-
325 return;
executed: return;
Execution Count:9
9
326 } -
327 emit selectionChanged();
executed (the execution status of this line is deduced): selectionChanged();
-
328 emitCursorPositionChanged();
executed (the execution status of this line is deduced): emitCursorPositionChanged();
-
329}
executed: }
Execution Count:3761
3761
330 -
331void QWidgetLineControl::_q_clipboardChanged() -
332{ -
333} -
334 -
335void QWidgetLineControl::_q_deleteSelected() -
336{ -
337 if (!hasSelectedText())
never evaluated: !hasSelectedText()
0
338 return;
never executed: return;
0
339 -
340 int priorState = m_undoState;
never executed (the execution status of this line is deduced): int priorState = m_undoState;
-
341 emit resetInputContext();
never executed (the execution status of this line is deduced): resetInputContext();
-
342 removeSelectedText();
never executed (the execution status of this line is deduced): removeSelectedText();
-
343 separate();
never executed (the execution status of this line is deduced): separate();
-
344 finishChange(priorState);
never executed (the execution status of this line is deduced): finishChange(priorState);
-
345}
never executed: }
0
346 -
347/*! -
348 \internal -
349 -
350 Initializes the line control with a starting text value of \a txt. -
351*/ -
352void QWidgetLineControl::init(const QString &txt) -
353{ -
354 m_textLayout.setCacheEnabled(true);
executed (the execution status of this line is deduced): m_textLayout.setCacheEnabled(true);
-
355 m_text = txt;
executed (the execution status of this line is deduced): m_text = txt;
-
356 updateDisplayText();
executed (the execution status of this line is deduced): updateDisplayText();
-
357 m_cursor = m_text.length();
executed (the execution status of this line is deduced): m_cursor = m_text.length();
-
358 if (const QPlatformTheme *theme = QGuiApplicationPrivate::platformTheme())
partially evaluated: const QPlatformTheme *theme = QGuiApplicationPrivate::platformTheme()
TRUEFALSE
yes
Evaluation Count:814
no
Evaluation Count:0
0-814
359 m_keyboardScheme = theme->themeHint(QPlatformTheme::KeyboardScheme).toInt();
executed: m_keyboardScheme = theme->themeHint(QPlatformTheme::KeyboardScheme).toInt();
Execution Count:814
814
360 // Generalize for X11 -
361 if (m_keyboardScheme == QPlatformTheme::KdeKeyboardScheme
partially evaluated: m_keyboardScheme == QPlatformTheme::KdeKeyboardScheme
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:814
0-814
362 || m_keyboardScheme == QPlatformTheme::GnomeKeyboardScheme
partially evaluated: m_keyboardScheme == QPlatformTheme::GnomeKeyboardScheme
TRUEFALSE
yes
Evaluation Count:814
no
Evaluation Count:0
0-814
363 || m_keyboardScheme == QPlatformTheme::CdeKeyboardScheme) {
never evaluated: m_keyboardScheme == QPlatformTheme::CdeKeyboardScheme
0
364 m_keyboardScheme = QPlatformTheme::X11KeyboardScheme;
executed (the execution status of this line is deduced): m_keyboardScheme = QPlatformTheme::X11KeyboardScheme;
-
365 }
executed: }
Execution Count:814
814
366}
executed: }
Execution Count:814
814
367 -
368/*! -
369 \internal -
370 -
371 Sets the password echo editing to \a editing. If password echo editing -
372 is true, then the text of the password is displayed even if the echo -
373 mode is set to QLineEdit::PasswordEchoOnEdit. Password echoing editing -
374 does not affect other echo modes. -
375*/ -
376void QWidgetLineControl::updatePasswordEchoEditing(bool editing) -
377{ -
378 cancelPasswordEchoTimer();
never executed (the execution status of this line is deduced): cancelPasswordEchoTimer();
-
379 m_passwordEchoEditing = editing;
never executed (the execution status of this line is deduced): m_passwordEchoEditing = editing;
-
380 updateDisplayText();
never executed (the execution status of this line is deduced): updateDisplayText();
-
381}
never executed: }
0
382 -
383/*! -
384 \internal -
385 -
386 Returns the cursor position of the given \a x pixel value in relation -
387 to the displayed text. The given \a betweenOrOn specified what kind -
388 of cursor position is requested. -
389*/ -
390int QWidgetLineControl::xToPos(int x, QTextLine::CursorPosition betweenOrOn) const -
391{ -
392 return textLayout()->lineAt(0).xToCursor(x, betweenOrOn);
executed: return textLayout()->lineAt(0).xToCursor(x, betweenOrOn);
Execution Count:2
2
393} -
394 -
395/*! -
396 \internal -
397 -
398 Returns the bounds of the current cursor, as defined as a -
399 between characters cursor. -
400*/ -
401QRect QWidgetLineControl::cursorRect() const -
402{ -
403 QTextLine l = textLayout()->lineAt(0);
executed (the execution status of this line is deduced): QTextLine l = textLayout()->lineAt(0);
-
404 int c = m_cursor;
executed (the execution status of this line is deduced): int c = m_cursor;
-
405 if (m_preeditCursor != -1)
partially evaluated: m_preeditCursor != -1
TRUEFALSE
yes
Evaluation Count:5917
no
Evaluation Count:0
0-5917
406 c += m_preeditCursor;
executed: c += m_preeditCursor;
Execution Count:5917
5917
407 int cix = qRound(l.cursorToX(c));
executed (the execution status of this line is deduced): int cix = qRound(l.cursorToX(c));
-
408 int w = m_cursorWidth;
executed (the execution status of this line is deduced): int w = m_cursorWidth;
-
409 int ch = l.height() + 1;
executed (the execution status of this line is deduced): int ch = l.height() + 1;
-
410 -
411 return QRect(cix-5, 0, w+9, ch);
executed: return QRect(cix-5, 0, w+9, ch);
Execution Count:5917
5917
412} -
413 -
414/*! -
415 \internal -
416 -
417 Fixes the current text so that it is valid given any set validators. -
418 -
419 Returns true if the text was changed. Otherwise returns false. -
420*/ -
421bool QWidgetLineControl::fixup() // this function assumes that validate currently returns != Acceptable -
422{ -
423#ifndef QT_NO_VALIDATOR -
424 if (m_validator) {
partially evaluated: m_validator
TRUEFALSE
yes
Evaluation Count:21
no
Evaluation Count:0
0-21
425 QString textCopy = m_text;
executed (the execution status of this line is deduced): QString textCopy = m_text;
-
426 int cursorCopy = m_cursor;
executed (the execution status of this line is deduced): int cursorCopy = m_cursor;
-
427 m_validator->fixup(textCopy);
executed (the execution status of this line is deduced): m_validator->fixup(textCopy);
-
428 if (m_validator->validate(textCopy, cursorCopy) == QValidator::Acceptable) {
partially evaluated: m_validator->validate(textCopy, cursorCopy) == QValidator::Acceptable
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:21
0-21
429 if (textCopy != m_text || cursorCopy != m_cursor)
never evaluated: textCopy != m_text
never evaluated: cursorCopy != m_cursor
0
430 internalSetText(textCopy, cursorCopy);
never executed: internalSetText(textCopy, cursorCopy);
0
431 return true;
never executed: return true;
0
432 } -
433 }
executed: }
Execution Count:21
21
434#endif -
435 return false;
executed: return false;
Execution Count:21
21
436} -
437 -
438/*! -
439 \internal -
440 -
441 Moves the cursor to the given position \a pos. If \a mark is true will -
442 adjust the currently selected text. -
443*/ -
444void QWidgetLineControl::moveCursor(int pos, bool mark) -
445{ -
446 commitPreedit();
executed (the execution status of this line is deduced): commitPreedit();
-
447 -
448 if (pos != m_cursor) {
evaluated: pos != m_cursor
TRUEFALSE
yes
Evaluation Count:1887
yes
Evaluation Count:768
768-1887
449 separate();
executed (the execution status of this line is deduced): separate();
-
450 if (m_maskData)
evaluated: m_maskData
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:1885
2-1885
451 pos = pos > m_cursor ? nextMaskBlank(pos) : prevMaskBlank(pos);
executed: pos = pos > m_cursor ? nextMaskBlank(pos) : prevMaskBlank(pos);
Execution Count:2
partially evaluated: pos > m_cursor
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:2
0-2
452 }
executed: }
Execution Count:1887
1887
453 if (mark) {
evaluated: mark
TRUEFALSE
yes
Evaluation Count:269
yes
Evaluation Count:2386
269-2386
454 int anchor;
executed (the execution status of this line is deduced): int anchor;
-
455 if (m_selend > m_selstart && m_cursor == m_selstart)
evaluated: m_selend > m_selstart
TRUEFALSE
yes
Evaluation Count:24
yes
Evaluation Count:245
evaluated: m_cursor == m_selstart
TRUEFALSE
yes
Evaluation Count:13
yes
Evaluation Count:11
11-245
456 anchor = m_selend;
executed: anchor = m_selend;
Execution Count:13
13
457 else if (m_selend > m_selstart && m_cursor == m_selend)
evaluated: m_selend > m_selstart
TRUEFALSE
yes
Evaluation Count:11
yes
Evaluation Count:245
partially evaluated: m_cursor == m_selend
TRUEFALSE
yes
Evaluation Count:11
no
Evaluation Count:0
0-245
458 anchor = m_selstart;
executed: anchor = m_selstart;
Execution Count:11
11
459 else -
460 anchor = m_cursor;
executed: anchor = m_cursor;
Execution Count:245
245
461 m_selstart = qMin(anchor, pos);
executed (the execution status of this line is deduced): m_selstart = qMin(anchor, pos);
-
462 m_selend = qMax(anchor, pos);
executed (the execution status of this line is deduced): m_selend = qMax(anchor, pos);
-
463 updateDisplayText();
executed (the execution status of this line is deduced): updateDisplayText();
-
464 } else {
executed: }
Execution Count:269
269
465 internalDeselect();
executed (the execution status of this line is deduced): internalDeselect();
-
466 }
executed: }
Execution Count:2386
2386
467 m_cursor = pos;
executed (the execution status of this line is deduced): m_cursor = pos;
-
468 if (mark || m_selDirty) {
evaluated: mark
TRUEFALSE
yes
Evaluation Count:269
yes
Evaluation Count:2386
evaluated: m_selDirty
TRUEFALSE
yes
Evaluation Count:61
yes
Evaluation Count:2325
61-2386
469 m_selDirty = false;
executed (the execution status of this line is deduced): m_selDirty = false;
-
470 emit selectionChanged();
executed (the execution status of this line is deduced): selectionChanged();
-
471 }
executed: }
Execution Count:330
330
472 emitCursorPositionChanged();
executed (the execution status of this line is deduced): emitCursorPositionChanged();
-
473}
executed: }
Execution Count:2655
2655
474 -
475/*! -
476 \internal -
477 -
478 Applies the given input method event \a event to the text of the line -
479 control -
480*/ -
481void QWidgetLineControl::processInputMethodEvent(QInputMethodEvent *event) -
482{ -
483 int priorState = -1;
never executed (the execution status of this line is deduced): int priorState = -1;
-
484 bool isGettingInput = !event->commitString().isEmpty()
never evaluated: !event->commitString().isEmpty()
0
485 || event->preeditString() != preeditAreaText()
never evaluated: event->preeditString() != preeditAreaText()
0
486 || event->replacementLength() > 0;
never evaluated: event->replacementLength() > 0
0
487 bool cursorPositionChanged = false;
never executed (the execution status of this line is deduced): bool cursorPositionChanged = false;
-
488 bool selectionChange = false;
never executed (the execution status of this line is deduced): bool selectionChange = false;
-
489 -
490 if (isGettingInput) {
never evaluated: isGettingInput
0
491 // If any text is being input, remove selected text. -
492 priorState = m_undoState;
never executed (the execution status of this line is deduced): priorState = m_undoState;
-
493 if (echoMode() == QLineEdit::PasswordEchoOnEdit && !passwordEchoEditing()) {
never evaluated: echoMode() == QLineEdit::PasswordEchoOnEdit
never evaluated: !passwordEchoEditing()
0
494 updatePasswordEchoEditing(true);
never executed (the execution status of this line is deduced): updatePasswordEchoEditing(true);
-
495 m_selstart = 0;
never executed (the execution status of this line is deduced): m_selstart = 0;
-
496 m_selend = m_text.length();
never executed (the execution status of this line is deduced): m_selend = m_text.length();
-
497 }
never executed: }
0
498 removeSelectedText();
never executed (the execution status of this line is deduced): removeSelectedText();
-
499 }
never executed: }
0
500 -
501 int c = m_cursor; // cursor position after insertion of commit string
never executed (the execution status of this line is deduced): int c = m_cursor;
-
502 if (event->replacementStart() <= 0)
never evaluated: event->replacementStart() <= 0
0
503 c += event->commitString().length() - qMin(-event->replacementStart(), event->replacementLength());
never executed: c += event->commitString().length() - qMin(-event->replacementStart(), event->replacementLength());
0
504 -
505 m_cursor += event->replacementStart();
never executed (the execution status of this line is deduced): m_cursor += event->replacementStart();
-
506 if (m_cursor < 0)
never evaluated: m_cursor < 0
0
507 m_cursor = 0;
never executed: m_cursor = 0;
0
508 -
509 // insert commit string -
510 if (event->replacementLength()) {
never evaluated: event->replacementLength()
0
511 m_selstart = m_cursor;
never executed (the execution status of this line is deduced): m_selstart = m_cursor;
-
512 m_selend = m_selstart + event->replacementLength();
never executed (the execution status of this line is deduced): m_selend = m_selstart + event->replacementLength();
-
513 removeSelectedText();
never executed (the execution status of this line is deduced): removeSelectedText();
-
514 }
never executed: }
0
515 if (!event->commitString().isEmpty()) {
never evaluated: !event->commitString().isEmpty()
0
516 internalInsert(event->commitString());
never executed (the execution status of this line is deduced): internalInsert(event->commitString());
-
517 cursorPositionChanged = true;
never executed (the execution status of this line is deduced): cursorPositionChanged = true;
-
518 }
never executed: }
0
519 -
520 m_cursor = qBound(0, c, m_text.length());
never executed (the execution status of this line is deduced): m_cursor = qBound(0, c, m_text.length());
-
521 -
522 for (int i = 0; i < event->attributes().size(); ++i) {
never evaluated: i < event->attributes().size()
0
523 const QInputMethodEvent::Attribute &a = event->attributes().at(i);
never executed (the execution status of this line is deduced): const QInputMethodEvent::Attribute &a = event->attributes().at(i);
-
524 if (a.type == QInputMethodEvent::Selection) {
never evaluated: a.type == QInputMethodEvent::Selection
0
525 m_cursor = qBound(0, a.start + a.length, m_text.length());
never executed (the execution status of this line is deduced): m_cursor = qBound(0, a.start + a.length, m_text.length());
-
526 if (a.length) {
never evaluated: a.length
0
527 m_selstart = qMax(0, qMin(a.start, m_text.length()));
never executed (the execution status of this line is deduced): m_selstart = qMax(0, qMin(a.start, m_text.length()));
-
528 m_selend = m_cursor;
never executed (the execution status of this line is deduced): m_selend = m_cursor;
-
529 if (m_selend < m_selstart) {
never evaluated: m_selend < m_selstart
0
530 qSwap(m_selstart, m_selend);
never executed (the execution status of this line is deduced): qSwap(m_selstart, m_selend);
-
531 }
never executed: }
0
532 selectionChange = true;
never executed (the execution status of this line is deduced): selectionChange = true;
-
533 } else {
never executed: }
0
534 if (m_selstart != m_selend)
never evaluated: m_selstart != m_selend
0
535 selectionChange = true;
never executed: selectionChange = true;
0
536 m_selstart = m_selend = 0;
never executed (the execution status of this line is deduced): m_selstart = m_selend = 0;
-
537 }
never executed: }
0
538 cursorPositionChanged = true;
never executed (the execution status of this line is deduced): cursorPositionChanged = true;
-
539 }
never executed: }
0
540 }
never executed: }
0
541#ifndef QT_NO_IM -
542 setPreeditArea(m_cursor, event->preeditString());
never executed (the execution status of this line is deduced): setPreeditArea(m_cursor, event->preeditString());
-
543#endif //QT_NO_IM -
544 const int oldPreeditCursor = m_preeditCursor;
never executed (the execution status of this line is deduced): const int oldPreeditCursor = m_preeditCursor;
-
545 m_preeditCursor = event->preeditString().length();
never executed (the execution status of this line is deduced): m_preeditCursor = event->preeditString().length();
-
546 m_hideCursor = false;
never executed (the execution status of this line is deduced): m_hideCursor = false;
-
547 QList<QTextLayout::FormatRange> formats;
never executed (the execution status of this line is deduced): QList<QTextLayout::FormatRange> formats;
-
548 for (int i = 0; i < event->attributes().size(); ++i) {
never evaluated: i < event->attributes().size()
0
549 const QInputMethodEvent::Attribute &a = event->attributes().at(i);
never executed (the execution status of this line is deduced): const QInputMethodEvent::Attribute &a = event->attributes().at(i);
-
550 if (a.type == QInputMethodEvent::Cursor) {
never evaluated: a.type == QInputMethodEvent::Cursor
0
551 m_preeditCursor = a.start;
never executed (the execution status of this line is deduced): m_preeditCursor = a.start;
-
552 m_hideCursor = !a.length;
never executed (the execution status of this line is deduced): m_hideCursor = !a.length;
-
553 } else if (a.type == QInputMethodEvent::TextFormat) {
never executed: }
never evaluated: a.type == QInputMethodEvent::TextFormat
0
554 QTextCharFormat f = qvariant_cast<QTextFormat>(a.value).toCharFormat();
never executed (the execution status of this line is deduced): QTextCharFormat f = qvariant_cast<QTextFormat>(a.value).toCharFormat();
-
555 if (f.isValid()) {
never evaluated: f.isValid()
0
556 QTextLayout::FormatRange o;
never executed (the execution status of this line is deduced): QTextLayout::FormatRange o;
-
557 o.start = a.start + m_cursor;
never executed (the execution status of this line is deduced): o.start = a.start + m_cursor;
-
558 o.length = a.length;
never executed (the execution status of this line is deduced): o.length = a.length;
-
559 o.format = f;
never executed (the execution status of this line is deduced): o.format = f;
-
560 formats.append(o);
never executed (the execution status of this line is deduced): formats.append(o);
-
561 }
never executed: }
0
562 }
never executed: }
0
563 } -
564 m_textLayout.setAdditionalFormats(formats);
never executed (the execution status of this line is deduced): m_textLayout.setAdditionalFormats(formats);
-
565 updateDisplayText(/*force*/ true);
never executed (the execution status of this line is deduced): updateDisplayText( true);
-
566 if (cursorPositionChanged)
never evaluated: cursorPositionChanged
0
567 emitCursorPositionChanged();
never executed: emitCursorPositionChanged();
0
568 else if (m_preeditCursor != oldPreeditCursor)
never evaluated: m_preeditCursor != oldPreeditCursor
0
569 emit updateMicroFocus();
never executed: updateMicroFocus();
0
570 -
571 if (isGettingInput)
never evaluated: isGettingInput
0
572 finishChange(priorState);
never executed: finishChange(priorState);
0
573 -
574 if (selectionChange)
never evaluated: selectionChange
0
575 emit selectionChanged();
never executed: selectionChanged();
0
576}
never executed: }
0
577 -
578/*! -
579 \internal -
580 -
581 Draws the display text for the line control using the given -
582 \a painter, \a clip, and \a offset. Which aspects of the display text -
583 are drawn is specified by the given \a flags. -
584 -
585 If the flags contain DrawSelections, then the selection or input mask -
586 backgrounds and foregrounds will be applied before drawing the text. -
587 -
588 If the flags contain DrawCursor a cursor of the current cursorWidth() -
589 will be drawn after drawing the text. -
590 -
591 The display text will only be drawn if the flags contain DrawText -
592*/ -
593void QWidgetLineControl::draw(QPainter *painter, const QPoint &offset, const QRect &clip, int flags) -
594{ -
595 QVector<QTextLayout::FormatRange> selections;
executed (the execution status of this line is deduced): QVector<QTextLayout::FormatRange> selections;
-
596 if (flags & DrawSelections) {
evaluated: flags & DrawSelections
TRUEFALSE
yes
Evaluation Count:37
yes
Evaluation Count:329
37-329
597 QTextLayout::FormatRange o;
executed (the execution status of this line is deduced): QTextLayout::FormatRange o;
-
598 if (m_selstart < m_selend) {
partially evaluated: m_selstart < m_selend
TRUEFALSE
yes
Evaluation Count:37
no
Evaluation Count:0
0-37
599 o.start = m_selstart;
executed (the execution status of this line is deduced): o.start = m_selstart;
-
600 o.length = m_selend - m_selstart;
executed (the execution status of this line is deduced): o.length = m_selend - m_selstart;
-
601 o.format.setBackground(m_palette.brush(QPalette::Highlight));
executed (the execution status of this line is deduced): o.format.setBackground(m_palette.brush(QPalette::Highlight));
-
602 o.format.setForeground(m_palette.brush(QPalette::HighlightedText));
executed (the execution status of this line is deduced): o.format.setForeground(m_palette.brush(QPalette::HighlightedText));
-
603 } else {
executed: }
Execution Count:37
37
604 // mask selection -
605 if(!m_blinkPeriod || m_blinkStatus){
never evaluated: !m_blinkPeriod
never evaluated: m_blinkStatus
0
606 o.start = m_cursor;
never executed (the execution status of this line is deduced): o.start = m_cursor;
-
607 o.length = 1;
never executed (the execution status of this line is deduced): o.length = 1;
-
608 o.format.setBackground(m_palette.brush(QPalette::Text));
never executed (the execution status of this line is deduced): o.format.setBackground(m_palette.brush(QPalette::Text));
-
609 o.format.setForeground(m_palette.brush(QPalette::Window));
never executed (the execution status of this line is deduced): o.format.setForeground(m_palette.brush(QPalette::Window));
-
610 }
never executed: }
0
611 }
never executed: }
0
612 selections.append(o);
executed (the execution status of this line is deduced): selections.append(o);
-
613 }
executed: }
Execution Count:37
37
614 -
615 if (flags & DrawText)
partially evaluated: flags & DrawText
TRUEFALSE
yes
Evaluation Count:366
no
Evaluation Count:0
0-366
616 textLayout()->draw(painter, offset, selections, clip);
executed: textLayout()->draw(painter, offset, selections, clip);
Execution Count:366
366
617 -
618 if (flags & DrawCursor){
evaluated: flags & DrawCursor
TRUEFALSE
yes
Evaluation Count:184
yes
Evaluation Count:182
182-184
619 int cursor = m_cursor;
executed (the execution status of this line is deduced): int cursor = m_cursor;
-
620 if (m_preeditCursor != -1)
partially evaluated: m_preeditCursor != -1
TRUEFALSE
yes
Evaluation Count:184
no
Evaluation Count:0
0-184
621 cursor += m_preeditCursor;
executed: cursor += m_preeditCursor;
Execution Count:184
184
622 if (!m_hideCursor && (!m_blinkPeriod || m_blinkStatus))
partially evaluated: !m_hideCursor
TRUEFALSE
yes
Evaluation Count:184
no
Evaluation Count:0
evaluated: !m_blinkPeriod
TRUEFALSE
yes
Evaluation Count:8
yes
Evaluation Count:176
evaluated: m_blinkStatus
TRUEFALSE
yes
Evaluation Count:162
yes
Evaluation Count:14
0-184
623 textLayout()->drawCursor(painter, offset, cursor, m_cursorWidth);
executed: textLayout()->drawCursor(painter, offset, cursor, m_cursorWidth);
Execution Count:170
170
624 }
executed: }
Execution Count:184
184
625}
executed: }
Execution Count:366
366
626 -
627/*! -
628 \internal -
629 -
630 Sets the selection to cover the word at the given cursor position. -
631 The word boundaries are defined by the behavior of QTextLayout::SkipWords -
632 cursor mode. -
633*/ -
634void QWidgetLineControl::selectWordAtPos(int cursor) -
635{ -
636 int next = cursor + 1;
executed (the execution status of this line is deduced): int next = cursor + 1;
-
637 if(next > end())
partially evaluated: next > end()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1
0-1
638 --next;
never executed: --next;
0
639 int c = textLayout()->previousCursorPosition(next, QTextLayout::SkipWords);
executed (the execution status of this line is deduced): int c = textLayout()->previousCursorPosition(next, QTextLayout::SkipWords);
-
640 moveCursor(c, false);
executed (the execution status of this line is deduced): moveCursor(c, false);
-
641 // ## text layout should support end of words. -
642 int end = textLayout()->nextCursorPosition(c, QTextLayout::SkipWords);
executed (the execution status of this line is deduced): int end = textLayout()->nextCursorPosition(c, QTextLayout::SkipWords);
-
643 while (end > cursor && m_text[end-1].isSpace())
partially evaluated: end > cursor
TRUEFALSE
yes
Evaluation Count:1
no
Evaluation Count:0
partially evaluated: m_text[end-1].isSpace()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1
0-1
644 --end;
never executed: --end;
0
645 moveCursor(end, true);
executed (the execution status of this line is deduced): moveCursor(end, true);
-
646}
executed: }
Execution Count:1
1
647 -
648/*! -
649 \internal -
650 -
651 Completes a change to the line control text. If the change is not valid -
652 will undo the line control state back to the given \a validateFromState. -
653 -
654 If \a edited is true and the change is valid, will emit textEdited() in -
655 addition to textChanged(). Otherwise only emits textChanged() on a valid -
656 change. -
657 -
658 The \a update value is currently unused. -
659*/ -
660bool QWidgetLineControl::finishChange(int validateFromState, bool update, bool edited) -
661{ -
662 Q_UNUSED(update)
executed (the execution status of this line is deduced): (void)update;
-
663 -
664 if (m_textDirty) {
evaluated: m_textDirty
TRUEFALSE
yes
Evaluation Count:4786
yes
Evaluation Count:984
984-4786
665 // do validation -
666 bool wasValidInput = m_validInput;
executed (the execution status of this line is deduced): bool wasValidInput = m_validInput;
-
667 m_validInput = true;
executed (the execution status of this line is deduced): m_validInput = true;
-
668#ifndef QT_NO_VALIDATOR -
669 if (m_validator) {
evaluated: m_validator
TRUEFALSE
yes
Evaluation Count:4154
yes
Evaluation Count:632
632-4154
670 QString textCopy = m_text;
executed (the execution status of this line is deduced): QString textCopy = m_text;
-
671 int cursorCopy = m_cursor;
executed (the execution status of this line is deduced): int cursorCopy = m_cursor;
-
672 m_validInput = (m_validator->validate(textCopy, cursorCopy) != QValidator::Invalid);
executed (the execution status of this line is deduced): m_validInput = (m_validator->validate(textCopy, cursorCopy) != QValidator::Invalid);
-
673 if (m_validInput) {
evaluated: m_validInput
TRUEFALSE
yes
Evaluation Count:3921
yes
Evaluation Count:233
233-3921
674 if (m_text != textCopy) {
evaluated: m_text != textCopy
TRUEFALSE
yes
Evaluation Count:16
yes
Evaluation Count:3905
16-3905
675 internalSetText(textCopy, cursorCopy);
executed (the execution status of this line is deduced): internalSetText(textCopy, cursorCopy);
-
676 return true;
executed: return true;
Execution Count:16
16
677 } -
678 m_cursor = cursorCopy;
executed (the execution status of this line is deduced): m_cursor = cursorCopy;
-
679 }
executed: }
Execution Count:3905
3905
680 }
executed: }
Execution Count:4138
4138
681#endif -
682 if (validateFromState >= 0 && wasValidInput && !m_validInput) {
evaluated: validateFromState >= 0
TRUEFALSE
yes
Evaluation Count:940
yes
Evaluation Count:3830
partially evaluated: wasValidInput
TRUEFALSE
yes
Evaluation Count:940
no
Evaluation Count:0
evaluated: !m_validInput
TRUEFALSE
yes
Evaluation Count:231
yes
Evaluation Count:709
0-3830
683 if (m_transactions.count())
partially evaluated: m_transactions.count()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:231
0-231
684 return false;
never executed: return false;
0
685 internalUndo(validateFromState);
executed (the execution status of this line is deduced): internalUndo(validateFromState);
-
686 m_history.resize(m_undoState);
executed (the execution status of this line is deduced): m_history.resize(m_undoState);
-
687 if (m_modifiedState > m_undoState)
partially evaluated: m_modifiedState > m_undoState
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:231
0-231
688 m_modifiedState = -1;
never executed: m_modifiedState = -1;
0
689 m_validInput = true;
executed (the execution status of this line is deduced): m_validInput = true;
-
690 m_textDirty = false;
executed (the execution status of this line is deduced): m_textDirty = false;
-
691 }
executed: }
Execution Count:231
231
692 updateDisplayText();
executed (the execution status of this line is deduced): updateDisplayText();
-
693 -
694 if (m_textDirty) {
evaluated: m_textDirty
TRUEFALSE
yes
Evaluation Count:4539
yes
Evaluation Count:231
231-4539
695 m_textDirty = false;
executed (the execution status of this line is deduced): m_textDirty = false;
-
696 QString actualText = text();
executed (the execution status of this line is deduced): QString actualText = text();
-
697 if (edited)
evaluated: edited
TRUEFALSE
yes
Evaluation Count:727
yes
Evaluation Count:3812
727-3812
698 emit textEdited(actualText);
executed: textEdited(actualText);
Execution Count:727
727
699 emit textChanged(actualText);
executed (the execution status of this line is deduced): textChanged(actualText);
-
700 }
executed: }
Execution Count:4538
4538
701 }
executed: }
Execution Count:4769
4769
702 if (m_selDirty) {
evaluated: m_selDirty
TRUEFALSE
yes
Evaluation Count:2338
yes
Evaluation Count:3415
2338-3415
703 m_selDirty = false;
executed (the execution status of this line is deduced): m_selDirty = false;
-
704 emit selectionChanged();
executed (the execution status of this line is deduced): selectionChanged();
-
705 }
executed: }
Execution Count:2338
2338
706 if (m_cursor == m_lastCursorPos)
evaluated: m_cursor == m_lastCursorPos
TRUEFALSE
yes
Evaluation Count:1231
yes
Evaluation Count:4522
1231-4522
707 updateMicroFocus();
executed: updateMicroFocus();
Execution Count:1231
1231
708 emitCursorPositionChanged();
executed (the execution status of this line is deduced): emitCursorPositionChanged();
-
709 return true;
executed: return true;
Execution Count:5753
5753
710} -
711 -
712/*! -
713 \internal -
714 -
715 An internal function for setting the text of the line control. -
716*/ -
717void QWidgetLineControl::internalSetText(const QString &txt, int pos, bool edited) -
718{ -
719 cancelPasswordEchoTimer();
executed (the execution status of this line is deduced): cancelPasswordEchoTimer();
-
720 internalDeselect();
executed (the execution status of this line is deduced): internalDeselect();
-
721 emit resetInputContext();
executed (the execution status of this line is deduced): resetInputContext();
-
722 QString oldText = m_text;
executed (the execution status of this line is deduced): QString oldText = m_text;
-
723 if (m_maskData) {
evaluated: m_maskData
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:4620
2-4620
724 m_text = maskString(0, txt, true);
executed (the execution status of this line is deduced): m_text = maskString(0, txt, true);
-
725 m_text += clearString(m_text.length(), m_maxLength - m_text.length());
executed (the execution status of this line is deduced): m_text += clearString(m_text.length(), m_maxLength - m_text.length());
-
726 } else {
executed: }
Execution Count:2
2
727 m_text = txt.isEmpty() ? txt : txt.left(m_maxLength);
evaluated: txt.isEmpty()
TRUEFALSE
yes
Evaluation Count:172
yes
Evaluation Count:4448
172-4448
728 }
executed: }
Execution Count:4620
4620
729 m_history.clear();
executed (the execution status of this line is deduced): m_history.clear();
-
730 m_modifiedState = m_undoState = 0;
executed (the execution status of this line is deduced): m_modifiedState = m_undoState = 0;
-
731 m_cursor = (pos < 0 || pos > m_text.length()) ? m_text.length() : pos;
evaluated: pos < 0
TRUEFALSE
yes
Evaluation Count:4606
yes
Evaluation Count:16
partially evaluated: pos > m_text.length()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:16
0-4606
732 m_textDirty = (oldText != m_text);
executed (the execution status of this line is deduced): m_textDirty = (oldText != m_text);
-
733 const bool changed = finishChange(-1, true, edited);
executed (the execution status of this line is deduced): const bool changed = finishChange(-1, true, edited);
-
734 -
735#ifndef QT_NO_ACCESSIBILITY -
736 if (changed) {
partially evaluated: changed
TRUEFALSE
yes
Evaluation Count:4622
no
Evaluation Count:0
0-4622
737 if (oldText.isEmpty()) {
evaluated: oldText.isEmpty()
TRUEFALSE
yes
Evaluation Count:759
yes
Evaluation Count:3863
759-3863
738 QAccessibleTextInsertEvent event(parent(), 0, txt);
executed (the execution status of this line is deduced): QAccessibleTextInsertEvent event(parent(), 0, txt);
-
739 event.setCursorPosition(m_cursor);
executed (the execution status of this line is deduced): event.setCursorPosition(m_cursor);
-
740 QAccessible::updateAccessibility(&event);
executed (the execution status of this line is deduced): QAccessible::updateAccessibility(&event);
-
741 } else if (txt.isEmpty()) {
executed: }
Execution Count:759
evaluated: txt.isEmpty()
TRUEFALSE
yes
Evaluation Count:4
yes
Evaluation Count:3859
4-3859
742 QAccessibleTextRemoveEvent event(parent(), 0, oldText);
executed (the execution status of this line is deduced): QAccessibleTextRemoveEvent event(parent(), 0, oldText);
-
743 event.setCursorPosition(m_cursor);
executed (the execution status of this line is deduced): event.setCursorPosition(m_cursor);
-
744 QAccessible::updateAccessibility(&event);
executed (the execution status of this line is deduced): QAccessible::updateAccessibility(&event);
-
745 } else {
executed: }
Execution Count:4
4
746 QAccessibleTextUpdateEvent event(parent(), 0, oldText, txt);
executed (the execution status of this line is deduced): QAccessibleTextUpdateEvent event(parent(), 0, oldText, txt);
-
747 event.setCursorPosition(m_cursor);
executed (the execution status of this line is deduced): event.setCursorPosition(m_cursor);
-
748 QAccessible::updateAccessibility(&event);
executed (the execution status of this line is deduced): QAccessible::updateAccessibility(&event);
-
749 }
executed: }
Execution Count:3859
3859
750 } -
751#else -
752 Q_UNUSED(changed) -
753#endif -
754}
executed: }
Execution Count:4622
4622
755 -
756 -
757/*! -
758 \internal -
759 -
760 Adds the given \a command to the undo history -
761 of the line control. Does not apply the command. -
762*/ -
763void QWidgetLineControl::addCommand(const Command &cmd) -
764{ -
765 if (m_separator && m_undoState && m_history[m_undoState - 1].type != Separator) {
evaluated: m_separator
TRUEFALSE
yes
Evaluation Count:441
yes
Evaluation Count:1981
evaluated: m_undoState
TRUEFALSE
yes
Evaluation Count:263
yes
Evaluation Count:178
partially evaluated: m_history[m_undoState - 1].type != Separator
TRUEFALSE
yes
Evaluation Count:263
no
Evaluation Count:0
0-1981
766 m_history.resize(m_undoState + 2);
executed (the execution status of this line is deduced): m_history.resize(m_undoState + 2);
-
767 m_history[m_undoState++] = Command(Separator, m_cursor, 0, m_selstart, m_selend);
executed (the execution status of this line is deduced): m_history[m_undoState++] = Command(Separator, m_cursor, 0, m_selstart, m_selend);
-
768 } else {
executed: }
Execution Count:263
263
769 m_history.resize(m_undoState + 1);
executed (the execution status of this line is deduced): m_history.resize(m_undoState + 1);
-
770 }
executed: }
Execution Count:2159
2159
771 m_separator = false;
executed (the execution status of this line is deduced): m_separator = false;
-
772 m_history[m_undoState++] = cmd;
executed (the execution status of this line is deduced): m_history[m_undoState++] = cmd;
-
773}
executed: }
Execution Count:2422
2422
774 -
775/*! -
776 \internal -
777 -
778 Inserts the given string \a s into the line -
779 control. -
780 -
781 Also adds the appropriate commands into the undo history. -
782 This function does not call finishChange(), and may leave the text -
783 in an invalid state. -
784*/ -
785void QWidgetLineControl::internalInsert(const QString &s) -
786{ -
787 if (m_echoMode == QLineEdit::Password) {
partially evaluated: m_echoMode == QLineEdit::Password
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:853
0-853
788 if (m_passwordEchoTimer != 0)
never evaluated: m_passwordEchoTimer != 0
0
789 killTimer(m_passwordEchoTimer);
never executed: killTimer(m_passwordEchoTimer);
0
790 int delay = qGuiApp->styleHints()->passwordMaskDelay();
never executed (the execution status of this line is deduced): int delay = (static_cast<QGuiApplication *>(QCoreApplication::instance()))->styleHints()->passwordMaskDelay();
-
791#ifdef QT_BUILD_INTERNAL -
792 if (m_passwordMaskDelayOverride >= 0) -
793 delay = m_passwordMaskDelayOverride; -
794#endif -
795 -
796 if (delay > 0)
never evaluated: delay > 0
0
797 m_passwordEchoTimer = startTimer(delay);
never executed: m_passwordEchoTimer = startTimer(delay);
0
798 }
never executed: }
0
799 if (hasSelectedText())
partially evaluated: hasSelectedText()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:853
0-853
800 addCommand(Command(SetSelection, m_cursor, 0, m_selstart, m_selend));
never executed: addCommand(Command(SetSelection, m_cursor, 0, m_selstart, m_selend));
0
801 if (m_maskData) {
partially evaluated: m_maskData
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:853
0-853
802 QString ms = maskString(m_cursor, s);
never executed (the execution status of this line is deduced): QString ms = maskString(m_cursor, s);
-
803#ifndef QT_NO_ACCESSIBILITY -
804 QAccessibleTextInsertEvent insertEvent(parent(), m_cursor, ms);
never executed (the execution status of this line is deduced): QAccessibleTextInsertEvent insertEvent(parent(), m_cursor, ms);
-
805 QAccessible::updateAccessibility(&insertEvent);
never executed (the execution status of this line is deduced): QAccessible::updateAccessibility(&insertEvent);
-
806#endif -
807 for (int i = 0; i < (int) ms.length(); ++i) {
never evaluated: i < (int) ms.length()
0
808 addCommand (Command(DeleteSelection, m_cursor + i, m_text.at(m_cursor + i), -1, -1));
never executed (the execution status of this line is deduced): addCommand (Command(DeleteSelection, m_cursor + i, m_text.at(m_cursor + i), -1, -1));
-
809 addCommand(Command(Insert, m_cursor + i, ms.at(i), -1, -1));
never executed (the execution status of this line is deduced): addCommand(Command(Insert, m_cursor + i, ms.at(i), -1, -1));
-
810 }
never executed: }
0
811 m_text.replace(m_cursor, ms.length(), ms);
never executed (the execution status of this line is deduced): m_text.replace(m_cursor, ms.length(), ms);
-
812 m_cursor += ms.length();
never executed (the execution status of this line is deduced): m_cursor += ms.length();
-
813 m_cursor = nextMaskBlank(m_cursor);
never executed (the execution status of this line is deduced): m_cursor = nextMaskBlank(m_cursor);
-
814 m_textDirty = true;
never executed (the execution status of this line is deduced): m_textDirty = true;
-
815#ifndef QT_NO_ACCESSIBILITY -
816 QAccessibleTextCursorEvent event(parent(), m_cursor);
never executed (the execution status of this line is deduced): QAccessibleTextCursorEvent event(parent(), m_cursor);
-
817 QAccessible::updateAccessibility(&event);
never executed (the execution status of this line is deduced): QAccessible::updateAccessibility(&event);
-
818#endif -
819 } else {
never executed: }
0
820 int remaining = m_maxLength - m_text.length();
executed (the execution status of this line is deduced): int remaining = m_maxLength - m_text.length();
-
821 if (remaining != 0) {
partially evaluated: remaining != 0
TRUEFALSE
yes
Evaluation Count:853
no
Evaluation Count:0
0-853
822#ifndef QT_NO_ACCESSIBILITY -
823 QAccessibleTextInsertEvent insertEvent(parent(), m_cursor, s);
executed (the execution status of this line is deduced): QAccessibleTextInsertEvent insertEvent(parent(), m_cursor, s);
-
824 QAccessible::updateAccessibility(&insertEvent);
executed (the execution status of this line is deduced): QAccessible::updateAccessibility(&insertEvent);
-
825#endif -
826 m_text.insert(m_cursor, s.left(remaining));
executed (the execution status of this line is deduced): m_text.insert(m_cursor, s.left(remaining));
-
827 for (int i = 0; i < (int) s.left(remaining).length(); ++i)
evaluated: i < (int) s.left(remaining).length()
TRUEFALSE
yes
Evaluation Count:923
yes
Evaluation Count:853
853-923
828 addCommand(Command(Insert, m_cursor++, s.at(i), -1, -1));
executed: addCommand(Command(Insert, m_cursor++, s.at(i), -1, -1));
Execution Count:923
923
829 m_textDirty = true;
executed (the execution status of this line is deduced): m_textDirty = true;
-
830 }
executed: }
Execution Count:853
853
831 }
executed: }
Execution Count:853
853
832} -
833 -
834/*! -
835 \internal -
836 -
837 deletes a single character from the current text. If \a wasBackspace, -
838 the character prior to the cursor is removed. Otherwise the character -
839 after the cursor is removed. -
840 -
841 Also adds the appropriate commands into the undo history. -
842 This function does not call finishChange(), and may leave the text -
843 in an invalid state. -
844*/ -
845void QWidgetLineControl::internalDelete(bool wasBackspace) -
846{ -
847 if (m_cursor < (int) m_text.length()) {
partially evaluated: m_cursor < (int) m_text.length()
TRUEFALSE
yes
Evaluation Count:77
no
Evaluation Count:0
0-77
848 cancelPasswordEchoTimer();
executed (the execution status of this line is deduced): cancelPasswordEchoTimer();
-
849 if (hasSelectedText())
partially evaluated: hasSelectedText()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:77
0-77
850 addCommand(Command(SetSelection, m_cursor, 0, m_selstart, m_selend));
never executed: addCommand(Command(SetSelection, m_cursor, 0, m_selstart, m_selend));
0
851 addCommand(Command((CommandType)((m_maskData ? 2 : 0) + (wasBackspace ? Remove : Delete)),
executed (the execution status of this line is deduced): addCommand(Command((CommandType)((m_maskData ? 2 : 0) + (wasBackspace ? Remove : Delete)),
-
852 m_cursor, m_text.at(m_cursor), -1, -1));
executed (the execution status of this line is deduced): m_cursor, m_text.at(m_cursor), -1, -1));
-
853#ifndef QT_NO_ACCESSIBILITY -
854 QAccessibleTextRemoveEvent event(parent(), m_cursor, m_text.at(m_cursor));
executed (the execution status of this line is deduced): QAccessibleTextRemoveEvent event(parent(), m_cursor, m_text.at(m_cursor));
-
855 QAccessible::updateAccessibility(&event);
executed (the execution status of this line is deduced): QAccessible::updateAccessibility(&event);
-
856#endif -
857 if (m_maskData) {
partially evaluated: m_maskData
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:77
0-77
858 m_text.replace(m_cursor, 1, clearString(m_cursor, 1));
never executed (the execution status of this line is deduced): m_text.replace(m_cursor, 1, clearString(m_cursor, 1));
-
859 addCommand(Command(Insert, m_cursor, m_text.at(m_cursor), -1, -1));
never executed (the execution status of this line is deduced): addCommand(Command(Insert, m_cursor, m_text.at(m_cursor), -1, -1));
-
860 } else {
never executed: }
0
861 m_text.remove(m_cursor, 1);
executed (the execution status of this line is deduced): m_text.remove(m_cursor, 1);
-
862 }
executed: }
Execution Count:77
77
863 m_textDirty = true;
executed (the execution status of this line is deduced): m_textDirty = true;
-
864 }
executed: }
Execution Count:77
77
865}
executed: }
Execution Count:77
77
866 -
867/*! -
868 \internal -
869 -
870 removes the currently selected text from the line control. -
871 -
872 Also adds the appropriate commands into the undo history. -
873 This function does not call finishChange(), and may leave the text -
874 in an invalid state. -
875*/ -
876void QWidgetLineControl::removeSelectedText() -
877{ -
878 if (m_selstart < m_selend && m_selend <= (int) m_text.length()) {
evaluated: m_selstart < m_selend
TRUEFALSE
yes
Evaluation Count:376
yes
Evaluation Count:504
partially evaluated: m_selend <= (int) m_text.length()
TRUEFALSE
yes
Evaluation Count:376
no
Evaluation Count:0
0-504
879 cancelPasswordEchoTimer();
executed (the execution status of this line is deduced): cancelPasswordEchoTimer();
-
880 separate();
executed (the execution status of this line is deduced): separate();
-
881 int i ;
executed (the execution status of this line is deduced): int i ;
-
882 addCommand(Command(SetSelection, m_cursor, 0, m_selstart, m_selend));
executed (the execution status of this line is deduced): addCommand(Command(SetSelection, m_cursor, 0, m_selstart, m_selend));
-
883 if (m_selstart <= m_cursor && m_cursor < m_selend) {
partially evaluated: m_selstart <= m_cursor
TRUEFALSE
yes
Evaluation Count:376
no
Evaluation Count:0
evaluated: m_cursor < m_selend
TRUEFALSE
yes
Evaluation Count:309
yes
Evaluation Count:67
0-376
884 // cursor is within the selection. Split up the commands -
885 // to be able to restore the correct cursor position -
886 for (i = m_cursor; i >= m_selstart; --i)
evaluated: i >= m_selstart
TRUEFALSE
yes
Evaluation Count:312
yes
Evaluation Count:309
309-312
887 addCommand (Command(DeleteSelection, i, m_text.at(i), -1, 1));
executed: addCommand (Command(DeleteSelection, i, m_text.at(i), -1, 1));
Execution Count:312
312
888 for (i = m_selend - 1; i > m_cursor; --i)
evaluated: i > m_cursor
TRUEFALSE
yes
Evaluation Count:487
yes
Evaluation Count:309
309-487
889 addCommand (Command(DeleteSelection, i - m_cursor + m_selstart - 1, m_text.at(i), -1, -1));
executed: addCommand (Command(DeleteSelection, i - m_cursor + m_selstart - 1, m_text.at(i), -1, -1));
Execution Count:487
487
890 } else {
executed: }
Execution Count:309
309
891 for (i = m_selend-1; i >= m_selstart; --i)
evaluated: i >= m_selstart
TRUEFALSE
yes
Evaluation Count:247
yes
Evaluation Count:67
67-247
892 addCommand (Command(RemoveSelection, i, m_text.at(i), -1, -1));
executed: addCommand (Command(RemoveSelection, i, m_text.at(i), -1, -1));
Execution Count:247
247
893 }
executed: }
Execution Count:67
67
894#ifndef QT_NO_ACCESSIBILITY -
895 QAccessibleTextRemoveEvent event(parent(), m_selstart, m_text.mid(m_selstart, m_selend - m_selstart));
executed (the execution status of this line is deduced): QAccessibleTextRemoveEvent event(parent(), m_selstart, m_text.mid(m_selstart, m_selend - m_selstart));
-
896 QAccessible::updateAccessibility(&event);
executed (the execution status of this line is deduced): QAccessible::updateAccessibility(&event);
-
897#endif -
898 if (m_maskData) {
partially evaluated: m_maskData
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:376
0-376
899 m_text.replace(m_selstart, m_selend - m_selstart, clearString(m_selstart, m_selend - m_selstart));
never executed (the execution status of this line is deduced): m_text.replace(m_selstart, m_selend - m_selstart, clearString(m_selstart, m_selend - m_selstart));
-
900 for (int i = 0; i < m_selend - m_selstart; ++i)
never evaluated: i < m_selend - m_selstart
0
901 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
902 } else {
never executed: }
0
903 m_text.remove(m_selstart, m_selend - m_selstart);
executed (the execution status of this line is deduced): m_text.remove(m_selstart, m_selend - m_selstart);
-
904 }
executed: }
Execution Count:376
376
905 if (m_cursor > m_selstart)
evaluated: m_cursor > m_selstart
TRUEFALSE
yes
Evaluation Count:68
yes
Evaluation Count:308
68-308
906 m_cursor -= qMin(m_cursor, m_selend) - m_selstart;
executed: m_cursor -= qMin(m_cursor, m_selend) - m_selstart;
Execution Count:68
68
907 internalDeselect();
executed (the execution status of this line is deduced): internalDeselect();
-
908 m_textDirty = true;
executed (the execution status of this line is deduced): m_textDirty = true;
-
909 }
executed: }
Execution Count:376
376
910}
executed: }
Execution Count:880
880
911 -
912/*! -
913 \internal -
914 -
915 Parses the input mask specified by \a maskFields to generate -
916 the mask data used to handle input masks. -
917*/ -
918void QWidgetLineControl::parseInputMask(const QString &maskFields) -
919{ -
920 int delimiter = maskFields.indexOf(QLatin1Char(';'));
executed (the execution status of this line is deduced): int delimiter = maskFields.indexOf(QLatin1Char(';'));
-
921 if (maskFields.isEmpty() || delimiter == 0) {
partially evaluated: maskFields.isEmpty()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:2
partially evaluated: delimiter == 0
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:2
0-2
922 if (m_maskData) {
never evaluated: m_maskData
0
923 delete [] m_maskData;
never executed (the execution status of this line is deduced): delete [] m_maskData;
-
924 m_maskData = 0;
never executed (the execution status of this line is deduced): m_maskData = 0;
-
925 m_maxLength = 32767;
never executed (the execution status of this line is deduced): m_maxLength = 32767;
-
926 internalSetText(QString());
never executed (the execution status of this line is deduced): internalSetText(QString());
-
927 }
never executed: }
0
928 return;
never executed: return;
0
929 } -
930 -
931 if (delimiter == -1) {
partially evaluated: delimiter == -1
TRUEFALSE
yes
Evaluation Count:2
no
Evaluation Count:0
0-2
932 m_blank = QLatin1Char(' ');
executed (the execution status of this line is deduced): m_blank = QLatin1Char(' ');
-
933 m_inputMask = maskFields;
executed (the execution status of this line is deduced): m_inputMask = maskFields;
-
934 } else {
executed: }
Execution Count:2
2
935 m_inputMask = maskFields.left(delimiter);
never executed (the execution status of this line is deduced): m_inputMask = maskFields.left(delimiter);
-
936 m_blank = (delimiter + 1 < maskFields.length()) ? maskFields[delimiter + 1] : QLatin1Char(' ');
never evaluated: (delimiter + 1 < maskFields.length())
0
937 }
never executed: }
0
938 -
939 // calculate m_maxLength / m_maskData length -
940 m_maxLength = 0;
executed (the execution status of this line is deduced): m_maxLength = 0;
-
941 QChar c = 0;
executed (the execution status of this line is deduced): QChar c = 0;
-
942 for (int i=0; i<m_inputMask.length(); i++) {
evaluated: i<m_inputMask.length()
TRUEFALSE
yes
Evaluation Count:8
yes
Evaluation Count:2
2-8
943 c = m_inputMask.at(i);
executed (the execution status of this line is deduced): c = m_inputMask.at(i);
-
944 if (i > 0 && m_inputMask.at(i-1) == QLatin1Char('\\')) {
evaluated: i > 0
TRUEFALSE
yes
Evaluation Count:6
yes
Evaluation Count:2
partially evaluated: m_inputMask.at(i-1) == QLatin1Char('\\')
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:6
0-6
945 m_maxLength++;
never executed (the execution status of this line is deduced): m_maxLength++;
-
946 continue;
never executed: continue;
0
947 } -
948 if (c != QLatin1Char('\\') && c != QLatin1Char('!') &&
partially evaluated: c != QLatin1Char('\\')
TRUEFALSE
yes
Evaluation Count:8
no
Evaluation Count:0
partially evaluated: c != QLatin1Char('!')
TRUEFALSE
yes
Evaluation Count:8
no
Evaluation Count:0
0-8
949 c != QLatin1Char('<') && c != QLatin1Char('>') &&
partially evaluated: c != QLatin1Char('<')
TRUEFALSE
yes
Evaluation Count:8
no
Evaluation Count:0
partially evaluated: c != QLatin1Char('>')
TRUEFALSE
yes
Evaluation Count:8
no
Evaluation Count:0
0-8
950 c != QLatin1Char('{') && c != QLatin1Char('}') &&
partially evaluated: c != QLatin1Char('{')
TRUEFALSE
yes
Evaluation Count:8
no
Evaluation Count:0
partially evaluated: c != QLatin1Char('}')
TRUEFALSE
yes
Evaluation Count:8
no
Evaluation Count:0
0-8
951 c != QLatin1Char('[') && c != QLatin1Char(']'))
partially evaluated: c != QLatin1Char('[')
TRUEFALSE
yes
Evaluation Count:8
no
Evaluation Count:0
partially evaluated: c != QLatin1Char(']')
TRUEFALSE
yes
Evaluation Count:8
no
Evaluation Count:0
0-8
952 m_maxLength++;
executed: m_maxLength++;
Execution Count:8
8
953 }
executed: }
Execution Count:8
8
954 -
955 delete [] m_maskData;
executed (the execution status of this line is deduced): delete [] m_maskData;
-
956 m_maskData = new MaskInputData[m_maxLength];
executed (the execution status of this line is deduced): m_maskData = new MaskInputData[m_maxLength];
-
957 -
958 MaskInputData::Casemode m = MaskInputData::NoCaseMode;
executed (the execution status of this line is deduced): MaskInputData::Casemode m = MaskInputData::NoCaseMode;
-
959 c = 0;
executed (the execution status of this line is deduced): c = 0;
-
960 bool s;
executed (the execution status of this line is deduced): bool s;
-
961 bool escape = false;
executed (the execution status of this line is deduced): bool escape = false;
-
962 int index = 0;
executed (the execution status of this line is deduced): int index = 0;
-
963 for (int i = 0; i < m_inputMask.length(); i++) {
evaluated: i < m_inputMask.length()
TRUEFALSE
yes
Evaluation Count:8
yes
Evaluation Count:2
2-8
964 c = m_inputMask.at(i);
executed (the execution status of this line is deduced): c = m_inputMask.at(i);
-
965 if (escape) {
partially evaluated: escape
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:8
0-8
966 s = true;
never executed (the execution status of this line is deduced): s = true;
-
967 m_maskData[index].maskChar = c;
never executed (the execution status of this line is deduced): m_maskData[index].maskChar = c;
-
968 m_maskData[index].separator = s;
never executed (the execution status of this line is deduced): m_maskData[index].separator = s;
-
969 m_maskData[index].caseMode = m;
never executed (the execution status of this line is deduced): m_maskData[index].caseMode = m;
-
970 index++;
never executed (the execution status of this line is deduced): index++;
-
971 escape = false;
never executed (the execution status of this line is deduced): escape = false;
-
972 } else if (c == QLatin1Char('<')) {
never executed: }
partially evaluated: c == QLatin1Char('<')
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:8
0-8
973 m = MaskInputData::Lower;
never executed (the execution status of this line is deduced): m = MaskInputData::Lower;
-
974 } else if (c == QLatin1Char('>')) {
never executed: }
partially evaluated: c == QLatin1Char('>')
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:8
0-8
975 m = MaskInputData::Upper;
never executed (the execution status of this line is deduced): m = MaskInputData::Upper;
-
976 } else if (c == QLatin1Char('!')) {
never executed: }
partially evaluated: c == QLatin1Char('!')
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:8
0-8
977 m = MaskInputData::NoCaseMode;
never executed (the execution status of this line is deduced): m = MaskInputData::NoCaseMode;
-
978 } else if (c != QLatin1Char('{') && c != QLatin1Char('}') && c != QLatin1Char('[') && c != QLatin1Char(']')) {
never executed: }
partially evaluated: c != QLatin1Char('{')
TRUEFALSE
yes
Evaluation Count:8
no
Evaluation Count:0
partially evaluated: c != QLatin1Char('}')
TRUEFALSE
yes
Evaluation Count:8
no
Evaluation Count:0
partially evaluated: c != QLatin1Char('[')
TRUEFALSE
yes
Evaluation Count:8
no
Evaluation Count:0
partially evaluated: c != QLatin1Char(']')
TRUEFALSE
yes
Evaluation Count:8
no
Evaluation Count:0
0-8
979 switch (c.unicode()) { -
980 case 'A': -
981 case 'a': -
982 case 'N': -
983 case 'n': -
984 case 'X': -
985 case 'x': -
986 case '9': -
987 case '0': -
988 case 'D': -
989 case 'd': -
990 case '#': -
991 case 'H': -
992 case 'h': -
993 case 'B': -
994 case 'b': -
995 s = false;
executed (the execution status of this line is deduced): s = false;
-
996 break;
executed: break;
Execution Count:3
3
997 case '\\': -
998 escape = true;
never executed (the execution status of this line is deduced): escape = true;
-
999 default:
code before this statement never executed: default:
0
1000 s = true;
executed (the execution status of this line is deduced): s = true;
-
1001 break;
executed: break;
Execution Count:5
5
1002 } -
1003 -
1004 if (!escape) {
partially evaluated: !escape
TRUEFALSE
yes
Evaluation Count:8
no
Evaluation Count:0
0-8
1005 m_maskData[index].maskChar = c;
executed (the execution status of this line is deduced): m_maskData[index].maskChar = c;
-
1006 m_maskData[index].separator = s;
executed (the execution status of this line is deduced): m_maskData[index].separator = s;
-
1007 m_maskData[index].caseMode = m;
executed (the execution status of this line is deduced): m_maskData[index].caseMode = m;
-
1008 index++;
executed (the execution status of this line is deduced): index++;
-
1009 }
executed: }
Execution Count:8
8
1010 }
executed: }
Execution Count:8
8
1011 } -
1012 internalSetText(m_text);
executed (the execution status of this line is deduced): internalSetText(m_text);
-
1013}
executed: }
Execution Count:2
2
1014 -
1015 -
1016/*! -
1017 \internal -
1018 -
1019 checks if the key is valid compared to the inputMask -
1020*/ -
1021bool QWidgetLineControl::isValidInput(QChar key, QChar mask) const -
1022{ -
1023 switch (mask.unicode()) { -
1024 case 'A': -
1025 if (key.isLetter())
never evaluated: key.isLetter()
0
1026 return true;
never executed: return true;
0
1027 break;
never executed: break;
0
1028 case 'a': -
1029 if (key.isLetter() || key == m_blank)
partially evaluated: key.isLetter()
TRUEFALSE
yes
Evaluation Count:2
no
Evaluation Count:0
never evaluated: key == m_blank
0-2
1030 return true;
executed: return true;
Execution Count:2
2
1031 break;
never executed: break;
0
1032 case 'N': -
1033 if (key.isLetterOrNumber())
never evaluated: key.isLetterOrNumber()
0
1034 return true;
never executed: return true;
0
1035 break;
never executed: break;
0
1036 case 'n': -
1037 if (key.isLetterOrNumber() || key == m_blank)
never evaluated: key.isLetterOrNumber()
never evaluated: key == m_blank
0
1038 return true;
never executed: return true;
0
1039 break;
never executed: break;
0
1040 case 'X': -
1041 if (key.isPrint())
never evaluated: key.isPrint()
0
1042 return true;
never executed: return true;
0
1043 break;
never executed: break;
0
1044 case 'x': -
1045 if (key.isPrint() || key == m_blank)
never evaluated: key.isPrint()
never evaluated: key == m_blank
0
1046 return true;
never executed: return true;
0
1047 break;
never executed: break;
0
1048 case '9': -
1049 if (key.isNumber())
never evaluated: key.isNumber()
0
1050 return true;
never executed: return true;
0
1051 break;
never executed: break;
0
1052 case '0': -
1053 if (key.isNumber() || key == m_blank)
never evaluated: key.isNumber()
never evaluated: key == m_blank
0
1054 return true;
never executed: return true;
0
1055 break;
never executed: break;
0
1056 case 'D': -
1057 if (key.isNumber() && key.digitValue() > 0)
never evaluated: key.isNumber()
never evaluated: key.digitValue() > 0
0
1058 return true;
never executed: return true;
0
1059 break;
never executed: break;
0
1060 case 'd': -
1061 if ((key.isNumber() && key.digitValue() > 0) || key == m_blank)
never evaluated: key.isNumber()
never evaluated: key.digitValue() > 0
never evaluated: key == m_blank
0
1062 return true;
never executed: return true;
0
1063 break;
never executed: break;
0
1064 case '#': -
1065 if (key.isNumber() || key == QLatin1Char('+') || key == QLatin1Char('-') || key == m_blank)
never evaluated: key.isNumber()
never evaluated: key == QLatin1Char('+')
never evaluated: key == QLatin1Char('-')
never evaluated: key == m_blank
0
1066 return true;
never executed: return true;
0
1067 break;
never executed: break;
0
1068 case 'B': -
1069 if (key == QLatin1Char('0') || key == QLatin1Char('1'))
partially evaluated: key == QLatin1Char('0')
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:2
partially evaluated: key == QLatin1Char('1')
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:2
0-2
1070 return true;
never executed: return true;
0
1071 break;
executed: break;
Execution Count:2
2
1072 case 'b': -
1073 if (key == QLatin1Char('0') || key == QLatin1Char('1') || key == m_blank)
never evaluated: key == QLatin1Char('0')
never evaluated: key == QLatin1Char('1')
never evaluated: key == m_blank
0
1074 return true;
never executed: return true;
0
1075 break;
never executed: break;
0
1076 case 'H': -
1077 if (key.isNumber() || (key >= QLatin1Char('a') && key <= QLatin1Char('f')) || (key >= QLatin1Char('A') && key <= QLatin1Char('F')))
never evaluated: key.isNumber()
never evaluated: key >= QLatin1Char('a')
never evaluated: key <= QLatin1Char('f')
never evaluated: key >= QLatin1Char('A')
never evaluated: key <= QLatin1Char('F')
0
1078 return true;
never executed: return true;
0
1079 break;
never executed: break;
0
1080 case 'h': -
1081 if (key.isNumber() || (key >= QLatin1Char('a') && key <= QLatin1Char('f')) || (key >= QLatin1Char('A') && key <= QLatin1Char('F')) || key == m_blank)
never evaluated: key.isNumber()
never evaluated: key >= QLatin1Char('a')
never evaluated: key <= QLatin1Char('f')
never evaluated: key >= QLatin1Char('A')
never evaluated: key <= QLatin1Char('F')
never evaluated: key == m_blank
0
1082 return true;
never executed: return true;
0
1083 break;
never executed: break;
0
1084 default: -
1085 break;
never executed: break;
0
1086 } -
1087 return false;
executed: return false;
Execution Count:2
2
1088} -
1089 -
1090/*! -
1091 \internal -
1092 -
1093 Returns true if the given text \a str is valid for any -
1094 validator or input mask set for the line control. -
1095 -
1096 Otherwise returns false -
1097*/ -
1098bool QWidgetLineControl::hasAcceptableInput(const QString &str) const -
1099{ -
1100#ifndef QT_NO_VALIDATOR -
1101 QString textCopy = str;
executed (the execution status of this line is deduced): QString textCopy = str;
-
1102 int cursorCopy = m_cursor;
executed (the execution status of this line is deduced): int cursorCopy = m_cursor;
-
1103 if (m_validator && m_validator->validate(textCopy, cursorCopy)
evaluated: m_validator
TRUEFALSE
yes
Evaluation Count:1565
yes
Evaluation Count:195
evaluated: m_validator->validate(textCopy, cursorCopy) != QValidator::Acceptable
TRUEFALSE
yes
Evaluation Count:632
yes
Evaluation Count:933
195-1565
1104 != QValidator::Acceptable)
evaluated: m_validator->validate(textCopy, cursorCopy) != QValidator::Acceptable
TRUEFALSE
yes
Evaluation Count:632
yes
Evaluation Count:933
632-933
1105 return false;
executed: return false;
Execution Count:632
632
1106#endif -
1107 -
1108 if (!m_maskData)
partially evaluated: !m_maskData
TRUEFALSE
yes
Evaluation Count:1128
no
Evaluation Count:0
0-1128
1109 return true;
executed: return true;
Execution Count:1128
1128
1110 -
1111 if (str.length() != m_maxLength)
never evaluated: str.length() != m_maxLength
0
1112 return false;
never executed: return false;
0
1113 -
1114 for (int i=0; i < m_maxLength; ++i) {
never evaluated: i < m_maxLength
0
1115 if (m_maskData[i].separator) {
never evaluated: m_maskData[i].separator
0
1116 if (str.at(i) != m_maskData[i].maskChar)
never evaluated: str.at(i) != m_maskData[i].maskChar
0
1117 return false;
never executed: return false;
0
1118 } else {
never executed: }
0
1119 if (!isValidInput(str.at(i), m_maskData[i].maskChar))
never evaluated: !isValidInput(str.at(i), m_maskData[i].maskChar)
0
1120 return false;
never executed: return false;
0
1121 }
never executed: }
0
1122 } -
1123 return true;
never executed: return true;
0
1124} -
1125 -
1126/*! -
1127 \internal -
1128 -
1129 Applies the inputMask on \a str starting from position \a pos in the mask. \a clear -
1130 specifies from where characters should be gotten when a separator is met in \a str - true means -
1131 that blanks will be used, false that previous input is used. -
1132 Calling this when no inputMask is set is undefined. -
1133*/ -
1134QString QWidgetLineControl::maskString(uint pos, const QString &str, bool clear) const -
1135{ -
1136 if (pos >= (uint)m_maxLength)
partially evaluated: pos >= (uint)m_maxLength
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:2
0-2
1137 return QString::fromLatin1("");
never executed: return QString::fromLatin1("");
0
1138 -
1139 QString fill;
executed (the execution status of this line is deduced): QString fill;
-
1140 fill = clear ? clearString(0, m_maxLength) : m_text;
partially evaluated: clear
TRUEFALSE
yes
Evaluation Count:2
no
Evaluation Count:0
0-2
1141 -
1142 int strIndex = 0;
executed (the execution status of this line is deduced): int strIndex = 0;
-
1143 QString s = QString::fromLatin1("");
executed (the execution status of this line is deduced): QString s = QString::fromLatin1("");
-
1144 int i = pos;
executed (the execution status of this line is deduced): int i = pos;
-
1145 while (i < m_maxLength) {
evaluated: i < m_maxLength
TRUEFALSE
yes
Evaluation Count:5
yes
Evaluation Count:2
2-5
1146 if (strIndex < str.length()) {
partially evaluated: strIndex < str.length()
TRUEFALSE
yes
Evaluation Count:5
no
Evaluation Count:0
0-5
1147 if (m_maskData[i].separator) {
evaluated: m_maskData[i].separator
TRUEFALSE
yes
Evaluation Count:3
yes
Evaluation Count:2
2-3
1148 s += m_maskData[i].maskChar;
executed (the execution status of this line is deduced): s += m_maskData[i].maskChar;
-
1149 if (str[(int)strIndex] == m_maskData[i].maskChar)
partially evaluated: str[(int)strIndex] == m_maskData[i].maskChar
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:3
0-3
1150 strIndex++;
never executed: strIndex++;
0
1151 ++i;
executed (the execution status of this line is deduced): ++i;
-
1152 } else {
executed: }
Execution Count:3
3
1153 if (isValidInput(str[(int)strIndex], m_maskData[i].maskChar)) {
evaluated: isValidInput(str[(int)strIndex], m_maskData[i].maskChar)
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:1
1
1154 switch (m_maskData[i].caseMode) { -
1155 case MaskInputData::Upper: -
1156 s += str[(int)strIndex].toUpper();
never executed (the execution status of this line is deduced): s += str[(int)strIndex].toUpper();
-
1157 break;
never executed: break;
0
1158 case MaskInputData::Lower: -
1159 s += str[(int)strIndex].toLower();
never executed (the execution status of this line is deduced): s += str[(int)strIndex].toLower();
-
1160 break;
never executed: break;
0
1161 default: -
1162 s += str[(int)strIndex];
executed (the execution status of this line is deduced): s += str[(int)strIndex];
-
1163 }
executed: }
Execution Count:1
1
1164 ++i;
executed (the execution status of this line is deduced): ++i;
-
1165 } else {
executed: }
Execution Count:1
1
1166 // search for separator first -
1167 int n = findInMask(i, true, true, str[(int)strIndex]);
executed (the execution status of this line is deduced): int n = findInMask(i, true, true, str[(int)strIndex]);
-
1168 if (n != -1) {
partially evaluated: n != -1
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1
0-1
1169 if (str.length() != 1 || i == 0 || (i > 0 && (!m_maskData[i-1].separator || m_maskData[i-1].maskChar != str[(int)strIndex]))) {
never evaluated: str.length() != 1
never evaluated: i == 0
never evaluated: i > 0
never evaluated: !m_maskData[i-1].separator
never evaluated: m_maskData[i-1].maskChar != str[(int)strIndex]
0
1170 s += fill.mid(i, n-i+1);
never executed (the execution status of this line is deduced): s += fill.mid(i, n-i+1);
-
1171 i = n + 1; // update i to find + 1
never executed (the execution status of this line is deduced): i = n + 1;
-
1172 }
never executed: }
0
1173 } else {
never executed: }
0
1174 // search for valid m_blank if not -
1175 n = findInMask(i, true, false, str[(int)strIndex]);
executed (the execution status of this line is deduced): n = findInMask(i, true, false, str[(int)strIndex]);
-
1176 if (n != -1) {
partially evaluated: n != -1
TRUEFALSE
yes
Evaluation Count:1
no
Evaluation Count:0
0-1
1177 s += fill.mid(i, n-i);
executed (the execution status of this line is deduced): s += fill.mid(i, n-i);
-
1178 switch (m_maskData[n].caseMode) { -
1179 case MaskInputData::Upper: -
1180 s += str[(int)strIndex].toUpper();
never executed (the execution status of this line is deduced): s += str[(int)strIndex].toUpper();
-
1181 break;
never executed: break;
0
1182 case MaskInputData::Lower: -
1183 s += str[(int)strIndex].toLower();
never executed (the execution status of this line is deduced): s += str[(int)strIndex].toLower();
-
1184 break;
never executed: break;
0
1185 default: -
1186 s += str[(int)strIndex];
executed (the execution status of this line is deduced): s += str[(int)strIndex];
-
1187 }
executed: }
Execution Count:1
1
1188 i = n + 1; // updates i to find + 1
executed (the execution status of this line is deduced): i = n + 1;
-
1189 }
executed: }
Execution Count:1
1
1190 }
executed: }
Execution Count:1
1
1191 } -
1192 ++strIndex;
executed (the execution status of this line is deduced): ++strIndex;
-
1193 }
executed: }
Execution Count:2
2
1194 } else -
1195 break;
never executed: break;
0
1196 } -
1197 -
1198 return s;
executed: return s;
Execution Count:2
2
1199} -
1200 -
1201 -
1202 -
1203/*! -
1204 \internal -
1205 -
1206 Returns a "cleared" string with only separators and blank chars. -
1207 Calling this when no inputMask is set is undefined. -
1208*/ -
1209QString QWidgetLineControl::clearString(uint pos, uint len) const -
1210{ -
1211 if (pos >= (uint)m_maxLength)
evaluated: pos >= (uint)m_maxLength
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:2
2
1212 return QString();
executed: return QString();
Execution Count:2
2
1213 -
1214 QString s;
executed (the execution status of this line is deduced): QString s;
-
1215 int end = qMin((uint)m_maxLength, pos + len);
executed (the execution status of this line is deduced): int end = qMin((uint)m_maxLength, pos + len);
-
1216 for (int i = pos; i < end; ++i)
evaluated: i < end
TRUEFALSE
yes
Evaluation Count:8
yes
Evaluation Count:2
2-8
1217 if (m_maskData[i].separator)
evaluated: m_maskData[i].separator
TRUEFALSE
yes
Evaluation Count:5
yes
Evaluation Count:3
3-5
1218 s += m_maskData[i].maskChar;
executed: s += m_maskData[i].maskChar;
Execution Count:5
5
1219 else -
1220 s += m_blank;
executed: s += m_blank;
Execution Count:3
3
1221 -
1222 return s;
executed: return s;
Execution Count:2
2
1223} -
1224 -
1225/*! -
1226 \internal -
1227 -
1228 Strips blank parts of the input in a QWidgetLineControl when an inputMask is set, -
1229 separators are still included. Typically "127.0__.0__.1__" becomes "127.0.0.1". -
1230*/ -
1231QString QWidgetLineControl::stripString(const QString &str) const -
1232{ -
1233 if (!m_maskData)
partially evaluated: !m_maskData
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:2
0-2
1234 return str;
never executed: return str;
0
1235 -
1236 QString s;
executed (the execution status of this line is deduced): QString s;
-
1237 int end = qMin(m_maxLength, (int)str.length());
executed (the execution status of this line is deduced): int end = qMin(m_maxLength, (int)str.length());
-
1238 for (int i = 0; i < end; ++i)
evaluated: i < end
TRUEFALSE
yes
Evaluation Count:8
yes
Evaluation Count:2
2-8
1239 if (m_maskData[i].separator)
evaluated: m_maskData[i].separator
TRUEFALSE
yes
Evaluation Count:5
yes
Evaluation Count:3
3-5
1240 s += m_maskData[i].maskChar;
executed: s += m_maskData[i].maskChar;
Execution Count:5
5
1241 else -
1242 if (str[i] != m_blank)
evaluated: str[i] != m_blank
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:1
1-2
1243 s += str[i];
executed: s += str[i];
Execution Count:2
2
1244 -
1245 return s;
executed: return s;
Execution Count:2
2
1246} -
1247 -
1248/*! -
1249 \internal -
1250 searches forward/backward in m_maskData for either a separator or a m_blank -
1251*/ -
1252int QWidgetLineControl::findInMask(int pos, bool forward, bool findSeparator, QChar searchChar) const -
1253{ -
1254 if (pos >= m_maxLength || pos < 0)
partially evaluated: pos >= m_maxLength
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:6
partially evaluated: pos < 0
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:6
0-6
1255 return -1;
never executed: return -1;
0
1256 -
1257 int end = forward ? m_maxLength : -1;
evaluated: forward
TRUEFALSE
yes
Evaluation Count:4
yes
Evaluation Count:2
2-4
1258 int step = forward ? 1 : -1;
evaluated: forward
TRUEFALSE
yes
Evaluation Count:4
yes
Evaluation Count:2
2-4
1259 int i = pos;
executed (the execution status of this line is deduced): int i = pos;
-
1260 -
1261 while (i != end) {
evaluated: i != end
TRUEFALSE
yes
Evaluation Count:13
yes
Evaluation Count:1
1-13
1262 if (findSeparator) {
evaluated: findSeparator
TRUEFALSE
yes
Evaluation Count:4
yes
Evaluation Count:9
4-9
1263 if (m_maskData[i].separator && m_maskData[i].maskChar == searchChar)
evaluated: m_maskData[i].separator
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:2
partially evaluated: m_maskData[i].maskChar == searchChar
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:2
0-2
1264 return i;
never executed: return i;
0
1265 } else {
executed: }
Execution Count:4
4
1266 if (!m_maskData[i].separator) {
evaluated: !m_maskData[i].separator
TRUEFALSE
yes
Evaluation Count:6
yes
Evaluation Count:3
3-6
1267 if (searchChar.isNull())
evaluated: searchChar.isNull()
TRUEFALSE
yes
Evaluation Count:4
yes
Evaluation Count:2
2-4
1268 return i;
executed: return i;
Execution Count:4
4
1269 else if (isValidInput(searchChar, m_maskData[i].maskChar))
evaluated: isValidInput(searchChar, m_maskData[i].maskChar)
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:1
1
1270 return i;
executed: return i;
Execution Count:1
1
1271 } -
1272 }
executed: }
Execution Count:4
4
1273 i += step;
executed (the execution status of this line is deduced): i += step;
-
1274 }
executed: }
Execution Count:8
8
1275 return -1;
executed: return -1;
Execution Count:1
1
1276} -
1277 -
1278void QWidgetLineControl::internalUndo(int until) -
1279{ -
1280 if (!isUndoAvailable())
partially evaluated: !isUndoAvailable()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:232
0-232
1281 return;
never executed: return;
0
1282 cancelPasswordEchoTimer();
executed (the execution status of this line is deduced): cancelPasswordEchoTimer();
-
1283 internalDeselect();
executed (the execution status of this line is deduced): internalDeselect();
-
1284 -
1285 // Undo works only for clearing the line when in any of password the modes -
1286 if (m_echoMode != QLineEdit::Normal) {
partially evaluated: m_echoMode != QLineEdit::Normal
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:232
0-232
1287 clear();
never executed (the execution status of this line is deduced): clear();
-
1288 return;
never executed: return;
0
1289 } -
1290 -
1291 while (m_undoState && m_undoState > until) {
evaluated: m_undoState
TRUEFALSE
yes
Evaluation Count:1047
yes
Evaluation Count:43
evaluated: m_undoState > until
TRUEFALSE
yes
Evaluation Count:858
yes
Evaluation Count:189
43-1047
1292 Command& cmd = m_history[--m_undoState];
executed (the execution status of this line is deduced): Command& cmd = m_history[--m_undoState];
-
1293 switch (cmd.type) { -
1294 case Insert: -
1295 m_text.remove(cmd.pos, 1);
executed (the execution status of this line is deduced): m_text.remove(cmd.pos, 1);
-
1296 m_cursor = cmd.pos;
executed (the execution status of this line is deduced): m_cursor = cmd.pos;
-
1297 break;
executed: break;
Execution Count:232
232
1298 case SetSelection: -
1299 m_selstart = cmd.selStart;
executed (the execution status of this line is deduced): m_selstart = cmd.selStart;
-
1300 m_selend = cmd.selEnd;
executed (the execution status of this line is deduced): m_selend = cmd.selEnd;
-
1301 m_cursor = cmd.pos;
executed (the execution status of this line is deduced): m_cursor = cmd.pos;
-
1302 break;
executed: break;
Execution Count:144
144
1303 case Remove: -
1304 case RemoveSelection: -
1305 m_text.insert(cmd.pos, cmd.uc);
executed (the execution status of this line is deduced): m_text.insert(cmd.pos, cmd.uc);
-
1306 m_cursor = cmd.pos + 1;
executed (the execution status of this line is deduced): m_cursor = cmd.pos + 1;
-
1307 break;
executed: break;
Execution Count:4
4
1308 case Delete: -
1309 case DeleteSelection: -
1310 m_text.insert(cmd.pos, cmd.uc);
executed (the execution status of this line is deduced): m_text.insert(cmd.pos, cmd.uc);
-
1311 m_cursor = cmd.pos;
executed (the execution status of this line is deduced): m_cursor = cmd.pos;
-
1312 break;
executed: break;
Execution Count:336
336
1313 case Separator: -
1314 continue;
executed: continue;
Execution Count:142
142
1315 } -
1316 if (until < 0 && m_undoState) {
evaluated: until < 0
TRUEFALSE
yes
Evaluation Count:6
yes
Evaluation Count:710
evaluated: m_undoState
TRUEFALSE
yes
Evaluation Count:5
yes
Evaluation Count:1
1-710
1317 Command& next = m_history[m_undoState-1];
executed (the execution status of this line is deduced): Command& next = m_history[m_undoState-1];
-
1318 if (next.type != cmd.type && next.type < RemoveSelection
evaluated: next.type != cmd.type
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:3
partially evaluated: next.type < RemoveSelection
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:2
0-3
1319 && (cmd.type < RemoveSelection || next.type == Separator))
never evaluated: cmd.type < RemoveSelection
never evaluated: next.type == Separator
0
1320 break;
never executed: break;
0
1321 }
executed: }
Execution Count:5
5
1322 }
executed: }
Execution Count:716
716
1323 m_textDirty = true;
executed (the execution status of this line is deduced): m_textDirty = true;
-
1324 emitCursorPositionChanged();
executed (the execution status of this line is deduced): emitCursorPositionChanged();
-
1325}
executed: }
Execution Count:232
232
1326 -
1327void QWidgetLineControl::internalRedo() -
1328{ -
1329 if (!isRedoAvailable())
partially evaluated: !isRedoAvailable()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1
0-1
1330 return;
never executed: return;
0
1331 internalDeselect();
executed (the execution status of this line is deduced): internalDeselect();
-
1332 while (m_undoState < (int)m_history.size()) {
evaluated: m_undoState < (int)m_history.size()
TRUEFALSE
yes
Evaluation Count:6
yes
Evaluation Count:1
1-6
1333 Command& cmd = m_history[m_undoState++];
executed (the execution status of this line is deduced): Command& cmd = m_history[m_undoState++];
-
1334 switch (cmd.type) { -
1335 case Insert: -
1336 m_text.insert(cmd.pos, cmd.uc);
executed (the execution status of this line is deduced): m_text.insert(cmd.pos, cmd.uc);
-
1337 m_cursor = cmd.pos + 1;
executed (the execution status of this line is deduced): m_cursor = cmd.pos + 1;
-
1338 break;
executed: break;
Execution Count:1
1
1339 case SetSelection: -
1340 m_selstart = cmd.selStart;
executed (the execution status of this line is deduced): m_selstart = cmd.selStart;
-
1341 m_selend = cmd.selEnd;
executed (the execution status of this line is deduced): m_selend = cmd.selEnd;
-
1342 m_cursor = cmd.pos;
executed (the execution status of this line is deduced): m_cursor = cmd.pos;
-
1343 break;
executed: break;
Execution Count:1
1
1344 case Remove: -
1345 case Delete: -
1346 case RemoveSelection: -
1347 case DeleteSelection: -
1348 m_text.remove(cmd.pos, 1);
executed (the execution status of this line is deduced): m_text.remove(cmd.pos, 1);
-
1349 m_selstart = cmd.selStart;
executed (the execution status of this line is deduced): m_selstart = cmd.selStart;
-
1350 m_selend = cmd.selEnd;
executed (the execution status of this line is deduced): m_selend = cmd.selEnd;
-
1351 m_cursor = cmd.pos;
executed (the execution status of this line is deduced): m_cursor = cmd.pos;
-
1352 break;
executed: break;
Execution Count:4
4
1353 case Separator: -
1354 m_selstart = cmd.selStart;
never executed (the execution status of this line is deduced): m_selstart = cmd.selStart;
-
1355 m_selend = cmd.selEnd;
never executed (the execution status of this line is deduced): m_selend = cmd.selEnd;
-
1356 m_cursor = cmd.pos;
never executed (the execution status of this line is deduced): m_cursor = cmd.pos;
-
1357 break;
never executed: break;
0
1358 } -
1359 if (m_undoState < (int)m_history.size()) {
evaluated: m_undoState < (int)m_history.size()
TRUEFALSE
yes
Evaluation Count:5
yes
Evaluation Count:1
1-5
1360 Command& next = m_history[m_undoState];
executed (the execution status of this line is deduced): Command& next = m_history[m_undoState];
-
1361 if (next.type != cmd.type && cmd.type < RemoveSelection && next.type != Separator
evaluated: next.type != cmd.type
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:3
partially evaluated: cmd.type < RemoveSelection
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:2
never evaluated: next.type != Separator
0-3
1362 && (next.type < RemoveSelection || cmd.type == Separator))
never evaluated: next.type < RemoveSelection
never evaluated: cmd.type == Separator
0
1363 break;
never executed: break;
0
1364 }
executed: }
Execution Count:5
5
1365 }
executed: }
Execution Count:6
6
1366 m_textDirty = true;
executed (the execution status of this line is deduced): m_textDirty = true;
-
1367 emitCursorPositionChanged();
executed (the execution status of this line is deduced): emitCursorPositionChanged();
-
1368}
executed: }
Execution Count:1
1
1369 -
1370/*! -
1371 \internal -
1372 -
1373 If the current cursor position differs from the last emitted cursor -
1374 position, emits cursorPositionChanged(). -
1375*/ -
1376void QWidgetLineControl::emitCursorPositionChanged() -
1377{ -
1378 if (m_cursor != m_lastCursorPos) {
evaluated: m_cursor != m_lastCursorPos
TRUEFALSE
yes
Evaluation Count:9292
yes
Evaluation Count:3119
3119-9292
1379 const int oldLast = m_lastCursorPos;
executed (the execution status of this line is deduced): const int oldLast = m_lastCursorPos;
-
1380 m_lastCursorPos = m_cursor;
executed (the execution status of this line is deduced): m_lastCursorPos = m_cursor;
-
1381 cursorPositionChanged(oldLast, m_cursor);
executed (the execution status of this line is deduced): cursorPositionChanged(oldLast, m_cursor);
-
1382#ifndef QT_NO_ACCESSIBILITY -
1383 // otherwise we send a selection update which includes the cursor -
1384 if (!hasSelectedText()) {
evaluated: !hasSelectedText()
TRUEFALSE
yes
Evaluation Count:6437
yes
Evaluation Count:2855
2855-6437
1385 QAccessibleTextCursorEvent event(parent(), m_cursor);
executed (the execution status of this line is deduced): QAccessibleTextCursorEvent event(parent(), m_cursor);
-
1386 QAccessible::updateAccessibility(&event);
executed (the execution status of this line is deduced): QAccessible::updateAccessibility(&event);
-
1387 }
executed: }
Execution Count:6437
6437
1388#endif -
1389 }
executed: }
Execution Count:9292
9292
1390}
executed: }
Execution Count:12411
12411
1391 -
1392#ifndef QT_NO_COMPLETER -
1393// iterating forward(dir=1)/backward(dir=-1) from the -
1394// current row based. dir=0 indicates a new completion prefix was set. -
1395bool QWidgetLineControl::advanceToEnabledItem(int dir) -
1396{ -
1397 int start = m_completer->currentRow();
executed (the execution status of this line is deduced): int start = m_completer->currentRow();
-
1398 if (start == -1)
partially evaluated: start == -1
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:2
0-2
1399 return false;
never executed: return false;
0
1400 int i = start + dir;
executed (the execution status of this line is deduced): int i = start + dir;
-
1401 if (dir == 0) dir = 1;
executed: dir = 1;
Execution Count:2
partially evaluated: dir == 0
TRUEFALSE
yes
Evaluation Count:2
no
Evaluation Count:0
0-2
1402 do { -
1403 if (!m_completer->setCurrentRow(i)) {
partially evaluated: !m_completer->setCurrentRow(i)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:2
0-2
1404 if (!m_completer->wrapAround())
never evaluated: !m_completer->wrapAround()
0
1405 break;
never executed: break;
0
1406 i = i > 0 ? 0 : m_completer->completionCount() - 1;
never evaluated: i > 0
0
1407 } else {
never executed: }
0
1408 QModelIndex currentIndex = m_completer->currentIndex();
executed (the execution status of this line is deduced): QModelIndex currentIndex = m_completer->currentIndex();
-
1409 if (m_completer->completionModel()->flags(currentIndex) & Qt::ItemIsEnabled)
partially evaluated: m_completer->completionModel()->flags(currentIndex) & Qt::ItemIsEnabled
TRUEFALSE
yes
Evaluation Count:2
no
Evaluation Count:0
0-2
1410 return true;
executed: return true;
Execution Count:2
2
1411 i += dir;
never executed (the execution status of this line is deduced): i += dir;
-
1412 }
never executed: }
0
1413 } while (i != start);
never evaluated: i != start
0
1414 -
1415 m_completer->setCurrentRow(start); // restore
never executed (the execution status of this line is deduced): m_completer->setCurrentRow(start);
-
1416 return false;
never executed: return false;
0
1417} -
1418 -
1419void QWidgetLineControl::complete(int key) -
1420{ -
1421 if (!m_completer || isReadOnly() || echoMode() != QLineEdit::Normal)
evaluated: !m_completer
TRUEFALSE
yes
Evaluation Count:849
yes
Evaluation Count:60
partially evaluated: isReadOnly()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:60
partially evaluated: echoMode() != QLineEdit::Normal
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:60
0-849
1422 return;
executed: return;
Execution Count:849
849
1423 -
1424 QString text = this->text();
executed (the execution status of this line is deduced): QString text = this->text();
-
1425 if (m_completer->completionMode() == QCompleter::InlineCompletion) {
evaluated: m_completer->completionMode() == QCompleter::InlineCompletion
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:58
2-58
1426 if (key == Qt::Key_Backspace)
partially evaluated: key == Qt::Key_Backspace
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:2
0-2
1427 return;
never executed: return;
0
1428 int n = 0;
executed (the execution status of this line is deduced): int n = 0;
-
1429 if (key == Qt::Key_Up || key == Qt::Key_Down) {
partially evaluated: key == Qt::Key_Up
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:2
partially evaluated: key == Qt::Key_Down
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:2
0-2
1430 if (textAfterSelection().length())
never evaluated: textAfterSelection().length()
0
1431 return;
never executed: return;
0
1432 QString prefix = hasSelectedText() ? textBeforeSelection()
never evaluated: hasSelectedText()
0
1433 : text;
never executed (the execution status of this line is deduced): : text;
-
1434 if (text.compare(m_completer->currentCompletion(), m_completer->caseSensitivity()) != 0
never evaluated: text.compare(m_completer->currentCompletion(), m_completer->caseSensitivity()) != 0
0
1435 || prefix.compare(m_completer->completionPrefix(), m_completer->caseSensitivity()) != 0) {
never evaluated: prefix.compare(m_completer->completionPrefix(), m_completer->caseSensitivity()) != 0
0
1436 m_completer->setCompletionPrefix(prefix);
never executed (the execution status of this line is deduced): m_completer->setCompletionPrefix(prefix);
-
1437 } else {
never executed: }
0
1438 n = (key == Qt::Key_Up) ? -1 : +1;
never evaluated: (key == Qt::Key_Up)
0
1439 }
never executed: }
0
1440 } else { -
1441 m_completer->setCompletionPrefix(text);
executed (the execution status of this line is deduced): m_completer->setCompletionPrefix(text);
-
1442 }
executed: }
Execution Count:2
2
1443 if (!advanceToEnabledItem(n))
partially evaluated: !advanceToEnabledItem(n)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:2
0-2
1444 return;
never executed: return;
0
1445 } else {
executed: }
Execution Count:2
2
1446#ifndef QT_KEYPAD_NAVIGATION -
1447 if (text.isEmpty()) {
partially evaluated: text.isEmpty()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:58
0-58
1448 m_completer->popup()->hide();
never executed (the execution status of this line is deduced): m_completer->popup()->hide();
-
1449 return;
never executed: return;
0
1450 } -
1451#endif -
1452 m_completer->setCompletionPrefix(text);
executed (the execution status of this line is deduced): m_completer->setCompletionPrefix(text);
-
1453 }
executed: }
Execution Count:58
58
1454 -
1455 m_completer->complete();
executed (the execution status of this line is deduced): m_completer->complete();
-
1456}
executed: }
Execution Count:59
59
1457#endif -
1458 -
1459void QWidgetLineControl::setReadOnly(bool enable) -
1460{ -
1461 m_readOnly = enable;
executed (the execution status of this line is deduced): m_readOnly = enable;
-
1462 if (enable)
evaluated: enable
TRUEFALSE
yes
Evaluation Count:10
yes
Evaluation Count:3
3-10
1463 setCursorBlinkPeriod(0);
executed: setCursorBlinkPeriod(0);
Execution Count:10
10
1464 else -
1465 setCursorBlinkPeriod(QApplication::cursorFlashTime());
executed: setCursorBlinkPeriod(QApplication::cursorFlashTime());
Execution Count:3
3
1466} -
1467 -
1468void QWidgetLineControl::setCursorBlinkPeriod(int msec) -
1469{ -
1470 if (msec == m_blinkPeriod)
evaluated: msec == m_blinkPeriod
TRUEFALSE
yes
Evaluation Count:1574
yes
Evaluation Count:2343
1574-2343
1471 return;
executed: return;
Execution Count:1574
1574
1472 if (m_blinkTimer) {
evaluated: m_blinkTimer
TRUEFALSE
yes
Evaluation Count:1108
yes
Evaluation Count:1235
1108-1235
1473 killTimer(m_blinkTimer);
executed (the execution status of this line is deduced): killTimer(m_blinkTimer);
-
1474 }
executed: }
Execution Count:1108
1108
1475 if (msec && !m_readOnly) {
evaluated: msec
TRUEFALSE
yes
Evaluation Count:1235
yes
Evaluation Count:1108
evaluated: !m_readOnly
TRUEFALSE
yes
Evaluation Count:1232
yes
Evaluation Count:3
3-1235
1476 m_blinkTimer = startTimer(msec / 2);
executed (the execution status of this line is deduced): m_blinkTimer = startTimer(msec / 2);
-
1477 m_blinkStatus = 1;
executed (the execution status of this line is deduced): m_blinkStatus = 1;
-
1478 } else {
executed: }
Execution Count:1232
1232
1479 m_blinkTimer = 0;
executed (the execution status of this line is deduced): m_blinkTimer = 0;
-
1480 if (m_blinkStatus == 1)
evaluated: m_blinkStatus == 1
TRUEFALSE
yes
Evaluation Count:1104
yes
Evaluation Count:7
7-1104
1481 emit updateNeeded(inputMask().isEmpty() ? cursorRect() : QRect());
executed: updateNeeded(inputMask().isEmpty() ? cursorRect() : QRect());
Execution Count:1104
1104
1482 }
executed: }
Execution Count:1111
1111
1483 m_blinkPeriod = msec;
executed (the execution status of this line is deduced): m_blinkPeriod = msec;
-
1484}
executed: }
Execution Count:2343
2343
1485 -
1486// This is still used by QDeclarativeTextInput in the qtquick1 repo -
1487void QWidgetLineControl::resetCursorBlinkTimer() -
1488{ -
1489 if (m_blinkPeriod == 0 || m_blinkTimer == 0)
never evaluated: m_blinkPeriod == 0
never evaluated: m_blinkTimer == 0
0
1490 return;
never executed: return;
0
1491 killTimer(m_blinkTimer);
never executed (the execution status of this line is deduced): killTimer(m_blinkTimer);
-
1492 m_blinkTimer = startTimer(m_blinkPeriod / 2);
never executed (the execution status of this line is deduced): m_blinkTimer = startTimer(m_blinkPeriod / 2);
-
1493 m_blinkStatus = 1;
never executed (the execution status of this line is deduced): m_blinkStatus = 1;
-
1494}
never executed: }
0
1495 -
1496void QWidgetLineControl::timerEvent(QTimerEvent *event) -
1497{ -
1498 if (event->timerId() == m_blinkTimer) {
partially evaluated: event->timerId() == m_blinkTimer
TRUEFALSE
yes
Evaluation Count:21
no
Evaluation Count:0
0-21
1499 m_blinkStatus = !m_blinkStatus;
executed (the execution status of this line is deduced): m_blinkStatus = !m_blinkStatus;
-
1500 emit updateNeeded(inputMask().isEmpty() ? cursorRect() : QRect());
executed (the execution status of this line is deduced): updateNeeded(inputMask().isEmpty() ? cursorRect() : QRect());
-
1501 } else if (event->timerId() == m_deleteAllTimer) {
executed: }
Execution Count:21
never evaluated: event->timerId() == m_deleteAllTimer
0-21
1502 killTimer(m_deleteAllTimer);
never executed (the execution status of this line is deduced): killTimer(m_deleteAllTimer);
-
1503 m_deleteAllTimer = 0;
never executed (the execution status of this line is deduced): m_deleteAllTimer = 0;
-
1504 clear();
never executed (the execution status of this line is deduced): clear();
-
1505 } else if (event->timerId() == m_tripleClickTimer) {
never executed: }
never evaluated: event->timerId() == m_tripleClickTimer
0
1506 killTimer(m_tripleClickTimer);
never executed (the execution status of this line is deduced): killTimer(m_tripleClickTimer);
-
1507 m_tripleClickTimer = 0;
never executed (the execution status of this line is deduced): m_tripleClickTimer = 0;
-
1508 } else if (event->timerId() == m_passwordEchoTimer) {
never executed: }
never evaluated: event->timerId() == m_passwordEchoTimer
0
1509 killTimer(m_passwordEchoTimer);
never executed (the execution status of this line is deduced): killTimer(m_passwordEchoTimer);
-
1510 m_passwordEchoTimer = 0;
never executed (the execution status of this line is deduced): m_passwordEchoTimer = 0;
-
1511 updateDisplayText();
never executed (the execution status of this line is deduced): updateDisplayText();
-
1512 }
never executed: }
0
1513} -
1514 -
1515#ifndef QT_NO_SHORTCUT -
1516void QWidgetLineControl::processShortcutOverrideEvent(QKeyEvent *ke) -
1517{ -
1518 if (isReadOnly())
evaluated: isReadOnly()
TRUEFALSE
yes
Evaluation Count:3
yes
Evaluation Count:2536
3-2536
1519 return;
executed: return;
Execution Count:3
3
1520 -
1521 if (ke == QKeySequence::Copy
partially evaluated: ke == QKeySequence::Copy
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:2536
0-2536
1522 || ke == QKeySequence::Paste
partially evaluated: ke == QKeySequence::Paste
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:2536
0-2536
1523 || ke == QKeySequence::Cut
partially evaluated: ke == QKeySequence::Cut
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:2536
0-2536
1524 || ke == QKeySequence::Redo
evaluated: ke == QKeySequence::Redo
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:2535
1-2535
1525 || ke == QKeySequence::Undo
evaluated: ke == QKeySequence::Undo
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:2534
1-2534
1526 || ke == QKeySequence::MoveToNextWord
evaluated: ke == QKeySequence::MoveToNextWord
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:2533
1-2533
1527 || ke == QKeySequence::MoveToPreviousWord
evaluated: ke == QKeySequence::MoveToPreviousWord
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:2532
1-2532
1528 || ke == QKeySequence::MoveToStartOfDocument
partially evaluated: ke == QKeySequence::MoveToStartOfDocument
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:2532
0-2532
1529 || ke == QKeySequence::MoveToEndOfDocument
partially evaluated: ke == QKeySequence::MoveToEndOfDocument
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:2532
0-2532
1530 || ke == QKeySequence::SelectNextWord
partially evaluated: ke == QKeySequence::SelectNextWord
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:2532
0-2532
1531 || ke == QKeySequence::SelectPreviousWord
partially evaluated: ke == QKeySequence::SelectPreviousWord
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:2532
0-2532
1532 || ke == QKeySequence::SelectStartOfLine
partially evaluated: ke == QKeySequence::SelectStartOfLine
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:2532
0-2532
1533 || ke == QKeySequence::SelectEndOfLine
evaluated: ke == QKeySequence::SelectEndOfLine
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:2531
1-2531
1534 || ke == QKeySequence::SelectStartOfBlock
partially evaluated: ke == QKeySequence::SelectStartOfBlock
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:2531
0-2531
1535 || ke == QKeySequence::SelectEndOfBlock
partially evaluated: ke == QKeySequence::SelectEndOfBlock
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:2531
0-2531
1536 || ke == QKeySequence::SelectStartOfDocument
partially evaluated: ke == QKeySequence::SelectStartOfDocument
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:2531
0-2531
1537 || ke == QKeySequence::SelectAll
partially evaluated: ke == QKeySequence::SelectAll
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:2531
0-2531
1538 || ke == QKeySequence::SelectEndOfDocument) {
partially evaluated: ke == QKeySequence::SelectEndOfDocument
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:2531
0-2531
1539 ke->accept();
executed (the execution status of this line is deduced): ke->accept();
-
1540 } else if (ke->modifiers() == Qt::NoModifier || ke->modifiers() == Qt::ShiftModifier
executed: }
Execution Count:5
evaluated: ke->modifiers() == Qt::NoModifier
TRUEFALSE
yes
Evaluation Count:2439
yes
Evaluation Count:92
evaluated: ke->modifiers() == Qt::ShiftModifier
TRUEFALSE
yes
Evaluation Count:82
yes
Evaluation Count:10
5-2439
1541 || ke->modifiers() == Qt::KeypadModifier) {
evaluated: ke->modifiers() == Qt::KeypadModifier
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:8
2-8
1542 if (ke->key() < Qt::Key_Escape) {
evaluated: ke->key() < Qt::Key_Escape
TRUEFALSE
yes
Evaluation Count:820
yes
Evaluation Count:1703
820-1703
1543 ke->accept();
executed (the execution status of this line is deduced): ke->accept();
-
1544 } else {
executed: }
Execution Count:820
820
1545 switch (ke->key()) { -
1546 case Qt::Key_Delete: -
1547 case Qt::Key_Home: -
1548 case Qt::Key_End: -
1549 case Qt::Key_Backspace: -
1550 case Qt::Key_Left: -
1551 case Qt::Key_Right: -
1552 ke->accept();
executed (the execution status of this line is deduced): ke->accept();
-
1553 default: -
1554 break;
executed: break;
Execution Count:1703
1703
1555 } -
1556 }
executed: }
Execution Count:1703
1703
1557 } -
1558} -
1559#endif -
1560 -
1561void QWidgetLineControl::processKeyEvent(QKeyEvent* event) -
1562{ -
1563 bool inlineCompletionAccepted = false;
executed (the execution status of this line is deduced): bool inlineCompletionAccepted = false;
-
1564 -
1565#ifndef QT_NO_COMPLETER -
1566 if (m_completer) {
evaluated: m_completer
TRUEFALSE
yes
Evaluation Count:14
yes
Evaluation Count:1165
14-1165
1567 QCompleter::CompletionMode completionMode = m_completer->completionMode();
executed (the execution status of this line is deduced): QCompleter::CompletionMode completionMode = m_completer->completionMode();
-
1568 if ((completionMode == QCompleter::PopupCompletion
evaluated: completionMode == QCompleter::PopupCompletion
TRUEFALSE
yes
Evaluation Count:12
yes
Evaluation Count:2
2-12
1569 || completionMode == QCompleter::UnfilteredPopupCompletion)
partially evaluated: completionMode == QCompleter::UnfilteredPopupCompletion
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:2
0-2
1570 && m_completer->popup()
partially evaluated: m_completer->popup()
TRUEFALSE
yes
Evaluation Count:12
no
Evaluation Count:0
0-12
1571 && m_completer->popup()->isVisible()) {
evaluated: m_completer->popup()->isVisible()
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:10
2-10
1572 // The following keys are forwarded by the completer to the widget -
1573 // Ignoring the events lets the completer provide suitable default behavior -
1574 switch (event->key()) { -
1575 case Qt::Key_Escape: -
1576 event->ignore();
never executed (the execution status of this line is deduced): event->ignore();
-
1577 return;
never executed: return;
0
1578 case Qt::Key_Enter: -
1579 case Qt::Key_Return: -
1580 case Qt::Key_F4: -
1581#ifdef QT_KEYPAD_NAVIGATION -
1582 case Qt::Key_Select: -
1583 if (!QApplication::keypadNavigationEnabled()) -
1584 break; -
1585#endif -
1586 m_completer->popup()->hide(); // just hide. will end up propagating to parent
executed (the execution status of this line is deduced): m_completer->popup()->hide();
-
1587 default: -
1588 break; // normal key processing
executed: break;
Execution Count:2
2
1589 } -
1590 } else if (completionMode == QCompleter::InlineCompletion) {
executed: }
Execution Count:2
evaluated: completionMode == QCompleter::InlineCompletion
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:10
2-10
1591 switch (event->key()) { -
1592 case Qt::Key_Enter: -
1593 case Qt::Key_Return: -
1594 case Qt::Key_F4: -
1595#ifdef QT_KEYPAD_NAVIGATION -
1596 case Qt::Key_Select: -
1597 if (!QApplication::keypadNavigationEnabled()) -
1598 break; -
1599#endif -
1600 if (!m_completer->currentCompletion().isEmpty() && hasSelectedText()
never evaluated: !m_completer->currentCompletion().isEmpty()
never evaluated: hasSelectedText()
0
1601 && textAfterSelection().isEmpty()) {
never evaluated: textAfterSelection().isEmpty()
0
1602 setText(m_completer->currentCompletion());
never executed (the execution status of this line is deduced): setText(m_completer->currentCompletion());
-
1603 inlineCompletionAccepted = true;
never executed (the execution status of this line is deduced): inlineCompletionAccepted = true;
-
1604 }
never executed: }
0
1605 default: -
1606 break; // normal key processing
executed: break;
Execution Count:2
2
1607 } -
1608 }
executed: }
Execution Count:2
2
1609 } -
1610#endif // QT_NO_COMPLETER -
1611 -
1612 if (event->key() == Qt::Key_Enter || event->key() == Qt::Key_Return) {
evaluated: event->key() == Qt::Key_Enter
TRUEFALSE
yes
Evaluation Count:12
yes
Evaluation Count:1167
evaluated: event->key() == Qt::Key_Return
TRUEFALSE
yes
Evaluation Count:21
yes
Evaluation Count:1146
12-1167
1613 if (hasAcceptableInput() || fixup()) {
evaluated: hasAcceptableInput()
TRUEFALSE
yes
Evaluation Count:12
yes
Evaluation Count:21
partially evaluated: fixup()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:21
0-21
1614 emit accepted();
executed (the execution status of this line is deduced): accepted();
-
1615 emit editingFinished();
executed (the execution status of this line is deduced): editingFinished();
-
1616 }
executed: }
Execution Count:12
12
1617 if (inlineCompletionAccepted)
partially evaluated: inlineCompletionAccepted
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:33
0-33
1618 event->accept();
never executed: event->accept();
0
1619 else -
1620 event->ignore();
executed: event->ignore();
Execution Count:33
33
1621 return;
executed: return;
Execution Count:33
33
1622 } -
1623 -
1624 if (echoMode() == QLineEdit::PasswordEchoOnEdit
partially evaluated: echoMode() == QLineEdit::PasswordEchoOnEdit
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1146
0-1146
1625 && !passwordEchoEditing()
never evaluated: !passwordEchoEditing()
0
1626 && !isReadOnly()
never evaluated: !isReadOnly()
0
1627 && !event->text().isEmpty()
never evaluated: !event->text().isEmpty()
0
1628#ifdef QT_KEYPAD_NAVIGATION
executed (the execution status of this line is deduced):
-
1629 && event->key() != Qt::Key_Select
executed (the execution status of this line is deduced):
-
1630 && event->key() != Qt::Key_Up
executed (the execution status of this line is deduced):
-
1631 && event->key() != Qt::Key_Down
executed (the execution status of this line is deduced):
-
1632 && event->key() != Qt::Key_Back
executed (the execution status of this line is deduced):
-
1633#endif
executed (the execution status of this line is deduced):
-
1634 && !(event->modifiers() & Qt::ControlModifier)) {
never evaluated: !(event->modifiers() & Qt::ControlModifier)
0
1635 // Clear the edit and reset to normal echo mode while editing; the -
1636 // echo mode switches back when the edit loses focus -
1637 // ### resets current content. dubious code; you can -
1638 // navigate with keys up, down, back, and select(?), but if you press -
1639 // "left" or "right" it clears? -
1640 updatePasswordEchoEditing(true);
never executed (the execution status of this line is deduced): updatePasswordEchoEditing(true);
-
1641 clear();
never executed (the execution status of this line is deduced): clear();
-
1642 }
never executed: }
0
1643 -
1644 bool unknown = false;
executed (the execution status of this line is deduced): bool unknown = false;
-
1645 bool visual = cursorMoveStyle() == Qt::VisualMoveStyle;
executed (the execution status of this line is deduced): bool visual = cursorMoveStyle() == Qt::VisualMoveStyle;
-
1646 -
1647 if (false) {
partially evaluated: false
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1146
0-1146
1648 }
never executed: }
0
1649#ifndef QT_NO_SHORTCUT -
1650 else if (event == QKeySequence::Undo) {
evaluated: event == QKeySequence::Undo
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:1145
1-1145
1651 if (!isReadOnly())
partially evaluated: !isReadOnly()
TRUEFALSE
yes
Evaluation Count:1
no
Evaluation Count:0
0-1
1652 undo();
executed: undo();
Execution Count:1
1
1653 }
executed: }
Execution Count:1
1
1654 else if (event == QKeySequence::Redo) {
evaluated: event == QKeySequence::Redo
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:1144
1-1144
1655 if (!isReadOnly())
partially evaluated: !isReadOnly()
TRUEFALSE
yes
Evaluation Count:1
no
Evaluation Count:0
0-1
1656 redo();
executed: redo();
Execution Count:1
1
1657 }
executed: }
Execution Count:1
1
1658 else if (event == QKeySequence::SelectAll) {
partially evaluated: event == QKeySequence::SelectAll
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1144
0-1144
1659 selectAll();
never executed (the execution status of this line is deduced): selectAll();
-
1660 }
never executed: }
0
1661#ifndef QT_NO_CLIPBOARD -
1662 else if (event == QKeySequence::Copy) {
partially evaluated: event == QKeySequence::Copy
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1144
0-1144
1663 copy();
never executed (the execution status of this line is deduced): copy();
-
1664 }
never executed: }
0
1665 else if (event == QKeySequence::Paste) {
partially evaluated: event == QKeySequence::Paste
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1144
0-1144
1666 if (!isReadOnly()) {
never evaluated: !isReadOnly()
0
1667 QClipboard::Mode mode = QClipboard::Clipboard;
never executed (the execution status of this line is deduced): QClipboard::Mode mode = QClipboard::Clipboard;
-
1668 if (m_keyboardScheme == QPlatformTheme::X11KeyboardScheme
never evaluated: m_keyboardScheme == QPlatformTheme::X11KeyboardScheme
0
1669 && event->modifiers() == (Qt::CTRL | Qt::SHIFT)
never evaluated: event->modifiers() == (Qt::CTRL | Qt::SHIFT)
0
1670 && event->key() == Qt::Key_Insert) {
never evaluated: event->key() == Qt::Key_Insert
0
1671 mode = QClipboard::Selection;
never executed (the execution status of this line is deduced): mode = QClipboard::Selection;
-
1672 }
never executed: }
0
1673 paste(mode);
never executed (the execution status of this line is deduced): paste(mode);
-
1674 }
never executed: }
0
1675 }
never executed: }
0
1676 else if (event == QKeySequence::Cut) {
partially evaluated: event == QKeySequence::Cut
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1144
0-1144
1677 if (!isReadOnly()) {
never evaluated: !isReadOnly()
0
1678 copy();
never executed (the execution status of this line is deduced): copy();
-
1679 del();
never executed (the execution status of this line is deduced): del();
-
1680 }
never executed: }
0
1681 }
never executed: }
0
1682 else if (event == QKeySequence::DeleteEndOfLine) {
partially evaluated: event == QKeySequence::DeleteEndOfLine
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1144
0-1144
1683 if (!isReadOnly()) {
never evaluated: !isReadOnly()
0
1684 setSelection(cursor(), end());
never executed (the execution status of this line is deduced): setSelection(cursor(), end());
-
1685 copy();
never executed (the execution status of this line is deduced): copy();
-
1686 del();
never executed (the execution status of this line is deduced): del();
-
1687 }
never executed: }
0
1688 }
never executed: }
0
1689#endif //QT_NO_CLIPBOARD -
1690 else if (event == QKeySequence::MoveToStartOfLine || event == QKeySequence::MoveToStartOfBlock) {
evaluated: event == QKeySequence::MoveToStartOfLine
TRUEFALSE
yes
Evaluation Count:24
yes
Evaluation Count:1120
partially evaluated: event == QKeySequence::MoveToStartOfBlock
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1120
0-1120
1691 home(0);
executed (the execution status of this line is deduced): home(0);
-
1692 }
executed: }
Execution Count:24
24
1693 else if (event == QKeySequence::MoveToEndOfLine || event == QKeySequence::MoveToEndOfBlock) {
evaluated: event == QKeySequence::MoveToEndOfLine
TRUEFALSE
yes
Evaluation Count:26
yes
Evaluation Count:1094
partially evaluated: event == QKeySequence::MoveToEndOfBlock
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1094
0-1094
1694 end(0);
executed (the execution status of this line is deduced): end(0);
-
1695 }
executed: }
Execution Count:26
26
1696 else if (event == QKeySequence::SelectStartOfLine || event == QKeySequence::SelectStartOfBlock) {
partially evaluated: event == QKeySequence::SelectStartOfLine
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1094
partially evaluated: event == QKeySequence::SelectStartOfBlock
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1094
0-1094
1697 home(1);
never executed (the execution status of this line is deduced): home(1);
-
1698 }
never executed: }
0
1699 else if (event == QKeySequence::SelectEndOfLine || event == QKeySequence::SelectEndOfBlock) {
evaluated: event == QKeySequence::SelectEndOfLine
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:1093
partially evaluated: event == QKeySequence::SelectEndOfBlock
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1093
0-1093
1700 end(1);
executed (the execution status of this line is deduced): end(1);
-
1701 }
executed: }
Execution Count:1
1
1702 else if (event == QKeySequence::MoveToNextChar) {
evaluated: event == QKeySequence::MoveToNextChar
TRUEFALSE
yes
Evaluation Count:75
yes
Evaluation Count:1018
75-1018
1703#if defined(QT_NO_COMPLETER) -
1704 const bool inlineCompletion = false; -
1705#else -
1706 const bool inlineCompletion = m_completer && m_completer->completionMode() == QCompleter::InlineCompletion;
partially evaluated: m_completer
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:75
never evaluated: m_completer->completionMode() == QCompleter::InlineCompletion
0-75
1707#endif -
1708 if (hasSelectedText()
partially evaluated: hasSelectedText()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:75
0-75
1709 && (m_keyboardScheme != QPlatformTheme::WindowsKeyboardScheme
never evaluated: m_keyboardScheme != QPlatformTheme::WindowsKeyboardScheme
0
1710 || inlineCompletion)) {
never evaluated: inlineCompletion
0
1711 moveCursor(selectionEnd(), false);
never executed (the execution status of this line is deduced): moveCursor(selectionEnd(), false);
-
1712 } else {
never executed: }
0
1713 cursorForward(0, visual ? 1 : (layoutDirection() == Qt::LeftToRight ? 1 : -1));
executed (the execution status of this line is deduced): cursorForward(0, visual ? 1 : (layoutDirection() == Qt::LeftToRight ? 1 : -1));
-
1714 }
executed: }
Execution Count:75
75
1715 } -
1716 else if (event == QKeySequence::SelectNextChar) {
evaluated: event == QKeySequence::SelectNextChar
TRUEFALSE
yes
Evaluation Count:14
yes
Evaluation Count:1004
14-1004
1717 cursorForward(1, visual ? 1 : (layoutDirection() == Qt::LeftToRight ? 1 : -1));
executed (the execution status of this line is deduced): cursorForward(1, visual ? 1 : (layoutDirection() == Qt::LeftToRight ? 1 : -1));
-
1718 }
executed: }
Execution Count:14
14
1719 else if (event == QKeySequence::MoveToPreviousChar) {
evaluated: event == QKeySequence::MoveToPreviousChar
TRUEFALSE
yes
Evaluation Count:10
yes
Evaluation Count:994
10-994
1720#if defined(QT_NO_COMPLETER) -
1721 const bool inlineCompletion = false; -
1722#else -
1723 const bool inlineCompletion = m_completer && m_completer->completionMode() == QCompleter::InlineCompletion;
partially evaluated: m_completer
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:10
never evaluated: m_completer->completionMode() == QCompleter::InlineCompletion
0-10
1724#endif -
1725 if (hasSelectedText()
evaluated: hasSelectedText()
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:9
1-9
1726 && (m_keyboardScheme != QPlatformTheme::WindowsKeyboardScheme
partially evaluated: m_keyboardScheme != QPlatformTheme::WindowsKeyboardScheme
TRUEFALSE
yes
Evaluation Count:1
no
Evaluation Count:0
0-1
1727 || inlineCompletion)) {
never evaluated: inlineCompletion
0
1728 moveCursor(selectionStart(), false);
executed (the execution status of this line is deduced): moveCursor(selectionStart(), false);
-
1729 } else {
executed: }
Execution Count:1
1
1730 cursorForward(0, visual ? -1 : (layoutDirection() == Qt::LeftToRight ? -1 : 1));
executed (the execution status of this line is deduced): cursorForward(0, visual ? -1 : (layoutDirection() == Qt::LeftToRight ? -1 : 1));
-
1731 }
executed: }
Execution Count:9
9
1732 } -
1733 else if (event == QKeySequence::SelectPreviousChar) {
evaluated: event == QKeySequence::SelectPreviousChar
TRUEFALSE
yes
Evaluation Count:15
yes
Evaluation Count:979
15-979
1734 cursorForward(1, visual ? -1 : (layoutDirection() == Qt::LeftToRight ? -1 : 1));
executed (the execution status of this line is deduced): cursorForward(1, visual ? -1 : (layoutDirection() == Qt::LeftToRight ? -1 : 1));
-
1735 }
executed: }
Execution Count:15
15
1736 else if (event == QKeySequence::MoveToNextWord) {
partially evaluated: event == QKeySequence::MoveToNextWord
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:979
0-979
1737 if (echoMode() == QLineEdit::Normal)
never evaluated: echoMode() == QLineEdit::Normal
0
1738 layoutDirection() == Qt::LeftToRight ? cursorWordForward(0) : cursorWordBackward(0);
never executed: layoutDirection() == Qt::LeftToRight ? cursorWordForward(0) : cursorWordBackward(0);
0
1739 else -
1740 layoutDirection() == Qt::LeftToRight ? end(0) : home(0);
never executed: layoutDirection() == Qt::LeftToRight ? end(0) : home(0);
0
1741 } -
1742 else if (event == QKeySequence::MoveToPreviousWord) {
partially evaluated: event == QKeySequence::MoveToPreviousWord
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:979
0-979
1743 if (echoMode() == QLineEdit::Normal)
never evaluated: echoMode() == QLineEdit::Normal
0
1744 layoutDirection() == Qt::LeftToRight ? cursorWordBackward(0) : cursorWordForward(0);
never executed: layoutDirection() == Qt::LeftToRight ? cursorWordBackward(0) : cursorWordForward(0);
0
1745 else if (!isReadOnly()) {
never evaluated: !isReadOnly()
0
1746 layoutDirection() == Qt::LeftToRight ? home(0) : end(0);
never executed (the execution status of this line is deduced): layoutDirection() == Qt::LeftToRight ? home(0) : end(0);
-
1747 }
never executed: }
0
1748 } -
1749 else if (event == QKeySequence::SelectNextWord) {
partially evaluated: event == QKeySequence::SelectNextWord
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:979
0-979
1750 if (echoMode() == QLineEdit::Normal)
never evaluated: echoMode() == QLineEdit::Normal
0
1751 layoutDirection() == Qt::LeftToRight ? cursorWordForward(1) : cursorWordBackward(1);
never executed: layoutDirection() == Qt::LeftToRight ? cursorWordForward(1) : cursorWordBackward(1);
0
1752 else -
1753 layoutDirection() == Qt::LeftToRight ? end(1) : home(1);
never executed: layoutDirection() == Qt::LeftToRight ? end(1) : home(1);
0
1754 } -
1755 else if (event == QKeySequence::SelectPreviousWord) {
partially evaluated: event == QKeySequence::SelectPreviousWord
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:979
0-979
1756 if (echoMode() == QLineEdit::Normal)
never evaluated: echoMode() == QLineEdit::Normal
0
1757 layoutDirection() == Qt::LeftToRight ? cursorWordBackward(1) : cursorWordForward(1);
never executed: layoutDirection() == Qt::LeftToRight ? cursorWordBackward(1) : cursorWordForward(1);
0
1758 else -
1759 layoutDirection() == Qt::LeftToRight ? home(1) : end(1);
never executed: layoutDirection() == Qt::LeftToRight ? home(1) : end(1);
0
1760 } -
1761 else if (event == QKeySequence::Delete) {
evaluated: event == QKeySequence::Delete
TRUEFALSE
yes
Evaluation Count:68
yes
Evaluation Count:911
68-911
1762 if (!isReadOnly())
partially evaluated: !isReadOnly()
TRUEFALSE
yes
Evaluation Count:68
no
Evaluation Count:0
0-68
1763 del();
executed: del();
Execution Count:68
68
1764 }
executed: }
Execution Count:68
68
1765 else if (event == QKeySequence::DeleteEndOfWord) {
partially evaluated: event == QKeySequence::DeleteEndOfWord
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:911
0-911
1766 if (!isReadOnly()) {
never evaluated: !isReadOnly()
0
1767 cursorWordForward(true);
never executed (the execution status of this line is deduced): cursorWordForward(true);
-
1768 del();
never executed (the execution status of this line is deduced): del();
-
1769 }
never executed: }
0
1770 }
never executed: }
0
1771 else if (event == QKeySequence::DeleteStartOfWord) {
partially evaluated: event == QKeySequence::DeleteStartOfWord
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:911
0-911
1772 if (!isReadOnly()) {
never evaluated: !isReadOnly()
0
1773 cursorWordBackward(true);
never executed (the execution status of this line is deduced): cursorWordBackward(true);
-
1774 del();
never executed (the execution status of this line is deduced): del();
-
1775 }
never executed: }
0
1776 }
never executed: }
0
1777#endif // QT_NO_SHORTCUT -
1778 else { -
1779 bool handled = false;
executed (the execution status of this line is deduced): bool handled = false;
-
1780 if (m_keyboardScheme == QPlatformTheme::MacKeyboardScheme
partially evaluated: m_keyboardScheme == QPlatformTheme::MacKeyboardScheme
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:911
0-911
1781 && (event->key() == Qt::Key_Up || event->key() == Qt::Key_Down)) {
never evaluated: event->key() == Qt::Key_Up
never evaluated: event->key() == Qt::Key_Down
0
1782 Qt::KeyboardModifiers myModifiers = (event->modifiers() & ~Qt::KeypadModifier);
never executed (the execution status of this line is deduced): Qt::KeyboardModifiers myModifiers = (event->modifiers() & ~Qt::KeypadModifier);
-
1783 if (myModifiers & Qt::ShiftModifier) {
never evaluated: myModifiers & Qt::ShiftModifier
0
1784 if (myModifiers == (Qt::ControlModifier|Qt::ShiftModifier)
never evaluated: myModifiers == (Qt::ControlModifier|Qt::ShiftModifier)
0
1785 || myModifiers == (Qt::AltModifier|Qt::ShiftModifier)
never evaluated: myModifiers == (Qt::AltModifier|Qt::ShiftModifier)
0
1786 || myModifiers == Qt::ShiftModifier) {
never evaluated: myModifiers == Qt::ShiftModifier
0
1787 -
1788 event->key() == Qt::Key_Up ? home(1) : end(1);
never executed (the execution status of this line is deduced): event->key() == Qt::Key_Up ? home(1) : end(1);
-
1789 }
never executed: }
0
1790 } else {
never executed: }
0
1791 if ((myModifiers == Qt::ControlModifier
never evaluated: myModifiers == Qt::ControlModifier
0
1792 || myModifiers == Qt::AltModifier
never evaluated: myModifiers == Qt::AltModifier
0
1793 || myModifiers == Qt::NoModifier)) {
never evaluated: myModifiers == Qt::NoModifier
0
1794 event->key() == Qt::Key_Up ? home(0) : end(0);
never executed (the execution status of this line is deduced): event->key() == Qt::Key_Up ? home(0) : end(0);
-
1795 }
never executed: }
0
1796 }
never executed: }
0
1797 handled = true;
never executed (the execution status of this line is deduced): handled = true;
-
1798 }
never executed: }
0
1799 if (event->modifiers() & Qt::ControlModifier) {
evaluated: event->modifiers() & Qt::ControlModifier
TRUEFALSE
yes
Evaluation Count:5
yes
Evaluation Count:906
5-906
1800 switch (event->key()) { -
1801 case Qt::Key_Backspace: -
1802 if (!isReadOnly()) {
never evaluated: !isReadOnly()
0
1803 cursorWordBackward(true);
never executed (the execution status of this line is deduced): cursorWordBackward(true);
-
1804 del();
never executed (the execution status of this line is deduced): del();
-
1805 }
never executed: }
0
1806 break;
never executed: break;
0
1807#ifndef QT_NO_COMPLETER -
1808 case Qt::Key_Up: -
1809 case Qt::Key_Down: -
1810 complete(event->key());
never executed (the execution status of this line is deduced): complete(event->key());
-
1811 break;
never executed: break;
0
1812#endif -
1813 case Qt::Key_E: -
1814 if (m_keyboardScheme == QPlatformTheme::X11KeyboardScheme)
never evaluated: m_keyboardScheme == QPlatformTheme::X11KeyboardScheme
0
1815 end(0);
never executed: end(0);
0
1816 break;
never executed: break;
0
1817 -
1818 case Qt::Key_U: -
1819 if (m_keyboardScheme == QPlatformTheme::X11KeyboardScheme && !isReadOnly()) {
never evaluated: m_keyboardScheme == QPlatformTheme::X11KeyboardScheme
never evaluated: !isReadOnly()
0
1820 setSelection(0, text().size());
never executed (the execution status of this line is deduced): setSelection(0, text().size());
-
1821#ifndef QT_NO_CLIPBOARD -
1822 copy();
never executed (the execution status of this line is deduced): copy();
-
1823#endif -
1824 del();
never executed (the execution status of this line is deduced): del();
-
1825 }
never executed: }
0
1826 break;
never executed: break;
0
1827 default: -
1828 if (!handled)
partially evaluated: !handled
TRUEFALSE
yes
Evaluation Count:5
no
Evaluation Count:0
0-5
1829 unknown = true;
executed: unknown = true;
Execution Count:5
5
1830 }
executed: }
Execution Count:5
5
1831 } else { // ### check for *no* modifier
executed: }
Execution Count:5
5
1832 switch (event->key()) { -
1833 case Qt::Key_Backspace: -
1834 if (!isReadOnly()) {
partially evaluated: !isReadOnly()
TRUEFALSE
yes
Evaluation Count:45
no
Evaluation Count:0
0-45
1835 backspace();
executed (the execution status of this line is deduced): backspace();
-
1836#ifndef QT_NO_COMPLETER -
1837 complete(Qt::Key_Backspace);
executed (the execution status of this line is deduced): complete(Qt::Key_Backspace);
-
1838#endif -
1839 }
executed: }
Execution Count:45
45
1840 break;
executed: break;
Execution Count:45
45
1841#ifdef QT_KEYPAD_NAVIGATION -
1842 case Qt::Key_Back: -
1843 if (QApplication::keypadNavigationEnabled() && !event->isAutoRepeat() -
1844 && !isReadOnly()) { -
1845 if (text().length() == 0) { -
1846 setText(m_cancelText); -
1847 -
1848 if (passwordEchoEditing()) -
1849 updatePasswordEchoEditing(false); -
1850 -
1851 emit editFocusChange(false); -
1852 } else if (!m_deleteAllTimer) { -
1853 m_deleteAllTimer = startTimer(750); -
1854 } -
1855 } else { -
1856 unknown = true; -
1857 } -
1858 break; -
1859#endif -
1860 default: -
1861 if (!handled)
partially evaluated: !handled
TRUEFALSE
yes
Evaluation Count:861
no
Evaluation Count:0
0-861
1862 unknown = true;
executed: unknown = true;
Execution Count:861
861
1863 }
executed: }
Execution Count:861
861
1864 }
executed: }
Execution Count:906
906
1865 } -
1866 -
1867 if (event->key() == Qt::Key_Direction_L || event->key() == Qt::Key_Direction_R) {
partially evaluated: event->key() == Qt::Key_Direction_L
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1146
partially evaluated: event->key() == Qt::Key_Direction_R
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1146
0-1146
1868 setLayoutDirection((event->key() == Qt::Key_Direction_L) ? Qt::LeftToRight : Qt::RightToLeft);
never executed (the execution status of this line is deduced): setLayoutDirection((event->key() == Qt::Key_Direction_L) ? Qt::LeftToRight : Qt::RightToLeft);
-
1869 unknown = false;
never executed (the execution status of this line is deduced): unknown = false;
-
1870 }
never executed: }
0
1871 -
1872 if (unknown && !isReadOnly()) {
evaluated: unknown
TRUEFALSE
yes
Evaluation Count:866
yes
Evaluation Count:280
partially evaluated: !isReadOnly()
TRUEFALSE
yes
Evaluation Count:866
no
Evaluation Count:0
0-866
1873 QString t = event->text();
executed (the execution status of this line is deduced): QString t = event->text();
-
1874 if (!t.isEmpty() && t.at(0).isPrint()) {
evaluated: !t.isEmpty()
TRUEFALSE
yes
Evaluation Count:818
yes
Evaluation Count:48
partially evaluated: t.at(0).isPrint()
TRUEFALSE
yes
Evaluation Count:818
no
Evaluation Count:0
0-818
1875 insert(t);
executed (the execution status of this line is deduced): insert(t);
-
1876#ifndef QT_NO_COMPLETER -
1877 complete(event->key());
executed (the execution status of this line is deduced): complete(event->key());
-
1878#endif -
1879 event->accept();
executed (the execution status of this line is deduced): event->accept();
-
1880 return;
executed: return;
Execution Count:817
817
1881 } -
1882 }
executed: }
Execution Count:48
48
1883 -
1884 if (unknown)
evaluated: unknown
TRUEFALSE
yes
Evaluation Count:48
yes
Evaluation Count:280
48-280
1885 event->ignore();
executed: event->ignore();
Execution Count:48
48
1886 else -
1887 event->accept();
executed: event->accept();
Execution Count:280
280
1888} -
1889 -
1890bool QWidgetLineControl::isUndoAvailable() const -
1891{ -
1892 // For security reasons undo is not available in any password mode (NoEcho included) -
1893 // with the exception that the user can clear the password with undo. -
1894 return !m_readOnly && m_undoState
executed: return !m_readOnly && m_undoState && (m_echoMode == QLineEdit::Normal || m_history[m_undoState - 1].type == QWidgetLineControl::Insert);
Execution Count:239
239
1895 && (m_echoMode == QLineEdit::Normal || m_history[m_undoState - 1].type == QWidgetLineControl::Insert);
executed: return !m_readOnly && m_undoState && (m_echoMode == QLineEdit::Normal || m_history[m_undoState - 1].type == QWidgetLineControl::Insert);
Execution Count:239
239
1896} -
1897 -
1898bool QWidgetLineControl::isRedoAvailable() const -
1899{ -
1900 // Same as with undo. Disabled for password modes. -
1901 return !m_readOnly
executed: return !m_readOnly && m_echoMode == QLineEdit::Normal && m_undoState < m_history.size();
Execution Count:5
5
1902 && m_echoMode == QLineEdit::Normal
executed: return !m_readOnly && m_echoMode == QLineEdit::Normal && m_undoState < m_history.size();
Execution Count:5
5
1903 && m_undoState < m_history.size();
executed: return !m_readOnly && m_echoMode == QLineEdit::Normal && m_undoState < m_history.size();
Execution Count:5
5
1904} -
1905 -
1906QT_END_NAMESPACE -
1907 -
1908#endif -
1909 -
Source codeSwitch to Preprocessed file

Generated by Squish Coco Non-Commercial