qwidgetlinecontrol.cpp

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

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