OpenCoverage

qquicktextinput.cpp

Absolute File Name:/home/opencoverage/opencoverage/guest-scripts/qtdeclarative/src/qtdeclarative/src/quick/items/qquicktextinput.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 QtQuick 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 "qquicktextinput_p.h"-
41#include "qquicktextinput_p_p.h"-
42#include "qquickwindow.h"-
43-
44#include <private/qqmlglobal_p.h>-
45#include <private/qv4scopedvalue_p.h>-
46-
47#include <QtCore/qcoreapplication.h>-
48#include <QtCore/qmimedata.h>-
49#include <QtQml/qqmlinfo.h>-
50#include <QtGui/qevent.h>-
51#include <QTextBoundaryFinder>-
52#include "qquicktextnode_p.h"-
53#include <QtQuick/qsgsimplerectnode.h>-
54-
55#include <QtGui/qstylehints.h>-
56#include <QtGui/qinputmethod.h>-
57#include <QtCore/qmath.h>-
58-
59#if QT_CONFIG(accessibility)-
60#include "qaccessible.h"-
61#include "qquickaccessibleattached_p.h"-
62#endif-
63-
64#include <QtGui/private/qtextengine_p.h>-
65#include <QtGui/private/qinputcontrol_p.h>-
66-
67QT_BEGIN_NAMESPACE-
68-
69DEFINE_BOOL_CONFIG_OPTION(qmlDisableDistanceField, QML_DISABLE_DISTANCEFIELD)
never executed: status = Yes;
never executed: end of block
executed 10 times by 5 tests: end of block
Executed by:
  • tst_examples
  • tst_qquickitem
  • tst_qquickitem2
  • tst_qquicktextedit
  • tst_qquicktextinput
executed 7132 times by 5 tests: return status == Yes;
Executed by:
  • tst_examples
  • tst_qquickitem
  • tst_qquickitem2
  • tst_qquicktextedit
  • tst_qquicktextinput
status == UnknownDescription
TRUEevaluated 10 times by 5 tests
Evaluated by:
  • tst_examples
  • tst_qquickitem
  • tst_qquickitem2
  • tst_qquicktextedit
  • tst_qquicktextinput
FALSEevaluated 7122 times by 5 tests
Evaluated by:
  • tst_examples
  • tst_qquickitem
  • tst_qquickitem2
  • tst_qquicktextedit
  • tst_qquicktextinput
__builtin_expe...ELD")), false)Description
TRUEnever evaluated
FALSEevaluated 10 times by 5 tests
Evaluated by:
  • tst_examples
  • tst_qquickitem
  • tst_qquickitem2
  • tst_qquicktextedit
  • tst_qquicktextinput
v != "0"Description
TRUEnever evaluated
FALSEnever evaluated
v != "false"Description
TRUEnever evaluated
FALSEnever evaluated
0-7132
70-
71/*!-
72 \qmltype TextInput-
73 \instantiates QQuickTextInput-
74 \inqmlmodule QtQuick-
75 \ingroup qtquick-visual-
76 \ingroup qtquick-input-
77 \inherits Item-
78 \brief Displays an editable line of text.-
79-
80 The TextInput type displays a single line of editable plain text.-
81-
82 TextInput is used to accept a line of text input. Input constraints-
83 can be placed on a TextInput item (for example, through a \l validator or \l inputMask),-
84 and setting \l echoMode to an appropriate value enables TextInput to be used for-
85 a password input field.-
86-
87 On \macos, the Up/Down key bindings for Home/End are explicitly disabled.-
88 If you want such bindings (on any platform), you will need to construct them in QML.-
89-
90 \sa TextEdit, Text-
91*/-
92QQuickTextInput::QQuickTextInput(QQuickItem* parent)-
93: QQuickImplicitSizeItem(*(new QQuickTextInputPrivate), parent)-
94{-
95 Q_D(QQuickTextInput);-
96 d->init();-
97}
executed 1042 times by 5 tests: end of block
Executed by:
  • tst_examples
  • tst_qquickitem
  • tst_qquickitem2
  • tst_qquicktextedit
  • tst_qquicktextinput
1042
98-
99QQuickTextInput::QQuickTextInput(QQuickTextInputPrivate &dd, QQuickItem *parent)-
100: QQuickImplicitSizeItem(dd, parent)-
101{-
102 Q_D(QQuickTextInput);-
103 d->init();-
104}
never executed: end of block
0
105-
106QQuickTextInput::~QQuickTextInput()-
107{-
108}-
109-
110void QQuickTextInput::componentComplete()-
111{-
112 Q_D(QQuickTextInput);-
113-
114 QQuickImplicitSizeItem::componentComplete();-
115-
116 d->checkIsValid();-
117 d->updateLayout();-
118 updateCursorRectangle();-
119 if (d->cursorComponent && isCursorVisible())
isCursorVisible()Description
TRUEnever evaluated
FALSEevaluated 14 times by 1 test
Evaluated by:
  • tst_qquicktextinput
0-14
120 QQuickTextUtil::createCursor(d);
never executed: QQuickTextUtil::createCursor(d);
0
121}
executed 1022 times by 5 tests: end of block
Executed by:
  • tst_examples
  • tst_qquickitem
  • tst_qquickitem2
  • tst_qquicktextedit
  • tst_qquicktextinput
1022
122-
123/*!-
124 \qmlproperty string QtQuick::TextInput::text-
125-
126 The text in the TextInput.-
127-
128 \sa clear()-
129*/-
130QString QQuickTextInput::text() const-
131{-
132 Q_D(const QQuickTextInput);-
133-
134 QString content = d->m_text;-
135 QString res = d->m_maskData ? d->stripString(content) : content;
d->m_maskDataDescription
TRUEevaluated 1164 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEevaluated 3310 times by 4 tests
Evaluated by:
  • tst_examples
  • tst_qquickitem
  • tst_qquickitem2
  • tst_qquicktextinput
1164-3310
136 return (res.isNull() ? QString::fromLatin1("") : res);
executed 4474 times by 4 tests: return (res.isNull() ? QString::fromLatin1("") : res);
Executed by:
  • tst_examples
  • tst_qquickitem
  • tst_qquickitem2
  • tst_qquicktextinput
4474
137}-
138-
139void QQuickTextInput::setText(const QString &s)-
140{-
141 Q_D(QQuickTextInput);-
142 if (s == text())
s == text()Description
TRUEevaluated 36 times by 2 tests
Evaluated by:
  • tst_examples
  • tst_qquicktextinput
FALSEevaluated 1244 times by 4 tests
Evaluated by:
  • tst_examples
  • tst_qquickitem
  • tst_qquickitem2
  • tst_qquicktextinput
36-1244
143 return;
executed 36 times by 2 tests: return;
Executed by:
  • tst_examples
  • tst_qquicktextinput
36
144-
145#if QT_CONFIG(im)-
146 d->cancelPreedit();-
147#endif-
148 d->internalSetText(s, -1, false);-
149}
executed 1244 times by 4 tests: end of block
Executed by:
  • tst_examples
  • tst_qquickitem
  • tst_qquickitem2
  • tst_qquicktextinput
1244
150-
151-
152/*!-
153 \qmlproperty enumeration QtQuick::TextInput::renderType-
154-
155 Override the default rendering type for this component.-
156-
157 Supported render types are:-
158 \list-
159 \li Text.QtRendering-
160 \li Text.NativeRendering-
161 \endlist-
162-
163 Select Text.NativeRendering if you prefer text to look native on the target platform and do-
164 not require advanced features such as transformation of the text. Using such features in-
165 combination with the NativeRendering render type will lend poor and sometimes pixelated-
166 results.-
167-
168 The default rendering type is determined by \l QQuickWindow::textRenderType().-
169*/-
170QQuickTextInput::RenderType QQuickTextInput::renderType() const-
171{-
172 Q_D(const QQuickTextInput);-
173 return d->renderType;
executed 6 times by 1 test: return d->renderType;
Executed by:
  • tst_qquicktextinput
6
174}-
175-
176void QQuickTextInput::setRenderType(QQuickTextInput::RenderType renderType)-
177{-
178 Q_D(QQuickTextInput);-
179 if (d->renderType == renderType)
d->renderType == renderTypeDescription
TRUEevaluated 2 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEevaluated 4 times by 1 test
Evaluated by:
  • tst_qquicktextinput
2-4
180 return;
executed 2 times by 1 test: return;
Executed by:
  • tst_qquicktextinput
2
181-
182 d->renderType = renderType;-
183 emit renderTypeChanged();-
184-
185 if (isComponentComplete())
isComponentComplete()Description
TRUEevaluated 4 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEnever evaluated
0-4
186 d->updateLayout();
executed 4 times by 1 test: d->updateLayout();
Executed by:
  • tst_qquicktextinput
4
187}
executed 4 times by 1 test: end of block
Executed by:
  • tst_qquicktextinput
4
188-
189/*!-
190 \qmlproperty int QtQuick::TextInput::length-
191-
192 Returns the total number of characters in the TextInput item.-
193-
194 If the TextInput has an inputMask the length will include mask characters and may differ-
195 from the length of the string returned by the \l text property.-
196-
197 This property can be faster than querying the length the \l text property as it doesn't-
198 require any copying or conversion of the TextInput's internal string data.-
199*/-
200-
201int QQuickTextInput::length() const-
202{-
203 Q_D(const QQuickTextInput);-
204 return d->m_text.length();
executed 166 times by 1 test: return d->m_text.length();
Executed by:
  • tst_qquicktextinput
166
205}-
206-
207/*!-
208 \qmlmethod string QtQuick::TextInput::getText(int start, int end)-
209-
210 Returns the section of text that is between the \a start and \a end positions.-
211-
212 If the TextInput has an inputMask the length will include mask characters.-
213*/-
214-
215QString QQuickTextInput::getText(int start, int end) const-
216{-
217 Q_D(const QQuickTextInput);-
218-
219 if (start > end)
start > endDescription
TRUEevaluated 2 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEevaluated 50 times by 1 test
Evaluated by:
  • tst_qquicktextinput
2-50
220 qSwap(start, end);
executed 2 times by 1 test: qSwap(start, end);
Executed by:
  • tst_qquicktextinput
2
221-
222 return d->m_text.mid(start, end - start);
executed 52 times by 1 test: return d->m_text.mid(start, end - start);
Executed by:
  • tst_qquicktextinput
52
223}-
224-
225QString QQuickTextInputPrivate::realText() const-
226{-
227 QString res = m_maskData ? stripString(m_text) : m_text;
m_maskDataDescription
TRUEnever evaluated
FALSEevaluated 4 times by 1 test
Evaluated by:
  • tst_qquicktextinput
0-4
228 return (res.isNull() ? QString::fromLatin1("") : res);
executed 4 times by 1 test: return (res.isNull() ? QString::fromLatin1("") : res);
Executed by:
  • tst_qquicktextinput
4
229}-
230-
231/*!-
232 \qmlproperty string QtQuick::TextInput::font.family-
233-
234 Sets the family name of the font.-
235-
236 The family name is case insensitive and may optionally include a foundry name, e.g. "Helvetica [Cronyx]".-
237 If the family is available from more than one foundry and the foundry isn't specified, an arbitrary foundry is chosen.-
238 If the family isn't available a family will be set using the font matching algorithm.-
239*/-
240-
241/*!-
242 \qmlproperty string QtQuick::TextInput::font.styleName-
243 \since 5.6-
244-
245 Sets the style name of the font.-
246-
247 The style name is case insensitive. If set, the font will be matched against style name instead-
248 of the font properties \l font.weight, \l font.bold and \l font.italic.-
249*/-
250-
251/*!-
252 \qmlproperty bool QtQuick::TextInput::font.bold-
253-
254 Sets whether the font weight is bold.-
255*/-
256-
257/*!-
258 \qmlproperty enumeration QtQuick::TextInput::font.weight-
259-
260 Sets the font's weight.-
261-
262 The weight can be one of:-
263 \list-
264 \li Font.Thin-
265 \li Font.Light-
266 \li Font.ExtraLight-
267 \li Font.Normal - the default-
268 \li Font.Medium-
269 \li Font.DemiBold-
270 \li Font.Bold-
271 \li Font.ExtraBold-
272 \li Font.Black-
273 \endlist-
274-
275 \qml-
276 TextInput { text: "Hello"; font.weight: Font.DemiBold }-
277 \endqml-
278*/-
279-
280/*!-
281 \qmlproperty bool QtQuick::TextInput::font.italic-
282-
283 Sets whether the font has an italic style.-
284*/-
285-
286/*!-
287 \qmlproperty bool QtQuick::TextInput::font.underline-
288-
289 Sets whether the text is underlined.-
290*/-
291-
292/*!-
293 \qmlproperty bool QtQuick::TextInput::font.strikeout-
294-
295 Sets whether the font has a strikeout style.-
296*/-
297-
298/*!-
299 \qmlproperty real QtQuick::TextInput::font.pointSize-
300-
301 Sets the font size in points. The point size must be greater than zero.-
302*/-
303-
304/*!-
305 \qmlproperty int QtQuick::TextInput::font.pixelSize-
306-
307 Sets the font size in pixels.-
308-
309 Using this function makes the font device dependent.-
310 Use \c pointSize to set the size of the font in a device independent manner.-
311*/-
312-
313/*!-
314 \qmlproperty real QtQuick::TextInput::font.letterSpacing-
315-
316 Sets the letter spacing for the font.-
317-
318 Letter spacing changes the default spacing between individual letters in the font.-
319 A positive value increases the letter spacing by the corresponding pixels; a negative value decreases the spacing.-
320*/-
321-
322/*!-
323 \qmlproperty real QtQuick::TextInput::font.wordSpacing-
324-
325 Sets the word spacing for the font.-
326-
327 Word spacing changes the default spacing between individual words.-
328 A positive value increases the word spacing by a corresponding amount of pixels,-
329 while a negative value decreases the inter-word spacing accordingly.-
330*/-
331-
332/*!-
333 \qmlproperty enumeration QtQuick::TextInput::font.capitalization-
334-
335 Sets the capitalization for the text.-
336-
337 \list-
338 \li Font.MixedCase - This is the normal text rendering option where no capitalization change is applied.-
339 \li Font.AllUppercase - This alters the text to be rendered in all uppercase type.-
340 \li Font.AllLowercase - This alters the text to be rendered in all lowercase type.-
341 \li Font.SmallCaps - This alters the text to be rendered in small-caps type.-
342 \li Font.Capitalize - This alters the text to be rendered with the first character of each word as an uppercase character.-
343 \endlist-
344-
345 \qml-
346 TextInput { text: "Hello"; font.capitalization: Font.AllLowercase }-
347 \endqml-
348*/-
349-
350/*!-
351 \qmlproperty enumeration QtQuick::TextInput::font.hintingPreference-
352 \since 5.8-
353-
354 Sets the preferred hinting on the text. This is a hint to the underlying text rendering system-
355 to use a certain level of hinting, and has varying support across platforms. See the table in-
356 the documentation for QFont::HintingPreference for more details.-
357-
358 \note This property only has an effect when used together with render type TextInput.NativeRendering.-
359-
360 \list-
361 \value Font.PreferDefaultHinting - Use the default hinting level for the target platform.-
362 \value Font.PreferNoHinting - If possible, render text without hinting the outlines-
363 of the glyphs. The text layout will be typographically accurate, using the same metrics-
364 as are used e.g. when printing.-
365 \value Font.PreferVerticalHinting - If possible, render text with no horizontal hinting,-
366 but align glyphs to the pixel grid in the vertical direction. The text will appear-
367 crisper on displays where the density is too low to give an accurate rendering-
368 of the glyphs. But since the horizontal metrics of the glyphs are unhinted, the text's-
369 layout will be scalable to higher density devices (such as printers) without impacting-
370 details such as line breaks.-
371 \value Font.PreferFullHinting - If possible, render text with hinting in both horizontal and-
372 vertical directions. The text will be altered to optimize legibility on the target-
373 device, but since the metrics will depend on the target size of the text, the positions-
374 of glyphs, line breaks, and other typographical detail will not scale, meaning that a-
375 text layout may look different on devices with different pixel densities.-
376 \endlist-
377-
378 \qml-
379 TextInput { text: "Hello"; renderType: TextInput.NativeRendering; font.hintingPreference: Font.PreferVerticalHinting }-
380 \endqml-
381*/-
382-
383/*!-
384 \qmlproperty bool QtQuick::TextInput::font.kerning-
385 \since 5.10-
386-
387 Enables or disables the kerning OpenType feature when shaping the text. Disabling this may-
388 improve performance when creating or changing the text, at the expense of some cosmetic-
389 features. The default value is true.-
390-
391 \qml-
392 TextInput { text: "OATS FLAVOUR WAY"; font.kerning: false }-
393 \endqml-
394*/-
395-
396/*!-
397 \qmlproperty bool QtQuick::TextInput::font.preferShaping-
398 \since 5.10-
399-
400 Sometimes, a font will apply complex rules to a set of characters in order to-
401 display them correctly. In some writing systems, such as Brahmic scripts, this is-
402 required in order for the text to be legible, but in e.g. Latin script, it is merely-
403 a cosmetic feature. Setting the \c preferShaping property to false will disable all-
404 such features when they are not required, which will improve performance in most cases.-
405-
406 The default value is true.-
407-
408 \qml-
409 TextInput { text: "Some text"; font.preferShaping: false }-
410 \endqml-
411*/-
412QFont QQuickTextInput::font() const-
413{-
414 Q_D(const QQuickTextInput);-
415 return d->sourceFont;
executed 178 times by 2 tests: return d->sourceFont;
Executed by:
  • tst_examples
  • tst_qquicktextinput
178
416}-
417-
418void QQuickTextInput::setFont(const QFont &font)-
419{-
420 Q_D(QQuickTextInput);-
421 if (d->sourceFont == font)
d->sourceFont == fontDescription
TRUEevaluated 14 times by 1 test
Evaluated by:
  • tst_examples
FALSEevaluated 32 times by 2 tests
Evaluated by:
  • tst_examples
  • tst_qquicktextinput
14-32
422 return;
executed 14 times by 1 test: return;
Executed by:
  • tst_examples
14
423-
424 d->sourceFont = font;-
425 QFont oldFont = d->font;-
426 d->font = font;-
427 if (d->font.pointSizeF() != -1) {
d->font.pointSizeF() != -1Description
TRUEevaluated 16 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEevaluated 16 times by 2 tests
Evaluated by:
  • tst_examples
  • tst_qquicktextinput
16
428 // 0.5pt resolution-
429 qreal size = qRound(d->font.pointSizeF()*2.0);-
430 d->font.setPointSizeF(size/2.0);-
431 }
executed 16 times by 1 test: end of block
Executed by:
  • tst_qquicktextinput
16
432 if (oldFont != d->font) {
oldFont != d->fontDescription
TRUEevaluated 32 times by 2 tests
Evaluated by:
  • tst_examples
  • tst_qquicktextinput
FALSEnever evaluated
0-32
433 d->updateLayout();-
434 updateCursorRectangle();-
435#if QT_CONFIG(im)-
436 updateInputMethod(Qt::ImCursorRectangle | Qt::ImFont | Qt::ImAnchorRectangle);-
437#endif-
438 }
executed 32 times by 2 tests: end of block
Executed by:
  • tst_examples
  • tst_qquicktextinput
32
439 emit fontChanged(d->sourceFont);-
440}
executed 32 times by 2 tests: end of block
Executed by:
  • tst_examples
  • tst_qquicktextinput
32
441-
442/*!-
443 \qmlproperty color QtQuick::TextInput::color-
444-
445 The text color.-
446*/-
447QColor QQuickTextInput::color() const-
448{-
449 Q_D(const QQuickTextInput);-
450 return d->color;
executed 32 times by 1 test: return d->color;
Executed by:
  • tst_qquicktextinput
32
451}-
452-
453void QQuickTextInput::setColor(const QColor &c)-
454{-
455 Q_D(QQuickTextInput);-
456 if (c != d->color) {
c != d->colorDescription
TRUEevaluated 28 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEevaluated 4 times by 1 test
Evaluated by:
  • tst_qquicktextinput
4-28
457 d->color = c;-
458 d->textLayoutDirty = true;-
459 d->updateType = QQuickTextInputPrivate::UpdatePaintNode;-
460 polish();-
461 update();-
462 emit colorChanged();-
463 }
executed 28 times by 1 test: end of block
Executed by:
  • tst_qquicktextinput
28
464}
executed 32 times by 1 test: end of block
Executed by:
  • tst_qquicktextinput
32
465-
466-
467/*!-
468 \qmlproperty color QtQuick::TextInput::selectionColor-
469-
470 The text highlight color, used behind selections.-
471*/-
472QColor QQuickTextInput::selectionColor() const-
473{-
474 Q_D(const QQuickTextInput);-
475 return d->selectionColor;
executed 30 times by 1 test: return d->selectionColor;
Executed by:
  • tst_qquicktextinput
30
476}-
477-
478void QQuickTextInput::setSelectionColor(const QColor &color)-
479{-
480 Q_D(QQuickTextInput);-
481 if (d->selectionColor == color)
d->selectionColor == colorDescription
TRUEevaluated 2 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEevaluated 28 times by 1 test
Evaluated by:
  • tst_qquicktextinput
2-28
482 return;
executed 2 times by 1 test: return;
Executed by:
  • tst_qquicktextinput
2
483-
484 d->selectionColor = color;-
485 if (d->hasSelectedText()) {
d->hasSelectedText()Description
TRUEnever evaluated
FALSEevaluated 28 times by 1 test
Evaluated by:
  • tst_qquicktextinput
0-28
486 d->textLayoutDirty = true;-
487 d->updateType = QQuickTextInputPrivate::UpdatePaintNode;-
488 polish();-
489 update();-
490 }
never executed: end of block
0
491 emit selectionColorChanged();-
492}
executed 28 times by 1 test: end of block
Executed by:
  • tst_qquicktextinput
28
493/*!-
494 \qmlproperty color QtQuick::TextInput::selectedTextColor-
495-
496 The highlighted text color, used in selections.-
497*/-
498QColor QQuickTextInput::selectedTextColor() const-
499{-
500 Q_D(const QQuickTextInput);-
501 return d->selectedTextColor;
executed 30 times by 1 test: return d->selectedTextColor;
Executed by:
  • tst_qquicktextinput
30
502}-
503-
504void QQuickTextInput::setSelectedTextColor(const QColor &color)-
505{-
506 Q_D(QQuickTextInput);-
507 if (d->selectedTextColor == color)
d->selectedTextColor == colorDescription
TRUEevaluated 4 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEevaluated 26 times by 1 test
Evaluated by:
  • tst_qquicktextinput
4-26
508 return;
executed 4 times by 1 test: return;
Executed by:
  • tst_qquicktextinput
4
509-
510 d->selectedTextColor = color;-
511 if (d->hasSelectedText()) {
d->hasSelectedText()Description
TRUEnever evaluated
FALSEevaluated 26 times by 1 test
Evaluated by:
  • tst_qquicktextinput
0-26
512 d->textLayoutDirty = true;-
513 d->updateType = QQuickTextInputPrivate::UpdatePaintNode;-
514 polish();-
515 update();-
516 }
never executed: end of block
0
517 emit selectedTextColorChanged();-
518}
executed 26 times by 1 test: end of block
Executed by:
  • tst_qquicktextinput
26
519-
520/*!-
521 \qmlproperty enumeration QtQuick::TextInput::horizontalAlignment-
522 \qmlproperty enumeration QtQuick::TextInput::effectiveHorizontalAlignment-
523 \qmlproperty enumeration QtQuick::TextInput::verticalAlignment-
524-
525 Sets the horizontal alignment of the text within the TextInput item's-
526 width and height. By default, the text alignment follows the natural alignment-
527 of the text, for example text that is read from left to right will be aligned to-
528 the left.-
529-
530 TextInput does not have vertical alignment, as the natural height is-
531 exactly the height of the single line of text. If you set the height-
532 manually to something larger, TextInput will always be top aligned-
533 vertically. You can use anchors to align it however you want within-
534 another item.-
535-
536 The valid values for \c horizontalAlignment are \c TextInput.AlignLeft, \c TextInput.AlignRight and-
537 \c TextInput.AlignHCenter.-
538-
539 Valid values for \c verticalAlignment are \c TextInput.AlignTop (default),-
540 \c TextInput.AlignBottom \c TextInput.AlignVCenter.-
541-
542 When using the attached property LayoutMirroring::enabled to mirror application-
543 layouts, the horizontal alignment of text will also be mirrored. However, the property-
544 \c horizontalAlignment will remain unchanged. To query the effective horizontal alignment-
545 of TextInput, use the read-only property \c effectiveHorizontalAlignment.-
546*/-
547QQuickTextInput::HAlignment QQuickTextInput::hAlign() const-
548{-
549 Q_D(const QQuickTextInput);-
550 return d->hAlign;
executed 66 times by 2 tests: return d->hAlign;
Executed by:
  • tst_examples
  • tst_qquicktextinput
66
551}-
552-
553void QQuickTextInput::setHAlign(HAlignment align)-
554{-
555 Q_D(QQuickTextInput);-
556 bool forceAlign = d->hAlignImplicit && d->effectiveLayoutMirror;
d->hAlignImplicitDescription
TRUEevaluated 28 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEevaluated 6 times by 1 test
Evaluated by:
  • tst_qquicktextinput
d->effectiveLayoutMirrorDescription
TRUEevaluated 2 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEevaluated 26 times by 1 test
Evaluated by:
  • tst_qquicktextinput
2-28
557 d->hAlignImplicit = false;-
558 if (d->setHAlign(align, forceAlign) && isComponentComplete()) {
d->setHAlign(a...n, forceAlign)Description
TRUEevaluated 28 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEevaluated 6 times by 1 test
Evaluated by:
  • tst_qquicktextinput
isComponentComplete()Description
TRUEevaluated 28 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEnever evaluated
0-28
559 d->updateLayout();-
560 updateCursorRectangle();-
561 }
executed 28 times by 1 test: end of block
Executed by:
  • tst_qquicktextinput
28
562}
executed 34 times by 1 test: end of block
Executed by:
  • tst_qquicktextinput
34
563-
564void QQuickTextInput::resetHAlign()-
565{-
566 Q_D(QQuickTextInput);-
567 d->hAlignImplicit = true;-
568 if (d->determineHorizontalAlignment() && isComponentComplete()) {
d->determineHo...talAlignment()Description
TRUEevaluated 4 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEevaluated 16 times by 2 tests
Evaluated by:
  • tst_examples
  • tst_qquicktextinput
isComponentComplete()Description
TRUEevaluated 4 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEnever evaluated
0-16
569 d->updateLayout();-
570 updateCursorRectangle();-
571 }
executed 4 times by 1 test: end of block
Executed by:
  • tst_qquicktextinput
4
572}
executed 20 times by 2 tests: end of block
Executed by:
  • tst_examples
  • tst_qquicktextinput
20
573-
574QQuickTextInput::HAlignment QQuickTextInput::effectiveHAlign() const-
575{-
576 Q_D(const QQuickTextInput);-
577 QQuickTextInput::HAlignment effectiveAlignment = d->hAlign;-
578 if (!d->hAlignImplicit && d->effectiveLayoutMirror) {
!d->hAlignImplicitDescription
TRUEevaluated 160 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEevaluated 6190 times by 5 tests
Evaluated by:
  • tst_examples
  • tst_qquickitem
  • tst_qquickitem2
  • tst_qquicktextedit
  • tst_qquicktextinput
d->effectiveLayoutMirrorDescription
TRUEevaluated 22 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEevaluated 138 times by 1 test
Evaluated by:
  • tst_qquicktextinput
22-6190
579 switch (d->hAlign) {-
580 case QQuickTextInput::AlignLeft:
executed 10 times by 1 test: case QQuickTextInput::AlignLeft:
Executed by:
  • tst_qquicktextinput
10
581 effectiveAlignment = QQuickTextInput::AlignRight;-
582 break;
executed 10 times by 1 test: break;
Executed by:
  • tst_qquicktextinput
10
583 case QQuickTextInput::AlignRight:
executed 12 times by 1 test: case QQuickTextInput::AlignRight:
Executed by:
  • tst_qquicktextinput
12
584 effectiveAlignment = QQuickTextInput::AlignLeft;-
585 break;
executed 12 times by 1 test: break;
Executed by:
  • tst_qquicktextinput
12
586 default:
never executed: default:
0
587 break;
never executed: break;
0
588 }-
589 }-
590 return effectiveAlignment;
executed 6350 times by 5 tests: return effectiveAlignment;
Executed by:
  • tst_examples
  • tst_qquickitem
  • tst_qquickitem2
  • tst_qquicktextedit
  • tst_qquicktextinput
6350
591}-
592-
593bool QQuickTextInputPrivate::setHAlign(QQuickTextInput::HAlignment alignment, bool forceAlign)-
594{-
595 Q_Q(QQuickTextInput);-
596 if ((hAlign != alignment || forceAlign) && alignment <= QQuickTextInput::AlignHCenter) { // justify not supported
hAlign != alignmentDescription
TRUEevaluated 66 times by 2 tests
Evaluated by:
  • tst_examples
  • tst_qquicktextinput
FALSEevaluated 4724 times by 5 tests
Evaluated by:
  • tst_examples
  • tst_qquickitem
  • tst_qquickitem2
  • tst_qquicktextedit
  • tst_qquicktextinput
forceAlignDescription
TRUEevaluated 2 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEevaluated 4722 times by 5 tests
Evaluated by:
  • tst_examples
  • tst_qquickitem
  • tst_qquickitem2
  • tst_qquicktextedit
  • tst_qquicktextinput
alignment <= Q...::AlignHCenterDescription
TRUEevaluated 68 times by 2 tests
Evaluated by:
  • tst_examples
  • tst_qquicktextinput
FALSEnever evaluated
0-4724
597 QQuickTextInput::HAlignment oldEffectiveHAlign = q->effectiveHAlign();-
598 hAlign = alignment;-
599 emit q->horizontalAlignmentChanged(alignment);-
600 if (oldEffectiveHAlign != q->effectiveHAlign())
oldEffectiveHA...ectiveHAlign()Description
TRUEevaluated 66 times by 2 tests
Evaluated by:
  • tst_examples
  • tst_qquicktextinput
FALSEevaluated 2 times by 1 test
Evaluated by:
  • tst_qquicktextinput
2-66
601 emit q->effectiveHorizontalAlignmentChanged();
executed 66 times by 2 tests: q->effectiveHorizontalAlignmentChanged();
Executed by:
  • tst_examples
  • tst_qquicktextinput
66
602 return true;
executed 68 times by 2 tests: return true;
Executed by:
  • tst_examples
  • tst_qquicktextinput
68
603 }-
604 return false;
executed 4722 times by 5 tests: return false;
Executed by:
  • tst_examples
  • tst_qquickitem
  • tst_qquickitem2
  • tst_qquicktextedit
  • tst_qquicktextinput
4722
605}-
606-
607Qt::LayoutDirection QQuickTextInputPrivate::textDirection() const-
608{-
609 QString text = m_text;-
610#if QT_CONFIG(im)-
611 if (text.isEmpty())
text.isEmpty()Description
TRUEevaluated 1816 times by 5 tests
Evaluated by:
  • tst_examples
  • tst_qquickitem
  • tst_qquickitem2
  • tst_qquicktextedit
  • tst_qquicktextinput
FALSEevaluated 9088 times by 4 tests
Evaluated by:
  • tst_examples
  • tst_qquickitem
  • tst_qquickitem2
  • tst_qquicktextinput
1816-9088
612 text = m_textLayout.preeditAreaText();
executed 1816 times by 5 tests: text = m_textLayout.preeditAreaText();
Executed by:
  • tst_examples
  • tst_qquickitem
  • tst_qquickitem2
  • tst_qquicktextedit
  • tst_qquicktextinput
1816
613#endif-
614-
615 const QChar *character = text.constData();-
616 while (!character->isNull()) {
!character->isNull()Description
TRUEevaluated 25808 times by 4 tests
Evaluated by:
  • tst_examples
  • tst_qquickitem
  • tst_qquickitem2
  • tst_qquicktextinput
FALSEevaluated 3858 times by 5 tests
Evaluated by:
  • tst_examples
  • tst_qquickitem
  • tst_qquickitem2
  • tst_qquicktextedit
  • tst_qquicktextinput
3858-25808
617 switch (character->direction()) {-
618 case QChar::DirL:
executed 6958 times by 4 tests: case QChar::DirL:
Executed by:
  • tst_examples
  • tst_qquickitem
  • tst_qquickitem2
  • tst_qquicktextinput
6958
619 return Qt::LeftToRight;
executed 6958 times by 4 tests: return Qt::LeftToRight;
Executed by:
  • tst_examples
  • tst_qquickitem
  • tst_qquickitem2
  • tst_qquicktextinput
6958
620 case QChar::DirR:
never executed: case QChar::DirR:
0
621 case QChar::DirAL:
executed 88 times by 2 tests: case QChar::DirAL:
Executed by:
  • tst_examples
  • tst_qquicktextinput
88
622 case QChar::DirAN:
never executed: case QChar::DirAN:
0
623 return Qt::RightToLeft;
executed 88 times by 2 tests: return Qt::RightToLeft;
Executed by:
  • tst_examples
  • tst_qquicktextinput
88
624 default:
executed 18762 times by 2 tests: default:
Executed by:
  • tst_examples
  • tst_qquicktextinput
18762
625 break;
executed 18762 times by 2 tests: break;
Executed by:
  • tst_examples
  • tst_qquicktextinput
18762
626 }-
627 character++;-
628 }
executed 18762 times by 2 tests: end of block
Executed by:
  • tst_examples
  • tst_qquicktextinput
18762
629 return Qt::LayoutDirectionAuto;
executed 3858 times by 5 tests: return Qt::LayoutDirectionAuto;
Executed by:
  • tst_examples
  • tst_qquickitem
  • tst_qquickitem2
  • tst_qquicktextedit
  • tst_qquicktextinput
3858
630}-
631-
632Qt::LayoutDirection QQuickTextInputPrivate::layoutDirection() const-
633{-
634 Qt::LayoutDirection direction = m_layoutDirection;-
635 if (direction == Qt::LayoutDirectionAuto) {
direction == Q...tDirectionAutoDescription
TRUEevaluated 6148 times by 5 tests
Evaluated by:
  • tst_examples
  • tst_qquickitem
  • tst_qquickitem2
  • tst_qquicktextedit
  • tst_qquicktextinput
FALSEevaluated 58 times by 1 test
Evaluated by:
  • tst_qquicktextinput
58-6148
636 direction = textDirection();-
637#if QT_CONFIG(im)-
638 if (direction == Qt::LayoutDirectionAuto)
direction == Q...tDirectionAutoDescription
TRUEevaluated 1674 times by 5 tests
Evaluated by:
  • tst_examples
  • tst_qquickitem
  • tst_qquickitem2
  • tst_qquicktextedit
  • tst_qquicktextinput
FALSEevaluated 4474 times by 4 tests
Evaluated by:
  • tst_examples
  • tst_qquickitem
  • tst_qquickitem2
  • tst_qquicktextinput
1674-4474
639 direction = QGuiApplication::inputMethod()->inputDirection();
executed 1674 times by 5 tests: direction = QGuiApplication::inputMethod()->inputDirection();
Executed by:
  • tst_examples
  • tst_qquickitem
  • tst_qquickitem2
  • tst_qquicktextedit
  • tst_qquicktextinput
1674
640#endif-
641 }
executed 6148 times by 5 tests: end of block
Executed by:
  • tst_examples
  • tst_qquickitem
  • tst_qquickitem2
  • tst_qquicktextedit
  • tst_qquicktextinput
6148
642 return (direction == Qt::LayoutDirectionAuto) ? Qt::LeftToRight : direction;
executed 6206 times by 5 tests: return (direction == Qt::LayoutDirectionAuto) ? Qt::LeftToRight : direction;
Executed by:
  • tst_examples
  • tst_qquickitem
  • tst_qquickitem2
  • tst_qquicktextedit
  • tst_qquicktextinput
6206
643}-
644-
645bool QQuickTextInputPrivate::determineHorizontalAlignment()-
646{-
647 if (hAlignImplicit) {
hAlignImplicitDescription
TRUEevaluated 4756 times by 5 tests
Evaluated by:
  • tst_examples
  • tst_qquickitem
  • tst_qquickitem2
  • tst_qquicktextedit
  • tst_qquicktextinput
FALSEevaluated 16 times by 1 test
Evaluated by:
  • tst_qquicktextinput
16-4756
648 // if no explicit alignment has been set, follow the natural layout direction of the text-
649 Qt::LayoutDirection direction = textDirection();-
650#if QT_CONFIG(im)-
651 if (direction == Qt::LayoutDirectionAuto)
direction == Q...tDirectionAutoDescription
TRUEevaluated 2184 times by 5 tests
Evaluated by:
  • tst_examples
  • tst_qquickitem
  • tst_qquickitem2
  • tst_qquicktextedit
  • tst_qquicktextinput
FALSEevaluated 2572 times by 4 tests
Evaluated by:
  • tst_examples
  • tst_qquickitem
  • tst_qquickitem2
  • tst_qquicktextinput
2184-2572
652 direction = QGuiApplication::inputMethod()->inputDirection();
executed 2184 times by 5 tests: direction = QGuiApplication::inputMethod()->inputDirection();
Executed by:
  • tst_examples
  • tst_qquickitem
  • tst_qquickitem2
  • tst_qquicktextedit
  • tst_qquicktextinput
2184
653#endif-
654 return setHAlign(direction == Qt::RightToLeft ? QQuickTextInput::AlignRight : QQuickTextInput::AlignLeft);
executed 4756 times by 5 tests: return setHAlign(direction == Qt::RightToLeft ? QQuickTextInput::AlignRight : QQuickTextInput::AlignLeft);
Executed by:
  • tst_examples
  • tst_qquickitem
  • tst_qquickitem2
  • tst_qquicktextedit
  • tst_qquicktextinput
4756
655 }-
656 return false;
executed 16 times by 1 test: return false;
Executed by:
  • tst_qquicktextinput
16
657}-
658-
659QQuickTextInput::VAlignment QQuickTextInput::vAlign() const-
660{-
661 Q_D(const QQuickTextInput);-
662 return d->vAlign;
executed 6 times by 1 test: return d->vAlign;
Executed by:
  • tst_qquicktextinput
6
663}-
664-
665void QQuickTextInput::setVAlign(QQuickTextInput::VAlignment alignment)-
666{-
667 Q_D(QQuickTextInput);-
668 if (alignment == d->vAlign)
alignment == d->vAlignDescription
TRUEevaluated 4 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEevaluated 20 times by 1 test
Evaluated by:
  • tst_qquicktextinput
4-20
669 return;
executed 4 times by 1 test: return;
Executed by:
  • tst_qquicktextinput
4
670 d->vAlign = alignment;-
671 emit verticalAlignmentChanged(d->vAlign);-
672 if (isComponentComplete()) {
isComponentComplete()Description
TRUEevaluated 8 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEevaluated 12 times by 1 test
Evaluated by:
  • tst_qquicktextinput
8-12
673 updateCursorRectangle();-
674 d->updateBaselineOffset();-
675 }
executed 8 times by 1 test: end of block
Executed by:
  • tst_qquicktextinput
8
676}
executed 20 times by 1 test: end of block
Executed by:
  • tst_qquicktextinput
20
677-
678/*!-
679 \qmlproperty enumeration QtQuick::TextInput::wrapMode-
680-
681 Set this property to wrap the text to the TextInput item's width.-
682 The text will only wrap if an explicit width has been set.-
683-
684 \list-
685 \li TextInput.NoWrap - no wrapping will be performed. If the text contains insufficient newlines, then implicitWidth will exceed a set width.-
686 \li TextInput.WordWrap - wrapping is done on word boundaries only. If a word is too long, implicitWidth will exceed a set width.-
687 \li TextInput.WrapAnywhere - wrapping is done at any point on a line, even if it occurs in the middle of a word.-
688 \li TextInput.Wrap - if possible, wrapping occurs at a word boundary; otherwise it will occur at the appropriate point on the line, even in the middle of a word.-
689 \endlist-
690-
691 The default is TextInput.NoWrap. If you set a width, consider using TextInput.Wrap.-
692*/-
693QQuickTextInput::WrapMode QQuickTextInput::wrapMode() const-
694{-
695 Q_D(const QQuickTextInput);-
696 return d->wrapMode;
executed 8 times by 1 test: return d->wrapMode;
Executed by:
  • tst_qquicktextinput
8
697}-
698-
699void QQuickTextInput::setWrapMode(WrapMode mode)-
700{-
701 Q_D(QQuickTextInput);-
702 if (mode == d->wrapMode)
mode == d->wrapModeDescription
TRUEevaluated 6 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEevaluated 42 times by 1 test
Evaluated by:
  • tst_qquicktextinput
6-42
703 return;
executed 6 times by 1 test: return;
Executed by:
  • tst_qquicktextinput
6
704 d->wrapMode = mode;-
705 d->updateLayout();-
706 updateCursorRectangle();-
707 emit wrapModeChanged();-
708}
executed 42 times by 1 test: end of block
Executed by:
  • tst_qquicktextinput
42
709-
710void QQuickTextInputPrivate::mirrorChange()-
711{-
712 Q_Q(QQuickTextInput);-
713 if (q->isComponentComplete()) {
q->isComponentComplete()Description
TRUEevaluated 4 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEnever evaluated
0-4
714 if (!hAlignImplicit && (hAlign == QQuickTextInput::AlignRight || hAlign == QQuickTextInput::AlignLeft)) {
!hAlignImplicitDescription
TRUEevaluated 2 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEevaluated 2 times by 1 test
Evaluated by:
  • tst_qquicktextinput
hAlign == QQui...ut::AlignRightDescription
TRUEnever evaluated
FALSEevaluated 2 times by 1 test
Evaluated by:
  • tst_qquicktextinput
hAlign == QQui...put::AlignLeftDescription
TRUEevaluated 2 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEnever evaluated
0-2
715 q->updateCursorRectangle();-
716 emit q->effectiveHorizontalAlignmentChanged();-
717 }
executed 2 times by 1 test: end of block
Executed by:
  • tst_qquicktextinput
2
718 }
executed 4 times by 1 test: end of block
Executed by:
  • tst_qquicktextinput
4
719}
executed 4 times by 1 test: end of block
Executed by:
  • tst_qquicktextinput
4
720-
721/*!-
722 \qmlproperty bool QtQuick::TextInput::readOnly-
723-
724 Sets whether user input can modify the contents of the TextInput.-
725-
726 If readOnly is set to true, then user input will not affect the text-
727 property. Any bindings or attempts to set the text property will still-
728 work.-
729*/-
730bool QQuickTextInput::isReadOnly() const-
731{-
732 Q_D(const QQuickTextInput);-
733 return d->m_readOnly;
executed 305 times by 4 tests: return d->m_readOnly;
Executed by:
  • tst_examples
  • tst_qquickitem
  • tst_qquickitem2
  • tst_qquicktextinput
305
734}-
735-
736void QQuickTextInput::setReadOnly(bool ro)-
737{-
738 Q_D(QQuickTextInput);-
739 if (d->m_readOnly == ro)
d->m_readOnly == roDescription
TRUEevaluated 2 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEevaluated 38 times by 2 tests
Evaluated by:
  • tst_qquickitem2
  • tst_qquicktextinput
2-38
740 return;
executed 2 times by 1 test: return;
Executed by:
  • tst_qquicktextinput
2
741-
742#if QT_CONFIG(im)-
743 setFlag(QQuickItem::ItemAcceptsInputMethod, !ro);-
744#endif-
745 d->m_readOnly = ro;-
746 d->setCursorPosition(d->end());-
747#if QT_CONFIG(im)-
748 updateInputMethod(Qt::ImEnabled);-
749#endif-
750 q_canPasteChanged();-
751 d->emitUndoRedoChanged();-
752 emit readOnlyChanged(ro);-
753 if (ro) {
roDescription
TRUEevaluated 24 times by 2 tests
Evaluated by:
  • tst_qquickitem2
  • tst_qquicktextinput
FALSEevaluated 14 times by 1 test
Evaluated by:
  • tst_qquicktextinput
14-24
754 setCursorVisible(false);-
755 } else if (hasActiveFocus()) {
executed 24 times by 2 tests: end of block
Executed by:
  • tst_qquickitem2
  • tst_qquicktextinput
hasActiveFocus()Description
TRUEevaluated 10 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEevaluated 4 times by 1 test
Evaluated by:
  • tst_qquicktextinput
4-24
756 setCursorVisible(true);-
757 }
executed 10 times by 1 test: end of block
Executed by:
  • tst_qquicktextinput
10
758 update();-
759}
executed 38 times by 2 tests: end of block
Executed by:
  • tst_qquickitem2
  • tst_qquicktextinput
38
760-
761/*!-
762 \qmlproperty int QtQuick::TextInput::maximumLength-
763 The maximum permitted length of the text in the TextInput.-
764-
765 If the text is too long, it is truncated at the limit.-
766-
767 By default, this property contains a value of 32767.-
768*/-
769int QQuickTextInput::maxLength() const-
770{-
771 Q_D(const QQuickTextInput);-
772 return d->m_maxLength;
executed 2 times by 1 test: return d->m_maxLength;
Executed by:
  • tst_qquicktextinput
2
773}-
774-
775void QQuickTextInput::setMaxLength(int ml)-
776{-
777 Q_D(QQuickTextInput);-
778 if (d->m_maxLength == ml || d->m_maskData)
d->m_maxLength == mlDescription
TRUEnever evaluated
FALSEevaluated 2 times by 1 test
Evaluated by:
  • tst_qquicktextinput
d->m_maskDataDescription
TRUEnever evaluated
FALSEevaluated 2 times by 1 test
Evaluated by:
  • tst_qquicktextinput
0-2
779 return;
never executed: return;
0
780-
781 d->m_maxLength = ml;-
782 d->internalSetText(d->m_text, -1, false);-
783-
784 emit maximumLengthChanged(ml);-
785}
executed 2 times by 1 test: end of block
Executed by:
  • tst_qquicktextinput
2
786-
787/*!-
788 \qmlproperty bool QtQuick::TextInput::cursorVisible-
789 Set to true when the TextInput shows a cursor.-
790-
791 This property is set and unset when the TextInput gets active focus, so that other-
792 properties can be bound to whether the cursor is currently showing. As it-
793 gets set and unset automatically, when you set the value yourself you must-
794 keep in mind that your value may be overwritten.-
795-
796 It can be set directly in script, for example if a KeyProxy might-
797 forward keys to it and you desire it to look active when this happens-
798 (but without actually giving it active focus).-
799-
800 It should not be set directly on the item, like in the below QML,-
801 as the specified value will be overridden and lost on focus changes.-
802-
803 \code-
804 TextInput {-
805 text: "Text"-
806 cursorVisible: false-
807 }-
808 \endcode-
809-
810 In the above snippet the cursor will still become visible when the-
811 TextInput gains active focus.-
812*/-
813bool QQuickTextInput::isCursorVisible() const-
814{-
815 Q_D(const QQuickTextInput);-
816 return d->cursorVisible;
executed 58 times by 1 test: return d->cursorVisible;
Executed by:
  • tst_qquicktextinput
58
817}-
818-
819void QQuickTextInput::setCursorVisible(bool on)-
820{-
821 Q_D(QQuickTextInput);-
822 if (d->cursorVisible == on)
d->cursorVisible == onDescription
TRUEevaluated 360 times by 2 tests
Evaluated by:
  • tst_qquickitem2
  • tst_qquicktextinput
FALSEevaluated 542 times by 4 tests
Evaluated by:
  • tst_examples
  • tst_qquickitem
  • tst_qquickitem2
  • tst_qquicktextinput
360-542
823 return;
executed 360 times by 2 tests: return;
Executed by:
  • tst_qquickitem2
  • tst_qquicktextinput
360
824 d->cursorVisible = on;-
825 if (on && isComponentComplete())
onDescription
TRUEevaluated 404 times by 4 tests
Evaluated by:
  • tst_examples
  • tst_qquickitem
  • tst_qquickitem2
  • tst_qquicktextinput
FALSEevaluated 138 times by 3 tests
Evaluated by:
  • tst_qquickitem
  • tst_qquickitem2
  • tst_qquicktextinput
isComponentComplete()Description
TRUEevaluated 390 times by 3 tests
Evaluated by:
  • tst_qquickitem
  • tst_qquickitem2
  • tst_qquicktextinput
FALSEevaluated 14 times by 1 test
Evaluated by:
  • tst_examples
14-404
826 QQuickTextUtil::createCursor(d);
executed 390 times by 3 tests: QQuickTextUtil::createCursor(d);
Executed by:
  • tst_qquickitem
  • tst_qquickitem2
  • tst_qquicktextinput
390
827 if (!d->cursorItem)
!d->cursorItemDescription
TRUEevaluated 500 times by 4 tests
Evaluated by:
  • tst_examples
  • tst_qquickitem
  • tst_qquickitem2
  • tst_qquicktextinput
FALSEevaluated 42 times by 1 test
Evaluated by:
  • tst_qquicktextinput
42-500
828 d->updateCursorBlinking();
executed 500 times by 4 tests: d->updateCursorBlinking();
Executed by:
  • tst_examples
  • tst_qquickitem
  • tst_qquickitem2
  • tst_qquicktextinput
500
829 emit cursorVisibleChanged(d->cursorVisible);-
830}
executed 542 times by 4 tests: end of block
Executed by:
  • tst_examples
  • tst_qquickitem
  • tst_qquickitem2
  • tst_qquicktextinput
542
831-
832/*!-
833 \qmlproperty int QtQuick::TextInput::cursorPosition-
834 The position of the cursor in the TextInput.-
835*/-
836int QQuickTextInput::cursorPosition() const-
837{-
838 Q_D(const QQuickTextInput);-
839 return d->m_cursor;
executed 382 times by 1 test: return d->m_cursor;
Executed by:
  • tst_qquicktextinput
382
840}-
841-
842void QQuickTextInput::setCursorPosition(int cp)-
843{-
844 Q_D(QQuickTextInput);-
845 if (cp < 0 || cp > text().length())
cp < 0Description
TRUEevaluated 2 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEevaluated 916 times by 1 test
Evaluated by:
  • tst_qquicktextinput
cp > text().length()Description
TRUEevaluated 8 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEevaluated 908 times by 1 test
Evaluated by:
  • tst_qquicktextinput
2-916
846 return;
executed 10 times by 1 test: return;
Executed by:
  • tst_qquicktextinput
10
847 d->moveCursor(cp);-
848}
executed 908 times by 1 test: end of block
Executed by:
  • tst_qquicktextinput
908
849-
850/*!-
851 \qmlproperty rectangle QtQuick::TextInput::cursorRectangle-
852-
853 The rectangle where the standard text cursor is rendered within the text input. Read only.-
854-
855 The position and height of a custom cursorDelegate are updated to follow the cursorRectangle-
856 automatically when it changes. The width of the delegate is unaffected by changes in the-
857 cursor rectangle.-
858*/-
859-
860QRectF QQuickTextInput::cursorRectangle() const-
861{-
862 Q_D(const QQuickTextInput);-
863-
864 int c = d->m_cursor;-
865#if QT_CONFIG(im)-
866 c += d->m_preeditCursor;-
867#endif-
868 if (d->m_echoMode == NoEcho)
d->m_echoMode == NoEchoDescription
TRUEevaluated 2 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEevaluated 2720 times by 4 tests
Evaluated by:
  • tst_examples
  • tst_qquickitem
  • tst_qquickitem2
  • tst_qquicktextinput
2-2720
869 c = 0;
executed 2 times by 1 test: c = 0;
Executed by:
  • tst_qquicktextinput
2
870 QTextLine l = d->m_textLayout.lineForTextPosition(c);-
871 if (!l.isValid())
!l.isValid()Description
TRUEnever evaluated
FALSEevaluated 2722 times by 4 tests
Evaluated by:
  • tst_examples
  • tst_qquickitem
  • tst_qquickitem2
  • tst_qquicktextinput
0-2722
872 return QRectF();
never executed: return QRectF();
0
873 qreal x = l.cursorToX(c) - d->hscroll + leftPadding();-
874 qreal y = l.y() - d->vscroll + topPadding();-
875 qreal w = 1;-
876 if (d->overwriteMode) {
d->overwriteModeDescription
TRUEnever evaluated
FALSEevaluated 2722 times by 4 tests
Evaluated by:
  • tst_examples
  • tst_qquickitem
  • tst_qquickitem2
  • tst_qquicktextinput
0-2722
877 if (c < text().length())
c < text().length()Description
TRUEnever evaluated
FALSEnever evaluated
0
878 w = l.cursorToX(c + 1) - x;
never executed: w = l.cursorToX(c + 1) - x;
0
879 else-
880 w = QFontMetrics(font()).width(QLatin1Char(' ')); // in sync with QTextLine::draw()
never executed: w = QFontMetrics(font()).width(QLatin1Char(' '));
0
881 }-
882 return QRectF(x, y, w, l.height());
executed 2722 times by 4 tests: return QRectF(x, y, w, l.height());
Executed by:
  • tst_examples
  • tst_qquickitem
  • tst_qquickitem2
  • tst_qquicktextinput
2722
883}-
884-
885/*!-
886 \qmlproperty int QtQuick::TextInput::selectionStart-
887-
888 The cursor position before the first character in the current selection.-
889-
890 This property is read-only. To change the selection, use select(start,end),-
891 selectAll(), or selectWord().-
892-
893 \sa selectionEnd, cursorPosition, selectedText-
894*/-
895int QQuickTextInput::selectionStart() const-
896{-
897 Q_D(const QQuickTextInput);-
898 return d->lastSelectionStart;
executed 588 times by 1 test: return d->lastSelectionStart;
Executed by:
  • tst_qquicktextinput
588
899}-
900/*!-
901 \qmlproperty int QtQuick::TextInput::selectionEnd-
902-
903 The cursor position after the last character in the current selection.-
904-
905 This property is read-only. To change the selection, use select(start,end),-
906 selectAll(), or selectWord().-
907-
908 \sa selectionStart, cursorPosition, selectedText-
909*/-
910int QQuickTextInput::selectionEnd() const-
911{-
912 Q_D(const QQuickTextInput);-
913 return d->lastSelectionEnd;
executed 586 times by 1 test: return d->lastSelectionEnd;
Executed by:
  • tst_qquicktextinput
586
914}-
915/*!-
916 \qmlmethod QtQuick::TextInput::select(int start, int end)-
917-
918 Causes the text from \a start to \a end to be selected.-
919-
920 If either start or end is out of range, the selection is not changed.-
921-
922 After calling this, selectionStart will become the lesser-
923 and selectionEnd will become the greater (regardless of the order passed-
924 to this method).-
925-
926 \sa selectionStart, selectionEnd-
927*/-
928void QQuickTextInput::select(int start, int end)-
929{-
930 Q_D(QQuickTextInput);-
931 if (start < 0 || end < 0 || start > d->m_text.length() || end > d->m_text.length())
start < 0Description
TRUEevaluated 4 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEevaluated 418 times by 1 test
Evaluated by:
  • tst_qquicktextinput
end < 0Description
TRUEevaluated 4 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEevaluated 414 times by 1 test
Evaluated by:
  • tst_qquicktextinput
start > d->m_text.length()Description
TRUEevaluated 4 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEevaluated 410 times by 1 test
Evaluated by:
  • tst_qquicktextinput
end > d->m_text.length()Description
TRUEevaluated 4 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEevaluated 406 times by 1 test
Evaluated by:
  • tst_qquicktextinput
4-418
932 return;
executed 16 times by 1 test: return;
Executed by:
  • tst_qquicktextinput
16
933 d->setSelection(start, end-start);-
934}
executed 406 times by 1 test: end of block
Executed by:
  • tst_qquicktextinput
406
935-
936/*!-
937 \qmlproperty string QtQuick::TextInput::selectedText-
938-
939 This read-only property provides the text currently selected in the-
940 text input.-
941-
942 It is equivalent to the following snippet, but is faster and easier-
943 to use.-
944-
945 \js-
946 myTextInput.text.toString().substring(myTextInput.selectionStart,-
947 myTextInput.selectionEnd);-
948 \endjs-
949*/-
950QString QQuickTextInput::selectedText() const-
951{-
952 Q_D(const QQuickTextInput);-
953 return d->selectedText();
executed 892 times by 1 test: return d->selectedText();
Executed by:
  • tst_qquicktextinput
892
954}-
955-
956/*!-
957 \qmlproperty bool QtQuick::TextInput::activeFocusOnPress-
958-
959 Whether the TextInput should gain active focus on a mouse press. By default this is-
960 set to true.-
961*/-
962bool QQuickTextInput::focusOnPress() const-
963{-
964 Q_D(const QQuickTextInput);-
965 return d->focusOnPress;
executed 12 times by 1 test: return d->focusOnPress;
Executed by:
  • tst_qquicktextinput
12
966}-
967-
968void QQuickTextInput::setFocusOnPress(bool b)-
969{-
970 Q_D(QQuickTextInput);-
971 if (d->focusOnPress == b)
d->focusOnPress == bDescription
TRUEevaluated 16 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEevaluated 12 times by 1 test
Evaluated by:
  • tst_qquicktextinput
12-16
972 return;
executed 16 times by 1 test: return;
Executed by:
  • tst_qquicktextinput
16
973-
974 d->focusOnPress = b;-
975-
976 emit activeFocusOnPressChanged(d->focusOnPress);-
977}
executed 12 times by 1 test: end of block
Executed by:
  • tst_qquicktextinput
12
978/*!-
979 \qmlproperty bool QtQuick::TextInput::autoScroll-
980-
981 Whether the TextInput should scroll when the text is longer than the width. By default this is-
982 set to true.-
983-
984 \sa ensureVisible()-
985*/-
986bool QQuickTextInput::autoScroll() const-
987{-
988 Q_D(const QQuickTextInput);-
989 return d->autoScroll;
never executed: return d->autoScroll;
0
990}-
991-
992void QQuickTextInput::setAutoScroll(bool b)-
993{-
994 Q_D(QQuickTextInput);-
995 if (d->autoScroll == b)
d->autoScroll == bDescription
TRUEevaluated 2 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEevaluated 18 times by 1 test
Evaluated by:
  • tst_qquicktextinput
2-18
996 return;
executed 2 times by 1 test: return;
Executed by:
  • tst_qquicktextinput
2
997-
998 d->autoScroll = b;-
999 //We need to repaint so that the scrolling is taking into account.-
1000 updateCursorRectangle();-
1001 emit autoScrollChanged(d->autoScroll);-
1002}
executed 18 times by 1 test: end of block
Executed by:
  • tst_qquicktextinput
18
1003-
1004/*!-
1005 \qmlproperty Validator QtQuick::TextInput::validator-
1006-
1007 Allows you to set a validator on the TextInput. When a validator is set-
1008 the TextInput will only accept input which leaves the text property in-
1009 an acceptable or intermediate state. The accepted signal will only be sent-
1010 if the text is in an acceptable state when enter is pressed.-
1011-
1012 Currently supported validators are IntValidator, DoubleValidator and-
1013 RegExpValidator. An example of using validators is shown below, which allows-
1014 input of integers between 11 and 31 into the text input:-
1015-
1016 \code-
1017 import QtQuick 2.0-
1018 TextInput{-
1019 validator: IntValidator{bottom: 11; top: 31;}-
1020 focus: true-
1021 }-
1022 \endcode-
1023-
1024 \sa acceptableInput, inputMask-
1025*/-
1026-
1027QValidator* QQuickTextInput::validator() const-
1028{-
1029#if !QT_CONFIG(validator)-
1030 return 0;-
1031#else-
1032 Q_D(const QQuickTextInput);-
1033 return d->m_validator;
executed 18 times by 1 test: return d->m_validator;
Executed by:
  • tst_qquicktextinput
18
1034#endif // validator-
1035}-
1036-
1037void QQuickTextInput::setValidator(QValidator* v)-
1038{-
1039#if !QT_CONFIG(validator)-
1040 Q_UNUSED(v);-
1041#else-
1042 Q_D(QQuickTextInput);-
1043 if (d->m_validator == v)
d->m_validator == vDescription
TRUEnever evaluated
FALSEevaluated 36 times by 2 tests
Evaluated by:
  • tst_examples
  • tst_qquicktextinput
0-36
1044 return;
never executed: return;
0
1045-
1046 if (d->m_validator) {
d->m_validatorDescription
TRUEevaluated 2 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEevaluated 34 times by 2 tests
Evaluated by:
  • tst_examples
  • tst_qquicktextinput
2-34
1047 qmlobject_disconnect(
executed 2 times by 1 test: end of block
Executed by:
  • tst_qquicktextinput
executed 2 times by 1 test: methodIdx = QQuickTextInput::staticMetaObject.indexOfSlot(method+1);
Executed by:
  • tst_qquicktextinput
never executed: methodIdx = QQuickTextInput::staticMetaObject.indexOfSignal(method+1);
signalIdx < 0Description
TRUEevaluated 2 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEnever evaluated
methodIdx < 0Description
TRUEevaluated 2 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEnever evaluated
code == 1Description
TRUEevaluated 2 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEnever evaluated
0-2
1048 d->m_validator, QValidator, SIGNAL(changed()),-
1049 this, QQuickTextInput, SLOT(q_validatorChanged()));-
1050 }
executed 2 times by 1 test: end of block
Executed by:
  • tst_qquicktextinput
2
1051-
1052 d->m_validator = v;-
1053-
1054 if (d->m_validator) {
d->m_validatorDescription
TRUEevaluated 36 times by 2 tests
Evaluated by:
  • tst_examples
  • tst_qquicktextinput
FALSEnever evaluated
0-36
1055 qmlobject_connect(
executed 4 times by 2 tests: end of block
Executed by:
  • tst_examples
  • tst_qquicktextinput
executed 4 times by 2 tests: methodIdx = QQuickTextInput::staticMetaObject.indexOfSlot(method+1);
Executed by:
  • tst_examples
  • tst_qquicktextinput
never executed: methodIdx = QQuickTextInput::staticMetaObject.indexOfSignal(method+1);
signalIdx < 0Description
TRUEevaluated 4 times by 2 tests
Evaluated by:
  • tst_examples
  • tst_qquicktextinput
FALSEevaluated 32 times by 2 tests
Evaluated by:
  • tst_examples
  • tst_qquicktextinput
methodIdx < 0Description
TRUEevaluated 4 times by 2 tests
Evaluated by:
  • tst_examples
  • tst_qquicktextinput
FALSEevaluated 32 times by 2 tests
Evaluated by:
  • tst_examples
  • tst_qquicktextinput
code == 1Description
TRUEevaluated 4 times by 2 tests
Evaluated by:
  • tst_examples
  • tst_qquicktextinput
FALSEnever evaluated
0-32
1056 d->m_validator, QValidator, SIGNAL(changed()),-
1057 this, QQuickTextInput, SLOT(q_validatorChanged()));-
1058 }
executed 36 times by 2 tests: end of block
Executed by:
  • tst_examples
  • tst_qquicktextinput
36
1059-
1060 if (isComponentComplete())
isComponentComplete()Description
TRUEevaluated 4 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEevaluated 32 times by 2 tests
Evaluated by:
  • tst_examples
  • tst_qquicktextinput
4-32
1061 d->checkIsValid();
executed 4 times by 1 test: d->checkIsValid();
Executed by:
  • tst_qquicktextinput
4
1062-
1063 emit validatorChanged();-
1064#endif // validator-
1065}
executed 36 times by 2 tests: end of block
Executed by:
  • tst_examples
  • tst_qquicktextinput
36
1066-
1067#if QT_CONFIG(validator)-
1068void QQuickTextInput::q_validatorChanged()-
1069{-
1070 Q_D(QQuickTextInput);-
1071 d->checkIsValid();-
1072}
executed 70 times by 2 tests: end of block
Executed by:
  • tst_examples
  • tst_qquicktextinput
70
1073#endif // validator-
1074-
1075QRectF QQuickTextInputPrivate::anchorRectangle() const-
1076{-
1077 Q_Q(const QQuickTextInput);-
1078 QRectF rect;-
1079 int a;-
1080 // Unfortunately we cannot use selectionStart() and selectionEnd()-
1081 // since they always assume that the selectionStart is logically before selectionEnd.-
1082 // To rely on that would cause havoc if the user was interactively moving the end selection-
1083 // handle to become before the start selection-
1084 if (m_selstart == m_selend)
m_selstart == m_selendDescription
TRUEnever evaluated
FALSEnever evaluated
0
1085 // This is to handle the case when there is "no selection" while moving the handle onto the-
1086 // same position as the other handle (in which case it would hide the selection handles)-
1087 a = m_cursor;
never executed: a = m_cursor;
0
1088 else-
1089 a = m_selstart == m_cursor ? m_selend : m_selstart;
never executed: a = m_selstart == m_cursor ? m_selend : m_selstart;
m_selstart == m_cursorDescription
TRUEnever evaluated
FALSEnever evaluated
0
1090 if (a >= 0) {
a >= 0Description
TRUEnever evaluated
FALSEnever evaluated
0
1091#if QT_CONFIG(im)-
1092 a += m_preeditCursor;-
1093#endif-
1094 if (m_echoMode == QQuickTextInput::NoEcho)
m_echoMode == ...tInput::NoEchoDescription
TRUEnever evaluated
FALSEnever evaluated
0
1095 a = 0;
never executed: a = 0;
0
1096 QTextLine l = m_textLayout.lineForTextPosition(a);-
1097 if (l.isValid()) {
l.isValid()Description
TRUEnever evaluated
FALSEnever evaluated
0
1098 qreal x = l.cursorToX(a) - hscroll + q->leftPadding();-
1099 qreal y = l.y() - vscroll + q->topPadding();-
1100 rect.setRect(x, y, 1, l.height());-
1101 }
never executed: end of block
0
1102 }
never executed: end of block
0
1103 return rect;
never executed: return rect;
0
1104}-
1105-
1106void QQuickTextInputPrivate::checkIsValid()-
1107{-
1108 Q_Q(QQuickTextInput);-
1109-
1110 ValidatorState state = hasAcceptableInput(m_text);-
1111 if (!m_maskData)
!m_maskDataDescription
TRUEevaluated 848 times by 5 tests
Evaluated by:
  • tst_examples
  • tst_qquickitem
  • tst_qquickitem2
  • tst_qquicktextedit
  • tst_qquicktextinput
FALSEevaluated 1302 times by 1 test
Evaluated by:
  • tst_qquicktextinput
848-1302
1112 m_validInput = state != InvalidInput;
executed 848 times by 5 tests: m_validInput = state != InvalidInput;
Executed by:
  • tst_examples
  • tst_qquickitem
  • tst_qquickitem2
  • tst_qquicktextedit
  • tst_qquicktextinput
848
1113 if (state != AcceptableInput) {
state != AcceptableInputDescription
TRUEevaluated 700 times by 2 tests
Evaluated by:
  • tst_examples
  • tst_qquicktextinput
FALSEevaluated 1450 times by 5 tests
Evaluated by:
  • tst_examples
  • tst_qquickitem
  • tst_qquickitem2
  • tst_qquicktextedit
  • tst_qquicktextinput
700-1450
1114 if (m_acceptableInput) {
m_acceptableInputDescription
TRUEevaluated 520 times by 2 tests
Evaluated by:
  • tst_examples
  • tst_qquicktextinput
FALSEevaluated 180 times by 2 tests
Evaluated by:
  • tst_examples
  • tst_qquicktextinput
180-520
1115 m_acceptableInput = false;-
1116 emit q->acceptableInputChanged();-
1117 }
executed 520 times by 2 tests: end of block
Executed by:
  • tst_examples
  • tst_qquicktextinput
520
1118 } else if (!m_acceptableInput) {
executed 700 times by 2 tests: end of block
Executed by:
  • tst_examples
  • tst_qquicktextinput
!m_acceptableInputDescription
TRUEevaluated 14 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEevaluated 1436 times by 5 tests
Evaluated by:
  • tst_examples
  • tst_qquickitem
  • tst_qquickitem2
  • tst_qquicktextedit
  • tst_qquicktextinput
14-1436
1119 m_acceptableInput = true;-
1120 emit q->acceptableInputChanged();-
1121 }
executed 14 times by 1 test: end of block
Executed by:
  • tst_qquicktextinput
14
1122}
executed 2150 times by 5 tests: end of block
Executed by:
  • tst_examples
  • tst_qquickitem
  • tst_qquickitem2
  • tst_qquicktextedit
  • tst_qquicktextinput
2150
1123-
1124/*!-
1125 \qmlproperty string QtQuick::TextInput::inputMask-
1126-
1127 Allows you to set an input mask on the TextInput, restricting the allowable-
1128 text inputs. See QLineEdit::inputMask for further details, as the exact-
1129 same mask strings are used by TextInput.-
1130-
1131 \sa acceptableInput, validator-
1132*/-
1133QString QQuickTextInput::inputMask() const-
1134{-
1135 Q_D(const QQuickTextInput);-
1136 return d->inputMask();
executed 22 times by 1 test: return d->inputMask();
Executed by:
  • tst_qquicktextinput
22
1137}-
1138-
1139void QQuickTextInput::setInputMask(const QString &im)-
1140{-
1141 Q_D(QQuickTextInput);-
1142 if (d->inputMask() == im)
d->inputMask() == imDescription
TRUEevaluated 88 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEevaluated 256 times by 1 test
Evaluated by:
  • tst_qquicktextinput
88-256
1143 return;
executed 88 times by 1 test: return;
Executed by:
  • tst_qquicktextinput
88
1144-
1145 d->setInputMask(im);-
1146 emit inputMaskChanged(d->inputMask());-
1147}
executed 256 times by 1 test: end of block
Executed by:
  • tst_qquicktextinput
256
1148-
1149/*!-
1150 \qmlproperty bool QtQuick::TextInput::acceptableInput-
1151-
1152 This property is always true unless a validator or input mask has been set.-
1153 If a validator or input mask has been set, this property will only be true-
1154 if the current text is acceptable to the validator or input mask as a final-
1155 string (not as an intermediate string).-
1156*/-
1157bool QQuickTextInput::hasAcceptableInput() const-
1158{-
1159 Q_D(const QQuickTextInput);-
1160 return d->m_acceptableInput;
executed 230 times by 1 test: return d->m_acceptableInput;
Executed by:
  • tst_qquicktextinput
230
1161}-
1162-
1163/*!-
1164 \qmlsignal QtQuick::TextInput::accepted()-
1165-
1166 This signal is emitted when the Return or Enter key is pressed.-
1167 Note that if there is a \l validator or \l inputMask set on the text-
1168 input, the signal will only be emitted if the input is in an acceptable-
1169 state.-
1170-
1171 The corresponding handler is \c onAccepted.-
1172*/-
1173-
1174/*!-
1175 \qmlsignal QtQuick::TextInput::editingFinished()-
1176 \since 5.2-
1177-
1178 This signal is emitted when the Return or Enter key is pressed or-
1179 the text input loses focus. Note that if there is a validator or-
1180 inputMask set on the text input and enter/return is pressed, this-
1181 signal will only be emitted if the input follows-
1182 the inputMask and the validator returns an acceptable state.-
1183-
1184 The corresponding handler is \c onEditingFinished.-
1185*/-
1186-
1187/*!-
1188 \qmlsignal QtQuick::TextInput::textEdited()-
1189 \since 5.9-
1190-
1191 This signal is emitted whenever the text is edited. Unlike \c textChanged(),-
1192 this signal is not emitted when the text is changed programmatically, for example,-
1193 by changing the value of the \c text property or by calling \c clear().-
1194-
1195 The corresponding handler is \c onTextEdited.-
1196*/-
1197-
1198#if QT_CONFIG(im)-
1199Qt::InputMethodHints QQuickTextInputPrivate::effectiveInputMethodHints() const-
1200{-
1201 Qt::InputMethodHints hints = inputMethodHints;-
1202 if (m_echoMode == QQuickTextInput::Password || m_echoMode == QQuickTextInput::NoEcho)
m_echoMode == ...nput::PasswordDescription
TRUEevaluated 12 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEevaluated 384 times by 3 tests
Evaluated by:
  • tst_qquickitem
  • tst_qquickitem2
  • tst_qquicktextinput
m_echoMode == ...tInput::NoEchoDescription
TRUEevaluated 2 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEevaluated 382 times by 3 tests
Evaluated by:
  • tst_qquickitem
  • tst_qquickitem2
  • tst_qquicktextinput
2-384
1203 hints |= Qt::ImhHiddenText;
executed 14 times by 1 test: hints |= Qt::ImhHiddenText;
Executed by:
  • tst_qquicktextinput
14
1204 else if (m_echoMode == QQuickTextInput::PasswordEchoOnEdit)
m_echoMode == ...wordEchoOnEditDescription
TRUEevaluated 4 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEevaluated 378 times by 3 tests
Evaluated by:
  • tst_qquickitem
  • tst_qquickitem2
  • tst_qquicktextinput
4-378
1205 hints &= ~Qt::ImhHiddenText;
executed 4 times by 1 test: hints &= ~Qt::ImhHiddenText;
Executed by:
  • tst_qquicktextinput
4
1206 if (m_echoMode != QQuickTextInput::Normal)
m_echoMode != ...tInput::NormalDescription
TRUEevaluated 18 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEevaluated 378 times by 3 tests
Evaluated by:
  • tst_qquickitem
  • tst_qquickitem2
  • tst_qquicktextinput
18-378
1207 hints |= (Qt::ImhNoAutoUppercase | Qt::ImhNoPredictiveText | Qt::ImhSensitiveData);
executed 18 times by 1 test: hints |= (Qt::ImhNoAutoUppercase | Qt::ImhNoPredictiveText | Qt::ImhSensitiveData);
Executed by:
  • tst_qquicktextinput
18
1208 return hints;
executed 396 times by 3 tests: return hints;
Executed by:
  • tst_qquickitem
  • tst_qquickitem2
  • tst_qquicktextinput
396
1209}-
1210#endif-
1211-
1212/*!-
1213 \qmlproperty enumeration QtQuick::TextInput::echoMode-
1214-
1215 Specifies how the text should be displayed in the TextInput.-
1216 \list-
1217 \li TextInput.Normal - Displays the text as it is. (Default)-
1218 \li TextInput.Password - Displays platform-dependent password mask-
1219 characters instead of the actual characters.-
1220 \li TextInput.NoEcho - Displays nothing.-
1221 \li TextInput.PasswordEchoOnEdit - Displays characters as they are entered-
1222 while editing, otherwise identical to \c TextInput.Password.-
1223 \endlist-
1224*/-
1225QQuickTextInput::EchoMode QQuickTextInput::echoMode() const-
1226{-
1227 Q_D(const QQuickTextInput);-
1228 return QQuickTextInput::EchoMode(d->m_echoMode);
executed 112 times by 1 test: return QQuickTextInput::EchoMode(d->m_echoMode);
Executed by:
  • tst_qquicktextinput
112
1229}-
1230-
1231void QQuickTextInput::setEchoMode(QQuickTextInput::EchoMode echo)-
1232{-
1233 Q_D(QQuickTextInput);-
1234 if (echoMode() == echo)
echoMode() == echoDescription
TRUEevaluated 54 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEevaluated 28 times by 1 test
Evaluated by:
  • tst_qquicktextinput
28-54
1235 return;
executed 54 times by 1 test: return;
Executed by:
  • tst_qquicktextinput
54
1236 d->cancelPasswordEchoTimer();-
1237 d->m_echoMode = echo;-
1238 d->m_passwordEchoEditing = false;-
1239#if QT_CONFIG(im)-
1240 updateInputMethod(Qt::ImHints);-
1241#endif-
1242 d->updateDisplayText();-
1243 updateCursorRectangle();-
1244-
1245 emit echoModeChanged(echoMode());-
1246}
executed 28 times by 1 test: end of block
Executed by:
  • tst_qquicktextinput
28
1247-
1248/*!-
1249 \qmlproperty enumeration QtQuick::TextInput::inputMethodHints-
1250-
1251 Provides hints to the input method about the expected content of the text input and how it-
1252 should operate.-
1253-
1254 The value is a bit-wise combination of flags, or Qt.ImhNone if no hints are set.-
1255-
1256 Flags that alter behaviour are:-
1257-
1258 \list-
1259 \li Qt.ImhHiddenText - Characters should be hidden, as is typically used when entering passwords.-
1260 This is automatically set when setting echoMode to \c TextInput.Password.-
1261 \li Qt.ImhSensitiveData - Typed text should not be stored by the active input method-
1262 in any persistent storage like predictive user dictionary.-
1263 \li Qt.ImhNoAutoUppercase - The input method should not try to automatically switch to upper case-
1264 when a sentence ends.-
1265 \li Qt.ImhPreferNumbers - Numbers are preferred (but not required).-
1266 \li Qt.ImhPreferUppercase - Upper case letters are preferred (but not required).-
1267 \li Qt.ImhPreferLowercase - Lower case letters are preferred (but not required).-
1268 \li Qt.ImhNoPredictiveText - Do not use predictive text (i.e. dictionary lookup) while typing.-
1269-
1270 \li Qt.ImhDate - The text editor functions as a date field.-
1271 \li Qt.ImhTime - The text editor functions as a time field.-
1272 \li Qt.ImhMultiLine - The text editor doesn't close software input keyboard when Return or Enter key is pressed (since QtQuick 2.4).-
1273 \endlist-
1274-
1275 Flags that restrict input (exclusive flags) are:-
1276-
1277 \list-
1278 \li Qt.ImhDigitsOnly - Only digits are allowed.-
1279 \li Qt.ImhFormattedNumbersOnly - Only number input is allowed. This includes decimal point and minus sign.-
1280 \li Qt.ImhUppercaseOnly - Only upper case letter input is allowed.-
1281 \li Qt.ImhLowercaseOnly - Only lower case letter input is allowed.-
1282 \li Qt.ImhDialableCharactersOnly - Only characters suitable for phone dialing are allowed.-
1283 \li Qt.ImhEmailCharactersOnly - Only characters suitable for email addresses are allowed.-
1284 \li Qt.ImhUrlCharactersOnly - Only characters suitable for URLs are allowed.-
1285 \endlist-
1286-
1287 Masks:-
1288-
1289 \list-
1290 \li Qt.ImhExclusiveInputMask - This mask yields nonzero if any of the exclusive flags are used.-
1291 \endlist-
1292*/-
1293-
1294Qt::InputMethodHints QQuickTextInput::inputMethodHints() const-
1295{-
1296#if !QT_CONFIG(im)-
1297 return Qt::ImhNone;-
1298#else-
1299 Q_D(const QQuickTextInput);-
1300 return d->inputMethodHints;
executed 14 times by 1 test: return d->inputMethodHints;
Executed by:
  • tst_qquicktextinput
14
1301#endif // im-
1302}-
1303-
1304void QQuickTextInput::setInputMethodHints(Qt::InputMethodHints hints)-
1305{-
1306#if !QT_CONFIG(im)-
1307 Q_UNUSED(hints);-
1308#else-
1309 Q_D(QQuickTextInput);-
1310-
1311 if (hints == d->inputMethodHints)
hints == d->inputMethodHintsDescription
TRUEevaluated 4 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEevaluated 4 times by 1 test
Evaluated by:
  • tst_qquicktextinput
4
1312 return;
executed 4 times by 1 test: return;
Executed by:
  • tst_qquicktextinput
4
1313-
1314 d->inputMethodHints = hints;-
1315 updateInputMethod(Qt::ImHints);-
1316 emit inputMethodHintsChanged();-
1317#endif // im-
1318}
executed 4 times by 1 test: end of block
Executed by:
  • tst_qquicktextinput
4
1319-
1320/*!-
1321 \qmlproperty Component QtQuick::TextInput::cursorDelegate-
1322 The delegate for the cursor in the TextInput.-
1323-
1324 If you set a cursorDelegate for a TextInput, this delegate will be used for-
1325 drawing the cursor instead of the standard cursor. An instance of the-
1326 delegate will be created and managed by the TextInput when a cursor is-
1327 needed, and the x property of the delegate instance will be set so as-
1328 to be one pixel before the top left of the current character.-
1329-
1330 Note that the root item of the delegate component must be a QQuickItem or-
1331 QQuickItem derived item.-
1332*/-
1333QQmlComponent* QQuickTextInput::cursorDelegate() const-
1334{-
1335 Q_D(const QQuickTextInput);-
1336 return d->cursorComponent;
never executed: return d->cursorComponent;
0
1337}-
1338-
1339void QQuickTextInput::setCursorDelegate(QQmlComponent* c)-
1340{-
1341 Q_D(QQuickTextInput);-
1342 QQuickTextUtil::setCursorDelegate(d, c);-
1343}
executed 24 times by 1 test: end of block
Executed by:
  • tst_qquicktextinput
24
1344-
1345void QQuickTextInput::createCursor()-
1346{-
1347 Q_D(QQuickTextInput);-
1348 d->cursorPending = true;-
1349 QQuickTextUtil::createCursor(d);-
1350}
executed 2 times by 1 test: end of block
Executed by:
  • tst_qquicktextinput
2
1351-
1352/*!-
1353 \qmlmethod rect QtQuick::TextInput::positionToRectangle(int pos)-
1354-
1355 This function takes a character position and returns the rectangle that the-
1356 cursor would occupy, if it was placed at that character position.-
1357-
1358 This is similar to setting the cursorPosition, and then querying the cursor-
1359 rectangle, but the cursorPosition is not changed.-
1360*/-
1361QRectF QQuickTextInput::positionToRectangle(int pos) const-
1362{-
1363 Q_D(const QQuickTextInput);-
1364 if (d->m_echoMode == NoEcho)
d->m_echoMode == NoEchoDescription
TRUEnever evaluated
FALSEevaluated 420 times by 1 test
Evaluated by:
  • tst_qquicktextinput
0-420
1365 pos = 0;
never executed: pos = 0;
0
1366#if QT_CONFIG(im)-
1367 else if (pos > d->m_cursor)
pos > d->m_cursorDescription
TRUEevaluated 26 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEevaluated 394 times by 1 test
Evaluated by:
  • tst_qquicktextinput
26-394
1368 pos += d->preeditAreaText().length();
executed 26 times by 1 test: pos += d->preeditAreaText().length();
Executed by:
  • tst_qquicktextinput
26
1369#endif-
1370 QTextLine l = d->m_textLayout.lineForTextPosition(pos);-
1371 if (!l.isValid())
!l.isValid()Description
TRUEnever evaluated
FALSEevaluated 420 times by 1 test
Evaluated by:
  • tst_qquicktextinput
0-420
1372 return QRectF();
never executed: return QRectF();
0
1373 qreal x = l.cursorToX(pos) - d->hscroll;-
1374 qreal y = l.y() - d->vscroll;-
1375 qreal w = 1;-
1376 if (d->overwriteMode) {
d->overwriteModeDescription
TRUEnever evaluated
FALSEevaluated 420 times by 1 test
Evaluated by:
  • tst_qquicktextinput
0-420
1377 if (pos < text().length())
pos < text().length()Description
TRUEnever evaluated
FALSEnever evaluated
0
1378 w = l.cursorToX(pos + 1) - x;
never executed: w = l.cursorToX(pos + 1) - x;
0
1379 else-
1380 w = QFontMetrics(font()).width(QLatin1Char(' ')); // in sync with QTextLine::draw()
never executed: w = QFontMetrics(font()).width(QLatin1Char(' '));
0
1381 }-
1382 return QRectF(x, y, w, l.height());
executed 420 times by 1 test: return QRectF(x, y, w, l.height());
Executed by:
  • tst_qquicktextinput
420
1383}-
1384-
1385/*!-
1386 \qmlmethod int QtQuick::TextInput::positionAt(real x, real y, CursorPosition position = CursorBetweenCharacters)-
1387-
1388 This function returns the character position at-
1389 x and y pixels from the top left of the textInput. Position 0 is before the-
1390 first character, position 1 is after the first character but before the second,-
1391 and so on until position text.length, which is after all characters.-
1392-
1393 This means that for all x values before the first character this function returns 0,-
1394 and for all x values after the last character this function returns text.length. If-
1395 the y value is above the text the position will be that of the nearest character on-
1396 the first line and if it is below the text the position of the nearest character-
1397 on the last line will be returned.-
1398-
1399 The cursor position type specifies how the cursor position should be resolved.-
1400-
1401 \list-
1402 \li TextInput.CursorBetweenCharacters - Returns the position between characters that is nearest x.-
1403 \li TextInput.CursorOnCharacter - Returns the position before the character that is nearest x.-
1404 \endlist-
1405*/-
1406-
1407void QQuickTextInput::positionAt(QQmlV4Function *args) const-
1408{-
1409 Q_D(const QQuickTextInput);-
1410-
1411 qreal x = 0;-
1412 qreal y = 0;-
1413 QTextLine::CursorPosition position = QTextLine::CursorBetweenCharacters;-
1414-
1415 if (args->length() < 1)
args->length() < 1Description
TRUEnever evaluated
FALSEevaluated 38 times by 1 test
Evaluated by:
  • tst_qquicktextinput
0-38
1416 return;
never executed: return;
0
1417-
1418 int i = 0;-
1419 QV4::Scope scope(args->v4engine());-
1420 QV4::ScopedValue arg(scope, (*args)[0]);-
1421 x = arg->toNumber();-
1422-
1423 if (++i < args->length()) {
++i < args->length()Description
TRUEevaluated 16 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEevaluated 22 times by 1 test
Evaluated by:
  • tst_qquicktextinput
16-22
1424 arg = (*args)[i];-
1425 y = arg->toNumber();-
1426 }
executed 16 times by 1 test: end of block
Executed by:
  • tst_qquicktextinput
16
1427-
1428 if (++i < args->length()) {
++i < args->length()Description
TRUEevaluated 8 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEevaluated 30 times by 1 test
Evaluated by:
  • tst_qquicktextinput
8-30
1429 arg = (*args)[i];-
1430 position = QTextLine::CursorPosition(arg->toInt32());-
1431 }
executed 8 times by 1 test: end of block
Executed by:
  • tst_qquicktextinput
8
1432-
1433 int pos = d->positionAt(x, y, position);-
1434 const int cursor = d->m_cursor;-
1435 if (pos > cursor) {
pos > cursorDescription
TRUEevaluated 14 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEevaluated 24 times by 1 test
Evaluated by:
  • tst_qquicktextinput
14-24
1436#if QT_CONFIG(im)-
1437 const int preeditLength = d->preeditAreaText().length();-
1438 pos = pos > cursor + preeditLength
pos > cursor + preeditLengthDescription
TRUEevaluated 10 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEevaluated 4 times by 1 test
Evaluated by:
  • tst_qquicktextinput
4-10
1439 ? pos - preeditLength-
1440 : cursor;-
1441#else-
1442 pos = cursor;-
1443#endif-
1444 }
executed 14 times by 1 test: end of block
Executed by:
  • tst_qquicktextinput
14
1445 args->setReturnValue(QV4::Encode(pos));-
1446}
executed 38 times by 1 test: end of block
Executed by:
  • tst_qquicktextinput
38
1447-
1448int QQuickTextInputPrivate::positionAt(qreal x, qreal y, QTextLine::CursorPosition position) const-
1449{-
1450 Q_Q(const QQuickTextInput);-
1451 x += hscroll - q->leftPadding();-
1452 y += vscroll - q->topPadding();-
1453 QTextLine line = m_textLayout.lineAt(0);-
1454 for (int i = 1; i < m_textLayout.lineCount(); ++i) {
i < m_textLayout.lineCount()Description
TRUEevaluated 12 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEevaluated 150 times by 1 test
Evaluated by:
  • tst_qquicktextinput
12-150
1455 QTextLine nextLine = m_textLayout.lineAt(i);-
1456-
1457 if (y < (line.rect().bottom() + nextLine.y()) / 2)
y < (line.rect...tLine.y()) / 2Description
TRUEevaluated 8 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEevaluated 4 times by 1 test
Evaluated by:
  • tst_qquicktextinput
4-8
1458 break;
executed 8 times by 1 test: break;
Executed by:
  • tst_qquicktextinput
8
1459 line = nextLine;-
1460 }
executed 4 times by 1 test: end of block
Executed by:
  • tst_qquicktextinput
4
1461 return line.isValid() ? line.xToCursor(x, position) : 0;
executed 158 times by 1 test: return line.isValid() ? line.xToCursor(x, position) : 0;
Executed by:
  • tst_qquicktextinput
158
1462}-
1463-
1464/*!-
1465 \qmlproperty bool QtQuick::TextInput::overwriteMode-
1466 \since 5.8-
1467-
1468 Whether text entered by the user will overwrite existing text.-
1469-
1470 As with many text editors, the text editor widget can be configured-
1471 to insert or overwrite existing text with new text entered by the user.-
1472-
1473 If this property is \c true, existing text is overwritten, character-for-character-
1474 by new text; otherwise, text is inserted at the cursor position, displacing-
1475 existing text.-
1476-
1477 By default, this property is \c false (new text does not overwrite existing text).-
1478*/-
1479bool QQuickTextInput::overwriteMode() const-
1480{-
1481 Q_D(const QQuickTextInput);-
1482 return d->overwriteMode;
executed 6 times by 1 test: return d->overwriteMode;
Executed by:
  • tst_qquicktextinput
6
1483}-
1484-
1485void QQuickTextInput::setOverwriteMode(bool overwrite)-
1486{-
1487 Q_D(QQuickTextInput);-
1488 if (d->overwriteMode == overwrite)
d->overwriteMode == overwriteDescription
TRUEnever evaluated
FALSEevaluated 6 times by 1 test
Evaluated by:
  • tst_qquicktextinput
0-6
1489 return;
never executed: return;
0
1490 d->overwriteMode = overwrite;-
1491 emit overwriteModeChanged(overwrite);-
1492}
executed 6 times by 1 test: end of block
Executed by:
  • tst_qquicktextinput
6
1493-
1494void QQuickTextInput::keyPressEvent(QKeyEvent* ev)-
1495{-
1496 Q_D(QQuickTextInput);-
1497 // Don't allow MacOSX up/down support, and we don't allow a completer.-
1498 bool ignore = (ev->key() == Qt::Key_Up || ev->key() == Qt::Key_Down) && ev->modifiers() == Qt::NoModifier;
ev->key() == Qt::Key_UpDescription
TRUEevaluated 2 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEevaluated 1988 times by 2 tests
Evaluated by:
  • tst_qquickitem2
  • tst_qquicktextinput
ev->key() == Qt::Key_DownDescription
TRUEnever evaluated
FALSEevaluated 1988 times by 2 tests
Evaluated by:
  • tst_qquickitem2
  • tst_qquicktextinput
ev->modifiers(...Qt::NoModifierDescription
TRUEevaluated 2 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEnever evaluated
0-1988
1499 if (!ignore && (d->lastSelectionStart == d->lastSelectionEnd) && (ev->key() == Qt::Key_Right || ev->key() == Qt::Key_Left)) {
!ignoreDescription
TRUEevaluated 1988 times by 2 tests
Evaluated by:
  • tst_qquickitem2
  • tst_qquicktextinput
FALSEevaluated 2 times by 1 test
Evaluated by:
  • tst_qquicktextinput
(d->lastSelect...tSelectionEnd)Description
TRUEevaluated 1920 times by 2 tests
Evaluated by:
  • tst_qquickitem2
  • tst_qquicktextinput
FALSEevaluated 68 times by 1 test
Evaluated by:
  • tst_qquicktextinput
ev->key() == Qt::Key_RightDescription
TRUEevaluated 40 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEevaluated 1880 times by 2 tests
Evaluated by:
  • tst_qquickitem2
  • tst_qquicktextinput
ev->key() == Qt::Key_LeftDescription
TRUEevaluated 46 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEevaluated 1834 times by 2 tests
Evaluated by:
  • tst_qquickitem2
  • tst_qquicktextinput
2-1988
1500 // Ignore when moving off the end unless there is a selection,-
1501 // because then moving will do something (deselect).-
1502 int cursorPosition = d->m_cursor;-
1503 if (cursorPosition == 0)
cursorPosition == 0Description
TRUEevaluated 16 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEevaluated 70 times by 1 test
Evaluated by:
  • tst_qquicktextinput
16-70
1504 ignore = ev->key() == (d->layoutDirection() == Qt::LeftToRight ? Qt::Key_Left : Qt::Key_Right);
executed 16 times by 1 test: ignore = ev->key() == (d->layoutDirection() == Qt::LeftToRight ? Qt::Key_Left : Qt::Key_Right);
Executed by:
  • tst_qquicktextinput
d->layoutDirec...t::LeftToRightDescription
TRUEevaluated 14 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEevaluated 2 times by 1 test
Evaluated by:
  • tst_qquicktextinput
2-16
1505 if (!ignore && cursorPosition == d->m_text.length())
!ignoreDescription
TRUEevaluated 80 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEevaluated 6 times by 1 test
Evaluated by:
  • tst_qquicktextinput
cursorPosition..._text.length()Description
TRUEevaluated 14 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEevaluated 66 times by 1 test
Evaluated by:
  • tst_qquicktextinput
6-80
1506 ignore = ev->key() == (d->layoutDirection() == Qt::LeftToRight ? Qt::Key_Right : Qt::Key_Left);
executed 14 times by 1 test: ignore = ev->key() == (d->layoutDirection() == Qt::LeftToRight ? Qt::Key_Right : Qt::Key_Left);
Executed by:
  • tst_qquicktextinput
d->layoutDirec...t::LeftToRightDescription
TRUEevaluated 12 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEevaluated 2 times by 1 test
Evaluated by:
  • tst_qquicktextinput
2-14
1507 }
executed 86 times by 1 test: end of block
Executed by:
  • tst_qquicktextinput
86
1508 if (ignore) {
ignoreDescription
TRUEevaluated 14 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEevaluated 1976 times by 2 tests
Evaluated by:
  • tst_qquickitem2
  • tst_qquicktextinput
14-1976
1509 ev->ignore();-
1510 } else {
executed 14 times by 1 test: end of block
Executed by:
  • tst_qquicktextinput
14
1511 d->processKeyEvent(ev);-
1512 }
executed 1976 times by 2 tests: end of block
Executed by:
  • tst_qquickitem2
  • tst_qquicktextinput
1976
1513 if (!ev->isAccepted())
!ev->isAccepted()Description
TRUEevaluated 226 times by 2 tests
Evaluated by:
  • tst_qquickitem2
  • tst_qquicktextinput
FALSEevaluated 1764 times by 1 test
Evaluated by:
  • tst_qquicktextinput
226-1764
1514 QQuickImplicitSizeItem::keyPressEvent(ev);
executed 226 times by 2 tests: QQuickImplicitSizeItem::keyPressEvent(ev);
Executed by:
  • tst_qquickitem2
  • tst_qquicktextinput
226
1515}
executed 1990 times by 2 tests: end of block
Executed by:
  • tst_qquickitem2
  • tst_qquicktextinput
1990
1516-
1517#if QT_CONFIG(im)-
1518void QQuickTextInput::inputMethodEvent(QInputMethodEvent *ev)-
1519{-
1520 Q_D(QQuickTextInput);-
1521 const bool wasComposing = d->hasImState;-
1522 if (d->m_readOnly) {
d->m_readOnlyDescription
TRUEnever evaluated
FALSEevaluated 348 times by 1 test
Evaluated by:
  • tst_qquicktextinput
0-348
1523 ev->ignore();-
1524 } else {
never executed: end of block
0
1525 d->processInputMethodEvent(ev);-
1526 }
executed 348 times by 1 test: end of block
Executed by:
  • tst_qquicktextinput
348
1527 if (!ev->isAccepted())
!ev->isAccepted()Description
TRUEnever evaluated
FALSEevaluated 348 times by 1 test
Evaluated by:
  • tst_qquicktextinput
0-348
1528 QQuickImplicitSizeItem::inputMethodEvent(ev);
never executed: QQuickImplicitSizeItem::inputMethodEvent(ev);
0
1529-
1530 if (wasComposing != d->hasImState)
wasComposing != d->hasImStateDescription
TRUEevaluated 44 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEevaluated 304 times by 1 test
Evaluated by:
  • tst_qquicktextinput
44-304
1531 emit inputMethodComposingChanged();
executed 44 times by 1 test: inputMethodComposingChanged();
Executed by:
  • tst_qquicktextinput
44
1532}
executed 348 times by 1 test: end of block
Executed by:
  • tst_qquicktextinput
348
1533#endif-
1534-
1535void QQuickTextInput::mouseDoubleClickEvent(QMouseEvent *event)-
1536{-
1537 Q_D(QQuickTextInput);-
1538-
1539 if (d->selectByMouse && event->button() == Qt::LeftButton) {
d->selectByMouseDescription
TRUEevaluated 6 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEnever evaluated
event->button(...Qt::LeftButtonDescription
TRUEevaluated 6 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEnever evaluated
0-6
1540#if QT_CONFIG(im)-
1541 d->commitPreedit();-
1542#endif-
1543 int cursor = d->positionAt(event->localPos());-
1544 d->selectWordAtPos(cursor);-
1545 event->setAccepted(true);-
1546 if (!d->hasPendingTripleClick()) {
!d->hasPendingTripleClick()Description
TRUEevaluated 2 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEevaluated 4 times by 1 test
Evaluated by:
  • tst_qquicktextinput
2-4
1547 d->tripleClickStartPoint = event->localPos();-
1548 d->tripleClickTimer.start();-
1549 }
executed 2 times by 1 test: end of block
Executed by:
  • tst_qquicktextinput
2
1550 } else {
executed 6 times by 1 test: end of block
Executed by:
  • tst_qquicktextinput
6
1551 if (d->sendMouseEventToInputContext(event))
d->sendMouseEv...Context(event)Description
TRUEnever evaluated
FALSEnever evaluated
0
1552 return;
never executed: return;
0
1553 QQuickImplicitSizeItem::mouseDoubleClickEvent(event);-
1554 }
never executed: end of block
0
1555}-
1556-
1557void QQuickTextInput::mousePressEvent(QMouseEvent *event)-
1558{-
1559 Q_D(QQuickTextInput);-
1560-
1561 d->pressPos = event->localPos();-
1562-
1563 if (d->sendMouseEventToInputContext(event))
d->sendMouseEv...Context(event)Description
TRUEevaluated 2 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEevaluated 84 times by 1 test
Evaluated by:
  • tst_qquicktextinput
2-84
1564 return;
executed 2 times by 1 test: return;
Executed by:
  • tst_qquicktextinput
2
1565-
1566 if (d->selectByMouse) {
d->selectByMouseDescription
TRUEevaluated 68 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEevaluated 16 times by 1 test
Evaluated by:
  • tst_qquicktextinput
16-68
1567 setKeepMouseGrab(false);-
1568 d->selectPressed = true;-
1569 QPointF distanceVector = d->pressPos - d->tripleClickStartPoint;-
1570 if (d->hasPendingTripleClick()
d->hasPendingTripleClick()Description
TRUEevaluated 12 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEevaluated 56 times by 1 test
Evaluated by:
  • tst_qquicktextinput
12-56
1571 && distanceVector.manhattanLength() < QGuiApplication::styleHints()->startDragDistance()) {
distanceVector...DragDistance()Description
TRUEevaluated 10 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEevaluated 2 times by 1 test
Evaluated by:
  • tst_qquicktextinput
2-10
1572 event->setAccepted(true);-
1573 selectAll();-
1574 return;
executed 10 times by 1 test: return;
Executed by:
  • tst_qquicktextinput
10
1575 }-
1576 }
executed 58 times by 1 test: end of block
Executed by:
  • tst_qquicktextinput
58
1577-
1578 bool mark = (event->modifiers() & Qt::ShiftModifier) && d->selectByMouse;
d->selectByMouseDescription
TRUEnever evaluated
FALSEnever evaluated
0
1579 int cursor = d->positionAt(event->localPos());-
1580 d->moveCursor(cursor, mark);-
1581-
1582 if (d->focusOnPress && !qGuiApp->styleHints()->setFocusOnTouchRelease())
d->focusOnPressDescription
TRUEevaluated 64 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEevaluated 10 times by 1 test
Evaluated by:
  • tst_qquicktextinput
!(static_cast<...TouchRelease()Description
TRUEevaluated 64 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEnever evaluated
0-64
1583 ensureActiveFocus();
executed 64 times by 1 test: ensureActiveFocus();
Executed by:
  • tst_qquicktextinput
64
1584-
1585 event->setAccepted(true);-
1586}
executed 74 times by 1 test: end of block
Executed by:
  • tst_qquicktextinput
74
1587-
1588void QQuickTextInput::mouseMoveEvent(QMouseEvent *event)-
1589{-
1590 Q_D(QQuickTextInput);-
1591-
1592 if (d->selectPressed) {
d->selectPressedDescription
TRUEevaluated 36 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEnever evaluated
0-36
1593 if (qAbs(int(event->localPos().x() - d->pressPos.x())) > QGuiApplication::styleHints()->startDragDistance())
qAbs(int(event...DragDistance()Description
TRUEevaluated 36 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEnever evaluated
0-36
1594 setKeepMouseGrab(true);
executed 36 times by 1 test: setKeepMouseGrab(true);
Executed by:
  • tst_qquicktextinput
36
1595-
1596#if QT_CONFIG(im)-
1597 if (d->composeMode()) {
d->composeMode()Description
TRUEnever evaluated
FALSEevaluated 36 times by 1 test
Evaluated by:
  • tst_qquicktextinput
0-36
1598 // start selection-
1599 int startPos = d->positionAt(d->pressPos);-
1600 int currentPos = d->positionAt(event->localPos());-
1601 if (startPos != currentPos)
startPos != currentPosDescription
TRUEnever evaluated
FALSEnever evaluated
0
1602 d->setSelection(startPos, currentPos - startPos);
never executed: d->setSelection(startPos, currentPos - startPos);
0
1603 } else
never executed: end of block
0
1604#endif-
1605 {-
1606 moveCursorSelection(d->positionAt(event->localPos()), d->mouseSelectionMode);-
1607 }
executed 36 times by 1 test: end of block
Executed by:
  • tst_qquicktextinput
36
1608 event->setAccepted(true);-
1609 } else {
executed 36 times by 1 test: end of block
Executed by:
  • tst_qquicktextinput
36
1610 QQuickImplicitSizeItem::mouseMoveEvent(event);-
1611 }
never executed: end of block
0
1612}-
1613-
1614void QQuickTextInput::mouseReleaseEvent(QMouseEvent *event)-
1615{-
1616 Q_D(QQuickTextInput);-
1617 if (d->sendMouseEventToInputContext(event))
d->sendMouseEv...Context(event)Description
TRUEevaluated 2 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEevaluated 84 times by 1 test
Evaluated by:
  • tst_qquicktextinput
2-84
1618 return;
executed 2 times by 1 test: return;
Executed by:
  • tst_qquicktextinput
2
1619 if (d->selectPressed) {
d->selectPressedDescription
TRUEevaluated 68 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEevaluated 16 times by 1 test
Evaluated by:
  • tst_qquicktextinput
16-68
1620 d->selectPressed = false;-
1621 setKeepMouseGrab(false);-
1622 }
executed 68 times by 1 test: end of block
Executed by:
  • tst_qquicktextinput
68
1623#if QT_CONFIG(clipboard)-
1624 if (QGuiApplication::clipboard()->supportsSelection()) {
QGuiApplicatio...rtsSelection()Description
TRUEevaluated 84 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEnever evaluated
0-84
1625 if (event->button() == Qt::LeftButton) {
event->button(...Qt::LeftButtonDescription
TRUEevaluated 82 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEevaluated 2 times by 1 test
Evaluated by:
  • tst_qquicktextinput
2-82
1626 d->copy(QClipboard::Selection);-
1627 } else if (!d->m_readOnly && event->button() == Qt::MidButton) {
executed 82 times by 1 test: end of block
Executed by:
  • tst_qquicktextinput
!d->m_readOnlyDescription
TRUEevaluated 2 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEnever evaluated
event->button(... Qt::MidButtonDescription
TRUEevaluated 2 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEnever evaluated
0-82
1628 d->deselect();-
1629 d->insert(QGuiApplication::clipboard()->text(QClipboard::Selection));-
1630 }
executed 2 times by 1 test: end of block
Executed by:
  • tst_qquicktextinput
2
1631 }
executed 84 times by 1 test: end of block
Executed by:
  • tst_qquicktextinput
84
1632#endif-
1633-
1634 if (d->focusOnPress && qGuiApp->styleHints()->setFocusOnTouchRelease())
d->focusOnPressDescription
TRUEevaluated 74 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEevaluated 10 times by 1 test
Evaluated by:
  • tst_qquicktextinput
(static_cast<Q...TouchRelease()Description
TRUEnever evaluated
FALSEevaluated 74 times by 1 test
Evaluated by:
  • tst_qquicktextinput
0-74
1635 ensureActiveFocus();
never executed: ensureActiveFocus();
0
1636-
1637 if (!event->isAccepted())
!event->isAccepted()Description
TRUEnever evaluated
FALSEevaluated 84 times by 1 test
Evaluated by:
  • tst_qquicktextinput
0-84
1638 QQuickImplicitSizeItem::mouseReleaseEvent(event);
never executed: QQuickImplicitSizeItem::mouseReleaseEvent(event);
0
1639}
executed 84 times by 1 test: end of block
Executed by:
  • tst_qquicktextinput
84
1640-
1641bool QQuickTextInputPrivate::sendMouseEventToInputContext(QMouseEvent *event)-
1642{-
1643#if QT_CONFIG(im)-
1644 if (composeMode()) {
composeMode()Description
TRUEevaluated 4 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEevaluated 168 times by 1 test
Evaluated by:
  • tst_qquicktextinput
4-168
1645 int tmp_cursor = positionAt(event->localPos());-
1646 int mousePos = tmp_cursor - m_cursor;-
1647 if (mousePos >= 0 && mousePos <= m_textLayout.preeditAreaText().length()) {
mousePos >= 0Description
TRUEevaluated 4 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEnever evaluated
mousePos <= m_...ext().length()Description
TRUEevaluated 4 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEnever evaluated
0-4
1648 if (event->type() == QEvent::MouseButtonRelease) {
event->type() ...eButtonReleaseDescription
TRUEevaluated 2 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEevaluated 2 times by 1 test
Evaluated by:
  • tst_qquicktextinput
2
1649 QGuiApplication::inputMethod()->invokeAction(QInputMethod::Click, mousePos);-
1650 }
executed 2 times by 1 test: end of block
Executed by:
  • tst_qquicktextinput
2
1651 return true;
executed 4 times by 1 test: return true;
Executed by:
  • tst_qquicktextinput
4
1652 }-
1653 }
never executed: end of block
0
1654#else-
1655 Q_UNUSED(event);-
1656#endif-
1657-
1658 return false;
executed 168 times by 1 test: return false;
Executed by:
  • tst_qquicktextinput
168
1659}-
1660-
1661void QQuickTextInput::mouseUngrabEvent()-
1662{-
1663 Q_D(QQuickTextInput);-
1664 d->selectPressed = false;-
1665 setKeepMouseGrab(false);-
1666}
executed 86 times by 1 test: end of block
Executed by:
  • tst_qquicktextinput
86
1667-
1668bool QQuickTextInput::event(QEvent* ev)-
1669{-
1670#if QT_CONFIG(shortcut)-
1671 Q_D(QQuickTextInput);-
1672 if (ev->type() == QEvent::ShortcutOverride) {
ev->type() == ...ortcutOverrideDescription
TRUEevaluated 1176 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEevaluated 7113 times by 5 tests
Evaluated by:
  • tst_examples
  • tst_qquickitem
  • tst_qquickitem2
  • tst_qquicktextedit
  • tst_qquicktextinput
1176-7113
1673 if (d->m_readOnly)
d->m_readOnlyDescription
TRUEnever evaluated
FALSEevaluated 1176 times by 1 test
Evaluated by:
  • tst_qquicktextinput
0-1176
1674 return false;
never executed: return false;
0
1675 QKeyEvent* ke = static_cast<QKeyEvent*>(ev);-
1676 if (ke == QKeySequence::Copy
ke == QKeySequence::CopyDescription
TRUEevaluated 10 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEevaluated 1166 times by 1 test
Evaluated by:
  • tst_qquicktextinput
10-1166
1677 || ke == QKeySequence::Paste
ke == QKeySequence::PasteDescription
TRUEevaluated 4 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEevaluated 1162 times by 1 test
Evaluated by:
  • tst_qquicktextinput
4-1162
1678 || ke == QKeySequence::Cut
ke == QKeySequence::CutDescription
TRUEevaluated 2 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEevaluated 1160 times by 1 test
Evaluated by:
  • tst_qquicktextinput
2-1160
1679 || ke == QKeySequence::Redo
ke == QKeySequence::RedoDescription
TRUEnever evaluated
FALSEevaluated 1160 times by 1 test
Evaluated by:
  • tst_qquicktextinput
0-1160
1680 || ke == QKeySequence::Undo
ke == QKeySequence::UndoDescription
TRUEnever evaluated
FALSEevaluated 1160 times by 1 test
Evaluated by:
  • tst_qquicktextinput
0-1160
1681 || ke == QKeySequence::MoveToNextWord
ke == QKeySequ...MoveToNextWordDescription
TRUEevaluated 8 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEevaluated 1152 times by 1 test
Evaluated by:
  • tst_qquicktextinput
8-1152
1682 || ke == QKeySequence::MoveToPreviousWord
ke == QKeySequ...ToPreviousWordDescription
TRUEevaluated 8 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEevaluated 1144 times by 1 test
Evaluated by:
  • tst_qquicktextinput
8-1144
1683 || ke == QKeySequence::MoveToStartOfDocument
ke == QKeySequ...tartOfDocumentDescription
TRUEnever evaluated
FALSEevaluated 1144 times by 1 test
Evaluated by:
  • tst_qquicktextinput
0-1144
1684 || ke == QKeySequence::MoveToEndOfDocument
ke == QKeySequ...oEndOfDocumentDescription
TRUEnever evaluated
FALSEevaluated 1144 times by 1 test
Evaluated by:
  • tst_qquicktextinput
0-1144
1685 || ke == QKeySequence::SelectNextWord
ke == QKeySequ...SelectNextWordDescription
TRUEevaluated 2 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEevaluated 1142 times by 1 test
Evaluated by:
  • tst_qquicktextinput
2-1142
1686 || ke == QKeySequence::SelectPreviousWord
ke == QKeySequ...ctPreviousWordDescription
TRUEevaluated 2 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEevaluated 1140 times by 1 test
Evaluated by:
  • tst_qquicktextinput
2-1140
1687 || ke == QKeySequence::SelectStartOfLine
ke == QKeySequ...ectStartOfLineDescription
TRUEevaluated 2 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEevaluated 1138 times by 1 test
Evaluated by:
  • tst_qquicktextinput
2-1138
1688 || ke == QKeySequence::SelectEndOfLine
ke == QKeySequ...electEndOfLineDescription
TRUEevaluated 2 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEevaluated 1136 times by 1 test
Evaluated by:
  • tst_qquicktextinput
2-1136
1689 || ke == QKeySequence::SelectStartOfBlock
ke == QKeySequ...ctStartOfBlockDescription
TRUEnever evaluated
FALSEevaluated 1136 times by 1 test
Evaluated by:
  • tst_qquicktextinput
0-1136
1690 || ke == QKeySequence::SelectEndOfBlock
ke == QKeySequ...lectEndOfBlockDescription
TRUEnever evaluated
FALSEevaluated 1136 times by 1 test
Evaluated by:
  • tst_qquicktextinput
0-1136
1691 || ke == QKeySequence::SelectStartOfDocument
ke == QKeySequ...tartOfDocumentDescription
TRUEnever evaluated
FALSEevaluated 1136 times by 1 test
Evaluated by:
  • tst_qquicktextinput
0-1136
1692 || ke == QKeySequence::SelectAll
ke == QKeySequence::SelectAllDescription
TRUEevaluated 4 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEevaluated 1132 times by 1 test
Evaluated by:
  • tst_qquicktextinput
4-1132
1693 || ke == QKeySequence::SelectEndOfDocument
ke == QKeySequ...tEndOfDocumentDescription
TRUEevaluated 2 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEevaluated 1130 times by 1 test
Evaluated by:
  • tst_qquicktextinput
2-1130
1694 || ke == QKeySequence::DeleteCompleteLine) {
ke == QKeySequ...teCompleteLineDescription
TRUEevaluated 2 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEevaluated 1128 times by 1 test
Evaluated by:
  • tst_qquicktextinput
2-1128
1695 ke->accept();-
1696 return true;
executed 48 times by 1 test: return true;
Executed by:
  • tst_qquicktextinput
48
1697 } else if (ke->modifiers() == Qt::NoModifier || ke->modifiers() == Qt::ShiftModifier
ke->modifiers(...Qt::NoModifierDescription
TRUEevaluated 1046 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEevaluated 82 times by 1 test
Evaluated by:
  • tst_qquicktextinput
ke->modifiers(...:ShiftModifierDescription
TRUEevaluated 26 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEevaluated 56 times by 1 test
Evaluated by:
  • tst_qquicktextinput
26-1046
1698 || ke->modifiers() == Qt::KeypadModifier) {
ke->modifiers(...KeypadModifierDescription
TRUEnever evaluated
FALSEevaluated 56 times by 1 test
Evaluated by:
  • tst_qquicktextinput
0-56
1699 if (ke->key() < Qt::Key_Escape) {
ke->key() < Qt::Key_EscapeDescription
TRUEevaluated 976 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEevaluated 96 times by 1 test
Evaluated by:
  • tst_qquicktextinput
96-976
1700 ke->accept();-
1701 return true;
executed 976 times by 1 test: return true;
Executed by:
  • tst_qquicktextinput
976
1702 } else {-
1703 switch (ke->key()) {-
1704 case Qt::Key_Delete:
executed 14 times by 1 test: case Qt::Key_Delete:
Executed by:
  • tst_qquicktextinput
14
1705 case Qt::Key_Home:
executed 2 times by 1 test: case Qt::Key_Home:
Executed by:
  • tst_qquicktextinput
2
1706 case Qt::Key_End:
never executed: case Qt::Key_End:
0
1707 case Qt::Key_Backspace:
executed 36 times by 1 test: case Qt::Key_Backspace:
Executed by:
  • tst_qquicktextinput
36
1708 case Qt::Key_Left:
executed 10 times by 1 test: case Qt::Key_Left:
Executed by:
  • tst_qquicktextinput
10
1709 case Qt::Key_Right:
executed 6 times by 1 test: case Qt::Key_Right:
Executed by:
  • tst_qquicktextinput
6
1710 ke->accept();-
1711 return true;
executed 68 times by 1 test: return true;
Executed by:
  • tst_qquicktextinput
68
1712 default:
executed 28 times by 1 test: default:
Executed by:
  • tst_qquicktextinput
28
1713 break;
executed 28 times by 1 test: break;
Executed by:
  • tst_qquicktextinput
28
1714 }-
1715 }-
1716 }-
1717 }
executed 84 times by 1 test: end of block
Executed by:
  • tst_qquicktextinput
84
1718#endif-
1719-
1720 return QQuickImplicitSizeItem::event(ev);
executed 7197 times by 5 tests: return QQuickImplicitSizeItem::event(ev);
Executed by:
  • tst_examples
  • tst_qquickitem
  • tst_qquickitem2
  • tst_qquicktextedit
  • tst_qquicktextinput
7197
1721}-
1722-
1723void QQuickTextInput::geometryChanged(const QRectF &newGeometry,-
1724 const QRectF &oldGeometry)-
1725{-
1726 Q_D(QQuickTextInput);-
1727 if (!d->inLayout) {
!d->inLayoutDescription
TRUEevaluated 3019 times by 5 tests
Evaluated by:
  • tst_examples
  • tst_qquickitem
  • tst_qquickitem2
  • tst_qquicktextedit
  • tst_qquicktextinput
FALSEevaluated 6 times by 1 test
Evaluated by:
  • tst_qquicktextinput
6-3019
1728 if (newGeometry.width() != oldGeometry.width())
newGeometry.wi...ometry.width()Description
TRUEevaluated 2686 times by 5 tests
Evaluated by:
  • tst_examples
  • tst_qquickitem
  • tst_qquickitem2
  • tst_qquicktextedit
  • tst_qquicktextinput
FALSEevaluated 333 times by 4 tests
Evaluated by:
  • tst_examples
  • tst_qquickitem
  • tst_qquickitem2
  • tst_qquicktextinput
333-2686
1729 d->updateLayout();
executed 2686 times by 5 tests: d->updateLayout();
Executed by:
  • tst_examples
  • tst_qquickitem
  • tst_qquickitem2
  • tst_qquicktextedit
  • tst_qquicktextinput
2686
1730 else if (newGeometry.height() != oldGeometry.height() && d->vAlign != QQuickTextInput::AlignTop)
newGeometry.he...metry.height()Description
TRUEevaluated 282 times by 4 tests
Evaluated by:
  • tst_examples
  • tst_qquickitem
  • tst_qquickitem2
  • tst_qquicktextinput
FALSEevaluated 51 times by 4 tests
Evaluated by:
  • tst_examples
  • tst_qquickitem
  • tst_qquickitem2
  • tst_qquicktextinput
d->vAlign != Q...nput::AlignTopDescription
TRUEevaluated 20 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEevaluated 262 times by 4 tests
Evaluated by:
  • tst_examples
  • tst_qquickitem
  • tst_qquickitem2
  • tst_qquicktextinput
20-282
1731 d->updateBaselineOffset();
executed 20 times by 1 test: d->updateBaselineOffset();
Executed by:
  • tst_qquicktextinput
20
1732 updateCursorRectangle();-
1733 }
executed 3019 times by 5 tests: end of block
Executed by:
  • tst_examples
  • tst_qquickitem
  • tst_qquickitem2
  • tst_qquicktextedit
  • tst_qquicktextinput
3019
1734 QQuickImplicitSizeItem::geometryChanged(newGeometry, oldGeometry);-
1735}
executed 3025 times by 5 tests: end of block
Executed by:
  • tst_examples
  • tst_qquickitem
  • tst_qquickitem2
  • tst_qquicktextedit
  • tst_qquicktextinput
3025
1736-
1737void QQuickTextInputPrivate::ensureVisible(int position, int preeditCursor, int preeditLength)-
1738{-
1739 Q_Q(QQuickTextInput);-
1740 QTextLine textLine = m_textLayout.lineForTextPosition(position + preeditCursor);-
1741 const qreal width = qMax<qreal>(0, q->width() - q->leftPadding() - q->rightPadding());-
1742 qreal cix = 0;-
1743 qreal widthUsed = 0;-
1744 if (textLine.isValid()) {
textLine.isValid()Description
TRUEevaluated 8395 times by 5 tests
Evaluated by:
  • tst_examples
  • tst_qquickitem
  • tst_qquickitem2
  • tst_qquicktextedit
  • tst_qquicktextinput
FALSEevaluated 10 times by 3 tests
Evaluated by:
  • tst_examples
  • tst_qquickitem2
  • tst_qquicktextinput
10-8395
1745 cix = textLine.cursorToX(position + preeditLength);-
1746 const qreal cursorWidth = cix >= 0 ? cix : width - cix;
cix >= 0Description
TRUEevaluated 8331 times by 5 tests
Evaluated by:
  • tst_examples
  • tst_qquickitem
  • tst_qquickitem2
  • tst_qquicktextedit
  • tst_qquicktextinput
FALSEevaluated 64 times by 2 tests
Evaluated by:
  • tst_examples
  • tst_qquicktextinput
64-8331
1747 widthUsed = qMax(textLine.naturalTextWidth(), cursorWidth);-
1748 }
executed 8395 times by 5 tests: end of block
Executed by:
  • tst_examples
  • tst_qquickitem
  • tst_qquickitem2
  • tst_qquicktextedit
  • tst_qquicktextinput
8395
1749 int previousScroll = hscroll;-
1750-
1751 if (widthUsed <= width) {
widthUsed <= widthDescription
TRUEevaluated 8091 times by 5 tests
Evaluated by:
  • tst_examples
  • tst_qquickitem
  • tst_qquickitem2
  • tst_qquicktextedit
  • tst_qquicktextinput
FALSEevaluated 314 times by 2 tests
Evaluated by:
  • tst_examples
  • tst_qquicktextinput
314-8091
1752 hscroll = 0;-
1753 } else {
executed 8091 times by 5 tests: end of block
Executed by:
  • tst_examples
  • tst_qquickitem
  • tst_qquickitem2
  • tst_qquicktextedit
  • tst_qquicktextinput
8091
1754 Q_ASSERT(textLine.isValid());-
1755 if (cix - hscroll >= width) {
cix - hscroll >= widthDescription
TRUEevaluated 138 times by 2 tests
Evaluated by:
  • tst_examples
  • tst_qquicktextinput
FALSEevaluated 176 times by 2 tests
Evaluated by:
  • tst_examples
  • tst_qquicktextinput
138-176
1756 // text doesn't fit, cursor is to the right of br (scroll right)-
1757 hscroll = cix - width;-
1758 } else if (cix - hscroll < 0 && hscroll < widthUsed) {
executed 138 times by 2 tests: end of block
Executed by:
  • tst_examples
  • tst_qquicktextinput
cix - hscroll < 0Description
TRUEevaluated 72 times by 2 tests
Evaluated by:
  • tst_examples
  • tst_qquicktextinput
FALSEevaluated 104 times by 2 tests
Evaluated by:
  • tst_examples
  • tst_qquicktextinput
hscroll < widthUsedDescription
TRUEevaluated 70 times by 2 tests
Evaluated by:
  • tst_examples
  • tst_qquicktextinput
FALSEevaluated 2 times by 1 test
Evaluated by:
  • tst_qquicktextinput
2-138
1759 // text doesn't fit, cursor is to the left of br (scroll left)-
1760 hscroll = cix;-
1761 } else if (widthUsed - hscroll < width) {
executed 70 times by 2 tests: end of block
Executed by:
  • tst_examples
  • tst_qquicktextinput
widthUsed - hscroll < widthDescription
TRUEevaluated 10 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEevaluated 96 times by 2 tests
Evaluated by:
  • tst_examples
  • tst_qquicktextinput
10-96
1762 // text doesn't fit, text document is to the left of br; align-
1763 // right-
1764 hscroll = widthUsed - width;-
1765 } else if (width - hscroll > widthUsed) {
executed 10 times by 1 test: end of block
Executed by:
  • tst_qquicktextinput
width - hscroll > widthUsedDescription
TRUEevaluated 8 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEevaluated 88 times by 2 tests
Evaluated by:
  • tst_examples
  • tst_qquicktextinput
8-88
1766 // text doesn't fit, text document is to the right of br; align-
1767 // left-
1768 hscroll = width - widthUsed;-
1769 }
executed 8 times by 1 test: end of block
Executed by:
  • tst_qquicktextinput
8
1770#if QT_CONFIG(im)-
1771 if (preeditLength > 0) {
preeditLength > 0Description
TRUEevaluated 26 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEevaluated 288 times by 2 tests
Evaluated by:
  • tst_examples
  • tst_qquicktextinput
26-288
1772 // check to ensure long pre-edit text doesn't push the cursor-
1773 // off to the left-
1774 cix = textLine.cursorToX(position + qMax(0, preeditCursor - 1));-
1775 if (cix < hscroll)
cix < hscrollDescription
TRUEevaluated 10 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEevaluated 16 times by 1 test
Evaluated by:
  • tst_qquicktextinput
10-16
1776 hscroll = cix;
executed 10 times by 1 test: hscroll = cix;
Executed by:
  • tst_qquicktextinput
10
1777 }
executed 26 times by 1 test: end of block
Executed by:
  • tst_qquicktextinput
26
1778#endif-
1779 }
executed 314 times by 2 tests: end of block
Executed by:
  • tst_examples
  • tst_qquicktextinput
314
1780 if (previousScroll != hscroll)
previousScroll != hscrollDescription
TRUEevaluated 208 times by 2 tests
Evaluated by:
  • tst_examples
  • tst_qquicktextinput
FALSEevaluated 8197 times by 5 tests
Evaluated by:
  • tst_examples
  • tst_qquickitem
  • tst_qquickitem2
  • tst_qquicktextedit
  • tst_qquicktextinput
208-8197
1781 textLayoutDirty = true;
executed 208 times by 2 tests: textLayoutDirty = true;
Executed by:
  • tst_examples
  • tst_qquicktextinput
208
1782}
executed 8405 times by 5 tests: end of block
Executed by:
  • tst_examples
  • tst_qquickitem
  • tst_qquickitem2
  • tst_qquicktextedit
  • tst_qquicktextinput
8405
1783-
1784void QQuickTextInputPrivate::updateHorizontalScroll()-
1785{-
1786 if (autoScroll && m_echoMode != QQuickTextInput::NoEcho) {
autoScrollDescription
TRUEevaluated 8411 times by 5 tests
Evaluated by:
  • tst_examples
  • tst_qquickitem
  • tst_qquickitem2
  • tst_qquicktextedit
  • tst_qquicktextinput
FALSEevaluated 122 times by 1 test
Evaluated by:
  • tst_qquicktextinput
m_echoMode != ...tInput::NoEchoDescription
TRUEevaluated 8401 times by 5 tests
Evaluated by:
  • tst_examples
  • tst_qquickitem
  • tst_qquickitem2
  • tst_qquicktextedit
  • tst_qquicktextinput
FALSEevaluated 10 times by 1 test
Evaluated by:
  • tst_qquicktextinput
10-8411
1787#if QT_CONFIG(im)-
1788 const int preeditLength = m_textLayout.preeditAreaText().length();-
1789 ensureVisible(m_cursor, m_preeditCursor, preeditLength);-
1790#else-
1791 ensureVisible(m_cursor);-
1792#endif-
1793 } else {
executed 8401 times by 5 tests: end of block
Executed by:
  • tst_examples
  • tst_qquickitem
  • tst_qquickitem2
  • tst_qquicktextedit
  • tst_qquicktextinput
8401
1794 hscroll = 0;-
1795 }
executed 132 times by 1 test: end of block
Executed by:
  • tst_qquicktextinput
132
1796}-
1797-
1798void QQuickTextInputPrivate::updateVerticalScroll()-
1799{-
1800 Q_Q(QQuickTextInput);-
1801#if QT_CONFIG(im)-
1802 const int preeditLength = m_textLayout.preeditAreaText().length();-
1803#endif-
1804 const qreal height = qMax<qreal>(0, q->height() - q->topPadding() - q->bottomPadding());-
1805 qreal heightUsed = contentSize.height();-
1806 qreal previousScroll = vscroll;-
1807-
1808 if (!autoScroll || heightUsed <= height) {
!autoScrollDescription
TRUEevaluated 122 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEevaluated 8411 times by 5 tests
Evaluated by:
  • tst_examples
  • tst_qquickitem
  • tst_qquickitem2
  • tst_qquicktextedit
  • tst_qquicktextinput
heightUsed <= heightDescription
TRUEevaluated 8153 times by 5 tests
Evaluated by:
  • tst_examples
  • tst_qquickitem
  • tst_qquickitem2
  • tst_qquicktextedit
  • tst_qquicktextinput
FALSEevaluated 258 times by 1 test
Evaluated by:
  • tst_qquicktextinput
122-8411
1809 // text fits in br; use vscroll for alignment-
1810 vscroll = -QQuickTextUtil::alignedY(-
1811 heightUsed, height, vAlign & ~(Qt::AlignAbsolute|Qt::AlignHorizontal_Mask));-
1812 } else {
executed 8275 times by 5 tests: end of block
Executed by:
  • tst_examples
  • tst_qquickitem
  • tst_qquickitem2
  • tst_qquicktextedit
  • tst_qquicktextinput
8275
1813#if QT_CONFIG(im)-
1814 QTextLine currentLine = m_textLayout.lineForTextPosition(m_cursor + preeditLength);-
1815#else-
1816 QTextLine currentLine = m_textLayout.lineForTextPosition(m_cursor);-
1817#endif-
1818 QRectF r = currentLine.isValid() ? currentLine.rect() : QRectF();
currentLine.isValid()Description
TRUEevaluated 258 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEnever evaluated
0-258
1819 qreal top = r.top();-
1820 int bottom = r.bottom();-
1821-
1822 if (bottom - vscroll >= height) {
bottom - vscroll >= heightDescription
TRUEevaluated 162 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEevaluated 96 times by 1 test
Evaluated by:
  • tst_qquicktextinput
96-162
1823 // text doesn't fit, cursor is to the below the br (scroll down)-
1824 vscroll = bottom - height;-
1825 } else if (top - vscroll < 0 && vscroll < heightUsed) {
executed 162 times by 1 test: end of block
Executed by:
  • tst_qquicktextinput
top - vscroll < 0Description
TRUEevaluated 16 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEevaluated 80 times by 1 test
Evaluated by:
  • tst_qquicktextinput
vscroll < heightUsedDescription
TRUEevaluated 16 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEnever evaluated
0-162
1826 // text doesn't fit, cursor is above br (scroll up)-
1827 vscroll = top;-
1828 } else if (heightUsed - vscroll < height) {
executed 16 times by 1 test: end of block
Executed by:
  • tst_qquicktextinput
heightUsed - vscroll < heightDescription
TRUEevaluated 6 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEevaluated 74 times by 1 test
Evaluated by:
  • tst_qquicktextinput
6-74
1829 // text doesn't fit, text document is to the left of br; align-
1830 // right-
1831 vscroll = heightUsed - height;-
1832 }
executed 6 times by 1 test: end of block
Executed by:
  • tst_qquicktextinput
6
1833#if QT_CONFIG(im)-
1834 if (preeditLength > 0) {
preeditLength > 0Description
TRUEnever evaluated
FALSEevaluated 258 times by 1 test
Evaluated by:
  • tst_qquicktextinput
0-258
1835 // check to ensure long pre-edit text doesn't push the cursor-
1836 // off the top-
1837 currentLine = m_textLayout.lineForTextPosition(m_cursor + qMax(0, m_preeditCursor - 1));-
1838 top = currentLine.isValid() ? currentLine.rect().top() : 0;
currentLine.isValid()Description
TRUEnever evaluated
FALSEnever evaluated
0
1839 if (top < vscroll)
top < vscrollDescription
TRUEnever evaluated
FALSEnever evaluated
0
1840 vscroll = top;
never executed: vscroll = top;
0
1841 }
never executed: end of block
0
1842#endif-
1843 }
executed 258 times by 1 test: end of block
Executed by:
  • tst_qquicktextinput
258
1844 if (previousScroll != vscroll)
previousScroll != vscrollDescription
TRUEevaluated 74 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEevaluated 8459 times by 5 tests
Evaluated by:
  • tst_examples
  • tst_qquickitem
  • tst_qquickitem2
  • tst_qquicktextedit
  • tst_qquicktextinput
74-8459
1845 textLayoutDirty = true;
executed 74 times by 1 test: textLayoutDirty = true;
Executed by:
  • tst_qquicktextinput
74
1846}
executed 8533 times by 5 tests: end of block
Executed by:
  • tst_examples
  • tst_qquickitem
  • tst_qquickitem2
  • tst_qquicktextedit
  • tst_qquicktextinput
8533
1847-
1848void QQuickTextInput::triggerPreprocess()-
1849{-
1850 Q_D(QQuickTextInput);-
1851 if (d->updateType == QQuickTextInputPrivate::UpdateNone)
d->updateType ...te::UpdateNoneDescription
TRUEnever evaluated
FALSEnever evaluated
0
1852 d->updateType = QQuickTextInputPrivate::UpdateOnlyPreprocess;
never executed: d->updateType = QQuickTextInputPrivate::UpdateOnlyPreprocess;
0
1853 polish();-
1854 update();-
1855}
never executed: end of block
0
1856-
1857void QQuickTextInput::updatePolish()-
1858{-
1859 invalidateFontCaches();-
1860}
executed 302 times by 4 tests: end of block
Executed by:
  • tst_examples
  • tst_qquickitem
  • tst_qquickitem2
  • tst_qquicktextinput
302
1861-
1862void QQuickTextInput::invalidateFontCaches()-
1863{-
1864 Q_D(QQuickTextInput);-
1865-
1866 if (d->m_textLayout.engine() != nullptr)
d->m_textLayou...e() != nullptrDescription
TRUEevaluated 599 times by 4 tests
Evaluated by:
  • tst_examples
  • tst_qquickitem
  • tst_qquickitem2
  • tst_qquicktextinput
FALSEnever evaluated
0-599
1867 d->m_textLayout.engine()->resetFontEngineCache();
executed 599 times by 4 tests: d->m_textLayout.engine()->resetFontEngineCache();
Executed by:
  • tst_examples
  • tst_qquickitem
  • tst_qquickitem2
  • tst_qquicktextinput
599
1868}
executed 599 times by 4 tests: end of block
Executed by:
  • tst_examples
  • tst_qquickitem
  • tst_qquickitem2
  • tst_qquicktextinput
599
1869-
1870void QQuickTextInput::ensureActiveFocus()-
1871{-
1872 bool hadActiveFocus = hasActiveFocus();-
1873 forceActiveFocus();-
1874#if QT_CONFIG(im)-
1875 Q_D(QQuickTextInput);-
1876 // re-open input panel on press if already focused-
1877 if (hasActiveFocus() && hadActiveFocus && !d->m_readOnly)
hasActiveFocus()Description
TRUEevaluated 62 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEevaluated 2 times by 1 test
Evaluated by:
  • tst_qquicktextinput
hadActiveFocusDescription
TRUEevaluated 50 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEevaluated 12 times by 1 test
Evaluated by:
  • tst_qquicktextinput
!d->m_readOnlyDescription
TRUEevaluated 36 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEevaluated 14 times by 1 test
Evaluated by:
  • tst_qquicktextinput
2-62
1878 qGuiApp->inputMethod()->show();
executed 36 times by 1 test: (static_cast<QGuiApplication *>(QCoreApplication::instance()))->inputMethod()->show();
Executed by:
  • tst_qquicktextinput
36
1879#else-
1880 Q_UNUSED(hadActiveFocus);-
1881#endif-
1882}
executed 64 times by 1 test: end of block
Executed by:
  • tst_qquicktextinput
64
1883-
1884QSGNode *QQuickTextInput::updatePaintNode(QSGNode *oldNode, UpdatePaintNodeData *data)-
1885{-
1886 Q_UNUSED(data);-
1887 Q_D(QQuickTextInput);-
1888-
1889 if (d->updateType != QQuickTextInputPrivate::UpdatePaintNode && oldNode != nullptr) {
d->updateType ...pdatePaintNodeDescription
TRUEnever evaluated
FALSEevaluated 297 times by 4 tests
Evaluated by:
  • tst_examples
  • tst_qquickitem
  • tst_qquickitem2
  • tst_qquicktextinput
oldNode != nullptrDescription
TRUEnever evaluated
FALSEnever evaluated
0-297
1890 // Update done in preprocess() in the nodes-
1891 d->updateType = QQuickTextInputPrivate::UpdateNone;-
1892 return oldNode;
never executed: return oldNode;
0
1893 }-
1894-
1895 d->updateType = QQuickTextInputPrivate::UpdateNone;-
1896-
1897 QQuickTextNode *node = static_cast<QQuickTextNode *>(oldNode);-
1898 if (node == nullptr)
node == nullptrDescription
TRUEevaluated 162 times by 4 tests
Evaluated by:
  • tst_examples
  • tst_qquickitem
  • tst_qquickitem2
  • tst_qquicktextinput
FALSEevaluated 135 times by 3 tests
Evaluated by:
  • tst_qquickitem
  • tst_qquickitem2
  • tst_qquicktextinput
135-162
1899 node = new QQuickTextNode(this);
executed 162 times by 4 tests: node = new QQuickTextNode(this);
Executed by:
  • tst_examples
  • tst_qquickitem
  • tst_qquickitem2
  • tst_qquicktextinput
162
1900 d->textNode = node;-
1901-
1902 const bool showCursor = !isReadOnly() && d->cursorItem == nullptr && d->cursorVisible && d->m_blinkStatus;
!isReadOnly()Description
TRUEevaluated 267 times by 4 tests
Evaluated by:
  • tst_examples
  • tst_qquickitem
  • tst_qquickitem2
  • tst_qquicktextinput
FALSEevaluated 30 times by 2 tests
Evaluated by:
  • tst_qquickitem2
  • tst_qquicktextinput
d->cursorItem == nullptrDescription
TRUEevaluated 236 times by 4 tests
Evaluated by:
  • tst_examples
  • tst_qquickitem
  • tst_qquickitem2
  • tst_qquicktextinput
FALSEevaluated 31 times by 1 test
Evaluated by:
  • tst_qquicktextinput
d->cursorVisibleDescription
TRUEevaluated 69 times by 4 tests
Evaluated by:
  • tst_examples
  • tst_qquickitem
  • tst_qquickitem2
  • tst_qquicktextinput
FALSEevaluated 167 times by 4 tests
Evaluated by:
  • tst_examples
  • tst_qquickitem
  • tst_qquickitem2
  • tst_qquicktextinput
d->m_blinkStatusDescription
TRUEevaluated 66 times by 4 tests
Evaluated by:
  • tst_examples
  • tst_qquickitem
  • tst_qquickitem2
  • tst_qquicktextinput
FALSEevaluated 3 times by 1 test
Evaluated by:
  • tst_qquicktextinput
3-267
1903-
1904 if (!d->textLayoutDirty && oldNode != nullptr) {
!d->textLayoutDirtyDescription
TRUEevaluated 86 times by 3 tests
Evaluated by:
  • tst_qquickitem
  • tst_qquickitem2
  • tst_qquicktextinput
FALSEevaluated 211 times by 4 tests
Evaluated by:
  • tst_examples
  • tst_qquickitem
  • tst_qquickitem2
  • tst_qquicktextinput
oldNode != nullptrDescription
TRUEevaluated 86 times by 3 tests
Evaluated by:
  • tst_qquickitem
  • tst_qquickitem2
  • tst_qquicktextinput
FALSEnever evaluated
0-211
1905 if (showCursor)
showCursorDescription
TRUEevaluated 26 times by 3 tests
Evaluated by:
  • tst_qquickitem
  • tst_qquickitem2
  • tst_qquicktextinput
FALSEevaluated 60 times by 2 tests
Evaluated by:
  • tst_qquickitem2
  • tst_qquicktextinput
26-60
1906 node->setCursor(cursorRectangle(), d->color);
executed 26 times by 3 tests: node->setCursor(cursorRectangle(), d->color);
Executed by:
  • tst_qquickitem
  • tst_qquickitem2
  • tst_qquicktextinput
26
1907 else-
1908 node->clearCursor();
executed 60 times by 2 tests: node->clearCursor();
Executed by:
  • tst_qquickitem2
  • tst_qquicktextinput
60
1909 } else {-
1910 node->setUseNativeRenderer(d->renderType == NativeRendering);-
1911 node->deleteContent();-
1912 node->setMatrix(QMatrix4x4());-
1913-
1914 QPointF offset(leftPadding(), topPadding());-
1915 if (d->autoScroll && d->m_textLayout.lineCount() > 0) {
d->autoScrollDescription
TRUEevaluated 209 times by 4 tests
Evaluated by:
  • tst_examples
  • tst_qquickitem
  • tst_qquickitem2
  • tst_qquicktextinput
FALSEevaluated 2 times by 1 test
Evaluated by:
  • tst_qquicktextinput
d->m_textLayou...ineCount() > 0Description
TRUEevaluated 209 times by 4 tests
Evaluated by:
  • tst_examples
  • tst_qquickitem
  • tst_qquickitem2
  • tst_qquicktextinput
FALSEnever evaluated
0-209
1916 QFontMetricsF fm(d->font);-
1917 // the y offset is there to keep the baseline constant in case we have script changes in the text.-
1918 offset += -QPointF(d->hscroll, d->vscroll + d->m_textLayout.lineAt(0).ascent() - fm.ascent());-
1919 } else {
executed 209 times by 4 tests: end of block
Executed by:
  • tst_examples
  • tst_qquickitem
  • tst_qquickitem2
  • tst_qquicktextinput
209
1920 offset += -QPointF(d->hscroll, d->vscroll);-
1921 }
executed 2 times by 1 test: end of block
Executed by:
  • tst_qquicktextinput
2
1922-
1923 if (!d->m_textLayout.text().isEmpty()
!d->m_textLayo...xt().isEmpty()Description
TRUEevaluated 145 times by 4 tests
Evaluated by:
  • tst_examples
  • tst_qquickitem
  • tst_qquickitem2
  • tst_qquicktextinput
FALSEevaluated 66 times by 4 tests
Evaluated by:
  • tst_examples
  • tst_qquickitem
  • tst_qquickitem2
  • tst_qquicktextinput
66-145
1924#if QT_CONFIG(im)-
1925 || !d->m_textLayout.preeditAreaText().isEmpty()
!d->m_textLayo...xt().isEmpty()Description
TRUEevaluated 2 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEevaluated 64 times by 4 tests
Evaluated by:
  • tst_examples
  • tst_qquickitem
  • tst_qquickitem2
  • tst_qquicktextinput
2-64
1926#endif-
1927 ) {-
1928 node->addTextLayout(offset, &d->m_textLayout, d->color,-
1929 QQuickText::Normal, QColor(), QColor(),-
1930 d->selectionColor, d->selectedTextColor,-
1931 d->selectionStart(),-
1932 d->selectionEnd() - 1); // selectionEnd() returns first char after-
1933 // selection-
1934 }
executed 147 times by 4 tests: end of block
Executed by:
  • tst_examples
  • tst_qquickitem
  • tst_qquickitem2
  • tst_qquicktextinput
147
1935-
1936 if (showCursor)
showCursorDescription
TRUEevaluated 40 times by 2 tests
Evaluated by:
  • tst_examples
  • tst_qquicktextinput
FALSEevaluated 171 times by 4 tests
Evaluated by:
  • tst_examples
  • tst_qquickitem
  • tst_qquickitem2
  • tst_qquicktextinput
40-171
1937 node->setCursor(cursorRectangle(), d->color);
executed 40 times by 2 tests: node->setCursor(cursorRectangle(), d->color);
Executed by:
  • tst_examples
  • tst_qquicktextinput
40
1938-
1939 d->textLayoutDirty = false;-
1940 }
executed 211 times by 4 tests: end of block
Executed by:
  • tst_examples
  • tst_qquickitem
  • tst_qquickitem2
  • tst_qquicktextinput
211
1941-
1942 invalidateFontCaches();-
1943-
1944 return node;
executed 297 times by 4 tests: return node;
Executed by:
  • tst_examples
  • tst_qquickitem
  • tst_qquickitem2
  • tst_qquicktextinput
297
1945}-
1946-
1947#if QT_CONFIG(im)-
1948QVariant QQuickTextInput::inputMethodQuery(Qt::InputMethodQuery property) const-
1949{-
1950 return inputMethodQuery(property, QVariant());
executed 1279 times by 3 tests: return inputMethodQuery(property, QVariant());
Executed by:
  • tst_qquickitem
  • tst_qquickitem2
  • tst_qquicktextinput
1279
1951}-
1952-
1953QVariant QQuickTextInput::inputMethodQuery(Qt::InputMethodQuery property, QVariant argument) const-
1954{-
1955 Q_D(const QQuickTextInput);-
1956 switch (property) {-
1957 case Qt::ImEnabled:
executed 531 times by 3 tests: case Qt::ImEnabled:
Executed by:
  • tst_qquickitem
  • tst_qquickitem2
  • tst_qquicktextinput
531
1958 return QVariant((bool)(flags() & ItemAcceptsInputMethod));
executed 531 times by 3 tests: return QVariant((bool)(flags() & ItemAcceptsInputMethod));
Executed by:
  • tst_qquickitem
  • tst_qquickitem2
  • tst_qquicktextinput
531
1959 case Qt::ImHints:
executed 396 times by 3 tests: case Qt::ImHints:
Executed by:
  • tst_qquickitem
  • tst_qquickitem2
  • tst_qquicktextinput
396
1960 return QVariant((int) d->effectiveInputMethodHints());
executed 396 times by 3 tests: return QVariant((int) d->effectiveInputMethodHints());
Executed by:
  • tst_qquickitem
  • tst_qquickitem2
  • tst_qquicktextinput
396
1961 case Qt::ImCursorRectangle:
executed 344 times by 1 test: case Qt::ImCursorRectangle:
Executed by:
  • tst_qquicktextinput
344
1962 return cursorRectangle();
executed 344 times by 1 test: return cursorRectangle();
Executed by:
  • tst_qquicktextinput
344
1963 case Qt::ImAnchorRectangle:
never executed: case Qt::ImAnchorRectangle:
0
1964 return d->anchorRectangle();
never executed: return d->anchorRectangle();
0
1965 case Qt::ImFont:
never executed: case Qt::ImFont:
0
1966 return font();
never executed: return font();
0
1967 case Qt::ImCursorPosition: {
never executed: case Qt::ImCursorPosition:
0
1968 const QPointF pt = argument.toPointF();-
1969 if (!pt.isNull())
!pt.isNull()Description
TRUEnever evaluated
FALSEnever evaluated
0
1970 return QVariant(d->positionAt(pt));
never executed: return QVariant(d->positionAt(pt));
0
1971 return QVariant(d->m_cursor);
never executed: return QVariant(d->m_cursor);
0
1972 }-
1973 case Qt::ImSurroundingText:
executed 8 times by 1 test: case Qt::ImSurroundingText:
Executed by:
  • tst_qquicktextinput
8
1974 if (d->m_echoMode == PasswordEchoOnEdit && !d->m_passwordEchoEditing) {
d->m_echoMode ...wordEchoOnEditDescription
TRUEevaluated 8 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEnever evaluated
!d->m_passwordEchoEditingDescription
TRUEevaluated 4 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEevaluated 4 times by 1 test
Evaluated by:
  • tst_qquicktextinput
0-8
1975 return QVariant(displayText());
executed 4 times by 1 test: return QVariant(displayText());
Executed by:
  • tst_qquicktextinput
4
1976 } else {-
1977 return QVariant(d->realText());
executed 4 times by 1 test: return QVariant(d->realText());
Executed by:
  • tst_qquicktextinput
4
1978 }-
1979 case Qt::ImCurrentSelection:
never executed: case Qt::ImCurrentSelection:
0
1980 return QVariant(selectedText());
never executed: return QVariant(selectedText());
0
1981 case Qt::ImMaximumTextLength:
never executed: case Qt::ImMaximumTextLength:
0
1982 return QVariant(maxLength());
never executed: return QVariant(maxLength());
0
1983 case Qt::ImAnchorPosition:
never executed: case Qt::ImAnchorPosition:
0
1984 if (d->selectionStart() == d->selectionEnd())
d->selectionSt...selectionEnd()Description
TRUEnever evaluated
FALSEnever evaluated
0
1985 return QVariant(d->m_cursor);
never executed: return QVariant(d->m_cursor);
0
1986 else if (d->selectionStart() == d->m_cursor)
d->selectionSt...== d->m_cursorDescription
TRUEnever evaluated
FALSEnever evaluated
0
1987 return QVariant(d->selectionEnd());
never executed: return QVariant(d->selectionEnd());
0
1988 else-
1989 return QVariant(d->selectionStart());
never executed: return QVariant(d->selectionStart());
0
1990 case Qt::ImAbsolutePosition:
never executed: case Qt::ImAbsolutePosition:
0
1991 return QVariant(d->m_cursor);
never executed: return QVariant(d->m_cursor);
0
1992 case Qt::ImTextAfterCursor:
never executed: case Qt::ImTextAfterCursor:
0
1993 if (argument.isValid())
argument.isValid()Description
TRUEnever evaluated
FALSEnever evaluated
0
1994 return QVariant(d->m_text.mid(d->m_cursor, argument.toInt()));
never executed: return QVariant(d->m_text.mid(d->m_cursor, argument.toInt()));
0
1995 return QVariant(d->m_text.mid(d->m_cursor));
never executed: return QVariant(d->m_text.mid(d->m_cursor));
0
1996 case Qt::ImTextBeforeCursor:
never executed: case Qt::ImTextBeforeCursor:
0
1997 if (argument.isValid())
argument.isValid()Description
TRUEnever evaluated
FALSEnever evaluated
0
1998 return QVariant(d->m_text.leftRef(d->m_cursor).right(argument.toInt()).toString());
never executed: return QVariant(d->m_text.leftRef(d->m_cursor).right(argument.toInt()).toString());
0
1999 return QVariant(d->m_text.left(d->m_cursor));
never executed: return QVariant(d->m_text.left(d->m_cursor));
0
2000 default:
never executed: default:
0
2001 return QQuickItem::inputMethodQuery(property);
never executed: return QQuickItem::inputMethodQuery(property);
0
2002 }-
2003}-
2004#endif // im-
2005-
2006/*!-
2007 \qmlmethod QtQuick::TextInput::deselect()-
2008-
2009 Removes active text selection.-
2010*/-
2011void QQuickTextInput::deselect()-
2012{-
2013 Q_D(QQuickTextInput);-
2014 d->deselect();-
2015}
executed 4 times by 1 test: end of block
Executed by:
  • tst_qquicktextinput
4
2016-
2017/*!-
2018 \qmlmethod QtQuick::TextInput::selectAll()-
2019-
2020 Causes all text to be selected.-
2021*/-
2022void QQuickTextInput::selectAll()-
2023{-
2024 Q_D(QQuickTextInput);-
2025 d->setSelection(0, text().length());-
2026}
executed 20 times by 1 test: end of block
Executed by:
  • tst_qquicktextinput
20
2027-
2028/*!-
2029 \qmlmethod QtQuick::TextInput::isRightToLeft(int start, int end)-
2030-
2031 Returns true if the natural reading direction of the editor text-
2032 found between positions \a start and \a end is right to left.-
2033*/-
2034bool QQuickTextInput::isRightToLeft(int start, int end)-
2035{-
2036 if (start > end) {
start > endDescription
TRUEevaluated 4 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEevaluated 164 times by 1 test
Evaluated by:
  • tst_qquicktextinput
4-164
2037 qmlWarning(this) << "isRightToLeft(start, end) called with the end property being smaller than the start.";-
2038 return false;
executed 4 times by 1 test: return false;
Executed by:
  • tst_qquicktextinput
4
2039 } else {-
2040 return text().midRef(start, end - start).isRightToLeft();
executed 164 times by 1 test: return text().midRef(start, end - start).isRightToLeft();
Executed by:
  • tst_qquicktextinput
164
2041 }-
2042}-
2043-
2044#if QT_CONFIG(clipboard)-
2045/*!-
2046 \qmlmethod QtQuick::TextInput::cut()-
2047-
2048 Moves the currently selected text to the system clipboard.-
2049-
2050 \note If the echo mode is set to a mode other than Normal then cut-
2051 will not work. This is to prevent using cut as a method of bypassing-
2052 password features of the line control.-
2053*/-
2054void QQuickTextInput::cut()-
2055{-
2056 Q_D(QQuickTextInput);-
2057 if (!d->m_readOnly && d->m_echoMode == QQuickTextInput::Normal) {
!d->m_readOnlyDescription
TRUEevaluated 8 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEevaluated 2 times by 1 test
Evaluated by:
  • tst_qquicktextinput
d->m_echoMode ...tInput::NormalDescription
TRUEevaluated 8 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEnever evaluated
0-8
2058 d->copy();-
2059 d->del();-
2060 }
executed 8 times by 1 test: end of block
Executed by:
  • tst_qquicktextinput
8
2061}
executed 10 times by 1 test: end of block
Executed by:
  • tst_qquicktextinput
10
2062-
2063/*!-
2064 \qmlmethod QtQuick::TextInput::copy()-
2065-
2066 Copies the currently selected text to the system clipboard.-
2067-
2068 \note If the echo mode is set to a mode other than Normal then copy-
2069 will not work. This is to prevent using copy as a method of bypassing-
2070 password features of the line control.-
2071*/-
2072void QQuickTextInput::copy()-
2073{-
2074 Q_D(QQuickTextInput);-
2075 d->copy();-
2076}
executed 14 times by 1 test: end of block
Executed by:
  • tst_qquicktextinput
14
2077-
2078/*!-
2079 \qmlmethod QtQuick::TextInput::paste()-
2080-
2081 Replaces the currently selected text by the contents of the system clipboard.-
2082*/-
2083void QQuickTextInput::paste()-
2084{-
2085 Q_D(QQuickTextInput);-
2086 if (!d->m_readOnly)
!d->m_readOnlyDescription
TRUEevaluated 6 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEevaluated 2 times by 1 test
Evaluated by:
  • tst_qquicktextinput
2-6
2087 d->paste();
executed 6 times by 1 test: d->paste();
Executed by:
  • tst_qquicktextinput
6
2088}
executed 8 times by 1 test: end of block
Executed by:
  • tst_qquicktextinput
8
2089#endif // clipboard-
2090-
2091/*!-
2092 \qmlmethod QtQuick::TextInput::undo()-
2093-
2094 Undoes the last operation if undo is \l {canUndo}{available}. Deselects any-
2095 current selection, and updates the selection start to the current cursor-
2096 position.-
2097*/-
2098-
2099void QQuickTextInput::undo()-
2100{-
2101 Q_D(QQuickTextInput);-
2102 if (!d->m_readOnly) {
!d->m_readOnlyDescription
TRUEevaluated 164 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEnever evaluated
0-164
2103 d->resetInputMethod();-
2104 d->internalUndo();-
2105 d->finishChange(-1, true);-
2106 }
executed 164 times by 1 test: end of block
Executed by:
  • tst_qquicktextinput
164
2107}
executed 164 times by 1 test: end of block
Executed by:
  • tst_qquicktextinput
164
2108-
2109/*!-
2110 \qmlmethod QtQuick::TextInput::redo()-
2111-
2112 Redoes the last operation if redo is \l {canRedo}{available}.-
2113*/-
2114-
2115void QQuickTextInput::redo()-
2116{-
2117 Q_D(QQuickTextInput);-
2118 if (!d->m_readOnly) {
!d->m_readOnlyDescription
TRUEevaluated 12 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEnever evaluated
0-12
2119 d->resetInputMethod();-
2120 d->internalRedo();-
2121 d->finishChange();-
2122 }
executed 12 times by 1 test: end of block
Executed by:
  • tst_qquicktextinput
12
2123}
executed 12 times by 1 test: end of block
Executed by:
  • tst_qquicktextinput
12
2124-
2125/*!-
2126 \qmlmethod QtQuick::TextInput::insert(int position, string text)-
2127-
2128 Inserts \a text into the TextInput at position.-
2129*/-
2130-
2131void QQuickTextInput::insert(int position, const QString &text)-
2132{-
2133 Q_D(QQuickTextInput);-
2134 if (d->m_echoMode == QQuickTextInput::Password) {
d->m_echoMode ...nput::PasswordDescription
TRUEnever evaluated
FALSEevaluated 126 times by 1 test
Evaluated by:
  • tst_qquicktextinput
0-126
2135 if (d->m_passwordMaskDelay > 0)
d->m_passwordMaskDelay > 0Description
TRUEnever evaluated
FALSEnever evaluated
0
2136 d->m_passwordEchoTimer.start(d->m_passwordMaskDelay, this);
never executed: d->m_passwordEchoTimer.start(d->m_passwordMaskDelay, this);
0
2137 }
never executed: end of block
0
2138 if (position < 0 || position > d->m_text.length())
position < 0Description
TRUEevaluated 4 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEevaluated 122 times by 1 test
Evaluated by:
  • tst_qquicktextinput
position > d->m_text.length()Description
TRUEevaluated 2 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEevaluated 120 times by 1 test
Evaluated by:
  • tst_qquicktextinput
2-122
2139 return;
executed 6 times by 1 test: return;
Executed by:
  • tst_qquicktextinput
6
2140-
2141 const int priorState = d->m_undoState;-
2142-
2143 QString insertText = text;-
2144-
2145 if (d->hasSelectedText()) {
d->hasSelectedText()Description
TRUEevaluated 24 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEevaluated 96 times by 1 test
Evaluated by:
  • tst_qquicktextinput
24-96
2146 d->addCommand(QQuickTextInputPrivate::Command(-
2147 QQuickTextInputPrivate::SetSelection, d->m_cursor, 0, d->m_selstart, d->m_selend));-
2148 }
executed 24 times by 1 test: end of block
Executed by:
  • tst_qquicktextinput
24
2149 if (d->m_maskData) {
d->m_maskDataDescription
TRUEevaluated 92 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEevaluated 28 times by 1 test
Evaluated by:
  • tst_qquicktextinput
28-92
2150 insertText = d->maskString(position, insertText);-
2151 for (int i = 0; i < insertText.length(); ++i) {
i < insertText.length()Description
TRUEevaluated 538 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEevaluated 92 times by 1 test
Evaluated by:
  • tst_qquicktextinput
92-538
2152 d->addCommand(QQuickTextInputPrivate::Command(-
2153 QQuickTextInputPrivate::DeleteSelection, position + i, d->m_text.at(position + i), -1, -1));-
2154 d->addCommand(QQuickTextInputPrivate::Command(-
2155 QQuickTextInputPrivate::Insert, position + i, insertText.at(i), -1, -1));-
2156 }
executed 538 times by 1 test: end of block
Executed by:
  • tst_qquicktextinput
538
2157 d->m_text.replace(position, insertText.length(), insertText);-
2158 if (!insertText.isEmpty())
!insertText.isEmpty()Description
TRUEevaluated 82 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEevaluated 10 times by 1 test
Evaluated by:
  • tst_qquicktextinput
10-82
2159 d->m_textDirty = true;
executed 82 times by 1 test: d->m_textDirty = true;
Executed by:
  • tst_qquicktextinput
82
2160 if (position < d->m_selend && position + insertText.length() > d->m_selstart)
position < d->m_selendDescription
TRUEevaluated 8 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEevaluated 84 times by 1 test
Evaluated by:
  • tst_qquicktextinput
position + ins... d->m_selstartDescription
TRUEevaluated 4 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEevaluated 4 times by 1 test
Evaluated by:
  • tst_qquicktextinput
4-84
2161 d->m_selDirty = true;
executed 4 times by 1 test: d->m_selDirty = true;
Executed by:
  • tst_qquicktextinput
4
2162 } else {
executed 92 times by 1 test: end of block
Executed by:
  • tst_qquicktextinput
92
2163 int remaining = d->m_maxLength - d->m_text.length();-
2164 if (remaining != 0) {
remaining != 0Description
TRUEevaluated 28 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEnever evaluated
0-28
2165 insertText = insertText.left(remaining);-
2166 d->m_text.insert(position, insertText);-
2167 for (int i = 0; i < insertText.length(); ++i)
i < insertText.length()Description
TRUEevaluated 154 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEevaluated 28 times by 1 test
Evaluated by:
  • tst_qquicktextinput
28-154
2168 d->addCommand(QQuickTextInputPrivate::Command(
executed 154 times by 1 test: d->addCommand(QQuickTextInputPrivate::Command( QQuickTextInputPrivate::Insert, position + i, insertText.at(i), -1, -1));
Executed by:
  • tst_qquicktextinput
154
2169 QQuickTextInputPrivate::Insert, position + i, insertText.at(i), -1, -1));
executed 154 times by 1 test: d->addCommand(QQuickTextInputPrivate::Command( QQuickTextInputPrivate::Insert, position + i, insertText.at(i), -1, -1));
Executed by:
  • tst_qquicktextinput
154
2170 if (d->m_cursor >= position)
d->m_cursor >= positionDescription
TRUEevaluated 18 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEevaluated 10 times by 1 test
Evaluated by:
  • tst_qquicktextinput
10-18
2171 d->m_cursor += insertText.length();
executed 18 times by 1 test: d->m_cursor += insertText.length();
Executed by:
  • tst_qquicktextinput
18
2172 if (d->m_selstart >= position)
d->m_selstart >= positionDescription
TRUEevaluated 10 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEevaluated 18 times by 1 test
Evaluated by:
  • tst_qquicktextinput
10-18
2173 d->m_selstart += insertText.length();
executed 10 times by 1 test: d->m_selstart += insertText.length();
Executed by:
  • tst_qquicktextinput
10
2174 if (d->m_selend >= position)
d->m_selend >= positionDescription
TRUEevaluated 14 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEevaluated 14 times by 1 test
Evaluated by:
  • tst_qquicktextinput
14
2175 d->m_selend += insertText.length();
executed 14 times by 1 test: d->m_selend += insertText.length();
Executed by:
  • tst_qquicktextinput
14
2176 d->m_textDirty = true;-
2177 if (position >= d->m_selstart && position <= d->m_selend)
position >= d->m_selstartDescription
TRUEevaluated 18 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEevaluated 10 times by 1 test
Evaluated by:
  • tst_qquicktextinput
position <= d->m_selendDescription
TRUEevaluated 4 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEevaluated 14 times by 1 test
Evaluated by:
  • tst_qquicktextinput
4-18
2178 d->m_selDirty = true;
executed 4 times by 1 test: d->m_selDirty = true;
Executed by:
  • tst_qquicktextinput
4
2179 }
executed 28 times by 1 test: end of block
Executed by:
  • tst_qquicktextinput
28
2180 }
executed 28 times by 1 test: end of block
Executed by:
  • tst_qquicktextinput
28
2181-
2182 d->addCommand(QQuickTextInputPrivate::Command(-
2183 QQuickTextInputPrivate::SetSelection, d->m_cursor, 0, d->m_selstart, d->m_selend));-
2184 d->finishChange(priorState);-
2185-
2186 if (d->lastSelectionStart != d->lastSelectionEnd) {
d->lastSelecti...stSelectionEndDescription
TRUEevaluated 24 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEevaluated 96 times by 1 test
Evaluated by:
  • tst_qquicktextinput
24-96
2187 if (d->m_selstart != d->lastSelectionStart) {
d->m_selstart ...SelectionStartDescription
TRUEevaluated 4 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEevaluated 20 times by 1 test
Evaluated by:
  • tst_qquicktextinput
4-20
2188 d->lastSelectionStart = d->m_selstart;-
2189 emit selectionStartChanged();-
2190 }
executed 4 times by 1 test: end of block
Executed by:
  • tst_qquicktextinput
4
2191 if (d->m_selend != d->lastSelectionEnd) {
d->m_selend !=...stSelectionEndDescription
TRUEevaluated 4 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEevaluated 20 times by 1 test
Evaluated by:
  • tst_qquicktextinput
4-20
2192 d->lastSelectionEnd = d->m_selend;-
2193 emit selectionEndChanged();-
2194 }
executed 4 times by 1 test: end of block
Executed by:
  • tst_qquicktextinput
4
2195 }
executed 24 times by 1 test: end of block
Executed by:
  • tst_qquicktextinput
24
2196}
executed 120 times by 1 test: end of block
Executed by:
  • tst_qquicktextinput
120
2197-
2198/*!-
2199 \qmlmethod QtQuick::TextInput::remove(int start, int end)-
2200-
2201 Removes the section of text that is between the \a start and \a end positions from the TextInput.-
2202*/-
2203-
2204void QQuickTextInput::remove(int start, int end)-
2205{-
2206 Q_D(QQuickTextInput);-
2207-
2208 start = qBound(0, start, d->m_text.length());-
2209 end = qBound(0, end, d->m_text.length());-
2210-
2211 if (start > end)
start > endDescription
TRUEevaluated 4 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEevaluated 60 times by 1 test
Evaluated by:
  • tst_qquicktextinput
4-60
2212 qSwap(start, end);
executed 4 times by 1 test: qSwap(start, end);
Executed by:
  • tst_qquicktextinput
4
2213 else if (start == end)
start == endDescription
TRUEnever evaluated
FALSEevaluated 60 times by 1 test
Evaluated by:
  • tst_qquicktextinput
0-60
2214 return;
never executed: return;
0
2215-
2216 if (start < d->m_selend && end > d->m_selstart)
start < d->m_selendDescription
TRUEevaluated 16 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEevaluated 48 times by 1 test
Evaluated by:
  • tst_qquicktextinput
end > d->m_selstartDescription
TRUEevaluated 8 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEevaluated 8 times by 1 test
Evaluated by:
  • tst_qquicktextinput
8-48
2217 d->m_selDirty = true;
executed 8 times by 1 test: d->m_selDirty = true;
Executed by:
  • tst_qquicktextinput
8
2218-
2219 const int priorState = d->m_undoState;-
2220-
2221 d->addCommand(QQuickTextInputPrivate::Command(-
2222 QQuickTextInputPrivate::SetSelection, d->m_cursor, 0, d->m_selstart, d->m_selend));-
2223-
2224 if (start <= d->m_cursor && d->m_cursor < end) {
start <= d->m_cursorDescription
TRUEevaluated 44 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEevaluated 20 times by 1 test
Evaluated by:
  • tst_qquicktextinput
d->m_cursor < endDescription
TRUEevaluated 18 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEevaluated 26 times by 1 test
Evaluated by:
  • tst_qquicktextinput
18-44
2225 // cursor is within the selection. Split up the commands-
2226 // to be able to restore the correct cursor position-
2227 for (int i = d->m_cursor; i >= start; --i) {
i >= startDescription
TRUEevaluated 18 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEevaluated 18 times by 1 test
Evaluated by:
  • tst_qquicktextinput
18
2228 d->addCommand(QQuickTextInputPrivate::Command(-
2229 QQuickTextInputPrivate::DeleteSelection, i, d->m_text.at(i), -1, 1));-
2230 }
executed 18 times by 1 test: end of block
Executed by:
  • tst_qquicktextinput
18
2231 for (int i = end - 1; i > d->m_cursor; --i) {
i > d->m_cursorDescription
TRUEevaluated 162 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEevaluated 18 times by 1 test
Evaluated by:
  • tst_qquicktextinput
18-162
2232 d->addCommand(QQuickTextInputPrivate::Command(-
2233 QQuickTextInputPrivate::DeleteSelection, i - d->m_cursor + start - 1, d->m_text.at(i), -1, -1));-
2234 }
executed 162 times by 1 test: end of block
Executed by:
  • tst_qquicktextinput
162
2235 } else {
executed 18 times by 1 test: end of block
Executed by:
  • tst_qquicktextinput
18
2236 for (int i = end - 1; i >= start; --i) {
i >= startDescription
TRUEevaluated 212 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEevaluated 46 times by 1 test
Evaluated by:
  • tst_qquicktextinput
46-212
2237 d->addCommand(QQuickTextInputPrivate::Command(-
2238 QQuickTextInputPrivate::RemoveSelection, i, d->m_text.at(i), -1, -1));-
2239 }
executed 212 times by 1 test: end of block
Executed by:
  • tst_qquicktextinput
212
2240 }
executed 46 times by 1 test: end of block
Executed by:
  • tst_qquicktextinput
46
2241 if (d->m_maskData) {
d->m_maskDataDescription
TRUEevaluated 26 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEevaluated 38 times by 1 test
Evaluated by:
  • tst_qquicktextinput
26-38
2242 d->m_text.replace(start, end - start, d->clearString(start, end - start));-
2243 for (int i = 0; i < end - start; ++i) {
i < end - startDescription
TRUEevaluated 94 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEevaluated 26 times by 1 test
Evaluated by:
  • tst_qquicktextinput
26-94
2244 d->addCommand(QQuickTextInputPrivate::Command(-
2245 QQuickTextInputPrivate::Insert, start + i, d->m_text.at(start + i), -1, -1));-
2246 }
executed 94 times by 1 test: end of block
Executed by:
  • tst_qquicktextinput
94
2247 } else {
executed 26 times by 1 test: end of block
Executed by:
  • tst_qquicktextinput
26
2248 d->m_text.remove(start, end - start);-
2249-
2250 if (d->m_cursor > start)
d->m_cursor > startDescription
TRUEevaluated 16 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEevaluated 22 times by 1 test
Evaluated by:
  • tst_qquicktextinput
16-22
2251 d->m_cursor -= qMin(d->m_cursor, end) - start;
executed 16 times by 1 test: d->m_cursor -= qMin(d->m_cursor, end) - start;
Executed by:
  • tst_qquicktextinput
16
2252 if (d->m_selstart > start)
d->m_selstart > startDescription
TRUEevaluated 4 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEevaluated 34 times by 1 test
Evaluated by:
  • tst_qquicktextinput
4-34
2253 d->m_selstart -= qMin(d->m_selstart, end) - start;
executed 4 times by 1 test: d->m_selstart -= qMin(d->m_selstart, end) - start;
Executed by:
  • tst_qquicktextinput
4
2254 if (d->m_selend > end)
d->m_selend > endDescription
TRUEevaluated 8 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEevaluated 30 times by 1 test
Evaluated by:
  • tst_qquicktextinput
8-30
2255 d->m_selend -= qMin(d->m_selend, end) - start;
executed 8 times by 1 test: d->m_selend -= qMin(d->m_selend, end) - start;
Executed by:
  • tst_qquicktextinput
8
2256 }
executed 38 times by 1 test: end of block
Executed by:
  • tst_qquicktextinput
38
2257 d->addCommand(QQuickTextInputPrivate::Command(-
2258 QQuickTextInputPrivate::SetSelection, d->m_cursor, 0, d->m_selstart, d->m_selend));-
2259-
2260 d->m_textDirty = true;-
2261 d->finishChange(priorState);-
2262-
2263 if (d->lastSelectionStart != d->lastSelectionEnd) {
d->lastSelecti...stSelectionEndDescription
TRUEevaluated 24 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEevaluated 40 times by 1 test
Evaluated by:
  • tst_qquicktextinput
24-40
2264 if (d->m_selstart != d->lastSelectionStart) {
d->m_selstart ...SelectionStartDescription
TRUEevaluated 4 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEevaluated 20 times by 1 test
Evaluated by:
  • tst_qquicktextinput
4-20
2265 d->lastSelectionStart = d->m_selstart;-
2266 emit selectionStartChanged();-
2267 }
executed 4 times by 1 test: end of block
Executed by:
  • tst_qquicktextinput
4
2268 if (d->m_selend != d->lastSelectionEnd) {
d->m_selend !=...stSelectionEndDescription
TRUEevaluated 4 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEevaluated 20 times by 1 test
Evaluated by:
  • tst_qquicktextinput
4-20
2269 d->lastSelectionEnd = d->m_selend;-
2270 emit selectionEndChanged();-
2271 }
executed 4 times by 1 test: end of block
Executed by:
  • tst_qquicktextinput
4
2272 }
executed 24 times by 1 test: end of block
Executed by:
  • tst_qquicktextinput
24
2273}
executed 64 times by 1 test: end of block
Executed by:
  • tst_qquicktextinput
64
2274-
2275-
2276/*!-
2277 \qmlmethod QtQuick::TextInput::selectWord()-
2278-
2279 Causes the word closest to the current cursor position to be selected.-
2280*/-
2281void QQuickTextInput::selectWord()-
2282{-
2283 Q_D(QQuickTextInput);-
2284 d->selectWordAtPos(d->m_cursor);-
2285}
executed 4 times by 1 test: end of block
Executed by:
  • tst_qquicktextinput
4
2286-
2287/*!-
2288 \qmlproperty string QtQuick::TextInput::passwordCharacter-
2289-
2290 This is the character displayed when echoMode is set to Password or-
2291 PasswordEchoOnEdit. By default it is the password character used by-
2292 the platform theme.-
2293-
2294 If this property is set to a string with more than one character,-
2295 the first character is used. If the string is empty, the value-
2296 is ignored and the property is not set.-
2297*/-
2298QString QQuickTextInput::passwordCharacter() const-
2299{-
2300 Q_D(const QQuickTextInput);-
2301 return QString(d->m_passwordCharacter);
executed 4 times by 1 test: return QString(d->m_passwordCharacter);
Executed by:
  • tst_qquicktextinput
4
2302}-
2303-
2304void QQuickTextInput::setPasswordCharacter(const QString &str)-
2305{-
2306 Q_D(QQuickTextInput);-
2307 if (str.length() < 1)
str.length() < 1Description
TRUEnever evaluated
FALSEevaluated 6 times by 1 test
Evaluated by:
  • tst_qquicktextinput
0-6
2308 return;
never executed: return;
0
2309 d->m_passwordCharacter = str.constData()[0];-
2310 if (d->m_echoMode == Password || d->m_echoMode == PasswordEchoOnEdit)
d->m_echoMode == PasswordDescription
TRUEevaluated 6 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEnever evaluated
d->m_echoMode ...wordEchoOnEditDescription
TRUEnever evaluated
FALSEnever evaluated
0-6
2311 d->updateDisplayText();
executed 6 times by 1 test: d->updateDisplayText();
Executed by:
  • tst_qquicktextinput
6
2312 emit passwordCharacterChanged();-
2313}
executed 6 times by 1 test: end of block
Executed by:
  • tst_qquicktextinput
6
2314-
2315/*!-
2316 \qmlproperty int QtQuick::TextInput::passwordMaskDelay-
2317 \since 5.4-
2318-
2319 Sets the delay before visible character is masked with password character, in milliseconds.-
2320-
2321 The reset method will be called by assigning undefined.-
2322*/-
2323int QQuickTextInput::passwordMaskDelay() const-
2324{-
2325 Q_D(const QQuickTextInput);-
2326 return d->m_passwordMaskDelay;
never executed: return d->m_passwordMaskDelay;
0
2327}-
2328-
2329void QQuickTextInput::setPasswordMaskDelay(int delay)-
2330{-
2331 Q_D(QQuickTextInput);-
2332 if (d->m_passwordMaskDelay != delay) {
d->m_passwordM...Delay != delayDescription
TRUEnever evaluated
FALSEnever evaluated
0
2333 d->m_passwordMaskDelay = delay;-
2334 emit passwordMaskDelayChanged(delay);-
2335 }
never executed: end of block
0
2336}
never executed: end of block
0
2337-
2338void QQuickTextInput::resetPasswordMaskDelay()-
2339{-
2340 setPasswordMaskDelay(qGuiApp->styleHints()->passwordMaskDelay());-
2341}
never executed: end of block
0
2342-
2343/*!-
2344 \qmlproperty string QtQuick::TextInput::displayText-
2345-
2346 This is the text displayed in the TextInput.-
2347-
2348 If \l echoMode is set to TextInput::Normal, this holds the-
2349 same value as the TextInput::text property. Otherwise,-
2350 this property holds the text visible to the user, while-
2351 the \l text property holds the actual entered text.-
2352-
2353 \note Unlike the TextInput::text property, this contains-
2354 partial text input from an input method.-
2355-
2356 \readonly-
2357 \sa preeditText-
2358*/-
2359QString QQuickTextInput::displayText() const-
2360{-
2361 Q_D(const QQuickTextInput);-
2362 return d->m_textLayout.text().insert(d->m_textLayout.preeditAreaPosition(), d->m_textLayout.preeditAreaText());
executed 176 times by 1 test: return d->m_textLayout.text().insert(d->m_textLayout.preeditAreaPosition(), d->m_textLayout.preeditAreaText());
Executed by:
  • tst_qquicktextinput
176
2363}-
2364-
2365/*!-
2366 \qmlproperty string QtQuick::TextInput::preeditText-
2367 \readonly-
2368 \since 5.7-
2369-
2370 This property contains partial text input from an input method.-
2371-
2372 \sa displayText-
2373*/-
2374QString QQuickTextInput::preeditText() const-
2375{-
2376 Q_D(const QQuickTextInput);-
2377 return d->m_textLayout.preeditAreaText();
executed 8 times by 1 test: return d->m_textLayout.preeditAreaText();
Executed by:
  • tst_qquicktextinput
8
2378}-
2379-
2380/*!-
2381 \qmlproperty bool QtQuick::TextInput::selectByMouse-
2382-
2383 Defaults to false.-
2384-
2385 If true, the user can use the mouse to select text in some-
2386 platform-specific way. Note that for some platforms this may-
2387 not be an appropriate interaction (it may conflict with how-
2388 the text needs to behave inside a \l Flickable, for example).-
2389*/-
2390bool QQuickTextInput::selectByMouse() const-
2391{-
2392 Q_D(const QQuickTextInput);-
2393 return d->selectByMouse;
executed 6 times by 1 test: return d->selectByMouse;
Executed by:
  • tst_qquicktextinput
6
2394}-
2395-
2396void QQuickTextInput::setSelectByMouse(bool on)-
2397{-
2398 Q_D(QQuickTextInput);-
2399 if (d->selectByMouse != on) {
d->selectByMouse != onDescription
TRUEevaluated 40 times by 2 tests
Evaluated by:
  • tst_examples
  • tst_qquicktextinput
FALSEevaluated 2 times by 1 test
Evaluated by:
  • tst_qquicktextinput
2-40
2400 d->selectByMouse = on;-
2401 emit selectByMouseChanged(on);-
2402 }
executed 40 times by 2 tests: end of block
Executed by:
  • tst_examples
  • tst_qquicktextinput
40
2403}
executed 42 times by 2 tests: end of block
Executed by:
  • tst_examples
  • tst_qquicktextinput
42
2404-
2405/*!-
2406 \qmlproperty enumeration QtQuick::TextInput::mouseSelectionMode-
2407-
2408 Specifies how text should be selected using a mouse.-
2409-
2410 \list-
2411 \li TextInput.SelectCharacters - The selection is updated with individual characters. (Default)-
2412 \li TextInput.SelectWords - The selection is updated with whole words.-
2413 \endlist-
2414-
2415 This property only applies when \l selectByMouse is true.-
2416*/-
2417-
2418QQuickTextInput::SelectionMode QQuickTextInput::mouseSelectionMode() const-
2419{-
2420 Q_D(const QQuickTextInput);-
2421 return d->mouseSelectionMode;
executed 6 times by 1 test: return d->mouseSelectionMode;
Executed by:
  • tst_qquicktextinput
6
2422}-
2423-
2424void QQuickTextInput::setMouseSelectionMode(SelectionMode mode)-
2425{-
2426 Q_D(QQuickTextInput);-
2427 if (d->mouseSelectionMode != mode) {
d->mouseSelectionMode != modeDescription
TRUEevaluated 10 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEevaluated 8 times by 1 test
Evaluated by:
  • tst_qquicktextinput
8-10
2428 d->mouseSelectionMode = mode;-
2429 emit mouseSelectionModeChanged(mode);-
2430 }
executed 10 times by 1 test: end of block
Executed by:
  • tst_qquicktextinput
10
2431}
executed 18 times by 1 test: end of block
Executed by:
  • tst_qquicktextinput
18
2432-
2433/*!-
2434 \qmlproperty bool QtQuick::TextInput::persistentSelection-
2435-
2436 Whether the TextInput should keep its selection when it loses active focus to another-
2437 item in the scene. By default this is set to false;-
2438*/-
2439-
2440bool QQuickTextInput::persistentSelection() const-
2441{-
2442 Q_D(const QQuickTextInput);-
2443 return d->persistentSelection;
executed 6 times by 1 test: return d->persistentSelection;
Executed by:
  • tst_qquicktextinput
6
2444}-
2445-
2446void QQuickTextInput::setPersistentSelection(bool on)-
2447{-
2448 Q_D(QQuickTextInput);-
2449 if (d->persistentSelection == on)
d->persistentSelection == onDescription
TRUEevaluated 2 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEevaluated 2 times by 1 test
Evaluated by:
  • tst_qquicktextinput
2
2450 return;
executed 2 times by 1 test: return;
Executed by:
  • tst_qquicktextinput
2
2451 d->persistentSelection = on;-
2452 emit persistentSelectionChanged();-
2453}
executed 2 times by 1 test: end of block
Executed by:
  • tst_qquicktextinput
2
2454-
2455/*!-
2456 \qmlproperty bool QtQuick::TextInput::canPaste-
2457-
2458 Returns true if the TextInput is writable and the content of the clipboard is-
2459 suitable for pasting into the TextInput.-
2460*/-
2461bool QQuickTextInput::canPaste() const-
2462{-
2463#if QT_CONFIG(clipboard)-
2464 Q_D(const QQuickTextInput);-
2465 if (!d->canPasteValid) {
!d->canPasteValidDescription
TRUEevaluated 4 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEevaluated 32 times by 1 test
Evaluated by:
  • tst_qquicktextinput
4-32
2466 if (const QMimeData *mimeData = QGuiApplication::clipboard()->mimeData())
const QMimeDat...()->mimeData()Description
TRUEevaluated 4 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEnever evaluated
0-4
2467 const_cast<QQuickTextInputPrivate *>(d)->canPaste = !d->m_readOnly && mimeData->hasText();
executed 4 times by 1 test: const_cast<QQuickTextInputPrivate *>(d)->canPaste = !d->m_readOnly && mimeData->hasText();
Executed by:
  • tst_qquicktextinput
!d->m_readOnlyDescription
TRUEevaluated 4 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEnever evaluated
mimeData->hasText()Description
TRUEevaluated 2 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEevaluated 2 times by 1 test
Evaluated by:
  • tst_qquicktextinput
0-4
2468 const_cast<QQuickTextInputPrivate *>(d)->canPasteValid = true;-
2469 }
executed 4 times by 1 test: end of block
Executed by:
  • tst_qquicktextinput
4
2470 return d->canPaste;
executed 36 times by 1 test: return d->canPaste;
Executed by:
  • tst_qquicktextinput
36
2471#else-
2472 return false;-
2473#endif-
2474}-
2475-
2476/*!-
2477 \qmlproperty bool QtQuick::TextInput::canUndo-
2478-
2479 Returns true if the TextInput is writable and there are previous operations-
2480 that can be undone.-
2481*/-
2482-
2483bool QQuickTextInput::canUndo() const-
2484{-
2485 Q_D(const QQuickTextInput);-
2486 return d->canUndo;
executed 100 times by 1 test: return d->canUndo;
Executed by:
  • tst_qquicktextinput
100
2487}-
2488-
2489/*!-
2490 \qmlproperty bool QtQuick::TextInput::canRedo-
2491-
2492 Returns true if the TextInput is writable and there are \l {undo}{undone}-
2493 operations that can be redone.-
2494*/-
2495-
2496bool QQuickTextInput::canRedo() const-
2497{-
2498 Q_D(const QQuickTextInput);-
2499 return d->canRedo;
executed 28 times by 1 test: return d->canRedo;
Executed by:
  • tst_qquicktextinput
28
2500}-
2501-
2502/*!-
2503 \qmlproperty real QtQuick::TextInput::contentWidth-
2504-
2505 Returns the width of the text, including the width past the width-
2506 which is covered due to insufficient wrapping if \l wrapMode is set.-
2507*/-
2508-
2509qreal QQuickTextInput::contentWidth() const-
2510{-
2511 Q_D(const QQuickTextInput);-
2512 return d->contentSize.width();
executed 136 times by 1 test: return d->contentSize.width();
Executed by:
  • tst_qquicktextinput
136
2513}-
2514-
2515/*!-
2516 \qmlproperty real QtQuick::TextInput::contentHeight-
2517-
2518 Returns the height of the text, including the height past the height-
2519 that is covered if the text does not fit within the set height.-
2520*/-
2521-
2522qreal QQuickTextInput::contentHeight() const-
2523{-
2524 Q_D(const QQuickTextInput);-
2525 return d->contentSize.height();
executed 194 times by 1 test: return d->contentSize.height();
Executed by:
  • tst_qquicktextinput
194
2526}-
2527-
2528void QQuickTextInput::moveCursorSelection(int position)-
2529{-
2530 Q_D(QQuickTextInput);-
2531 d->moveCursor(position, true);-
2532}
executed 2 times by 1 test: end of block
Executed by:
  • tst_qquicktextinput
2
2533-
2534/*!-
2535 \qmlmethod QtQuick::TextInput::moveCursorSelection(int position, SelectionMode mode = TextInput.SelectCharacters)-
2536-
2537 Moves the cursor to \a position and updates the selection according to the optional \a mode-
2538 parameter. (To only move the cursor, set the \l cursorPosition property.)-
2539-
2540 When this method is called it additionally sets either the-
2541 selectionStart or the selectionEnd (whichever was at the previous cursor position)-
2542 to the specified position. This allows you to easily extend and contract the selected-
2543 text range.-
2544-
2545 The selection mode specifies whether the selection is updated on a per character or a per word-
2546 basis. If not specified the selection mode will default to TextInput.SelectCharacters.-
2547-
2548 \list-
2549 \li TextInput.SelectCharacters - Sets either the selectionStart or selectionEnd (whichever was at-
2550 the previous cursor position) to the specified position.-
2551 \li TextInput.SelectWords - Sets the selectionStart and selectionEnd to include all-
2552 words between the specified position and the previous cursor position. Words partially in the-
2553 range are included.-
2554 \endlist-
2555-
2556 For example, take this sequence of calls:-
2557-
2558 \code-
2559 cursorPosition = 5-
2560 moveCursorSelection(9, TextInput.SelectCharacters)-
2561 moveCursorSelection(7, TextInput.SelectCharacters)-
2562 \endcode-
2563-
2564 This moves the cursor to position 5, extend the selection end from 5 to 9-
2565 and then retract the selection end from 9 to 7, leaving the text from position 5 to 7-
2566 selected (the 6th and 7th characters).-
2567-
2568 The same sequence with TextInput.SelectWords will extend the selection start to a word boundary-
2569 before or on position 5 and extend the selection end to a word boundary on or past position 9.-
2570*/-
2571void QQuickTextInput::moveCursorSelection(int pos, SelectionMode mode)-
2572{-
2573 Q_D(QQuickTextInput);-
2574-
2575 if (mode == SelectCharacters) {
mode == SelectCharactersDescription
TRUEevaluated 82 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEevaluated 302 times by 1 test
Evaluated by:
  • tst_qquicktextinput
82-302
2576 d->moveCursor(pos, true);-
2577 } else if (pos != d->m_cursor){
executed 82 times by 1 test: end of block
Executed by:
  • tst_qquicktextinput
pos != d->m_cursorDescription
TRUEevaluated 250 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEevaluated 52 times by 1 test
Evaluated by:
  • tst_qquicktextinput
52-250
2578 const int cursor = d->m_cursor;-
2579 int anchor;-
2580 if (!d->hasSelectedText())
!d->hasSelectedText()Description
TRUEevaluated 194 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEevaluated 56 times by 1 test
Evaluated by:
  • tst_qquicktextinput
56-194
2581 anchor = d->m_cursor;
executed 194 times by 1 test: anchor = d->m_cursor;
Executed by:
  • tst_qquicktextinput
194
2582 else if (d->selectionStart() == d->m_cursor)
d->selectionSt...== d->m_cursorDescription
TRUEevaluated 28 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEevaluated 28 times by 1 test
Evaluated by:
  • tst_qquicktextinput
28
2583 anchor = d->selectionEnd();
executed 28 times by 1 test: anchor = d->selectionEnd();
Executed by:
  • tst_qquicktextinput
28
2584 else-
2585 anchor = d->selectionStart();
executed 28 times by 1 test: anchor = d->selectionStart();
Executed by:
  • tst_qquicktextinput
28
2586-
2587 if (anchor < pos || (anchor == pos && cursor < pos)) {
anchor < posDescription
TRUEevaluated 124 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEevaluated 126 times by 1 test
Evaluated by:
  • tst_qquicktextinput
anchor == posDescription
TRUEevaluated 8 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEevaluated 118 times by 1 test
Evaluated by:
  • tst_qquicktextinput
cursor < posDescription
TRUEevaluated 4 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEevaluated 4 times by 1 test
Evaluated by:
  • tst_qquicktextinput
4-126
2588 const QString text = this->text();-
2589 QTextBoundaryFinder finder(QTextBoundaryFinder::Word, text);-
2590 finder.setPosition(anchor);-
2591-
2592 const QTextBoundaryFinder::BoundaryReasons reasons = finder.boundaryReasons();-
2593 if (anchor < text.length() && (reasons == QTextBoundaryFinder::NotAtBoundary
anchor < text.length()Description
TRUEevaluated 126 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEevaluated 2 times by 1 test
Evaluated by:
  • tst_qquicktextinput
reasons == QTe...:NotAtBoundaryDescription
TRUEevaluated 30 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEevaluated 96 times by 1 test
Evaluated by:
  • tst_qquicktextinput
2-126
2594 || (reasons & QTextBoundaryFinder::EndOfItem))) {-
2595 finder.toPreviousBoundary();-
2596 }
executed 78 times by 1 test: end of block
Executed by:
  • tst_qquicktextinput
78
2597 anchor = finder.position() != -1 ? finder.position() : 0;
finder.position() != -1Description
TRUEevaluated 128 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEnever evaluated
0-128
2598-
2599 finder.setPosition(pos);-
2600 if (pos > 0 && !finder.boundaryReasons())
pos > 0Description
TRUEevaluated 128 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEnever evaluated
!finder.boundaryReasons()Description
TRUEevaluated 62 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEevaluated 66 times by 1 test
Evaluated by:
  • tst_qquicktextinput
0-128
2601 finder.toNextBoundary();
executed 62 times by 1 test: finder.toNextBoundary();
Executed by:
  • tst_qquicktextinput
62
2602 const int cursor = finder.position() != -1 ? finder.position() : text.length();
finder.position() != -1Description
TRUEevaluated 128 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEnever evaluated
0-128
2603-
2604 d->setSelection(anchor, cursor - anchor);-
2605 } else if (anchor > pos || (anchor == pos && cursor > pos)) {
executed 128 times by 1 test: end of block
Executed by:
  • tst_qquicktextinput
anchor > posDescription
TRUEevaluated 118 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEevaluated 4 times by 1 test
Evaluated by:
  • tst_qquicktextinput
anchor == posDescription
TRUEevaluated 4 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEnever evaluated
cursor > posDescription
TRUEevaluated 4 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEnever evaluated
0-128
2606 const QString text = this->text();-
2607 QTextBoundaryFinder finder(QTextBoundaryFinder::Word, text);-
2608 finder.setPosition(anchor);-
2609-
2610 const QTextBoundaryFinder::BoundaryReasons reasons = finder.boundaryReasons();-
2611 if (anchor > 0 && (reasons == QTextBoundaryFinder::NotAtBoundary
anchor > 0Description
TRUEevaluated 120 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEevaluated 2 times by 1 test
Evaluated by:
  • tst_qquicktextinput
reasons == QTe...:NotAtBoundaryDescription
TRUEevaluated 44 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEevaluated 76 times by 1 test
Evaluated by:
  • tst_qquicktextinput
2-120
2612 || (reasons & QTextBoundaryFinder::StartOfItem))) {-
2613 finder.toNextBoundary();-
2614 }
executed 74 times by 1 test: end of block
Executed by:
  • tst_qquicktextinput
74
2615 anchor = finder.position() != -1 ? finder.position() : text.length();
finder.position() != -1Description
TRUEevaluated 122 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEnever evaluated
0-122
2616-
2617 finder.setPosition(pos);-
2618 if (pos < text.length() && !finder.boundaryReasons())
pos < text.length()Description
TRUEevaluated 122 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEnever evaluated
!finder.boundaryReasons()Description
TRUEevaluated 36 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEevaluated 86 times by 1 test
Evaluated by:
  • tst_qquicktextinput
0-122
2619 finder.toPreviousBoundary();
executed 36 times by 1 test: finder.toPreviousBoundary();
Executed by:
  • tst_qquicktextinput
36
2620 const int cursor = finder.position() != -1 ? finder.position() : 0;
finder.position() != -1Description
TRUEevaluated 122 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEnever evaluated
0-122
2621-
2622 d->setSelection(anchor, cursor - anchor);-
2623 }
executed 122 times by 1 test: end of block
Executed by:
  • tst_qquicktextinput
122
2624 }
executed 250 times by 1 test: end of block
Executed by:
  • tst_qquicktextinput
250
2625}
executed 384 times by 1 test: end of block
Executed by:
  • tst_qquicktextinput
384
2626-
2627void QQuickTextInput::focusInEvent(QFocusEvent *event)-
2628{-
2629 Q_D(QQuickTextInput);-
2630 d->handleFocusEvent(event);-
2631 QQuickImplicitSizeItem::focusInEvent(event);-
2632}
executed 384 times by 3 tests: end of block
Executed by:
  • tst_qquickitem
  • tst_qquickitem2
  • tst_qquicktextinput
384
2633-
2634void QQuickTextInputPrivate::handleFocusEvent(QFocusEvent *event)-
2635{-
2636 Q_Q(QQuickTextInput);-
2637 bool focus = event->gotFocus();-
2638 if (!m_readOnly) {
!m_readOnlyDescription
TRUEevaluated 502 times by 3 tests
Evaluated by:
  • tst_qquickitem
  • tst_qquickitem2
  • tst_qquicktextinput
FALSEevaluated 20 times by 2 tests
Evaluated by:
  • tst_qquickitem2
  • tst_qquicktextinput
20-502
2639 q->setCursorVisible(focus);-
2640 setBlinkingCursorEnabled(focus);-
2641 }
executed 502 times by 3 tests: end of block
Executed by:
  • tst_qquickitem
  • tst_qquickitem2
  • tst_qquicktextinput
502
2642 if (focus) {
focusDescription
TRUEevaluated 384 times by 3 tests
Evaluated by:
  • tst_qquickitem
  • tst_qquickitem2
  • tst_qquicktextinput
FALSEevaluated 138 times by 3 tests
Evaluated by:
  • tst_qquickitem
  • tst_qquickitem2
  • tst_qquicktextinput
138-384
2643 q->q_updateAlignment();-
2644#if QT_CONFIG(im)-
2645 if (focusOnPress && !m_readOnly)
focusOnPressDescription
TRUEevaluated 382 times by 3 tests
Evaluated by:
  • tst_qquickitem
  • tst_qquickitem2
  • tst_qquicktextinput
FALSEevaluated 2 times by 1 test
Evaluated by:
  • tst_qquicktextinput
!m_readOnlyDescription
TRUEevaluated 372 times by 3 tests
Evaluated by:
  • tst_qquickitem
  • tst_qquickitem2
  • tst_qquicktextinput
FALSEevaluated 10 times by 2 tests
Evaluated by:
  • tst_qquickitem2
  • tst_qquicktextinput
2-382
2646 qGuiApp->inputMethod()->show();
executed 372 times by 3 tests: (static_cast<QGuiApplication *>(QCoreApplication::instance()))->inputMethod()->show();
Executed by:
  • tst_qquickitem
  • tst_qquickitem2
  • tst_qquicktextinput
372
2647 q->connect(QGuiApplication::inputMethod(), SIGNAL(inputDirectionChanged(Qt::LayoutDirection)),-
2648 q, SLOT(q_updateAlignment()));-
2649#endif-
2650 } else {
executed 384 times by 3 tests: end of block
Executed by:
  • tst_qquickitem
  • tst_qquickitem2
  • tst_qquicktextinput
384
2651 if ((m_passwordEchoEditing || m_passwordEchoTimer.isActive())) {
m_passwordEchoEditingDescription
TRUEevaluated 4 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEevaluated 134 times by 3 tests
Evaluated by:
  • tst_qquickitem
  • tst_qquickitem2
  • tst_qquicktextinput
m_passwordEchoTimer.isActive()Description
TRUEnever evaluated
FALSEevaluated 134 times by 3 tests
Evaluated by:
  • tst_qquickitem
  • tst_qquickitem2
  • tst_qquicktextinput
0-134
2652 updatePasswordEchoEditing(false);//QQuickTextInputPrivate sets it on key events, but doesn't deal with focus events-
2653 }
executed 4 times by 1 test: end of block
Executed by:
  • tst_qquicktextinput
4
2654-
2655 if (event->reason() != Qt::ActiveWindowFocusReason
event->reason(...dowFocusReasonDescription
TRUEevaluated 134 times by 3 tests
Evaluated by:
  • tst_qquickitem
  • tst_qquickitem2
  • tst_qquicktextinput
FALSEevaluated 4 times by 2 tests
Evaluated by:
  • tst_qquickitem2
  • tst_qquicktextinput
4-134
2656 && event->reason() != Qt::PopupFocusReason
event->reason(...pupFocusReasonDescription
TRUEevaluated 134 times by 3 tests
Evaluated by:
  • tst_qquickitem
  • tst_qquickitem2
  • tst_qquicktextinput
FALSEnever evaluated
0-134
2657 && hasSelectedText()
hasSelectedText()Description
TRUEevaluated 8 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEevaluated 126 times by 3 tests
Evaluated by:
  • tst_qquickitem
  • tst_qquickitem2
  • tst_qquicktextinput
8-126
2658 && !persistentSelection)
!persistentSelectionDescription
TRUEevaluated 6 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEevaluated 2 times by 1 test
Evaluated by:
  • tst_qquicktextinput
2-6
2659 deselect();
executed 6 times by 1 test: deselect();
Executed by:
  • tst_qquicktextinput
6
2660-
2661 if (hasAcceptableInput(m_text) == AcceptableInput || fixup())
hasAcceptableI...cceptableInputDescription
TRUEevaluated 136 times by 3 tests
Evaluated by:
  • tst_qquickitem
  • tst_qquickitem2
  • tst_qquicktextinput
FALSEevaluated 2 times by 1 test
Evaluated by:
  • tst_qquicktextinput
fixup()Description
TRUEevaluated 2 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEnever evaluated
0-136
2662 emit q->editingFinished();
executed 138 times by 3 tests: q->editingFinished();
Executed by:
  • tst_qquickitem
  • tst_qquickitem2
  • tst_qquicktextinput
138
2663-
2664#if QT_CONFIG(im)-
2665 q->disconnect(QGuiApplication::inputMethod(), SIGNAL(inputDirectionChanged(Qt::LayoutDirection)),-
2666 q, SLOT(q_updateAlignment()));-
2667#endif-
2668 }
executed 138 times by 3 tests: end of block
Executed by:
  • tst_qquickitem
  • tst_qquickitem2
  • tst_qquicktextinput
138
2669}-
2670-
2671void QQuickTextInput::focusOutEvent(QFocusEvent *event)-
2672{-
2673 Q_D(QQuickTextInput);-
2674 d->handleFocusEvent(event);-
2675 QQuickImplicitSizeItem::focusOutEvent(event);-
2676}
executed 138 times by 3 tests: end of block
Executed by:
  • tst_qquickitem
  • tst_qquickitem2
  • tst_qquicktextinput
138
2677-
2678/*!-
2679 \qmlproperty bool QtQuick::TextInput::inputMethodComposing-
2680-
2681-
2682 This property holds whether the TextInput has partial text input from an-
2683 input method.-
2684-
2685 While it is composing an input method may rely on mouse or key events from-
2686 the TextInput to edit or commit the partial text. This property can be-
2687 used to determine when to disable events handlers that may interfere with-
2688 the correct operation of an input method.-
2689*/-
2690bool QQuickTextInput::isInputMethodComposing() const-
2691{-
2692#if !QT_CONFIG(im)-
2693 return false;-
2694#else-
2695 Q_D(const QQuickTextInput);-
2696 return d->hasImState;
executed 24 times by 1 test: return d->hasImState;
Executed by:
  • tst_qquicktextinput
24
2697#endif-
2698}-
2699-
2700QQuickTextInputPrivate::ExtraData::ExtraData()-
2701 : padding(0)-
2702 , topPadding(0)-
2703 , leftPadding(0)-
2704 , rightPadding(0)-
2705 , bottomPadding(0)-
2706 , explicitTopPadding(false)-
2707 , explicitLeftPadding(false)-
2708 , explicitRightPadding(false)-
2709 , explicitBottomPadding(false)-
2710 , implicitResize(true)-
2711{-
2712}
executed 18 times by 1 test: end of block
Executed by:
  • tst_qquicktextinput
18
2713-
2714void QQuickTextInputPrivate::init()-
2715{-
2716 Q_Q(QQuickTextInput);-
2717#if QT_CONFIG(clipboard)-
2718 if (QGuiApplication::clipboard()->supportsSelection())
QGuiApplicatio...rtsSelection()Description
TRUEevaluated 1042 times by 5 tests
Evaluated by:
  • tst_examples
  • tst_qquickitem
  • tst_qquickitem2
  • tst_qquicktextedit
  • tst_qquicktextinput
FALSEnever evaluated
0-1042
2719 q->setAcceptedMouseButtons(Qt::LeftButton | Qt::MiddleButton);
executed 1042 times by 5 tests: q->setAcceptedMouseButtons(Qt::LeftButton | Qt::MiddleButton);
Executed by:
  • tst_examples
  • tst_qquickitem
  • tst_qquickitem2
  • tst_qquicktextedit
  • tst_qquicktextinput
1042
2720 else-
2721#endif-
2722 q->setAcceptedMouseButtons(Qt::LeftButton);
never executed: q->setAcceptedMouseButtons(Qt::LeftButton);
0
2723-
2724#if QT_CONFIG(im)-
2725 q->setFlag(QQuickItem::ItemAcceptsInputMethod);-
2726#endif-
2727 q->setFlag(QQuickItem::ItemHasContents);-
2728#if QT_CONFIG(clipboard)-
2729 qmlobject_connect(QGuiApplication::clipboard(), QClipboard, SIGNAL(dataChanged()),
executed 10 times by 5 tests: end of block
Executed by:
  • tst_examples
  • tst_qquickitem
  • tst_qquickitem2
  • tst_qquicktextedit
  • tst_qquicktextinput
executed 10 times by 5 tests: methodIdx = QQuickTextInput::staticMetaObject.indexOfSlot(method+1);
Executed by:
  • tst_examples
  • tst_qquickitem
  • tst_qquickitem2
  • tst_qquicktextedit
  • tst_qquicktextinput
never executed: methodIdx = QQuickTextInput::staticMetaObject.indexOfSignal(method+1);
signalIdx < 0Description
TRUEevaluated 10 times by 5 tests
Evaluated by:
  • tst_examples
  • tst_qquickitem
  • tst_qquickitem2
  • tst_qquicktextedit
  • tst_qquicktextinput
FALSEevaluated 1032 times by 4 tests
Evaluated by:
  • tst_examples
  • tst_qquickitem
  • tst_qquickitem2
  • tst_qquicktextinput
methodIdx < 0Description
TRUEevaluated 10 times by 5 tests
Evaluated by:
  • tst_examples
  • tst_qquickitem
  • tst_qquickitem2
  • tst_qquicktextedit
  • tst_qquicktextinput
FALSEevaluated 1032 times by 4 tests
Evaluated by:
  • tst_examples
  • tst_qquickitem
  • tst_qquickitem2
  • tst_qquicktextinput
code == 1Description
TRUEevaluated 10 times by 5 tests
Evaluated by:
  • tst_examples
  • tst_qquickitem
  • tst_qquickitem2
  • tst_qquicktextedit
  • tst_qquicktextinput
FALSEnever evaluated
0-1032
2730 q, QQuickTextInput, SLOT(q_canPasteChanged()));-
2731#endif // clipboard-
2732-
2733 lastSelectionStart = 0;-
2734 lastSelectionEnd = 0;-
2735 determineHorizontalAlignment();-
2736-
2737 if (!qmlDisableDistanceField()) {
!qmlDisableDistanceField()Description
TRUEevaluated 1042 times by 5 tests
Evaluated by:
  • tst_examples
  • tst_qquickitem
  • tst_qquickitem2
  • tst_qquicktextedit
  • tst_qquicktextinput
FALSEnever evaluated
0-1042
2738 QTextOption option = m_textLayout.textOption();-
2739 option.setUseDesignMetrics(renderType != QQuickTextInput::NativeRendering);-
2740 m_textLayout.setTextOption(option);-
2741 }
executed 1042 times by 5 tests: end of block
Executed by:
  • tst_examples
  • tst_qquickitem
  • tst_qquickitem2
  • tst_qquicktextedit
  • tst_qquicktextinput
1042
2742-
2743 m_inputControl = new QInputControl(QInputControl::LineEdit, q);-
2744}
executed 1042 times by 5 tests: end of block
Executed by:
  • tst_examples
  • tst_qquickitem
  • tst_qquickitem2
  • tst_qquicktextedit
  • tst_qquicktextinput
1042
2745-
2746void QQuickTextInputPrivate::resetInputMethod()-
2747{-
2748 Q_Q(QQuickTextInput);-
2749 if (!m_readOnly && q->hasActiveFocus() && qGuiApp)
!m_readOnlyDescription
TRUEevaluated 182 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEnever evaluated
q->hasActiveFocus()Description
TRUEevaluated 182 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEnever evaluated
(static_cast<Q...::instance()))Description
TRUEevaluated 182 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEnever evaluated
0-182
2750 QGuiApplication::inputMethod()->reset();
executed 182 times by 1 test: QGuiApplication::inputMethod()->reset();
Executed by:
  • tst_qquicktextinput
182
2751}
executed 182 times by 1 test: end of block
Executed by:
  • tst_qquicktextinput
182
2752-
2753void QQuickTextInput::updateCursorRectangle(bool scroll)-
2754{-
2755 Q_D(QQuickTextInput);-
2756 if (!isComponentComplete())
!isComponentComplete()Description
TRUEevaluated 1344 times by 4 tests
Evaluated by:
  • tst_examples
  • tst_qquickitem
  • tst_qquickitem2
  • tst_qquicktextinput
FALSEevaluated 8537 times by 5 tests
Evaluated by:
  • tst_examples
  • tst_qquickitem
  • tst_qquickitem2
  • tst_qquicktextedit
  • tst_qquicktextinput
1344-8537
2757 return;
executed 1344 times by 4 tests: return;
Executed by:
  • tst_examples
  • tst_qquickitem
  • tst_qquickitem2
  • tst_qquicktextinput
1344
2758-
2759 if (scroll) {
scrollDescription
TRUEevaluated 8533 times by 5 tests
Evaluated by:
  • tst_examples
  • tst_qquickitem
  • tst_qquickitem2
  • tst_qquicktextedit
  • tst_qquicktextinput
FALSEevaluated 4 times by 1 test
Evaluated by:
  • tst_qquicktextinput
4-8533
2760 d->updateHorizontalScroll();-
2761 d->updateVerticalScroll();-
2762 }
executed 8533 times by 5 tests: end of block
Executed by:
  • tst_examples
  • tst_qquickitem
  • tst_qquickitem2
  • tst_qquicktextedit
  • tst_qquicktextinput
8533
2763 d->updateType = QQuickTextInputPrivate::UpdatePaintNode;-
2764 polish();-
2765 update();-
2766 emit cursorRectangleChanged();-
2767 if (d->cursorItem) {
d->cursorItemDescription
TRUEevaluated 954 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEevaluated 7583 times by 5 tests
Evaluated by:
  • tst_examples
  • tst_qquickitem
  • tst_qquickitem2
  • tst_qquicktextedit
  • tst_qquicktextinput
954-7583
2768 QRectF r = cursorRectangle();-
2769 d->cursorItem->setPosition(r.topLeft());-
2770 d->cursorItem->setHeight(r.height());-
2771 }
executed 954 times by 1 test: end of block
Executed by:
  • tst_qquicktextinput
954
2772#if QT_CONFIG(im)-
2773 updateInputMethod(Qt::ImCursorRectangle | Qt::ImAnchorRectangle);-
2774#endif-
2775}
executed 8537 times by 5 tests: end of block
Executed by:
  • tst_examples
  • tst_qquickitem
  • tst_qquickitem2
  • tst_qquicktextedit
  • tst_qquicktextinput
8537
2776-
2777void QQuickTextInput::selectionChanged()-
2778{-
2779 Q_D(QQuickTextInput);-
2780 d->textLayoutDirty = true; //TODO: Only update rect in selection-
2781 d->updateType = QQuickTextInputPrivate::UpdatePaintNode;-
2782 polish();-
2783 update();-
2784 emit selectedTextChanged();-
2785-
2786 if (d->lastSelectionStart != d->selectionStart()) {
d->lastSelecti...lectionStart()Description
TRUEevaluated 740 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEevaluated 262 times by 1 test
Evaluated by:
  • tst_qquicktextinput
262-740
2787 d->lastSelectionStart = d->selectionStart();-
2788 if (d->lastSelectionStart == -1)
d->lastSelectionStart == -1Description
TRUEevaluated 320 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEevaluated 420 times by 1 test
Evaluated by:
  • tst_qquicktextinput
320-420
2789 d->lastSelectionStart = d->m_cursor;
executed 320 times by 1 test: d->lastSelectionStart = d->m_cursor;
Executed by:
  • tst_qquicktextinput
320
2790 emit selectionStartChanged();-
2791 }
executed 740 times by 1 test: end of block
Executed by:
  • tst_qquicktextinput
740
2792 if (d->lastSelectionEnd != d->selectionEnd()) {
d->lastSelecti...selectionEnd()Description
TRUEevaluated 782 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEevaluated 220 times by 1 test
Evaluated by:
  • tst_qquicktextinput
220-782
2793 d->lastSelectionEnd = d->selectionEnd();-
2794 if (d->lastSelectionEnd == -1)
d->lastSelectionEnd == -1Description
TRUEevaluated 320 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEevaluated 462 times by 1 test
Evaluated by:
  • tst_qquicktextinput
320-462
2795 d->lastSelectionEnd = d->m_cursor;
executed 320 times by 1 test: d->lastSelectionEnd = d->m_cursor;
Executed by:
  • tst_qquicktextinput
320
2796 emit selectionEndChanged();-
2797 }
executed 782 times by 1 test: end of block
Executed by:
  • tst_qquicktextinput
782
2798}
executed 1002 times by 1 test: end of block
Executed by:
  • tst_qquicktextinput
1002
2799-
2800QRectF QQuickTextInput::boundingRect() const-
2801{-
2802 Q_D(const QQuickTextInput);-
2803-
2804 int cursorWidth = d->cursorItem ? 0 : 1;
d->cursorItemDescription
TRUEevaluated 58 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEevaluated 92 times by 1 test
Evaluated by:
  • tst_qquicktextinput
58-92
2805-
2806 qreal hscroll = d->hscroll;-
2807 if (!d->autoScroll || d->contentSize.width() < width())
!d->autoScrollDescription
TRUEevaluated 32 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEevaluated 118 times by 1 test
Evaluated by:
  • tst_qquicktextinput
d->contentSize...th() < width()Description
TRUEevaluated 60 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEevaluated 58 times by 1 test
Evaluated by:
  • tst_qquicktextinput
32-118
2808 hscroll -= QQuickTextUtil::alignedX(d->contentSize.width(), width(), effectiveHAlign());
executed 92 times by 1 test: hscroll -= QQuickTextUtil::alignedX(d->contentSize.width(), width(), effectiveHAlign());
Executed by:
  • tst_qquicktextinput
92
2809-
2810 // Could include font max left/right bearings to either side of rectangle.-
2811 QRectF r(-hscroll, -d->vscroll, d->contentSize.width(), d->contentSize.height());-
2812 r.setRight(r.right() + cursorWidth);-
2813 return r;
executed 150 times by 1 test: return r;
Executed by:
  • tst_qquicktextinput
150
2814}-
2815-
2816QRectF QQuickTextInput::clipRect() const-
2817{-
2818 Q_D(const QQuickTextInput);-
2819-
2820 int cursorWidth = d->cursorItem ? d->cursorItem->width() : 1;
d->cursorItemDescription
TRUEevaluated 40 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEevaluated 32 times by 1 test
Evaluated by:
  • tst_qquicktextinput
32-40
2821-
2822 // Could include font max left/right bearings to either side of rectangle.-
2823 QRectF r = QQuickImplicitSizeItem::clipRect();-
2824 r.setRight(r.right() + cursorWidth);-
2825 return r;
executed 72 times by 1 test: return r;
Executed by:
  • tst_qquicktextinput
72
2826}-
2827-
2828void QQuickTextInput::q_canPasteChanged()-
2829{-
2830 Q_D(QQuickTextInput);-
2831 bool old = d->canPaste;-
2832#if QT_CONFIG(clipboard)-
2833 if (const QMimeData *mimeData = QGuiApplication::clipboard()->mimeData())
const QMimeDat...()->mimeData()Description
TRUEevaluated 816 times by 2 tests
Evaluated by:
  • tst_qquickitem2
  • tst_qquicktextinput
FALSEnever evaluated
0-816
2834 d->canPaste = !d->m_readOnly && mimeData->hasText();
executed 816 times by 2 tests: d->canPaste = !d->m_readOnly && mimeData->hasText();
Executed by:
  • tst_qquickitem2
  • tst_qquicktextinput
!d->m_readOnlyDescription
TRUEevaluated 792 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEevaluated 24 times by 2 tests
Evaluated by:
  • tst_qquickitem2
  • tst_qquicktextinput
mimeData->hasText()Description
TRUEevaluated 754 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEevaluated 38 times by 1 test
Evaluated by:
  • tst_qquicktextinput
24-816
2835 else-
2836 d->canPaste = false;
never executed: d->canPaste = false;
0
2837#endif-
2838-
2839 bool changed = d->canPaste != old || !d->canPasteValid;
d->canPaste != oldDescription
TRUEevaluated 298 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEevaluated 518 times by 2 tests
Evaluated by:
  • tst_qquickitem2
  • tst_qquicktextinput
!d->canPasteValidDescription
TRUEevaluated 20 times by 2 tests
Evaluated by:
  • tst_qquickitem2
  • tst_qquicktextinput
FALSEevaluated 498 times by 1 test
Evaluated by:
  • tst_qquicktextinput
20-518
2840 d->canPasteValid = true;-
2841 if (changed)
changedDescription
TRUEevaluated 318 times by 2 tests
Evaluated by:
  • tst_qquickitem2
  • tst_qquicktextinput
FALSEevaluated 498 times by 1 test
Evaluated by:
  • tst_qquicktextinput
318-498
2842 emit canPasteChanged();
executed 318 times by 2 tests: canPasteChanged();
Executed by:
  • tst_qquickitem2
  • tst_qquicktextinput
318
2843-
2844}
executed 816 times by 2 tests: end of block
Executed by:
  • tst_qquickitem2
  • tst_qquicktextinput
816
2845-
2846void QQuickTextInput::q_updateAlignment()-
2847{-
2848 Q_D(QQuickTextInput);-
2849 if (d->determineHorizontalAlignment()) {
d->determineHo...talAlignment()Description
TRUEevaluated 12 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEevaluated 402 times by 3 tests
Evaluated by:
  • tst_qquickitem
  • tst_qquickitem2
  • tst_qquicktextinput
12-402
2850 d->updateLayout();-
2851 updateCursorRectangle();-
2852 }
executed 12 times by 1 test: end of block
Executed by:
  • tst_qquicktextinput
12
2853}
executed 414 times by 3 tests: end of block
Executed by:
  • tst_qquickitem
  • tst_qquickitem2
  • tst_qquicktextinput
414
2854-
2855/*!-
2856 \internal-
2857-
2858 Updates the display text based of the current edit text-
2859 If the text has changed will emit displayTextChanged()-
2860*/-
2861void QQuickTextInputPrivate::updateDisplayText(bool forceUpdate)-
2862{-
2863 QString orig = m_textLayout.text();-
2864 QString str;-
2865 if (m_echoMode == QQuickTextInput::NoEcho)
m_echoMode == ...tInput::NoEchoDescription
TRUEevaluated 6 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEevaluated 3708 times by 4 tests
Evaluated by:
  • tst_examples
  • tst_qquickitem
  • tst_qquickitem2
  • tst_qquicktextinput
6-3708
2866 str = QString::fromLatin1("");
executed 6 times by 1 test: str = QString::fromLatin1("");
Executed by:
  • tst_qquicktextinput
6
2867 else-
2868 str = m_text;
executed 3708 times by 4 tests: str = m_text;
Executed by:
  • tst_examples
  • tst_qquickitem
  • tst_qquickitem2
  • tst_qquicktextinput
3708
2869-
2870 if (m_echoMode == QQuickTextInput::Password) {
m_echoMode == ...nput::PasswordDescription
TRUEevaluated 32 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEevaluated 3682 times by 4 tests
Evaluated by:
  • tst_examples
  • tst_qquickitem
  • tst_qquickitem2
  • tst_qquicktextinput
32-3682
2871 str.fill(m_passwordCharacter);-
2872 if (m_passwordEchoTimer.isActive() && m_cursor > 0 && m_cursor <= m_text.length()) {
m_passwordEchoTimer.isActive()Description
TRUEnever evaluated
FALSEevaluated 32 times by 1 test
Evaluated by:
  • tst_qquicktextinput
m_cursor > 0Description
TRUEnever evaluated
FALSEnever evaluated
m_cursor <= m_text.length()Description
TRUEnever evaluated
FALSEnever evaluated
0-32
2873 int cursor = m_cursor - 1;-
2874 QChar uc = m_text.at(cursor);-
2875 str[cursor] = uc;-
2876 if (cursor > 0 && uc.unicode() >= 0xdc00 && uc.unicode() < 0xe000) {
cursor > 0Description
TRUEnever evaluated
FALSEnever evaluated
uc.unicode() >= 0xdc00Description
TRUEnever evaluated
FALSEnever evaluated
uc.unicode() < 0xe000Description
TRUEnever evaluated
FALSEnever evaluated
0
2877 // second half of a surrogate, check if we have the first half as well,-
2878 // if yes restore both at once-
2879 uc = m_text.at(cursor - 1);-
2880 if (uc.unicode() >= 0xd800 && uc.unicode() < 0xdc00)
uc.unicode() >= 0xd800Description
TRUEnever evaluated
FALSEnever evaluated
uc.unicode() < 0xdc00Description
TRUEnever evaluated
FALSEnever evaluated
0
2881 str[cursor - 1] = uc;
never executed: str[cursor - 1] = uc;
0
2882 }
never executed: end of block
0
2883 }
never executed: end of block
0
2884 } else if (m_echoMode == QQuickTextInput::PasswordEchoOnEdit && !m_passwordEchoEditing) {
executed 32 times by 1 test: end of block
Executed by:
  • tst_qquicktextinput
m_echoMode == ...wordEchoOnEditDescription
TRUEevaluated 22 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEevaluated 3660 times by 4 tests
Evaluated by:
  • tst_examples
  • tst_qquickitem
  • tst_qquickitem2
  • tst_qquicktextinput
!m_passwordEchoEditingDescription
TRUEevaluated 10 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEevaluated 12 times by 1 test
Evaluated by:
  • tst_qquicktextinput
10-3660
2885 str.fill(m_passwordCharacter);-
2886 }
executed 10 times by 1 test: end of block
Executed by:
  • tst_qquicktextinput
10
2887-
2888 // replace certain non-printable characters with spaces (to avoid-
2889 // drawing boxes when using fonts that don't have glyphs for such-
2890 // characters)-
2891 QChar* uc = str.data();-
2892 for (int i = 0; i < str.length(); ++i) {
i < str.length()Description
TRUEevaluated 48304 times by 4 tests
Evaluated by:
  • tst_examples
  • tst_qquickitem
  • tst_qquickitem2
  • tst_qquicktextinput
FALSEevaluated 3714 times by 4 tests
Evaluated by:
  • tst_examples
  • tst_qquickitem
  • tst_qquickitem2
  • tst_qquicktextinput
3714-48304
2893 if ((uc[i].unicode() < 0x20 && uc[i] != QChar::Tabulation)
uc[i].unicode() < 0x20Description
TRUEevaluated 6 times by 2 tests
Evaluated by:
  • tst_examples
  • tst_qquicktextinput
FALSEevaluated 48298 times by 4 tests
Evaluated by:
  • tst_examples
  • tst_qquickitem
  • tst_qquickitem2
  • tst_qquicktextinput
uc[i] != QChar::TabulationDescription
TRUEevaluated 6 times by 2 tests
Evaluated by:
  • tst_examples
  • tst_qquicktextinput
FALSEnever evaluated
0-48298
2894 || uc[i] == QChar::LineSeparator
uc[i] == QChar::LineSeparatorDescription
TRUEnever evaluated
FALSEevaluated 48298 times by 4 tests
Evaluated by:
  • tst_examples
  • tst_qquickitem
  • tst_qquickitem2
  • tst_qquicktextinput
0-48298
2895 || uc[i] == QChar::ParagraphSeparator
uc[i] == QChar...graphSeparatorDescription
TRUEnever evaluated
FALSEevaluated 48298 times by 4 tests
Evaluated by:
  • tst_examples
  • tst_qquickitem
  • tst_qquickitem2
  • tst_qquicktextinput
0-48298
2896 || uc[i] == QChar::ObjectReplacementCharacter)
uc[i] == QChar...ementCharacterDescription
TRUEnever evaluated
FALSEevaluated 48298 times by 4 tests
Evaluated by:
  • tst_examples
  • tst_qquickitem
  • tst_qquickitem2
  • tst_qquicktextinput
0-48298
2897 uc[i] = QChar(0x0020);
executed 6 times by 2 tests: uc[i] = QChar(0x0020);
Executed by:
  • tst_examples
  • tst_qquicktextinput
6
2898 }
executed 48304 times by 4 tests: end of block
Executed by:
  • tst_examples
  • tst_qquickitem
  • tst_qquickitem2
  • tst_qquicktextinput
48304
2899-
2900 if (str != orig || forceUpdate) {
str != origDescription
TRUEevaluated 3184 times by 4 tests
Evaluated by:
  • tst_examples
  • tst_qquickitem
  • tst_qquickitem2
  • tst_qquicktextinput
FALSEevaluated 530 times by 1 test
Evaluated by:
  • tst_qquicktextinput
forceUpdateDescription
TRUEevaluated 92 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEevaluated 438 times by 1 test
Evaluated by:
  • tst_qquicktextinput
92-3184
2901 m_textLayout.setText(str);-
2902 updateLayout(); // polish?-
2903 emit q_func()->displayTextChanged();-
2904 }
executed 3276 times by 4 tests: end of block
Executed by:
  • tst_examples
  • tst_qquickitem
  • tst_qquickitem2
  • tst_qquicktextinput
3276
2905}
executed 3714 times by 4 tests: end of block
Executed by:
  • tst_examples
  • tst_qquickitem
  • tst_qquickitem2
  • tst_qquicktextinput
3714
2906-
2907qreal QQuickTextInputPrivate::getImplicitWidth() const-
2908{-
2909 Q_Q(const QQuickTextInput);-
2910 if (!requireImplicitWidth) {
!requireImplicitWidthDescription
TRUEevaluated 14 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEevaluated 38 times by 1 test
Evaluated by:
  • tst_qquicktextinput
14-38
2911 QQuickTextInputPrivate *d = const_cast<QQuickTextInputPrivate *>(this);-
2912 d->requireImplicitWidth = true;-
2913-
2914 if (q->isComponentComplete()) {
q->isComponentComplete()Description
TRUEevaluated 10 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEevaluated 4 times by 1 test
Evaluated by:
  • tst_qquicktextinput
4-10
2915 // One time cost, only incurred if implicitWidth is first requested after-
2916 // componentComplete.-
2917 QTextLayout layout(m_text);-
2918-
2919 QTextOption option = m_textLayout.textOption();-
2920 option.setTextDirection(m_layoutDirection);-
2921 option.setFlags(QTextOption::IncludeTrailingSpaces);-
2922 option.setWrapMode(QTextOption::WrapMode(wrapMode));-
2923 option.setAlignment(Qt::Alignment(q->effectiveHAlign()));-
2924 layout.setTextOption(option);-
2925 layout.setFont(font);-
2926#if QT_CONFIG(im)-
2927 layout.setPreeditArea(m_textLayout.preeditAreaPosition(), m_textLayout.preeditAreaText());-
2928#endif-
2929 layout.beginLayout();-
2930-
2931 QTextLine line = layout.createLine();-
2932 line.setLineWidth(INT_MAX);-
2933 d->implicitWidth = qCeil(line.naturalTextWidth()) + q->leftPadding() + q->rightPadding();-
2934-
2935 layout.endLayout();-
2936 }
executed 10 times by 1 test: end of block
Executed by:
  • tst_qquicktextinput
10
2937 }
executed 14 times by 1 test: end of block
Executed by:
  • tst_qquicktextinput
14
2938 return implicitWidth;
executed 52 times by 1 test: return implicitWidth;
Executed by:
  • tst_qquicktextinput
52
2939}-
2940-
2941void QQuickTextInputPrivate::setTopPadding(qreal value, bool reset)-
2942{-
2943 Q_Q(QQuickTextInput);-
2944 qreal oldPadding = q->topPadding();-
2945 if (!reset || extra.isAllocated()) {
!resetDescription
TRUEevaluated 14 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEevaluated 2 times by 1 test
Evaluated by:
  • tst_qquicktextinput
extra.isAllocated()Description
TRUEevaluated 2 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEnever evaluated
0-14
2946 extra.value().topPadding = value;-
2947 extra.value().explicitTopPadding = !reset;-
2948 }
executed 16 times by 1 test: end of block
Executed by:
  • tst_qquicktextinput
16
2949 if ((!reset && !qFuzzyCompare(oldPadding, value)) || (reset && !qFuzzyCompare(oldPadding, padding()))) {
!resetDescription
TRUEevaluated 14 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEevaluated 2 times by 1 test
Evaluated by:
  • tst_qquicktextinput
!qFuzzyCompare...adding, value)Description
TRUEevaluated 14 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEnever evaluated
resetDescription
TRUEevaluated 2 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEnever evaluated
!qFuzzyCompare...ng, padding())Description
TRUEevaluated 2 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEnever evaluated
0-14
2950 updateLayout();-
2951 emit q->topPaddingChanged();-
2952 }
executed 16 times by 1 test: end of block
Executed by:
  • tst_qquicktextinput
16
2953}
executed 16 times by 1 test: end of block
Executed by:
  • tst_qquicktextinput
16
2954-
2955void QQuickTextInputPrivate::setLeftPadding(qreal value, bool reset)-
2956{-
2957 Q_Q(QQuickTextInput);-
2958 qreal oldPadding = q->leftPadding();-
2959 if (!reset || extra.isAllocated()) {
!resetDescription
TRUEevaluated 4 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEevaluated 2 times by 1 test
Evaluated by:
  • tst_qquicktextinput
extra.isAllocated()Description
TRUEevaluated 2 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEnever evaluated
0-4
2960 extra.value().leftPadding = value;-
2961 extra.value().explicitLeftPadding = !reset;-
2962 }
executed 6 times by 1 test: end of block
Executed by:
  • tst_qquicktextinput
6
2963 if ((!reset && !qFuzzyCompare(oldPadding, value)) || (reset && !qFuzzyCompare(oldPadding, padding()))) {
!resetDescription
TRUEevaluated 4 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEevaluated 2 times by 1 test
Evaluated by:
  • tst_qquicktextinput
!qFuzzyCompare...adding, value)Description
TRUEevaluated 4 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEnever evaluated
resetDescription
TRUEevaluated 2 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEnever evaluated
!qFuzzyCompare...ng, padding())Description
TRUEevaluated 2 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEnever evaluated
0-4
2964 updateLayout();-
2965 emit q->leftPaddingChanged();-
2966 }
executed 6 times by 1 test: end of block
Executed by:
  • tst_qquicktextinput
6
2967}
executed 6 times by 1 test: end of block
Executed by:
  • tst_qquicktextinput
6
2968-
2969void QQuickTextInputPrivate::setRightPadding(qreal value, bool reset)-
2970{-
2971 Q_Q(QQuickTextInput);-
2972 qreal oldPadding = q->rightPadding();-
2973 if (!reset || extra.isAllocated()) {
!resetDescription
TRUEevaluated 4 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEevaluated 2 times by 1 test
Evaluated by:
  • tst_qquicktextinput
extra.isAllocated()Description
TRUEevaluated 2 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEnever evaluated
0-4
2974 extra.value().rightPadding = value;-
2975 extra.value().explicitRightPadding = !reset;-
2976 }
executed 6 times by 1 test: end of block
Executed by:
  • tst_qquicktextinput
6
2977 if ((!reset && !qFuzzyCompare(oldPadding, value)) || (reset && !qFuzzyCompare(oldPadding, padding()))) {
!resetDescription
TRUEevaluated 4 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEevaluated 2 times by 1 test
Evaluated by:
  • tst_qquicktextinput
!qFuzzyCompare...adding, value)Description
TRUEevaluated 4 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEnever evaluated
resetDescription
TRUEevaluated 2 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEnever evaluated
!qFuzzyCompare...ng, padding())Description
TRUEevaluated 2 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEnever evaluated
0-4
2978 updateLayout();-
2979 emit q->rightPaddingChanged();-
2980 }
executed 6 times by 1 test: end of block
Executed by:
  • tst_qquicktextinput
6
2981}
executed 6 times by 1 test: end of block
Executed by:
  • tst_qquicktextinput
6
2982-
2983void QQuickTextInputPrivate::setBottomPadding(qreal value, bool reset)-
2984{-
2985 Q_Q(QQuickTextInput);-
2986 qreal oldPadding = q->bottomPadding();-
2987 if (!reset || extra.isAllocated()) {
!resetDescription
TRUEevaluated 14 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEevaluated 2 times by 1 test
Evaluated by:
  • tst_qquicktextinput
extra.isAllocated()Description
TRUEevaluated 2 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEnever evaluated
0-14
2988 extra.value().bottomPadding = value;-
2989 extra.value().explicitBottomPadding = !reset;-
2990 }
executed 16 times by 1 test: end of block
Executed by:
  • tst_qquicktextinput
16
2991 if ((!reset && !qFuzzyCompare(oldPadding, value)) || (reset && !qFuzzyCompare(oldPadding, padding()))) {
!resetDescription
TRUEevaluated 14 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEevaluated 2 times by 1 test
Evaluated by:
  • tst_qquicktextinput
!qFuzzyCompare...adding, value)Description
TRUEevaluated 14 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEnever evaluated
resetDescription
TRUEevaluated 2 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEnever evaluated
!qFuzzyCompare...ng, padding())Description
TRUEevaluated 2 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEnever evaluated
0-14
2992 updateLayout();-
2993 emit q->bottomPaddingChanged();-
2994 }
executed 16 times by 1 test: end of block
Executed by:
  • tst_qquicktextinput
16
2995}
executed 16 times by 1 test: end of block
Executed by:
  • tst_qquicktextinput
16
2996-
2997bool QQuickTextInputPrivate::isImplicitResizeEnabled() const-
2998{-
2999 return !extra.isAllocated() || extra->implicitResize;
executed 11336 times by 5 tests: return !extra.isAllocated() || extra->implicitResize;
Executed by:
  • tst_examples
  • tst_qquickitem
  • tst_qquickitem2
  • tst_qquicktextedit
  • tst_qquicktextinput
11336
3000}-
3001-
3002void QQuickTextInputPrivate::setImplicitResizeEnabled(bool enabled)-
3003{-
3004 if (!enabled)
!enabledDescription
TRUEevaluated 6 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEnever evaluated
0-6
3005 extra.value().implicitResize = false;
executed 6 times by 1 test: extra.value().implicitResize = false;
Executed by:
  • tst_qquicktextinput
6
3006 else if (extra.isAllocated())
extra.isAllocated()Description
TRUEnever evaluated
FALSEnever evaluated
0
3007 extra->implicitResize = true;
never executed: extra->implicitResize = true;
0
3008}
executed 6 times by 1 test: end of block
Executed by:
  • tst_qquicktextinput
6
3009-
3010void QQuickTextInputPrivate::updateLayout()-
3011{-
3012 Q_Q(QQuickTextInput);-
3013-
3014 if (!q->isComponentComplete())
!q->isComponentComplete()Description
TRUEevaluated 1068 times by 4 tests
Evaluated by:
  • tst_examples
  • tst_qquickitem
  • tst_qquickitem2
  • tst_qquicktextinput
FALSEevaluated 6090 times by 5 tests
Evaluated by:
  • tst_examples
  • tst_qquickitem
  • tst_qquickitem2
  • tst_qquicktextedit
  • tst_qquicktextinput
1068-6090
3015 return;
executed 1068 times by 4 tests: return;
Executed by:
  • tst_examples
  • tst_qquickitem
  • tst_qquickitem2
  • tst_qquicktextinput
1068
3016-
3017-
3018 QTextOption option = m_textLayout.textOption();-
3019 option.setTextDirection(layoutDirection());-
3020 option.setWrapMode(QTextOption::WrapMode(wrapMode));-
3021 option.setAlignment(Qt::Alignment(q->effectiveHAlign()));-
3022 if (!qmlDisableDistanceField())
!qmlDisableDistanceField()Description
TRUEevaluated 6090 times by 5 tests
Evaluated by:
  • tst_examples
  • tst_qquickitem
  • tst_qquickitem2
  • tst_qquicktextedit
  • tst_qquicktextinput
FALSEnever evaluated
0-6090
3023 option.setUseDesignMetrics(renderType != QQuickTextInput::NativeRendering);
executed 6090 times by 5 tests: option.setUseDesignMetrics(renderType != QQuickTextInput::NativeRendering);
Executed by:
  • tst_examples
  • tst_qquickitem
  • tst_qquickitem2
  • tst_qquicktextedit
  • tst_qquicktextinput
6090
3024-
3025 m_textLayout.setTextOption(option);-
3026 m_textLayout.setFont(font);-
3027-
3028 m_textLayout.beginLayout();-
3029-
3030 QTextLine line = m_textLayout.createLine();-
3031 if (requireImplicitWidth) {
requireImplicitWidthDescription
TRUEevaluated 62 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEevaluated 6028 times by 5 tests
Evaluated by:
  • tst_examples
  • tst_qquickitem
  • tst_qquickitem2
  • tst_qquicktextedit
  • tst_qquicktextinput
62-6028
3032 line.setLineWidth(INT_MAX);-
3033 const bool wasInLayout = inLayout;-
3034 inLayout = true;-
3035 if (isImplicitResizeEnabled())
isImplicitResizeEnabled()Description
TRUEevaluated 62 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEnever evaluated
0-62
3036 q->setImplicitWidth(qCeil(line.naturalTextWidth()) + q->leftPadding() + q->rightPadding());
executed 62 times by 1 test: q->setImplicitWidth(qCeil(line.naturalTextWidth()) + q->leftPadding() + q->rightPadding());
Executed by:
  • tst_qquicktextinput
62
3037 inLayout = wasInLayout;-
3038 if (inLayout) // probably the result of a binding loop, but by letting it
inLayoutDescription
TRUEnever evaluated
FALSEevaluated 62 times by 1 test
Evaluated by:
  • tst_qquicktextinput
0-62
3039 return; // get this far we'll get a warning to that effect.
never executed: return;
0
3040 }
executed 62 times by 1 test: end of block
Executed by:
  • tst_qquicktextinput
62
3041 qreal lineWidth = q->widthValid() || !isImplicitResizeEnabled() ? q->width() - q->leftPadding() - q->rightPadding() : INT_MAX;
q->widthValid()Description
TRUEevaluated 906 times by 4 tests
Evaluated by:
  • tst_examples
  • tst_qquickitem2
  • tst_qquicktextedit
  • tst_qquicktextinput
FALSEevaluated 5184 times by 4 tests
Evaluated by:
  • tst_examples
  • tst_qquickitem
  • tst_qquickitem2
  • tst_qquicktextinput
!isImplicitResizeEnabled()Description
TRUEevaluated 16 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEevaluated 5168 times by 4 tests
Evaluated by:
  • tst_examples
  • tst_qquickitem
  • tst_qquickitem2
  • tst_qquicktextinput
16-5184
3042 qreal height = 0;-
3043 qreal width = 0;-
3044 do {-
3045 line.setLineWidth(lineWidth);-
3046 line.setPosition(QPointF(0, height));-
3047-
3048 height += line.height();-
3049 width = qMax(width, line.naturalTextWidth());-
3050-
3051 line = m_textLayout.createLine();-
3052 } while (line.isValid());
executed 6532 times by 5 tests: end of block
Executed by:
  • tst_examples
  • tst_qquickitem
  • tst_qquickitem2
  • tst_qquicktextedit
  • tst_qquicktextinput
line.isValid()Description
TRUEevaluated 442 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEevaluated 6090 times by 5 tests
Evaluated by:
  • tst_examples
  • tst_qquickitem
  • tst_qquickitem2
  • tst_qquicktextedit
  • tst_qquicktextinput
442-6532
3053 m_textLayout.endLayout();-
3054-
3055 option.setWrapMode(QTextOption::NoWrap);-
3056 m_textLayout.setTextOption(option);-
3057-
3058 textLayoutDirty = true;-
3059-
3060 const QSizeF previousSize = contentSize;-
3061 contentSize = QSizeF(width, height);-
3062-
3063 updateType = UpdatePaintNode;-
3064 q->polish();-
3065 q->update();-
3066-
3067 if (isImplicitResizeEnabled()) {
isImplicitResizeEnabled()Description
TRUEevaluated 6074 times by 5 tests
Evaluated by:
  • tst_examples
  • tst_qquickitem
  • tst_qquickitem2
  • tst_qquicktextedit
  • tst_qquicktextinput
FALSEevaluated 16 times by 1 test
Evaluated by:
  • tst_qquicktextinput
16-6074
3068 if (!requireImplicitWidth && !q->widthValid())
!requireImplicitWidthDescription
TRUEevaluated 6012 times by 5 tests
Evaluated by:
  • tst_examples
  • tst_qquickitem
  • tst_qquickitem2
  • tst_qquicktextedit
  • tst_qquicktextinput
FALSEevaluated 62 times by 1 test
Evaluated by:
  • tst_qquicktextinput
!q->widthValid()Description
TRUEevaluated 5162 times by 4 tests
Evaluated by:
  • tst_examples
  • tst_qquickitem
  • tst_qquickitem2
  • tst_qquicktextinput
FALSEevaluated 850 times by 4 tests
Evaluated by:
  • tst_examples
  • tst_qquickitem2
  • tst_qquicktextedit
  • tst_qquicktextinput
62-6012
3069 q->setImplicitSize(width + q->leftPadding() + q->rightPadding(), height + q->topPadding() + q->bottomPadding());
executed 5162 times by 4 tests: q->setImplicitSize(width + q->leftPadding() + q->rightPadding(), height + q->topPadding() + q->bottomPadding());
Executed by:
  • tst_examples
  • tst_qquickitem
  • tst_qquickitem2
  • tst_qquicktextinput
5162
3070 else-
3071 q->setImplicitHeight(height + q->topPadding() + q->bottomPadding());
executed 912 times by 4 tests: q->setImplicitHeight(height + q->topPadding() + q->bottomPadding());
Executed by:
  • tst_examples
  • tst_qquickitem2
  • tst_qquicktextedit
  • tst_qquicktextinput
912
3072 }-
3073-
3074 updateBaselineOffset();-
3075-
3076 if (previousSize != contentSize)
previousSize != contentSizeDescription
TRUEevaluated 3254 times by 5 tests
Evaluated by:
  • tst_examples
  • tst_qquickitem
  • tst_qquickitem2
  • tst_qquicktextedit
  • tst_qquicktextinput
FALSEevaluated 2836 times by 4 tests
Evaluated by:
  • tst_examples
  • tst_qquickitem
  • tst_qquicktextedit
  • tst_qquicktextinput
2836-3254
3077 emit q->contentSizeChanged();
executed 3254 times by 5 tests: q->contentSizeChanged();
Executed by:
  • tst_examples
  • tst_qquickitem
  • tst_qquickitem2
  • tst_qquicktextedit
  • tst_qquicktextinput
3254
3078}
executed 6090 times by 5 tests: end of block
Executed by:
  • tst_examples
  • tst_qquickitem
  • tst_qquickitem2
  • tst_qquicktextedit
  • tst_qquicktextinput
6090
3079-
3080/*!-
3081 \internal-
3082 \brief QQuickTextInputPrivate::updateBaselineOffset-
3083-
3084 Assumes contentSize.height() is already calculated.-
3085 */-
3086void QQuickTextInputPrivate::updateBaselineOffset()-
3087{-
3088 Q_Q(QQuickTextInput);-
3089 if (!q->isComponentComplete())
!q->isComponentComplete()Description
TRUEevaluated 12 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEevaluated 6106 times by 5 tests
Evaluated by:
  • tst_examples
  • tst_qquickitem
  • tst_qquickitem2
  • tst_qquicktextedit
  • tst_qquicktextinput
12-6106
3090 return;
executed 12 times by 1 test: return;
Executed by:
  • tst_qquicktextinput
12
3091 QFontMetricsF fm(font);-
3092 qreal yoff = 0;-
3093 if (q->heightValid()) {
q->heightValid()Description
TRUEevaluated 772 times by 3 tests
Evaluated by:
  • tst_qquickitem2
  • tst_qquicktextedit
  • tst_qquicktextinput
FALSEevaluated 5334 times by 4 tests
Evaluated by:
  • tst_examples
  • tst_qquickitem
  • tst_qquickitem2
  • tst_qquicktextinput
772-5334
3094 const qreal surplusHeight = q->height() - contentSize.height() - q->topPadding() - q->bottomPadding();-
3095 if (vAlign == QQuickTextInput::AlignBottom)
vAlign == QQui...t::AlignBottomDescription
TRUEevaluated 58 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEevaluated 714 times by 3 tests
Evaluated by:
  • tst_qquickitem2
  • tst_qquicktextedit
  • tst_qquicktextinput
58-714
3096 yoff = surplusHeight;
executed 58 times by 1 test: yoff = surplusHeight;
Executed by:
  • tst_qquicktextinput
58
3097 else if (vAlign == QQuickTextInput::AlignVCenter)
vAlign == QQui...::AlignVCenterDescription
TRUEevaluated 42 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEevaluated 672 times by 3 tests
Evaluated by:
  • tst_qquickitem2
  • tst_qquicktextedit
  • tst_qquicktextinput
42-672
3098 yoff = surplusHeight/2;
executed 42 times by 1 test: yoff = surplusHeight/2;
Executed by:
  • tst_qquicktextinput
42
3099 }
executed 772 times by 3 tests: end of block
Executed by:
  • tst_qquickitem2
  • tst_qquicktextedit
  • tst_qquicktextinput
772
3100 q->setBaselineOffset(fm.ascent() + yoff + q->topPadding());-
3101}
executed 6106 times by 5 tests: end of block
Executed by:
  • tst_examples
  • tst_qquickitem
  • tst_qquickitem2
  • tst_qquicktextedit
  • tst_qquicktextinput
6106
3102-
3103#if QT_CONFIG(clipboard)-
3104/*!-
3105 \internal-
3106-
3107 Copies the currently selected text into the clipboard using the given-
3108 \a mode.-
3109-
3110 \note If the echo mode is set to a mode other than Normal then copy-
3111 will not work. This is to prevent using copy as a method of bypassing-
3112 password features of the line control.-
3113*/-
3114void QQuickTextInputPrivate::copy(QClipboard::Mode mode) const-
3115{-
3116 QString t = selectedText();-
3117 if (!t.isEmpty() && m_echoMode == QQuickTextInput::Normal) {
!t.isEmpty()Description
TRUEevaluated 76 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEevaluated 42 times by 1 test
Evaluated by:
  • tst_qquicktextinput
m_echoMode == ...tInput::NormalDescription
TRUEevaluated 64 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEevaluated 12 times by 1 test
Evaluated by:
  • tst_qquicktextinput
12-76
3118 QGuiApplication::clipboard()->setText(t, mode);-
3119 }
executed 64 times by 1 test: end of block
Executed by:
  • tst_qquicktextinput
64
3120}
executed 118 times by 1 test: end of block
Executed by:
  • tst_qquicktextinput
118
3121-
3122/*!-
3123 \internal-
3124-
3125 Inserts the text stored in the application clipboard into the line-
3126 control.-
3127-
3128 \sa insert()-
3129*/-
3130void QQuickTextInputPrivate::paste(QClipboard::Mode clipboardMode)-
3131{-
3132 QString clip = QGuiApplication::clipboard()->text(clipboardMode);-
3133 if (!clip.isEmpty() || hasSelectedText()) {
!clip.isEmpty()Description
TRUEevaluated 14 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEnever evaluated
hasSelectedText()Description
TRUEnever evaluated
FALSEnever evaluated
0-14
3134 separate(); //make it a separate undo/redo command-
3135 insert(clip);-
3136 separate();-
3137 }
executed 14 times by 1 test: end of block
Executed by:
  • tst_qquicktextinput
14
3138}
executed 14 times by 1 test: end of block
Executed by:
  • tst_qquicktextinput
14
3139-
3140#endif // clipboard-
3141-
3142#if QT_CONFIG(im)-
3143/*!-
3144 \internal-
3145*/-
3146void QQuickTextInputPrivate::commitPreedit()-
3147{-
3148 Q_Q(QQuickTextInput);-
3149-
3150 if (!hasImState)
!hasImStateDescription
TRUEevaluated 2278 times by 2 tests
Evaluated by:
  • tst_qquickitem2
  • tst_qquicktextinput
FALSEnever evaluated
0-2278
3151 return;
executed 2278 times by 2 tests: return;
Executed by:
  • tst_qquickitem2
  • tst_qquicktextinput
2278
3152-
3153 QGuiApplication::inputMethod()->commit();-
3154-
3155 if (!hasImState)
!hasImStateDescription
TRUEnever evaluated
FALSEnever evaluated
0
3156 return;
never executed: return;
0
3157-
3158 QInputMethodEvent ev;-
3159 QCoreApplication::sendEvent(q, &ev);-
3160}
never executed: end of block
0
3161-
3162void QQuickTextInputPrivate::cancelPreedit()-
3163{-
3164 Q_Q(QQuickTextInput);-
3165-
3166 if (!hasImState)
!hasImStateDescription
TRUEevaluated 1242 times by 4 tests
Evaluated by:
  • tst_examples
  • tst_qquickitem
  • tst_qquickitem2
  • tst_qquicktextinput
FALSEevaluated 2 times by 1 test
Evaluated by:
  • tst_qquicktextinput
2-1242
3167 return;
executed 1242 times by 4 tests: return;
Executed by:
  • tst_examples
  • tst_qquickitem
  • tst_qquickitem2
  • tst_qquicktextinput
1242
3168-
3169 QGuiApplication::inputMethod()->reset();-
3170-
3171 QInputMethodEvent ev;-
3172 QCoreApplication::sendEvent(q, &ev);-
3173}
executed 2 times by 1 test: end of block
Executed by:
  • tst_qquicktextinput
2
3174#endif // im-
3175-
3176/*!-
3177 \internal-
3178-
3179 Handles the behavior for the backspace key or function.-
3180 Removes the current selection if there is a selection, otherwise-
3181 removes the character prior to the cursor position.-
3182-
3183 \sa del()-
3184*/-
3185void QQuickTextInputPrivate::backspace()-
3186{-
3187 int priorState = m_undoState;-
3188 if (separateSelection()) {
separateSelection()Description
TRUEevaluated 4 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEevaluated 56 times by 1 test
Evaluated by:
  • tst_qquicktextinput
4-56
3189 removeSelectedText();-
3190 } else if (m_cursor) {
executed 4 times by 1 test: end of block
Executed by:
  • tst_qquicktextinput
m_cursorDescription
TRUEevaluated 54 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEevaluated 2 times by 1 test
Evaluated by:
  • tst_qquicktextinput
2-54
3191 --m_cursor;-
3192 if (m_maskData)
m_maskDataDescription
TRUEevaluated 16 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEevaluated 38 times by 1 test
Evaluated by:
  • tst_qquicktextinput
16-38
3193 m_cursor = prevMaskBlank(m_cursor);
executed 16 times by 1 test: m_cursor = prevMaskBlank(m_cursor);
Executed by:
  • tst_qquicktextinput
16
3194 QChar uc = m_text.at(m_cursor);-
3195 if (m_cursor > 0 && uc.unicode() >= 0xdc00 && uc.unicode() < 0xe000) {
m_cursor > 0Description
TRUEevaluated 52 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEevaluated 2 times by 1 test
Evaluated by:
  • tst_qquicktextinput
uc.unicode() >= 0xdc00Description
TRUEevaluated 10 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEevaluated 42 times by 1 test
Evaluated by:
  • tst_qquicktextinput
uc.unicode() < 0xe000Description
TRUEevaluated 10 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEnever evaluated
0-52
3196 // second half of a surrogate, check if we have the first half as well,-
3197 // if yes delete both at once-
3198 uc = m_text.at(m_cursor - 1);-
3199 if (uc.unicode() >= 0xd800 && uc.unicode() < 0xdc00) {
uc.unicode() >= 0xd800Description
TRUEevaluated 10 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEnever evaluated
uc.unicode() < 0xdc00Description
TRUEevaluated 10 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEnever evaluated
0-10
3200 internalDelete(true);-
3201 --m_cursor;-
3202 }
executed 10 times by 1 test: end of block
Executed by:
  • tst_qquicktextinput
10
3203 }
executed 10 times by 1 test: end of block
Executed by:
  • tst_qquicktextinput
10
3204 internalDelete(true);-
3205 }
executed 54 times by 1 test: end of block
Executed by:
  • tst_qquicktextinput
54
3206 finishChange(priorState);-
3207}
executed 60 times by 1 test: end of block
Executed by:
  • tst_qquicktextinput
60
3208-
3209/*!-
3210 \internal-
3211-
3212 Handles the behavior for the delete key or function.-
3213 Removes the current selection if there is a selection, otherwise-
3214 removes the character after the cursor position.-
3215-
3216 \sa del()-
3217*/-
3218void QQuickTextInputPrivate::del()-
3219{-
3220 int priorState = m_undoState;-
3221 if (separateSelection()) {
separateSelection()Description
TRUEevaluated 14 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEevaluated 28 times by 1 test
Evaluated by:
  • tst_qquicktextinput
14-28
3222 removeSelectedText();-
3223 } else {
executed 14 times by 1 test: end of block
Executed by:
  • tst_qquicktextinput
14
3224 int n = m_textLayout.nextCursorPosition(m_cursor) - m_cursor;-
3225 while (n--)
n--Description
TRUEevaluated 36 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEevaluated 28 times by 1 test
Evaluated by:
  • tst_qquicktextinput
28-36
3226 internalDelete();
executed 36 times by 1 test: internalDelete();
Executed by:
  • tst_qquicktextinput
36
3227 }
executed 28 times by 1 test: end of block
Executed by:
  • tst_qquicktextinput
28
3228 finishChange(priorState);-
3229}
executed 42 times by 1 test: end of block
Executed by:
  • tst_qquicktextinput
42
3230-
3231/*!-
3232 \internal-
3233-
3234 Inserts the given \a newText at the current cursor position.-
3235 If there is any selected text it is removed prior to insertion of-
3236 the new text.-
3237*/-
3238void QQuickTextInputPrivate::insert(const QString &newText)-
3239{-
3240 int priorState = m_undoState;-
3241 if (separateSelection())
separateSelection()Description
TRUEevaluated 16 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEevaluated 1360 times by 1 test
Evaluated by:
  • tst_qquicktextinput
16-1360
3242 removeSelectedText();
executed 16 times by 1 test: removeSelectedText();
Executed by:
  • tst_qquicktextinput
16
3243 internalInsert(newText);-
3244 finishChange(priorState);-
3245}
executed 1376 times by 1 test: end of block
Executed by:
  • tst_qquicktextinput
1376
3246-
3247/*!-
3248 \internal-
3249-
3250 Clears the line control text.-
3251*/-
3252void QQuickTextInputPrivate::clear()-
3253{-
3254 int priorState = m_undoState;-
3255 separateSelection();-
3256 m_selstart = 0;-
3257 m_selend = m_text.length();-
3258 removeSelectedText();-
3259 separate();-
3260 finishChange(priorState, /*update*/false, /*edited*/false);-
3261}
executed 8 times by 1 test: end of block
Executed by:
  • tst_qquicktextinput
8
3262-
3263/*!-
3264 \internal-
3265-
3266 Sets \a length characters from the given \a start position as selected.-
3267 The given \a start position must be within the current text for-
3268 the line control. If \a length characters cannot be selected, then-
3269 the selection will extend to the end of the current text.-
3270*/-
3271void QQuickTextInputPrivate::setSelection(int start, int length)-
3272{-
3273 Q_Q(QQuickTextInput);-
3274#if QT_CONFIG(im)-
3275 commitPreedit();-
3276#endif-
3277-
3278 if (start < 0 || start > m_text.length()) {
start < 0Description
TRUEnever evaluated
FALSEevaluated 680 times by 1 test
Evaluated by:
  • tst_qquicktextinput
start > m_text.length()Description
TRUEnever evaluated
FALSEevaluated 680 times by 1 test
Evaluated by:
  • tst_qquicktextinput
0-680
3279 qWarning("QQuickTextInputPrivate::setSelection: Invalid start position");-
3280 return;
never executed: return;
0
3281 }-
3282-
3283 if (length > 0) {
length > 0Description
TRUEevaluated 392 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEevaluated 288 times by 1 test
Evaluated by:
  • tst_qquicktextinput
288-392
3284 if (start == m_selstart && start + length == m_selend && m_cursor == m_selend)
start == m_selstartDescription
TRUEevaluated 192 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEevaluated 200 times by 1 test
Evaluated by:
  • tst_qquicktextinput
start + length == m_selendDescription
TRUEevaluated 20 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEevaluated 172 times by 1 test
Evaluated by:
  • tst_qquicktextinput
m_cursor == m_selendDescription
TRUEevaluated 20 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEnever evaluated
0-200
3285 return;
executed 20 times by 1 test: return;
Executed by:
  • tst_qquicktextinput
20
3286 m_selstart = start;-
3287 m_selend = qMin(start + length, m_text.length());-
3288 m_cursor = m_selend;-
3289 } else if (length < 0){
executed 372 times by 1 test: end of block
Executed by:
  • tst_qquicktextinput
length < 0Description
TRUEevaluated 144 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEevaluated 144 times by 1 test
Evaluated by:
  • tst_qquicktextinput
144-372
3290 if (start == m_selend && start + length == m_selstart && m_cursor == m_selstart)
start == m_selendDescription
TRUEevaluated 20 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEevaluated 124 times by 1 test
Evaluated by:
  • tst_qquicktextinput
start + length == m_selstartDescription
TRUEnever evaluated
FALSEevaluated 20 times by 1 test
Evaluated by:
  • tst_qquicktextinput
m_cursor == m_selstartDescription
TRUEnever evaluated
FALSEnever evaluated
0-124
3291 return;
never executed: return;
0
3292 m_selstart = qMax(start + length, 0);-
3293 m_selend = start;-
3294 m_cursor = m_selstart;-
3295 } else if (m_selstart != m_selend) {
executed 144 times by 1 test: end of block
Executed by:
  • tst_qquicktextinput
m_selstart != m_selendDescription
TRUEevaluated 6 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEevaluated 138 times by 1 test
Evaluated by:
  • tst_qquicktextinput
6-144
3296 m_selstart = 0;-
3297 m_selend = 0;-
3298 m_cursor = start;-
3299 } else {
executed 6 times by 1 test: end of block
Executed by:
  • tst_qquicktextinput
6
3300 m_cursor = start;-
3301 emitCursorPositionChanged();-
3302 return;
executed 138 times by 1 test: return;
Executed by:
  • tst_qquicktextinput
138
3303 }-
3304 emit q->selectionChanged();-
3305 emitCursorPositionChanged();-
3306#if QT_CONFIG(im)-
3307 q->updateInputMethod(Qt::ImCursorRectangle | Qt::ImAnchorRectangle | Qt::ImCursorPosition | Qt::ImAnchorPosition-
3308 | Qt::ImCurrentSelection);-
3309#endif-
3310}
executed 522 times by 1 test: end of block
Executed by:
  • tst_qquicktextinput
522
3311-
3312/*!-
3313 \internal-
3314-
3315 Sets the password echo editing to \a editing. If password echo editing-
3316 is true, then the text of the password is displayed even if the echo-
3317 mode is set to QLineEdit::PasswordEchoOnEdit. Password echoing editing-
3318 does not affect other echo modes.-
3319*/-
3320void QQuickTextInputPrivate::updatePasswordEchoEditing(bool editing)-
3321{-
3322 cancelPasswordEchoTimer();-
3323 m_passwordEchoEditing = editing;-
3324 updateDisplayText();-
3325}
executed 8 times by 1 test: end of block
Executed by:
  • tst_qquicktextinput
8
3326-
3327/*!-
3328 \internal-
3329-
3330 Fixes the current text so that it is valid given any set validators.-
3331-
3332 Returns true if the text was changed. Otherwise returns false.-
3333*/-
3334bool QQuickTextInputPrivate::fixup() // this function assumes that validate currently returns != Acceptable-
3335{-
3336#if QT_CONFIG(validator)-
3337 if (m_validator) {
m_validatorDescription
TRUEevaluated 8 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEnever evaluated
0-8
3338 QString textCopy = m_text;-
3339 int cursorCopy = m_cursor;-
3340 m_validator->fixup(textCopy);-
3341 if (m_validator->validate(textCopy, cursorCopy) == QValidator::Acceptable) {
m_validator->v...or::AcceptableDescription
TRUEevaluated 4 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEevaluated 4 times by 1 test
Evaluated by:
  • tst_qquicktextinput
4
3342 if (textCopy != m_text || cursorCopy != m_cursor)
textCopy != m_textDescription
TRUEevaluated 4 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEnever evaluated
cursorCopy != m_cursorDescription
TRUEnever evaluated
FALSEnever evaluated
0-4
3343 internalSetText(textCopy, cursorCopy);
executed 4 times by 1 test: internalSetText(textCopy, cursorCopy);
Executed by:
  • tst_qquicktextinput
4
3344 return true;
executed 4 times by 1 test: return true;
Executed by:
  • tst_qquicktextinput
4
3345 }-
3346 }
executed 4 times by 1 test: end of block
Executed by:
  • tst_qquicktextinput
4
3347#endif-
3348 return false;
executed 4 times by 1 test: return false;
Executed by:
  • tst_qquicktextinput
4
3349}-
3350-
3351/*!-
3352 \internal-
3353-
3354 Moves the cursor to the given position \a pos. If \a mark is true will-
3355 adjust the currently selected text.-
3356*/-
3357void QQuickTextInputPrivate::moveCursor(int pos, bool mark)-
3358{-
3359 Q_Q(QQuickTextInput);-
3360#if QT_CONFIG(im)-
3361 commitPreedit();-
3362#endif-
3363-
3364 if (pos != m_cursor) {
pos != m_cursorDescription
TRUEevaluated 1370 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEevaluated 222 times by 2 tests
Evaluated by:
  • tst_qquickitem2
  • tst_qquicktextinput
222-1370
3365 separate();-
3366 if (m_maskData)
m_maskDataDescription
TRUEevaluated 264 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEevaluated 1106 times by 1 test
Evaluated by:
  • tst_qquicktextinput
264-1106
3367 pos = pos > m_cursor ? nextMaskBlank(pos) : prevMaskBlank(pos);
executed 264 times by 1 test: pos = pos > m_cursor ? nextMaskBlank(pos) : prevMaskBlank(pos);
Executed by:
  • tst_qquicktextinput
pos > m_cursorDescription
TRUEevaluated 4 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEevaluated 260 times by 1 test
Evaluated by:
  • tst_qquicktextinput
4-264
3368 }
executed 1370 times by 1 test: end of block
Executed by:
  • tst_qquicktextinput
1370
3369 if (mark) {
markDescription
TRUEevaluated 160 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEevaluated 1432 times by 2 tests
Evaluated by:
  • tst_qquickitem2
  • tst_qquicktextinput
160-1432
3370 int anchor;-
3371 if (m_selend > m_selstart && m_cursor == m_selstart)
m_selend > m_selstartDescription
TRUEevaluated 22 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEevaluated 138 times by 1 test
Evaluated by:
  • tst_qquicktextinput
m_cursor == m_selstartDescription
TRUEevaluated 10 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEevaluated 12 times by 1 test
Evaluated by:
  • tst_qquicktextinput
10-138
3372 anchor = m_selend;
executed 10 times by 1 test: anchor = m_selend;
Executed by:
  • tst_qquicktextinput
10
3373 else if (m_selend > m_selstart && m_cursor == m_selend)
m_selend > m_selstartDescription
TRUEevaluated 12 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEevaluated 138 times by 1 test
Evaluated by:
  • tst_qquicktextinput
m_cursor == m_selendDescription
TRUEevaluated 12 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEnever evaluated
0-138
3374 anchor = m_selstart;
executed 12 times by 1 test: anchor = m_selstart;
Executed by:
  • tst_qquicktextinput
12
3375 else-
3376 anchor = m_cursor;
executed 138 times by 1 test: anchor = m_cursor;
Executed by:
  • tst_qquicktextinput
138
3377 m_selstart = qMin(anchor, pos);-
3378 m_selend = qMax(anchor, pos);-
3379 } else {
executed 160 times by 1 test: end of block
Executed by:
  • tst_qquicktextinput
160
3380 internalDeselect();-
3381 }
executed 1432 times by 2 tests: end of block
Executed by:
  • tst_qquickitem2
  • tst_qquicktextinput
1432
3382 m_cursor = pos;-
3383 if (mark || m_selDirty) {
markDescription
TRUEevaluated 160 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEevaluated 1432 times by 2 tests
Evaluated by:
  • tst_qquickitem2
  • tst_qquicktextinput
m_selDirtyDescription
TRUEevaluated 84 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEevaluated 1348 times by 2 tests
Evaluated by:
  • tst_qquickitem2
  • tst_qquicktextinput
84-1432
3384 m_selDirty = false;-
3385 emit q->selectionChanged();-
3386 }
executed 244 times by 1 test: end of block
Executed by:
  • tst_qquicktextinput
244
3387 emitCursorPositionChanged();-
3388#if QT_CONFIG(im)-
3389 q->updateInputMethod();-
3390#endif-
3391}
executed 1592 times by 2 tests: end of block
Executed by:
  • tst_qquickitem2
  • tst_qquicktextinput
1592
3392-
3393#if QT_CONFIG(im)-
3394/*!-
3395 \internal-
3396-
3397 Applies the given input method event \a event to the text of the line-
3398 control-
3399*/-
3400void QQuickTextInputPrivate::processInputMethodEvent(QInputMethodEvent *event)-
3401{-
3402 Q_Q(QQuickTextInput);-
3403-
3404 int priorState = -1;-
3405 bool isGettingInput = !event->commitString().isEmpty()
!event->commit...ng().isEmpty()Description
TRUEevaluated 148 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEevaluated 200 times by 1 test
Evaluated by:
  • tst_qquicktextinput
148-200
3406 || event->preeditString() != preeditAreaText()
event->preedit...editAreaText()Description
TRUEevaluated 46 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEevaluated 154 times by 1 test
Evaluated by:
  • tst_qquicktextinput
46-154
3407 || event->replacementLength() > 0;
event->replacementLength() > 0Description
TRUEevaluated 108 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEevaluated 46 times by 1 test
Evaluated by:
  • tst_qquicktextinput
46-108
3408 bool cursorPositionChanged = false;-
3409 bool selectionChange = false;-
3410 m_preeditDirty = event->preeditString() != preeditAreaText();-
3411-
3412 if (isGettingInput) {
isGettingInputDescription
TRUEevaluated 302 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEevaluated 46 times by 1 test
Evaluated by:
  • tst_qquicktextinput
46-302
3413 // If any text is being input, remove selected text.-
3414 priorState = m_undoState;-
3415 separateSelection();-
3416 if (m_echoMode == QQuickTextInput::PasswordEchoOnEdit && !m_passwordEchoEditing) {
m_echoMode == ...wordEchoOnEditDescription
TRUEevaluated 2 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEevaluated 300 times by 1 test
Evaluated by:
  • tst_qquicktextinput
!m_passwordEchoEditingDescription
TRUEevaluated 2 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEnever evaluated
0-300
3417 updatePasswordEchoEditing(true);-
3418 m_selstart = 0;-
3419 m_selend = m_text.length();-
3420 }
executed 2 times by 1 test: end of block
Executed by:
  • tst_qquicktextinput
2
3421 removeSelectedText();-
3422 }
executed 302 times by 1 test: end of block
Executed by:
  • tst_qquicktextinput
302
3423-
3424 int c = m_cursor; // cursor position after insertion of commit string-
3425 if (event->replacementStart() <= 0)
event->replacementStart() <= 0Description
TRUEevaluated 348 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEnever evaluated
0-348
3426 c += event->commitString().length() - qMin(-event->replacementStart(), event->replacementLength());
executed 348 times by 1 test: c += event->commitString().length() - qMin(-event->replacementStart(), event->replacementLength());
Executed by:
  • tst_qquicktextinput
348
3427-
3428 m_cursor += event->replacementStart();-
3429 if (m_cursor < 0)
m_cursor < 0Description
TRUEevaluated 2 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEevaluated 346 times by 1 test
Evaluated by:
  • tst_qquicktextinput
2-346
3430 m_cursor = 0;
executed 2 times by 1 test: m_cursor = 0;
Executed by:
  • tst_qquicktextinput
2
3431-
3432 // insert commit string-
3433 if (event->replacementLength()) {
event->replacementLength()Description
TRUEevaluated 124 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEevaluated 224 times by 1 test
Evaluated by:
  • tst_qquicktextinput
124-224
3434 m_selstart = m_cursor;-
3435 m_selend = m_selstart + event->replacementLength();-
3436 m_selend = qMin(m_selend, m_text.length());-
3437 removeSelectedText();-
3438 }
executed 124 times by 1 test: end of block
Executed by:
  • tst_qquicktextinput
124
3439 if (!event->commitString().isEmpty()) {
!event->commit...ng().isEmpty()Description
TRUEevaluated 148 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEevaluated 200 times by 1 test
Evaluated by:
  • tst_qquicktextinput
148-200
3440 internalInsert(event->commitString());-
3441 cursorPositionChanged = true;-
3442 } else {
executed 148 times by 1 test: end of block
Executed by:
  • tst_qquicktextinput
148
3443 m_cursor = qBound(0, c, m_text.length());-
3444 }
executed 200 times by 1 test: end of block
Executed by:
  • tst_qquicktextinput
200
3445-
3446 for (int i = 0; i < event->attributes().size(); ++i) {
i < event->attributes().size()Description
TRUEevaluated 54 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEevaluated 348 times by 1 test
Evaluated by:
  • tst_qquicktextinput
54-348
3447 const QInputMethodEvent::Attribute &a = event->attributes().at(i);-
3448 if (a.type == QInputMethodEvent::Selection) {
a.type == QInp...ent::SelectionDescription
TRUEevaluated 6 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEevaluated 48 times by 1 test
Evaluated by:
  • tst_qquicktextinput
6-48
3449 m_cursor = qBound(0, a.start + a.length, m_text.length());-
3450 if (a.length) {
a.lengthDescription
TRUEevaluated 6 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEnever evaluated
0-6
3451 m_selstart = qMax(0, qMin(a.start, m_text.length()));-
3452 m_selend = m_cursor;-
3453 if (m_selend < m_selstart) {
m_selend < m_selstartDescription
TRUEnever evaluated
FALSEevaluated 6 times by 1 test
Evaluated by:
  • tst_qquicktextinput
0-6
3454 qSwap(m_selstart, m_selend);-
3455 }
never executed: end of block
0
3456 selectionChange = true;-
3457 } else {
executed 6 times by 1 test: end of block
Executed by:
  • tst_qquicktextinput
6
3458 m_selstart = m_selend = 0;-
3459 }
never executed: end of block
0
3460 cursorPositionChanged = true;-
3461 }
executed 6 times by 1 test: end of block
Executed by:
  • tst_qquicktextinput
6
3462 }
executed 54 times by 1 test: end of block
Executed by:
  • tst_qquicktextinput
54
3463 QString oldPreeditString = m_textLayout.preeditAreaText();-
3464 m_textLayout.setPreeditArea(m_cursor, event->preeditString());-
3465 if (oldPreeditString != m_textLayout.preeditAreaText())
oldPreeditStri...editAreaText()Description
TRUEevaluated 46 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEevaluated 302 times by 1 test
Evaluated by:
  • tst_qquicktextinput
46-302
3466 emit q->preeditTextChanged();
executed 46 times by 1 test: q->preeditTextChanged();
Executed by:
  • tst_qquicktextinput
46
3467 const int oldPreeditCursor = m_preeditCursor;-
3468 m_preeditCursor = event->preeditString().length();-
3469 hasImState = !event->preeditString().isEmpty();-
3470 bool cursorVisible = true;-
3471 QVector<QTextLayout::FormatRange> formats;-
3472 for (int i = 0; i < event->attributes().size(); ++i) {
i < event->attributes().size()Description
TRUEevaluated 54 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEevaluated 348 times by 1 test
Evaluated by:
  • tst_qquicktextinput
54-348
3473 const QInputMethodEvent::Attribute &a = event->attributes().at(i);-
3474 if (a.type == QInputMethodEvent::Cursor) {
a.type == QInp...dEvent::CursorDescription
TRUEevaluated 46 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEevaluated 8 times by 1 test
Evaluated by:
  • tst_qquicktextinput
8-46
3475 hasImState = true;-
3476 m_preeditCursor = a.start;-
3477 cursorVisible = a.length != 0;-
3478 } else if (a.type == QInputMethodEvent::TextFormat) {
executed 46 times by 1 test: end of block
Executed by:
  • tst_qquicktextinput
a.type == QInp...nt::TextFormatDescription
TRUEevaluated 2 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEevaluated 6 times by 1 test
Evaluated by:
  • tst_qquicktextinput
2-46
3479 hasImState = true;-
3480 QTextCharFormat f = qvariant_cast<QTextFormat>(a.value).toCharFormat();-
3481 if (f.isValid()) {
f.isValid()Description
TRUEevaluated 2 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEnever evaluated
0-2
3482 QTextLayout::FormatRange o;-
3483 o.start = a.start + m_cursor;-
3484 o.length = a.length;-
3485 o.format = f;-
3486 formats.append(o);-
3487 }
executed 2 times by 1 test: end of block
Executed by:
  • tst_qquicktextinput
2
3488 }
executed 2 times by 1 test: end of block
Executed by:
  • tst_qquicktextinput
2
3489 }
executed 54 times by 1 test: end of block
Executed by:
  • tst_qquicktextinput
54
3490 m_textLayout.setFormats(formats);-
3491-
3492 updateDisplayText(/*force*/ true);-
3493 if ((cursorPositionChanged && !emitCursorPositionChanged())
cursorPositionChangedDescription
TRUEevaluated 154 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEevaluated 194 times by 1 test
Evaluated by:
  • tst_qquicktextinput
!emitCursorPositionChanged()Description
TRUEevaluated 8 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEevaluated 146 times by 1 test
Evaluated by:
  • tst_qquicktextinput
8-194
3494 || m_preeditCursor != oldPreeditCursor
m_preeditCurso...dPreeditCursorDescription
TRUEevaluated 74 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEevaluated 266 times by 1 test
Evaluated by:
  • tst_qquicktextinput
74-266
3495 || isGettingInput) {
isGettingInputDescription
TRUEevaluated 254 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEevaluated 12 times by 1 test
Evaluated by:
  • tst_qquicktextinput
12-254
3496 q->updateCursorRectangle();-
3497 }
executed 336 times by 1 test: end of block
Executed by:
  • tst_qquicktextinput
336
3498-
3499 if (isGettingInput)
isGettingInputDescription
TRUEevaluated 302 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEevaluated 46 times by 1 test
Evaluated by:
  • tst_qquicktextinput
46-302
3500 finishChange(priorState);
executed 302 times by 1 test: finishChange(priorState);
Executed by:
  • tst_qquicktextinput
302
3501-
3502 q->setCursorVisible(cursorVisible);-
3503-
3504 if (selectionChange) {
selectionChangeDescription
TRUEevaluated 6 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEevaluated 342 times by 1 test
Evaluated by:
  • tst_qquicktextinput
6-342
3505 emit q->selectionChanged();-
3506 q->updateInputMethod(Qt::ImCursorRectangle | Qt::ImAnchorRectangle-
3507 | Qt::ImCurrentSelection);-
3508 }
executed 6 times by 1 test: end of block
Executed by:
  • tst_qquicktextinput
6
3509}
executed 348 times by 1 test: end of block
Executed by:
  • tst_qquicktextinput
348
3510#endif // im-
3511-
3512/*!-
3513 \internal-
3514-
3515 Sets the selection to cover the word at the given cursor position.-
3516 The word boundaries are defined by the behavior of QTextLayout::SkipWords-
3517 cursor mode.-
3518*/-
3519void QQuickTextInputPrivate::selectWordAtPos(int cursor)-
3520{-
3521 int next = cursor + 1;-
3522 if (next > end())
next > end()Description
TRUEnever evaluated
FALSEevaluated 10 times by 1 test
Evaluated by:
  • tst_qquicktextinput
0-10
3523 --next;
never executed: --next;
0
3524 int c = m_textLayout.previousCursorPosition(next, QTextLayout::SkipWords);-
3525 moveCursor(c, false);-
3526 // ## text layout should support end of words.-
3527 int end = m_textLayout.nextCursorPosition(c, QTextLayout::SkipWords);-
3528 while (end > cursor && m_text[end-1].isSpace())
end > cursorDescription
TRUEevaluated 20 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEnever evaluated
m_text[end-1].isSpace()Description
TRUEevaluated 10 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEevaluated 10 times by 1 test
Evaluated by:
  • tst_qquicktextinput
0-20
3529 --end;
executed 10 times by 1 test: --end;
Executed by:
  • tst_qquicktextinput
10
3530 moveCursor(end, true);-
3531}
executed 10 times by 1 test: end of block
Executed by:
  • tst_qquicktextinput
10
3532-
3533/*!-
3534 \internal-
3535-
3536 Completes a change to the line control text. If the change is not valid-
3537 will undo the line control state back to the given \a validateFromState.-
3538-
3539 If \a edited is true and the change is valid, will emit textEdited() in-
3540 addition to textChanged(). Otherwise only emits textChanged() on a valid-
3541 change.-
3542-
3543 The \a update value is currently unused.-
3544*/-
3545bool QQuickTextInputPrivate::finishChange(int validateFromState, bool update, bool edited)-
3546{-
3547 Q_Q(QQuickTextInput);-
3548-
3549 Q_UNUSED(update)-
3550#if QT_CONFIG(im)-
3551 bool inputMethodAttributesChanged = m_textDirty || m_selDirty;
m_textDirtyDescription
TRUEevaluated 3266 times by 4 tests
Evaluated by:
  • tst_examples
  • tst_qquickitem
  • tst_qquickitem2
  • tst_qquicktextinput
FALSEevaluated 416 times by 1 test
Evaluated by:
  • tst_qquicktextinput
m_selDirtyDescription
TRUEevaluated 10 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEevaluated 406 times by 1 test
Evaluated by:
  • tst_qquicktextinput
10-3266
3552#endif-
3553 bool alignmentChanged = false;-
3554 bool textChanged = false;-
3555-
3556 if (m_textDirty) {
m_textDirtyDescription
TRUEevaluated 3266 times by 4 tests
Evaluated by:
  • tst_examples
  • tst_qquickitem
  • tst_qquickitem2
  • tst_qquicktextinput
FALSEevaluated 416 times by 1 test
Evaluated by:
  • tst_qquicktextinput
416-3266
3557 // do validation-
3558 bool wasValidInput = m_validInput;-
3559 bool wasAcceptable = m_acceptableInput;-
3560 m_validInput = true;-
3561 m_acceptableInput = true;-
3562#if QT_CONFIG(validator)-
3563 if (m_validator) {
m_validatorDescription
TRUEevaluated 148 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEevaluated 3118 times by 4 tests
Evaluated by:
  • tst_examples
  • tst_qquickitem
  • tst_qquickitem2
  • tst_qquicktextinput
148-3118
3564 QString textCopy = m_text;-
3565 if (m_maskData)
m_maskDataDescription
TRUEevaluated 56 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEevaluated 92 times by 1 test
Evaluated by:
  • tst_qquicktextinput
56-92
3566 textCopy = maskString(0, m_text, true);
executed 56 times by 1 test: textCopy = maskString(0, m_text, true);
Executed by:
  • tst_qquicktextinput
56
3567 int cursorCopy = m_cursor;-
3568 QValidator::State state = m_validator->validate(textCopy, cursorCopy);-
3569 if (m_maskData)
m_maskDataDescription
TRUEevaluated 56 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEevaluated 92 times by 1 test
Evaluated by:
  • tst_qquicktextinput
56-92
3570 textCopy = m_text;
executed 56 times by 1 test: textCopy = m_text;
Executed by:
  • tst_qquicktextinput
56
3571 m_validInput = state != QValidator::Invalid;-
3572 m_acceptableInput = state == QValidator::Acceptable;-
3573 if (m_validInput && !m_maskData) {
m_validInputDescription
TRUEevaluated 120 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEevaluated 28 times by 1 test
Evaluated by:
  • tst_qquicktextinput
!m_maskDataDescription
TRUEevaluated 72 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEevaluated 48 times by 1 test
Evaluated by:
  • tst_qquicktextinput
28-120
3574 if (m_text != textCopy) {
m_text != textCopyDescription
TRUEnever evaluated
FALSEevaluated 72 times by 1 test
Evaluated by:
  • tst_qquicktextinput
0-72
3575 internalSetText(textCopy, cursorCopy);-
3576 return true;
never executed: return true;
0
3577 }-
3578 m_cursor = cursorCopy;-
3579 }
executed 72 times by 1 test: end of block
Executed by:
  • tst_qquicktextinput
72
3580 }
executed 148 times by 1 test: end of block
Executed by:
  • tst_qquicktextinput
148
3581#endif-
3582 if (m_maskData)
m_maskDataDescription
TRUEevaluated 1054 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEevaluated 2212 times by 4 tests
Evaluated by:
  • tst_examples
  • tst_qquickitem
  • tst_qquickitem2
  • tst_qquicktextinput
1054-2212
3583 checkIsValid();
executed 1054 times by 1 test: checkIsValid();
Executed by:
  • tst_qquicktextinput
1054
3584-
3585 if (validateFromState >= 0 && wasValidInput && !m_validInput) {
validateFromState >= 0Description
TRUEevaluated 1906 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEevaluated 1360 times by 4 tests
Evaluated by:
  • tst_examples
  • tst_qquickitem
  • tst_qquickitem2
  • tst_qquicktextinput
wasValidInputDescription
TRUEevaluated 1892 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEevaluated 14 times by 1 test
Evaluated by:
  • tst_qquicktextinput
!m_validInputDescription
TRUEevaluated 16 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEevaluated 1876 times by 1 test
Evaluated by:
  • tst_qquicktextinput
14-1906
3586 if (m_transactions.count())
m_transactions.count()Description
TRUEnever evaluated
FALSEevaluated 16 times by 1 test
Evaluated by:
  • tst_qquicktextinput
0-16
3587 return false;
never executed: return false;
0
3588 internalUndo(validateFromState);-
3589 m_history.resize(m_undoState);-
3590 m_validInput = true;-
3591 m_acceptableInput = wasAcceptable;-
3592 m_textDirty = false;-
3593 }
executed 16 times by 1 test: end of block
Executed by:
  • tst_qquicktextinput
16
3594-
3595 if (m_textDirty) {
m_textDirtyDescription
TRUEevaluated 3250 times by 4 tests
Evaluated by:
  • tst_examples
  • tst_qquickitem
  • tst_qquickitem2
  • tst_qquicktextinput
FALSEevaluated 16 times by 1 test
Evaluated by:
  • tst_qquicktextinput
16-3250
3596 textChanged = true;-
3597 m_textDirty = false;-
3598#if QT_CONFIG(im)-
3599 m_preeditDirty = false;-
3600#endif-
3601 alignmentChanged = determineHorizontalAlignment();-
3602 if (edited)
editedDescription
TRUEevaluated 2294 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEevaluated 956 times by 4 tests
Evaluated by:
  • tst_examples
  • tst_qquickitem
  • tst_qquickitem2
  • tst_qquicktextinput
956-2294
3603 emit q->textEdited();
executed 2294 times by 1 test: q->textEdited();
Executed by:
  • tst_qquicktextinput
2294
3604 emit q->textChanged();-
3605 }
executed 3250 times by 4 tests: end of block
Executed by:
  • tst_examples
  • tst_qquickitem
  • tst_qquickitem2
  • tst_qquicktextinput
3250
3606-
3607 updateDisplayText(alignmentChanged);-
3608-
3609 if (m_acceptableInput != wasAcceptable)
m_acceptableIn... wasAcceptableDescription
TRUEevaluated 230 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEevaluated 3036 times by 4 tests
Evaluated by:
  • tst_examples
  • tst_qquickitem
  • tst_qquickitem2
  • tst_qquicktextinput
230-3036
3610 emit q->acceptableInputChanged();
executed 230 times by 1 test: q->acceptableInputChanged();
Executed by:
  • tst_qquicktextinput
230
3611 }
executed 3266 times by 4 tests: end of block
Executed by:
  • tst_examples
  • tst_qquickitem
  • tst_qquickitem2
  • tst_qquicktextinput
3266
3612#if QT_CONFIG(im)-
3613 if (m_preeditDirty) {
m_preeditDirtyDescription
TRUEevaluated 46 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEevaluated 3636 times by 4 tests
Evaluated by:
  • tst_examples
  • tst_qquickitem
  • tst_qquickitem2
  • tst_qquicktextinput
46-3636
3614 m_preeditDirty = false;-
3615 if (determineHorizontalAlignment()) {
determineHorizontalAlignment()Description
TRUEevaluated 4 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEevaluated 42 times by 1 test
Evaluated by:
  • tst_qquicktextinput
4-42
3616 alignmentChanged = true;-
3617 updateLayout();-
3618 }
executed 4 times by 1 test: end of block
Executed by:
  • tst_qquicktextinput
4
3619 }
executed 46 times by 1 test: end of block
Executed by:
  • tst_qquicktextinput
46
3620#endif-
3621-
3622 if (m_selDirty) {
m_selDirtyDescription
TRUEevaluated 230 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEevaluated 3452 times by 4 tests
Evaluated by:
  • tst_examples
  • tst_qquickitem
  • tst_qquickitem2
  • tst_qquicktextinput
230-3452
3623 m_selDirty = false;-
3624 emit q->selectionChanged();-
3625 }
executed 230 times by 1 test: end of block
Executed by:
  • tst_qquicktextinput
230
3626-
3627#if QT_CONFIG(im)-
3628 inputMethodAttributesChanged |= (m_cursor != m_lastCursorPos);-
3629 if (inputMethodAttributesChanged)
inputMethodAttributesChangedDescription
TRUEevaluated 3288 times by 4 tests
Evaluated by:
  • tst_examples
  • tst_qquickitem
  • tst_qquickitem2
  • tst_qquicktextinput
FALSEevaluated 394 times by 1 test
Evaluated by:
  • tst_qquicktextinput
394-3288
3630 q->updateInputMethod();
executed 3288 times by 4 tests: q->updateInputMethod();
Executed by:
  • tst_examples
  • tst_qquickitem
  • tst_qquickitem2
  • tst_qquicktextinput
3288
3631#endif-
3632 emitUndoRedoChanged();-
3633-
3634 if (!emitCursorPositionChanged() && (alignmentChanged || textChanged))
!emitCursorPositionChanged()Description
TRUEevaluated 948 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEevaluated 2734 times by 4 tests
Evaluated by:
  • tst_examples
  • tst_qquickitem
  • tst_qquickitem2
  • tst_qquicktextinput
alignmentChangedDescription
TRUEevaluated 4 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEevaluated 944 times by 1 test
Evaluated by:
  • tst_qquicktextinput
textChangedDescription
TRUEevaluated 530 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEevaluated 414 times by 1 test
Evaluated by:
  • tst_qquicktextinput
4-2734
3635 q->updateCursorRectangle();
executed 534 times by 1 test: q->updateCursorRectangle();
Executed by:
  • tst_qquicktextinput
534
3636-
3637 return true;
executed 3682 times by 4 tests: return true;
Executed by:
  • tst_examples
  • tst_qquickitem
  • tst_qquickitem2
  • tst_qquicktextinput
3682
3638}-
3639-
3640/*!-
3641 \internal-
3642-
3643 An internal function for setting the text of the line control.-
3644*/-
3645void QQuickTextInputPrivate::internalSetText(const QString &txt, int pos, bool edited)-
3646{-
3647 internalDeselect();-
3648 QString oldText = m_text;-
3649 if (m_maskData) {
m_maskDataDescription
TRUEevaluated 726 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEevaluated 780 times by 4 tests
Evaluated by:
  • tst_examples
  • tst_qquickitem
  • tst_qquickitem2
  • tst_qquicktextinput
726-780
3650 m_text = maskString(0, txt, true);-
3651 m_text += clearString(m_text.length(), m_maxLength - m_text.length());-
3652 } else {
executed 726 times by 1 test: end of block
Executed by:
  • tst_qquicktextinput
726
3653 m_text = txt.isEmpty() ? txt : txt.left(m_maxLength);
txt.isEmpty()Description
TRUEevaluated 58 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEevaluated 722 times by 4 tests
Evaluated by:
  • tst_examples
  • tst_qquickitem
  • tst_qquickitem2
  • tst_qquicktextinput
58-722
3654 }
executed 780 times by 4 tests: end of block
Executed by:
  • tst_examples
  • tst_qquickitem
  • tst_qquickitem2
  • tst_qquicktextinput
780
3655 m_history.clear();-
3656 m_undoState = 0;-
3657 m_cursor = (pos < 0 || pos > m_text.length()) ? m_text.length() : pos;
pos < 0Description
TRUEevaluated 1502 times by 4 tests
Evaluated by:
  • tst_examples
  • tst_qquickitem
  • tst_qquickitem2
  • tst_qquicktextinput
FALSEevaluated 4 times by 1 test
Evaluated by:
  • tst_qquicktextinput
pos > m_text.length()Description
TRUEnever evaluated
FALSEevaluated 4 times by 1 test
Evaluated by:
  • tst_qquicktextinput
0-1502
3658 m_textDirty = (oldText != m_text);-
3659-
3660 bool changed = finishChange(-1, true, edited);-
3661#if !QT_CONFIG(accessibility)-
3662 Q_UNUSED(changed)-
3663#else-
3664 Q_Q(QQuickTextInput);-
3665 if (changed && QAccessible::isActive()) {
changedDescription
TRUEevaluated 1506 times by 4 tests
Evaluated by:
  • tst_examples
  • tst_qquickitem
  • tst_qquickitem2
  • tst_qquicktextinput
FALSEnever evaluated
QAccessible::isActive()Description
TRUEnever evaluated
FALSEevaluated 1506 times by 4 tests
Evaluated by:
  • tst_examples
  • tst_qquickitem
  • tst_qquickitem2
  • tst_qquicktextinput
0-1506
3666 if (QObject *acc = QQuickAccessibleAttached::findAccessible(q, QAccessible::EditableText)) {
QObject *acc =...:EditableText)Description
TRUEnever evaluated
FALSEnever evaluated
0
3667 QAccessibleTextUpdateEvent ev(acc, 0, oldText, m_text);-
3668 QAccessible::updateAccessibility(&ev);-
3669 }
never executed: end of block
0
3670 }
never executed: end of block
0
3671#endif-
3672}
executed 1506 times by 4 tests: end of block
Executed by:
  • tst_examples
  • tst_qquickitem
  • tst_qquickitem2
  • tst_qquicktextinput
1506
3673-
3674-
3675/*!-
3676 \internal-
3677-
3678 Adds the given \a command to the undo history-
3679 of the line control. Does not apply the command.-
3680*/-
3681void QQuickTextInputPrivate::addCommand(const Command &cmd)-
3682{-
3683 if (m_separator && m_undoState && m_history[m_undoState - 1].type != Separator) {
m_separatorDescription
TRUEevaluated 396 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEevaluated 4638 times by 1 test
Evaluated by:
  • tst_qquicktextinput
m_undoStateDescription
TRUEevaluated 162 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEevaluated 234 times by 1 test
Evaluated by:
  • tst_qquicktextinput
m_history[m_un...e != SeparatorDescription
TRUEevaluated 148 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEevaluated 14 times by 1 test
Evaluated by:
  • tst_qquicktextinput
14-4638
3684 m_history.resize(m_undoState + 2);-
3685 m_history[m_undoState++] = Command(Separator, m_cursor, 0, m_selstart, m_selend);-
3686 } else {
executed 148 times by 1 test: end of block
Executed by:
  • tst_qquicktextinput
148
3687 m_history.resize(m_undoState + 1);-
3688 }
executed 4886 times by 1 test: end of block
Executed by:
  • tst_qquicktextinput
4886
3689 m_separator = false;-
3690 m_history[m_undoState++] = cmd;-
3691}
executed 5034 times by 1 test: end of block
Executed by:
  • tst_qquicktextinput
5034
3692-
3693/*!-
3694 \internal-
3695-
3696 Inserts the given string \a s into the line-
3697 control.-
3698-
3699 Also adds the appropriate commands into the undo history.-
3700 This function does not call finishChange(), and may leave the text-
3701 in an invalid state.-
3702*/-
3703void QQuickTextInputPrivate::internalInsert(const QString &s)-
3704{-
3705 Q_Q(QQuickTextInput);-
3706 if (m_echoMode == QQuickTextInput::Password) {
m_echoMode == ...nput::PasswordDescription
TRUEnever evaluated
FALSEevaluated 1524 times by 1 test
Evaluated by:
  • tst_qquicktextinput
0-1524
3707 if (m_passwordMaskDelay > 0)
m_passwordMaskDelay > 0Description
TRUEnever evaluated
FALSEnever evaluated
0
3708 m_passwordEchoTimer.start(m_passwordMaskDelay, q);
never executed: m_passwordEchoTimer.start(m_passwordMaskDelay, q);
0
3709 }
never executed: end of block
0
3710 Q_ASSERT(!hasSelectedText()); // insert(), processInputMethodEvent() call removeSelectedText() first.-
3711 if (m_maskData) {
m_maskDataDescription
TRUEevaluated 506 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEevaluated 1018 times by 1 test
Evaluated by:
  • tst_qquicktextinput
506-1018
3712 QString ms = maskString(m_cursor, s);-
3713 for (int i = 0; i < ms.length(); ++i) {
i < ms.length()Description
TRUEevaluated 518 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEevaluated 506 times by 1 test
Evaluated by:
  • tst_qquicktextinput
506-518
3714 addCommand (Command(DeleteSelection, m_cursor + i, m_text.at(m_cursor + i), -1, -1));-
3715 addCommand(Command(Insert, m_cursor + i, ms.at(i), -1, -1));-
3716 }
executed 518 times by 1 test: end of block
Executed by:
  • tst_qquicktextinput
518
3717 m_text.replace(m_cursor, ms.length(), ms);-
3718 m_cursor += ms.length();-
3719 m_cursor = nextMaskBlank(m_cursor);-
3720 m_textDirty = true;-
3721 } else {
executed 506 times by 1 test: end of block
Executed by:
  • tst_qquicktextinput
506
3722 int remaining = m_maxLength - m_text.length();-
3723 if (remaining != 0) {
remaining != 0Description
TRUEevaluated 998 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEevaluated 20 times by 1 test
Evaluated by:
  • tst_qquicktextinput
20-998
3724 const QStringRef remainingStr = s.leftRef(remaining);-
3725 m_text.insert(m_cursor, remainingStr);-
3726 for (auto e : remainingStr)-
3727 addCommand(Command(Insert, m_cursor++, e, -1, -1));
executed 1220 times by 1 test: addCommand(Command(Insert, m_cursor++, e, -1, -1));
Executed by:
  • tst_qquicktextinput
1220
3728 m_textDirty = true;-
3729 }
executed 998 times by 1 test: end of block
Executed by:
  • tst_qquicktextinput
998
3730 }
executed 1018 times by 1 test: end of block
Executed by:
  • tst_qquicktextinput
1018
3731}-
3732-
3733/*!-
3734 \internal-
3735-
3736 deletes a single character from the current text. If \a wasBackspace,-
3737 the character prior to the cursor is removed. Otherwise the character-
3738 after the cursor is removed.-
3739-
3740 Also adds the appropriate commands into the undo history.-
3741 This function does not call finishChange(), and may leave the text-
3742 in an invalid state.-
3743*/-
3744void QQuickTextInputPrivate::internalDelete(bool wasBackspace)-
3745{-
3746 if (m_cursor < m_text.length()) {
m_cursor < m_text.length()Description
TRUEevaluated 100 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEnever evaluated
0-100
3747 cancelPasswordEchoTimer();-
3748 Q_ASSERT(!hasSelectedText()); // del(), backspace() call removeSelectedText() first.-
3749 addCommand(Command((CommandType)((m_maskData ? 2 : 0) + (wasBackspace ? Remove : Delete)),-
3750 m_cursor, m_text.at(m_cursor), -1, -1));-
3751 if (m_maskData) {
m_maskDataDescription
TRUEevaluated 20 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEevaluated 80 times by 1 test
Evaluated by:
  • tst_qquicktextinput
20-80
3752 m_text.replace(m_cursor, 1, clearString(m_cursor, 1));-
3753 addCommand(Command(Insert, m_cursor, m_text.at(m_cursor), -1, -1));-
3754 } else {
executed 20 times by 1 test: end of block
Executed by:
  • tst_qquicktextinput
20
3755 m_text.remove(m_cursor, 1);-
3756 }
executed 80 times by 1 test: end of block
Executed by:
  • tst_qquicktextinput
80
3757 m_textDirty = true;-
3758 }
executed 100 times by 1 test: end of block
Executed by:
  • tst_qquicktextinput
100
3759}
executed 100 times by 1 test: end of block
Executed by:
  • tst_qquicktextinput
100
3760-
3761/*!-
3762 \internal-
3763-
3764 removes the currently selected text from the line control.-
3765-
3766 Also adds the appropriate commands into the undo history.-
3767 This function does not call finishChange(), and may leave the text-
3768 in an invalid state.-
3769*/-
3770void QQuickTextInputPrivate::removeSelectedText()-
3771{-
3772 if (m_selstart < m_selend && m_selend <= m_text.length()) {
m_selstart < m_selendDescription
TRUEevaluated 184 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEevaluated 300 times by 1 test
Evaluated by:
  • tst_qquicktextinput
m_selend <= m_text.length()Description
TRUEevaluated 184 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEnever evaluated
0-300
3773 cancelPasswordEchoTimer();-
3774 int i ;-
3775 if (m_selstart <= m_cursor && m_cursor < m_selend) {
m_selstart <= m_cursorDescription
TRUEevaluated 184 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEnever evaluated
m_cursor < m_selendDescription
TRUEevaluated 144 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEevaluated 40 times by 1 test
Evaluated by:
  • tst_qquicktextinput
0-184
3776 // cursor is within the selection. Split up the commands-
3777 // to be able to restore the correct cursor position-
3778 for (i = m_cursor; i >= m_selstart; --i)
i >= m_selstartDescription
TRUEevaluated 152 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEevaluated 144 times by 1 test
Evaluated by:
  • tst_qquicktextinput
144-152
3779 addCommand (Command(DeleteSelection, i, m_text.at(i), -1, 1));
executed 152 times by 1 test: addCommand (Command(DeleteSelection, i, m_text.at(i), -1, 1));
Executed by:
  • tst_qquicktextinput
152
3780 for (i = m_selend - 1; i > m_cursor; --i)
i > m_cursorDescription
TRUEevaluated 86 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEevaluated 144 times by 1 test
Evaluated by:
  • tst_qquicktextinput
86-144
3781 addCommand (Command(DeleteSelection, i - m_cursor + m_selstart - 1, m_text.at(i), -1, -1));
executed 86 times by 1 test: addCommand (Command(DeleteSelection, i - m_cursor + m_selstart - 1, m_text.at(i), -1, -1));
Executed by:
  • tst_qquicktextinput
86
3782 } else {
executed 144 times by 1 test: end of block
Executed by:
  • tst_qquicktextinput
144
3783 for (i = m_selend-1; i >= m_selstart; --i)
i >= m_selstartDescription
TRUEevaluated 378 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEevaluated 40 times by 1 test
Evaluated by:
  • tst_qquicktextinput
40-378
3784 addCommand (Command(RemoveSelection, i, m_text.at(i), -1, -1));
executed 378 times by 1 test: addCommand (Command(RemoveSelection, i, m_text.at(i), -1, -1));
Executed by:
  • tst_qquicktextinput
378
3785 }
executed 40 times by 1 test: end of block
Executed by:
  • tst_qquicktextinput
40
3786 if (m_maskData) {
m_maskDataDescription
TRUEnever evaluated
FALSEevaluated 184 times by 1 test
Evaluated by:
  • tst_qquicktextinput
0-184
3787 m_text.replace(m_selstart, m_selend - m_selstart, clearString(m_selstart, m_selend - m_selstart));-
3788 for (int i = 0; i < m_selend - m_selstart; ++i)
i < m_selend - m_selstartDescription
TRUEnever evaluated
FALSEnever evaluated
0
3789 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
3790 } else {
never executed: end of block
0
3791 m_text.remove(m_selstart, m_selend - m_selstart);-
3792 }
executed 184 times by 1 test: end of block
Executed by:
  • tst_qquicktextinput
184
3793 if (m_cursor > m_selstart)
m_cursor > m_selstartDescription
TRUEevaluated 42 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEevaluated 142 times by 1 test
Evaluated by:
  • tst_qquicktextinput
42-142
3794 m_cursor -= qMin(m_cursor, m_selend) - m_selstart;
executed 42 times by 1 test: m_cursor -= qMin(m_cursor, m_selend) - m_selstart;
Executed by:
  • tst_qquicktextinput
42
3795 internalDeselect();-
3796 m_textDirty = true;-
3797 }
executed 184 times by 1 test: end of block
Executed by:
  • tst_qquicktextinput
184
3798}
executed 484 times by 1 test: end of block
Executed by:
  • tst_qquicktextinput
484
3799-
3800/*!-
3801 \internal-
3802-
3803 Adds the current selection to the undo history.-
3804-
3805 Returns true if there is a current selection and false otherwise.-
3806*/-
3807-
3808bool QQuickTextInputPrivate::separateSelection()-
3809{-
3810 if (hasSelectedText()) {
hasSelectedText()Description
TRUEevaluated 38 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEevaluated 1750 times by 1 test
Evaluated by:
  • tst_qquicktextinput
38-1750
3811 separate();-
3812 addCommand(Command(SetSelection, m_cursor, 0, m_selstart, m_selend));-
3813 return true;
executed 38 times by 1 test: return true;
Executed by:
  • tst_qquicktextinput
38
3814 } else {-
3815 return false;
executed 1750 times by 1 test: return false;
Executed by:
  • tst_qquicktextinput
1750
3816 }-
3817}-
3818-
3819/*!-
3820 \internal-
3821-
3822 Parses the input mask specified by \a maskFields to generate-
3823 the mask data used to handle input masks.-
3824*/-
3825void QQuickTextInputPrivate::parseInputMask(const QString &maskFields)-
3826{-
3827 int delimiter = maskFields.indexOf(QLatin1Char(';'));-
3828 if (maskFields.isEmpty() || delimiter == 0) {
maskFields.isEmpty()Description
TRUEevaluated 2 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEevaluated 254 times by 1 test
Evaluated by:
  • tst_qquicktextinput
delimiter == 0Description
TRUEnever evaluated
FALSEevaluated 254 times by 1 test
Evaluated by:
  • tst_qquicktextinput
0-254
3829 if (m_maskData) {
m_maskDataDescription
TRUEevaluated 2 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEnever evaluated
0-2
3830 delete [] m_maskData;-
3831 m_maskData = nullptr;-
3832 m_maxLength = 32767;-
3833 internalSetText(QString());-
3834 }
executed 2 times by 1 test: end of block
Executed by:
  • tst_qquicktextinput
2
3835 return;
executed 2 times by 1 test: return;
Executed by:
  • tst_qquicktextinput
2
3836 }-
3837-
3838 if (delimiter == -1) {
delimiter == -1Description
TRUEevaluated 196 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEevaluated 58 times by 1 test
Evaluated by:
  • tst_qquicktextinput
58-196
3839 m_blank = QLatin1Char(' ');-
3840 m_inputMask = maskFields;-
3841 } else {
executed 196 times by 1 test: end of block
Executed by:
  • tst_qquicktextinput
196
3842 m_inputMask = maskFields.left(delimiter);-
3843 m_blank = (delimiter + 1 < maskFields.length()) ? maskFields[delimiter + 1] : QLatin1Char(' ');
(delimiter + 1...elds.length())Description
TRUEevaluated 54 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEevaluated 4 times by 1 test
Evaluated by:
  • tst_qquicktextinput
4-54
3844 }
executed 58 times by 1 test: end of block
Executed by:
  • tst_qquicktextinput
58
3845-
3846 // calculate m_maxLength / m_maskData length-
3847 m_maxLength = 0;-
3848 QChar c = 0;-
3849 for (int i=0; i<m_inputMask.length(); i++) {
i<m_inputMask.length()Description
TRUEevaluated 2682 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEevaluated 254 times by 1 test
Evaluated by:
  • tst_qquicktextinput
254-2682
3850 c = m_inputMask.at(i);-
3851 if (i > 0 && m_inputMask.at(i-1) == QLatin1Char('\\')) {
i > 0Description
TRUEevaluated 2428 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEevaluated 254 times by 1 test
Evaluated by:
  • tst_qquicktextinput
m_inputMask.at...tin1Char('\\')Description
TRUEevaluated 24 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEevaluated 2404 times by 1 test
Evaluated by:
  • tst_qquicktextinput
24-2428
3852 m_maxLength++;-
3853 continue;
executed 24 times by 1 test: continue;
Executed by:
  • tst_qquicktextinput
24
3854 }-
3855 if (c != QLatin1Char('\\') && c != QLatin1Char('!') &&
c != QLatin1Char('\\')Description
TRUEevaluated 2638 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEevaluated 20 times by 1 test
Evaluated by:
  • tst_qquicktextinput
c != QLatin1Char('!')Description
TRUEevaluated 2558 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEevaluated 80 times by 1 test
Evaluated by:
  • tst_qquicktextinput
20-2638
3856 c != QLatin1Char('<') && c != QLatin1Char('>') &&
c != QLatin1Char('<')Description
TRUEevaluated 2468 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEevaluated 90 times by 1 test
Evaluated by:
  • tst_qquicktextinput
c != QLatin1Char('>')Description
TRUEevaluated 2376 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEevaluated 92 times by 1 test
Evaluated by:
  • tst_qquicktextinput
90-2468
3857 c != QLatin1Char('{') && c != QLatin1Char('}') &&
c != QLatin1Char('{')Description
TRUEevaluated 2372 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEevaluated 4 times by 1 test
Evaluated by:
  • tst_qquicktextinput
c != QLatin1Char('}')Description
TRUEevaluated 2368 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEevaluated 4 times by 1 test
Evaluated by:
  • tst_qquicktextinput
4-2372
3858 c != QLatin1Char('[') && c != QLatin1Char(']'))
c != QLatin1Char('[')Description
TRUEevaluated 2364 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEevaluated 4 times by 1 test
Evaluated by:
  • tst_qquicktextinput
c != QLatin1Char(']')Description
TRUEevaluated 2360 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEevaluated 4 times by 1 test
Evaluated by:
  • tst_qquicktextinput
4-2364
3859 m_maxLength++;
executed 2360 times by 1 test: m_maxLength++;
Executed by:
  • tst_qquicktextinput
2360
3860 }
executed 2658 times by 1 test: end of block
Executed by:
  • tst_qquicktextinput
2658
3861-
3862 delete [] m_maskData;-
3863 m_maskData = new MaskInputData[m_maxLength];-
3864-
3865 MaskInputData::Casemode m = MaskInputData::NoCaseMode;-
3866 c = 0;-
3867 bool s;-
3868 bool escape = false;-
3869 int index = 0;-
3870 for (int i = 0; i < m_inputMask.length(); i++) {
i < m_inputMask.length()Description
TRUEevaluated 2682 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEevaluated 254 times by 1 test
Evaluated by:
  • tst_qquicktextinput
254-2682
3871 c = m_inputMask.at(i);-
3872 if (escape) {
escapeDescription
TRUEevaluated 20 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEevaluated 2662 times by 1 test
Evaluated by:
  • tst_qquicktextinput
20-2662
3873 s = true;-
3874 m_maskData[index].maskChar = c;-
3875 m_maskData[index].separator = s;-
3876 m_maskData[index].caseMode = m;-
3877 index++;-
3878 escape = false;-
3879 } else if (c == QLatin1Char('<')) {
executed 20 times by 1 test: end of block
Executed by:
  • tst_qquicktextinput
c == QLatin1Char('<')Description
TRUEevaluated 90 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEevaluated 2572 times by 1 test
Evaluated by:
  • tst_qquicktextinput
20-2572
3880 m = MaskInputData::Lower;-
3881 } else if (c == QLatin1Char('>')) {
executed 90 times by 1 test: end of block
Executed by:
  • tst_qquicktextinput
c == QLatin1Char('>')Description
TRUEevaluated 92 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEevaluated 2480 times by 1 test
Evaluated by:
  • tst_qquicktextinput
90-2480
3882 m = MaskInputData::Upper;-
3883 } else if (c == QLatin1Char('!')) {
executed 92 times by 1 test: end of block
Executed by:
  • tst_qquicktextinput
c == QLatin1Char('!')Description
TRUEevaluated 80 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEevaluated 2400 times by 1 test
Evaluated by:
  • tst_qquicktextinput
80-2400
3884 m = MaskInputData::NoCaseMode;-
3885 } else if (c != QLatin1Char('{') && c != QLatin1Char('}') && c != QLatin1Char('[') && c != QLatin1Char(']')) {
executed 80 times by 1 test: end of block
Executed by:
  • tst_qquicktextinput
c != QLatin1Char('{')Description
TRUEevaluated 2396 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEevaluated 4 times by 1 test
Evaluated by:
  • tst_qquicktextinput
c != QLatin1Char('}')Description
TRUEevaluated 2392 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEevaluated 4 times by 1 test
Evaluated by:
  • tst_qquicktextinput
c != QLatin1Char('[')Description
TRUEevaluated 2388 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEevaluated 4 times by 1 test
Evaluated by:
  • tst_qquicktextinput
c != QLatin1Char(']')Description
TRUEevaluated 2384 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEevaluated 4 times by 1 test
Evaluated by:
  • tst_qquicktextinput
4-2396
3886 switch (c.unicode()) {-
3887 case 'A':
executed 280 times by 1 test: case 'A':
Executed by:
  • tst_qquicktextinput
280
3888 case 'a':
executed 126 times by 1 test: case 'a':
Executed by:
  • tst_qquicktextinput
126
3889 case 'N':
executed 10 times by 1 test: case 'N':
Executed by:
  • tst_qquicktextinput
10
3890 case 'n':
executed 12 times by 1 test: case 'n':
Executed by:
  • tst_qquicktextinput
12
3891 case 'X':
executed 14 times by 1 test: case 'X':
Executed by:
  • tst_qquicktextinput
14
3892 case 'x':
executed 8 times by 1 test: case 'x':
Executed by:
  • tst_qquicktextinput
8
3893 case '9':
executed 304 times by 1 test: case '9':
Executed by:
  • tst_qquicktextinput
304
3894 case '0':
executed 936 times by 1 test: case '0':
Executed by:
  • tst_qquicktextinput
936
3895 case 'D':
executed 12 times by 1 test: case 'D':
Executed by:
  • tst_qquicktextinput
12
3896 case 'd':
executed 10 times by 1 test: case 'd':
Executed by:
  • tst_qquicktextinput
10
3897 case '#':
executed 8 times by 1 test: case '#':
Executed by:
  • tst_qquicktextinput
8
3898 case 'H':
executed 144 times by 1 test: case 'H':
Executed by:
  • tst_qquicktextinput
144
3899 case 'h':
executed 44 times by 1 test: case 'h':
Executed by:
  • tst_qquicktextinput
44
3900 case 'B':
executed 38 times by 1 test: case 'B':
Executed by:
  • tst_qquicktextinput
38
3901 case 'b':
executed 38 times by 1 test: case 'b':
Executed by:
  • tst_qquicktextinput
38
3902 s = false;-
3903 break;
executed 1984 times by 1 test: break;
Executed by:
  • tst_qquicktextinput
1984
3904 case '\\':
executed 20 times by 1 test: case '\\':
Executed by:
  • tst_qquicktextinput
20
3905 escape = true;-
3906 Q_FALLTHROUGH();-
3907 default:
code before this statement executed 20 times by 1 test: default:
Executed by:
  • tst_qquicktextinput
executed 380 times by 1 test: default:
Executed by:
  • tst_qquicktextinput
20-380
3908 s = true;-
3909 break;
executed 400 times by 1 test: break;
Executed by:
  • tst_qquicktextinput
400
3910 }-
3911-
3912 if (!escape) {
!escapeDescription
TRUEevaluated 2364 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEevaluated 20 times by 1 test
Evaluated by:
  • tst_qquicktextinput
20-2364
3913 m_maskData[index].maskChar = c;-
3914 m_maskData[index].separator = s;-
3915 m_maskData[index].caseMode = m;-
3916 index++;-
3917 }
executed 2364 times by 1 test: end of block
Executed by:
  • tst_qquicktextinput
2364
3918 }
executed 2384 times by 1 test: end of block
Executed by:
  • tst_qquicktextinput
2384
3919 }
executed 2682 times by 1 test: end of block
Executed by:
  • tst_qquicktextinput
2682
3920 internalSetText(m_text);-
3921}
executed 254 times by 1 test: end of block
Executed by:
  • tst_qquicktextinput
254
3922-
3923-
3924/*!-
3925 \internal-
3926-
3927 checks if the key is valid compared to the inputMask-
3928*/-
3929bool QQuickTextInputPrivate::isValidInput(QChar key, QChar mask) const-
3930{-
3931 switch (mask.unicode()) {-
3932 case 'A':
executed 1292 times by 1 test: case 'A':
Executed by:
  • tst_qquicktextinput
1292
3933 if (key.isLetter())
key.isLetter()Description
TRUEevaluated 850 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEevaluated 442 times by 1 test
Evaluated by:
  • tst_qquicktextinput
442-850
3934 return true;
executed 850 times by 1 test: return true;
Executed by:
  • tst_qquicktextinput
850
3935 break;
executed 442 times by 1 test: break;
Executed by:
  • tst_qquicktextinput
442
3936 case 'a':
executed 968 times by 1 test: case 'a':
Executed by:
  • tst_qquicktextinput
968
3937 if (key.isLetter() || key == m_blank)
key.isLetter()Description
TRUEevaluated 476 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEevaluated 492 times by 1 test
Evaluated by:
  • tst_qquicktextinput
key == m_blankDescription
TRUEevaluated 492 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEnever evaluated
0-492
3938 return true;
executed 968 times by 1 test: return true;
Executed by:
  • tst_qquicktextinput
968
3939 break;
never executed: break;
0
3940 case 'N':
executed 32 times by 1 test: case 'N':
Executed by:
  • tst_qquicktextinput
32
3941 if (key.isLetterOrNumber())
key.isLetterOrNumber()Description
TRUEevaluated 20 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEevaluated 12 times by 1 test
Evaluated by:
  • tst_qquicktextinput
12-20
3942 return true;
executed 20 times by 1 test: return true;
Executed by:
  • tst_qquicktextinput
20
3943 break;
executed 12 times by 1 test: break;
Executed by:
  • tst_qquicktextinput
12
3944 case 'n':
executed 46 times by 1 test: case 'n':
Executed by:
  • tst_qquicktextinput
46
3945 if (key.isLetterOrNumber() || key == m_blank)
key.isLetterOrNumber()Description
TRUEevaluated 18 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEevaluated 28 times by 1 test
Evaluated by:
  • tst_qquicktextinput
key == m_blankDescription
TRUEevaluated 28 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEnever evaluated
0-28
3946 return true;
executed 46 times by 1 test: return true;
Executed by:
  • tst_qquicktextinput
46
3947 break;
never executed: break;
0
3948 case 'X':
executed 40 times by 1 test: case 'X':
Executed by:
  • tst_qquicktextinput
40
3949 if (key.isPrint())
key.isPrint()Description
TRUEevaluated 40 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEnever evaluated
0-40
3950 return true;
executed 40 times by 1 test: return true;
Executed by:
  • tst_qquicktextinput
40
3951 break;
never executed: break;
0
3952 case 'x':
executed 28 times by 1 test: case 'x':
Executed by:
  • tst_qquicktextinput
28
3953 if (key.isPrint() || key == m_blank)
key.isPrint()Description
TRUEevaluated 28 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEnever evaluated
key == m_blankDescription
TRUEnever evaluated
FALSEnever evaluated
0-28
3954 return true;
executed 28 times by 1 test: return true;
Executed by:
  • tst_qquicktextinput
28
3955 break;
never executed: break;
0
3956 case '9':
executed 1412 times by 1 test: case '9':
Executed by:
  • tst_qquicktextinput
1412
3957 if (key.isNumber())
key.isNumber()Description
TRUEevaluated 786 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEevaluated 626 times by 1 test
Evaluated by:
  • tst_qquicktextinput
626-786
3958 return true;
executed 786 times by 1 test: return true;
Executed by:
  • tst_qquicktextinput
786
3959 break;
executed 626 times by 1 test: break;
Executed by:
  • tst_qquicktextinput
626
3960 case '0':
executed 4130 times by 1 test: case '0':
Executed by:
  • tst_qquicktextinput
4130
3961 if (key.isNumber() || key == m_blank)
key.isNumber()Description
TRUEevaluated 2210 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEevaluated 1920 times by 1 test
Evaluated by:
  • tst_qquicktextinput
key == m_blankDescription
TRUEevaluated 1694 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEevaluated 226 times by 1 test
Evaluated by:
  • tst_qquicktextinput
226-2210
3962 return true;
executed 3904 times by 1 test: return true;
Executed by:
  • tst_qquicktextinput
3904
3963 break;
executed 226 times by 1 test: break;
Executed by:
  • tst_qquicktextinput
226
3964 case 'D':
executed 48 times by 1 test: case 'D':
Executed by:
  • tst_qquicktextinput
48
3965 if (key.isNumber() && key.digitValue() > 0)
key.isNumber()Description
TRUEevaluated 24 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEevaluated 24 times by 1 test
Evaluated by:
  • tst_qquicktextinput
key.digitValue() > 0Description
TRUEevaluated 20 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEevaluated 4 times by 1 test
Evaluated by:
  • tst_qquicktextinput
4-24
3966 return true;
executed 20 times by 1 test: return true;
Executed by:
  • tst_qquicktextinput
20
3967 break;
executed 28 times by 1 test: break;
Executed by:
  • tst_qquicktextinput
28
3968 case 'd':
executed 32 times by 1 test: case 'd':
Executed by:
  • tst_qquicktextinput
32
3969 if ((key.isNumber() && key.digitValue() > 0) || key == m_blank)
key.isNumber()Description
TRUEevaluated 8 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEevaluated 24 times by 1 test
Evaluated by:
  • tst_qquicktextinput
key.digitValue() > 0Description
TRUEevaluated 8 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEnever evaluated
key == m_blankDescription
TRUEevaluated 24 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEnever evaluated
0-24
3970 return true;
executed 32 times by 1 test: return true;
Executed by:
  • tst_qquicktextinput
32
3971 break;
never executed: break;
0
3972 case '#':
executed 6 times by 1 test: case '#':
Executed by:
  • tst_qquicktextinput
6
3973 if (key.isNumber() || key == QLatin1Char('+') || key == QLatin1Char('-') || key == m_blank)
key.isNumber()Description
TRUEnever evaluated
FALSEevaluated 6 times by 1 test
Evaluated by:
  • tst_qquicktextinput
key == QLatin1Char('+')Description
TRUEnever evaluated
FALSEevaluated 6 times by 1 test
Evaluated by:
  • tst_qquicktextinput
key == QLatin1Char('-')Description
TRUEnever evaluated
FALSEevaluated 6 times by 1 test
Evaluated by:
  • tst_qquicktextinput
key == m_blankDescription
TRUEevaluated 6 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEnever evaluated
0-6
3974 return true;
executed 6 times by 1 test: return true;
Executed by:
  • tst_qquicktextinput
6
3975 break;
never executed: break;
0
3976 case 'B':
executed 392 times by 1 test: case 'B':
Executed by:
  • tst_qquicktextinput
392
3977 if (key == QLatin1Char('0') || key == QLatin1Char('1'))
key == QLatin1Char('0')Description
TRUEevaluated 164 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEevaluated 228 times by 1 test
Evaluated by:
  • tst_qquicktextinput
key == QLatin1Char('1')Description
TRUEevaluated 84 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEevaluated 144 times by 1 test
Evaluated by:
  • tst_qquicktextinput
84-228
3978 return true;
executed 248 times by 1 test: return true;
Executed by:
  • tst_qquicktextinput
248
3979 break;
executed 144 times by 1 test: break;
Executed by:
  • tst_qquicktextinput
144
3980 case 'b':
executed 432 times by 1 test: case 'b':
Executed by:
  • tst_qquicktextinput
432
3981 if (key == QLatin1Char('0') || key == QLatin1Char('1') || key == m_blank)
key == QLatin1Char('0')Description
TRUEevaluated 60 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEevaluated 372 times by 1 test
Evaluated by:
  • tst_qquicktextinput
key == QLatin1Char('1')Description
TRUEevaluated 58 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEevaluated 314 times by 1 test
Evaluated by:
  • tst_qquicktextinput
key == m_blankDescription
TRUEevaluated 154 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEevaluated 160 times by 1 test
Evaluated by:
  • tst_qquicktextinput
58-372
3982 return true;
executed 272 times by 1 test: return true;
Executed by:
  • tst_qquicktextinput
272
3983 break;
executed 160 times by 1 test: break;
Executed by:
  • tst_qquicktextinput
160
3984 case 'H':
executed 1088 times by 1 test: case 'H':
Executed by:
  • tst_qquicktextinput
1088
3985 if (key.isNumber() || (key >= QLatin1Char('a') && key <= QLatin1Char('f')) || (key >= QLatin1Char('A') && key <= QLatin1Char('F')))
key.isNumber()Description
TRUEevaluated 414 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEevaluated 674 times by 1 test
Evaluated by:
  • tst_qquicktextinput
key >= QLatin1Char('a')Description
TRUEevaluated 288 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEevaluated 386 times by 1 test
Evaluated by:
  • tst_qquicktextinput
key <= QLatin1Char('f')Description
TRUEevaluated 208 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEevaluated 80 times by 1 test
Evaluated by:
  • tst_qquicktextinput
key >= QLatin1Char('A')Description
TRUEevaluated 338 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEevaluated 128 times by 1 test
Evaluated by:
  • tst_qquicktextinput
key <= QLatin1Char('F')Description
TRUEevaluated 178 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEevaluated 160 times by 1 test
Evaluated by:
  • tst_qquicktextinput
80-674
3986 return true;
executed 800 times by 1 test: return true;
Executed by:
  • tst_qquicktextinput
800
3987 break;
executed 288 times by 1 test: break;
Executed by:
  • tst_qquicktextinput
288
3988 case 'h':
executed 560 times by 1 test: case 'h':
Executed by:
  • tst_qquicktextinput
560
3989 if (key.isNumber() || (key >= QLatin1Char('a') && key <= QLatin1Char('f')) || (key >= QLatin1Char('A') && key <= QLatin1Char('F')) || key == m_blank)
key.isNumber()Description
TRUEevaluated 58 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEevaluated 502 times by 1 test
Evaluated by:
  • tst_qquicktextinput
key >= QLatin1Char('a')Description
TRUEevaluated 202 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEevaluated 300 times by 1 test
Evaluated by:
  • tst_qquicktextinput
key <= QLatin1Char('f')Description
TRUEevaluated 122 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEevaluated 80 times by 1 test
Evaluated by:
  • tst_qquicktextinput
key >= QLatin1Char('A')Description
TRUEevaluated 232 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEevaluated 148 times by 1 test
Evaluated by:
  • tst_qquicktextinput
key <= QLatin1Char('F')Description
TRUEevaluated 72 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEevaluated 160 times by 1 test
Evaluated by:
  • tst_qquicktextinput
key == m_blankDescription
TRUEevaluated 148 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEevaluated 160 times by 1 test
Evaluated by:
  • tst_qquicktextinput
58-502
3990 return true;
executed 400 times by 1 test: return true;
Executed by:
  • tst_qquicktextinput
400
3991 break;
executed 160 times by 1 test: break;
Executed by:
  • tst_qquicktextinput
160
3992 default:
never executed: default:
0
3993 break;
never executed: break;
0
3994 }-
3995 return false;
executed 2086 times by 1 test: return false;
Executed by:
  • tst_qquicktextinput
2086
3996}-
3997-
3998/*!-
3999 \internal-
4000-
4001 Returns true if the given text \a str is valid for any-
4002 validator or input mask set for the line control.-
4003-
4004 Otherwise returns false-
4005*/-
4006QQuickTextInputPrivate::ValidatorState QQuickTextInputPrivate::hasAcceptableInput(const QString &str) const-
4007{-
4008#if QT_CONFIG(validator)-
4009 QString textCopy = str;-
4010 int cursorCopy = m_cursor;-
4011 if (m_validator) {
m_validatorDescription
TRUEevaluated 188 times by 2 tests
Evaluated by:
  • tst_examples
  • tst_qquicktextinput
FALSEevaluated 2112 times by 5 tests
Evaluated by:
  • tst_examples
  • tst_qquickitem
  • tst_qquickitem2
  • tst_qquicktextedit
  • tst_qquicktextinput
188-2112
4012 QValidator::State state = m_validator->validate(textCopy, cursorCopy);-
4013 if (state != QValidator::Acceptable)
state != QVali...or::AcceptableDescription
TRUEevaluated 120 times by 2 tests
Evaluated by:
  • tst_examples
  • tst_qquicktextinput
FALSEevaluated 68 times by 1 test
Evaluated by:
  • tst_qquicktextinput
68-120
4014 return ValidatorState(state);
executed 120 times by 2 tests: return ValidatorState(state);
Executed by:
  • tst_examples
  • tst_qquicktextinput
120
4015 }
executed 68 times by 1 test: end of block
Executed by:
  • tst_qquicktextinput
68
4016#endif-
4017-
4018 if (!m_maskData)
!m_maskDataDescription
TRUEevaluated 930 times by 5 tests
Evaluated by:
  • tst_examples
  • tst_qquickitem
  • tst_qquickitem2
  • tst_qquicktextedit
  • tst_qquicktextinput
FALSEevaluated 1250 times by 1 test
Evaluated by:
  • tst_qquicktextinput
930-1250
4019 return AcceptableInput;
executed 930 times by 5 tests: return AcceptableInput;
Executed by:
  • tst_examples
  • tst_qquickitem
  • tst_qquickitem2
  • tst_qquicktextedit
  • tst_qquicktextinput
930
4020-
4021 if (str.length() != m_maxLength)
str.length() != m_maxLengthDescription
TRUEnever evaluated
FALSEevaluated 1250 times by 1 test
Evaluated by:
  • tst_qquicktextinput
0-1250
4022 return InvalidInput;
never executed: return InvalidInput;
0
4023-
4024 for (int i=0; i < m_maxLength; ++i) {
i < m_maxLengthDescription
TRUEevaluated 8450 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEevaluated 662 times by 1 test
Evaluated by:
  • tst_qquicktextinput
662-8450
4025 if (m_maskData[i].separator) {
m_maskData[i].separatorDescription
TRUEevaluated 1130 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEevaluated 7320 times by 1 test
Evaluated by:
  • tst_qquicktextinput
1130-7320
4026 if (str.at(i) != m_maskData[i].maskChar)
str.at(i) != m...ta[i].maskCharDescription
TRUEnever evaluated
FALSEevaluated 1130 times by 1 test
Evaluated by:
  • tst_qquicktextinput
0-1130
4027 return InvalidInput;
never executed: return InvalidInput;
0
4028 } else {
executed 1130 times by 1 test: end of block
Executed by:
  • tst_qquicktextinput
1130
4029 if (!isValidInput(str.at(i), m_maskData[i].maskChar))
!isValidInput(...a[i].maskChar)Description
TRUEevaluated 588 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEevaluated 6732 times by 1 test
Evaluated by:
  • tst_qquicktextinput
588-6732
4030 return InvalidInput;
executed 588 times by 1 test: return InvalidInput;
Executed by:
  • tst_qquicktextinput
588
4031 }
executed 6732 times by 1 test: end of block
Executed by:
  • tst_qquicktextinput
6732
4032 }-
4033 return AcceptableInput;
executed 662 times by 1 test: return AcceptableInput;
Executed by:
  • tst_qquicktextinput
662
4034}-
4035-
4036/*!-
4037 \internal-
4038-
4039 Applies the inputMask on \a str starting from position \a pos in the mask. \a clear-
4040 specifies from where characters should be gotten when a separator is met in \a str - true means-
4041 that blanks will be used, false that previous input is used.-
4042 Calling this when no inputMask is set is undefined.-
4043*/-
4044QString QQuickTextInputPrivate::maskString(uint pos, const QString &str, bool clear) const-
4045{-
4046 if (pos >= (uint)m_maxLength)
pos >= (uint)m_maxLengthDescription
TRUEevaluated 24 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEevaluated 1356 times by 1 test
Evaluated by:
  • tst_qquicktextinput
24-1356
4047 return QString::fromLatin1("");
executed 24 times by 1 test: return QString::fromLatin1("");
Executed by:
  • tst_qquicktextinput
24
4048-
4049 QString fill;-
4050 fill = clear ? clearString(0, m_maxLength) : m_text;
clearDescription
TRUEevaluated 782 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEevaluated 574 times by 1 test
Evaluated by:
  • tst_qquicktextinput
574-782
4051-
4052 int strIndex = 0;-
4053 QString s = QString::fromLatin1("");-
4054 int i = pos;-
4055 while (i < m_maxLength) {
i < m_maxLengthDescription
TRUEevaluated 3598 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEevaluated 216 times by 1 test
Evaluated by:
  • tst_qquicktextinput
216-3598
4056 if (strIndex < str.length()) {
strIndex < str.length()Description
TRUEevaluated 2458 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEevaluated 1140 times by 1 test
Evaluated by:
  • tst_qquicktextinput
1140-2458
4057 if (m_maskData[i].separator) {
m_maskData[i].separatorDescription
TRUEevaluated 188 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEevaluated 2270 times by 1 test
Evaluated by:
  • tst_qquicktextinput
188-2270
4058 s += m_maskData[i].maskChar;-
4059 if (str[strIndex] == m_maskData[i].maskChar)
str[strIndex] ...ta[i].maskCharDescription
TRUEevaluated 146 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEevaluated 42 times by 1 test
Evaluated by:
  • tst_qquicktextinput
42-146
4060 strIndex++;
executed 146 times by 1 test: strIndex++;
Executed by:
  • tst_qquicktextinput
146
4061 ++i;-
4062 } else {
executed 188 times by 1 test: end of block
Executed by:
  • tst_qquicktextinput
188
4063 if (isValidInput(str[strIndex], m_maskData[i].maskChar)) {
isValidInput(s...a[i].maskChar)Description
TRUEevaluated 1680 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEevaluated 590 times by 1 test
Evaluated by:
  • tst_qquicktextinput
590-1680
4064 switch (m_maskData[i].caseMode) {-
4065 case MaskInputData::Upper:
executed 130 times by 1 test: case MaskInputData::Upper:
Executed by:
  • tst_qquicktextinput
130
4066 s += str[strIndex].toUpper();-
4067 break;
executed 130 times by 1 test: break;
Executed by:
  • tst_qquicktextinput
130
4068 case MaskInputData::Lower:
executed 128 times by 1 test: case MaskInputData::Lower:
Executed by:
  • tst_qquicktextinput
128
4069 s += str[strIndex].toLower();-
4070 break;
executed 128 times by 1 test: break;
Executed by:
  • tst_qquicktextinput
128
4071 default:
executed 1422 times by 1 test: default:
Executed by:
  • tst_qquicktextinput
1422
4072 s += str[strIndex];-
4073 }
executed 1422 times by 1 test: end of block
Executed by:
  • tst_qquicktextinput
1422
4074 ++i;-
4075 } else {
executed 1680 times by 1 test: end of block
Executed by:
  • tst_qquicktextinput
1680
4076 // search for separator first-
4077 int n = findInMask(i, true, true, str[strIndex]);-
4078 if (n != -1) {
n != -1Description
TRUEevaluated 122 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEevaluated 468 times by 1 test
Evaluated by:
  • tst_qquicktextinput
122-468
4079 if (str.length() != 1 || i == 0 || (i > 0 && (!m_maskData[i-1].separator || m_maskData[i-1].maskChar != str[strIndex]))) {
str.length() != 1Description
TRUEevaluated 90 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEevaluated 32 times by 1 test
Evaluated by:
  • tst_qquicktextinput
i == 0Description
TRUEevaluated 2 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEevaluated 30 times by 1 test
Evaluated by:
  • tst_qquicktextinput
i > 0Description
TRUEevaluated 30 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEnever evaluated
!m_maskData[i-1].separatorDescription
TRUEevaluated 18 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEevaluated 12 times by 1 test
Evaluated by:
  • tst_qquicktextinput
m_maskData[i-1... str[strIndex]Description
TRUEnever evaluated
FALSEevaluated 12 times by 1 test
Evaluated by:
  • tst_qquicktextinput
0-90
4080 s += fill.midRef(i, n-i+1);-
4081 i = n + 1; // update i to find + 1-
4082 }
executed 110 times by 1 test: end of block
Executed by:
  • tst_qquicktextinput
110
4083 } else {
executed 122 times by 1 test: end of block
Executed by:
  • tst_qquicktextinput
122
4084 // search for valid m_blank if not-
4085 n = findInMask(i, true, false, str[strIndex]);-
4086 if (n != -1) {
n != -1Description
TRUEevaluated 8 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEevaluated 460 times by 1 test
Evaluated by:
  • tst_qquicktextinput
8-460
4087 s += fill.midRef(i, n-i);-
4088 switch (m_maskData[n].caseMode) {-
4089 case MaskInputData::Upper:
executed 2 times by 1 test: case MaskInputData::Upper:
Executed by:
  • tst_qquicktextinput
2
4090 s += str[strIndex].toUpper();-
4091 break;
executed 2 times by 1 test: break;
Executed by:
  • tst_qquicktextinput
2
4092 case MaskInputData::Lower:
never executed: case MaskInputData::Lower:
0
4093 s += str[strIndex].toLower();-
4094 break;
never executed: break;
0
4095 default:
executed 6 times by 1 test: default:
Executed by:
  • tst_qquicktextinput
6
4096 s += str[strIndex];-
4097 }
executed 6 times by 1 test: end of block
Executed by:
  • tst_qquicktextinput
6
4098 i = n + 1; // updates i to find + 1-
4099 }
executed 8 times by 1 test: end of block
Executed by:
  • tst_qquicktextinput
8
4100 }
executed 468 times by 1 test: end of block
Executed by:
  • tst_qquicktextinput
468
4101 }-
4102 ++strIndex;-
4103 }
executed 2270 times by 1 test: end of block
Executed by:
  • tst_qquicktextinput
2270
4104 } else-
4105 break;
executed 1140 times by 1 test: break;
Executed by:
  • tst_qquicktextinput
1140
4106 }-
4107-
4108 return s;
executed 1356 times by 1 test: return s;
Executed by:
  • tst_qquicktextinput
1356
4109}-
4110-
4111-
4112-
4113/*!-
4114 \internal-
4115-
4116 Returns a "cleared" string with only separators and blank chars.-
4117 Calling this when no inputMask is set is undefined.-
4118*/-
4119QString QQuickTextInputPrivate::clearString(uint pos, uint len) const-
4120{-
4121 if (pos >= (uint)m_maxLength)
pos >= (uint)m_maxLengthDescription
TRUEevaluated 108 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEevaluated 1446 times by 1 test
Evaluated by:
  • tst_qquicktextinput
108-1446
4122 return QString();
executed 108 times by 1 test: return QString();
Executed by:
  • tst_qquicktextinput
108
4123-
4124 QString s;-
4125 int end = qMin((uint)m_maxLength, pos + len);-
4126 for (int i = pos; i < end; ++i)
i < endDescription
TRUEevaluated 6834 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEevaluated 1446 times by 1 test
Evaluated by:
  • tst_qquicktextinput
1446-6834
4127 if (m_maskData[i].separator)
m_maskData[i].separatorDescription
TRUEevaluated 1008 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEevaluated 5826 times by 1 test
Evaluated by:
  • tst_qquicktextinput
1008-5826
4128 s += m_maskData[i].maskChar;
executed 1008 times by 1 test: s += m_maskData[i].maskChar;
Executed by:
  • tst_qquicktextinput
1008
4129 else-
4130 s += m_blank;
executed 5826 times by 1 test: s += m_blank;
Executed by:
  • tst_qquicktextinput
5826
4131-
4132 return s;
executed 1446 times by 1 test: return s;
Executed by:
  • tst_qquicktextinput
1446
4133}-
4134-
4135/*!-
4136 \internal-
4137-
4138 Strips blank parts of the input in a QQuickTextInputPrivate when an inputMask is set,-
4139 separators are still included. Typically "127.0__.0__.1__" becomes "127.0.0.1".-
4140*/-
4141QString QQuickTextInputPrivate::stripString(const QString &str) const-
4142{-
4143 if (!m_maskData)
!m_maskDataDescription
TRUEnever evaluated
FALSEevaluated 1164 times by 1 test
Evaluated by:
  • tst_qquicktextinput
0-1164
4144 return str;
never executed: return str;
0
4145-
4146 QString s;-
4147 int end = qMin(m_maxLength, str.length());-
4148 for (int i = 0; i < end; ++i) {
i < endDescription
TRUEevaluated 4594 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEevaluated 1164 times by 1 test
Evaluated by:
  • tst_qquicktextinput
1164-4594
4149 if (m_maskData[i].separator)
m_maskData[i].separatorDescription
TRUEevaluated 530 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEevaluated 4064 times by 1 test
Evaluated by:
  • tst_qquicktextinput
530-4064
4150 s += m_maskData[i].maskChar;
executed 530 times by 1 test: s += m_maskData[i].maskChar;
Executed by:
  • tst_qquicktextinput
530
4151 else if (str[i] != m_blank)
str[i] != m_blankDescription
TRUEevaluated 1778 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEevaluated 2286 times by 1 test
Evaluated by:
  • tst_qquicktextinput
1778-2286
4152 s += str[i];
executed 1778 times by 1 test: s += str[i];
Executed by:
  • tst_qquicktextinput
1778
4153 }
executed 4594 times by 1 test: end of block
Executed by:
  • tst_qquicktextinput
4594
4154-
4155 return s;
executed 1164 times by 1 test: return s;
Executed by:
  • tst_qquicktextinput
1164
4156}-
4157-
4158/*!-
4159 \internal-
4160 searches forward/backward in m_maskData for either a separator or a m_blank-
4161*/-
4162int QQuickTextInputPrivate::findInMask(int pos, bool forward, bool findSeparator, QChar searchChar) const-
4163{-
4164 if (pos >= m_maxLength || pos < 0)
pos >= m_maxLengthDescription
TRUEevaluated 74 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEevaluated 2024 times by 1 test
Evaluated by:
  • tst_qquicktextinput
pos < 0Description
TRUEnever evaluated
FALSEevaluated 2024 times by 1 test
Evaluated by:
  • tst_qquicktextinput
0-2024
4165 return -1;
executed 74 times by 1 test: return -1;
Executed by:
  • tst_qquicktextinput
74
4166-
4167 int end = forward ? m_maxLength : -1;
forwardDescription
TRUEevaluated 1748 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEevaluated 276 times by 1 test
Evaluated by:
  • tst_qquicktextinput
276-1748
4168 int step = forward ? 1 : -1;
forwardDescription
TRUEevaluated 1748 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEevaluated 276 times by 1 test
Evaluated by:
  • tst_qquicktextinput
276-1748
4169 int i = pos;-
4170-
4171 while (i != end) {
i != endDescription
TRUEevaluated 3364 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEevaluated 934 times by 1 test
Evaluated by:
  • tst_qquicktextinput
934-3364
4172 if (findSeparator) {
findSeparatorDescription
TRUEevaluated 1374 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEevaluated 1990 times by 1 test
Evaluated by:
  • tst_qquicktextinput
1374-1990
4173 if (m_maskData[i].separator && m_maskData[i].maskChar == searchChar)
m_maskData[i].separatorDescription
TRUEevaluated 184 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEevaluated 1190 times by 1 test
Evaluated by:
  • tst_qquicktextinput
m_maskData[i].... == searchCharDescription
TRUEevaluated 122 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEevaluated 62 times by 1 test
Evaluated by:
  • tst_qquicktextinput
62-1190
4174 return i;
executed 122 times by 1 test: return i;
Executed by:
  • tst_qquicktextinput
122
4175 } else {
executed 1252 times by 1 test: end of block
Executed by:
  • tst_qquicktextinput
1252
4176 if (!m_maskData[i].separator) {
!m_maskData[i].separatorDescription
TRUEevaluated 1876 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEevaluated 114 times by 1 test
Evaluated by:
  • tst_qquicktextinput
114-1876
4177 if (searchChar.isNull())
searchChar.isNull()Description
TRUEevaluated 960 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEevaluated 916 times by 1 test
Evaluated by:
  • tst_qquicktextinput
916-960
4178 return i;
executed 960 times by 1 test: return i;
Executed by:
  • tst_qquicktextinput
960
4179 else if (isValidInput(searchChar, m_maskData[i].maskChar))
isValidInput(s...a[i].maskChar)Description
TRUEevaluated 8 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEevaluated 908 times by 1 test
Evaluated by:
  • tst_qquicktextinput
8-908
4180 return i;
executed 8 times by 1 test: return i;
Executed by:
  • tst_qquicktextinput
8
4181 }
executed 908 times by 1 test: end of block
Executed by:
  • tst_qquicktextinput
908
4182 }
executed 1022 times by 1 test: end of block
Executed by:
  • tst_qquicktextinput
1022
4183 i += step;-
4184 }
executed 2274 times by 1 test: end of block
Executed by:
  • tst_qquicktextinput
2274
4185 return -1;
executed 934 times by 1 test: return -1;
Executed by:
  • tst_qquicktextinput
934
4186}-
4187-
4188void QQuickTextInputPrivate::internalUndo(int until)-
4189{-
4190 if (!isUndoAvailable())
!isUndoAvailable()Description
TRUEevaluated 14 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEevaluated 166 times by 1 test
Evaluated by:
  • tst_qquicktextinput
14-166
4191 return;
executed 14 times by 1 test: return;
Executed by:
  • tst_qquicktextinput
14
4192 cancelPasswordEchoTimer();-
4193 internalDeselect();-
4194 while (m_undoState && m_undoState > until) {
m_undoStateDescription
TRUEevaluated 956 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEevaluated 58 times by 1 test
Evaluated by:
  • tst_qquicktextinput
m_undoState > untilDescription
TRUEevaluated 946 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEevaluated 10 times by 1 test
Evaluated by:
  • tst_qquicktextinput
10-956
4195 Command& cmd = m_history[--m_undoState];-
4196 switch (cmd.type) {-
4197 case Insert:
executed 618 times by 1 test: case Insert:
Executed by:
  • tst_qquicktextinput
618
4198 m_text.remove(cmd.pos, 1);-
4199 m_cursor = cmd.pos;-
4200 break;
executed 618 times by 1 test: break;
Executed by:
  • tst_qquicktextinput
618
4201 case SetSelection:
executed 38 times by 1 test: case SetSelection:
Executed by:
  • tst_qquicktextinput
38
4202 m_selstart = cmd.selStart;-
4203 m_selend = cmd.selEnd;-
4204 m_cursor = cmd.pos;-
4205 break;
executed 38 times by 1 test: break;
Executed by:
  • tst_qquicktextinput
38
4206 case Remove:
executed 4 times by 1 test: case Remove:
Executed by:
  • tst_qquicktextinput
4
4207 case RemoveSelection:
executed 102 times by 1 test: case RemoveSelection:
Executed by:
  • tst_qquicktextinput
102
4208 m_text.insert(cmd.pos, cmd.uc);-
4209 m_cursor = cmd.pos + 1;-
4210 break;
executed 106 times by 1 test: break;
Executed by:
  • tst_qquicktextinput
106
4211 case Delete:
never executed: case Delete:
0
4212 case DeleteSelection:
executed 108 times by 1 test: case DeleteSelection:
Executed by:
  • tst_qquicktextinput
108
4213 m_text.insert(cmd.pos, cmd.uc);-
4214 m_cursor = cmd.pos;-
4215 break;
executed 108 times by 1 test: break;
Executed by:
  • tst_qquicktextinput
108
4216 case Separator:
executed 76 times by 1 test: case Separator:
Executed by:
  • tst_qquicktextinput
76
4217 continue;
executed 76 times by 1 test: continue;
Executed by:
  • tst_qquicktextinput
76
4218 }-
4219 if (until < 0 && m_undoState) {
until < 0Description
TRUEevaluated 850 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEevaluated 20 times by 1 test
Evaluated by:
  • tst_qquicktextinput
m_undoStateDescription
TRUEevaluated 798 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEevaluated 52 times by 1 test
Evaluated by:
  • tst_qquicktextinput
20-850
4220 Command& next = m_history[m_undoState-1];-
4221 if (next.type != cmd.type
next.type != cmd.typeDescription
TRUEevaluated 152 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEevaluated 646 times by 1 test
Evaluated by:
  • tst_qquicktextinput
152-646
4222 && next.type < RemoveSelection
next.type < RemoveSelectionDescription
TRUEevaluated 98 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEevaluated 54 times by 1 test
Evaluated by:
  • tst_qquicktextinput
54-98
4223 && (cmd.type < RemoveSelection || next.type == Separator)) {
cmd.type < RemoveSelectionDescription
TRUEevaluated 60 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEevaluated 38 times by 1 test
Evaluated by:
  • tst_qquicktextinput
next.type == SeparatorDescription
TRUEevaluated 38 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEnever evaluated
0-60
4224 break;
executed 98 times by 1 test: break;
Executed by:
  • tst_qquicktextinput
98
4225 }-
4226 }
executed 700 times by 1 test: end of block
Executed by:
  • tst_qquicktextinput
700
4227 }
executed 772 times by 1 test: end of block
Executed by:
  • tst_qquicktextinput
772
4228 separate();-
4229 m_textDirty = true;-
4230}
executed 166 times by 1 test: end of block
Executed by:
  • tst_qquicktextinput
166
4231-
4232void QQuickTextInputPrivate::internalRedo()-
4233{-
4234 if (!isRedoAvailable())
!isRedoAvailable()Description
TRUEnever evaluated
FALSEevaluated 12 times by 1 test
Evaluated by:
  • tst_qquicktextinput
0-12
4235 return;
never executed: return;
0
4236 internalDeselect();-
4237 while (m_undoState < m_history.size()) {
m_undoState < m_history.size()Description
TRUEevaluated 62 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEevaluated 6 times by 1 test
Evaluated by:
  • tst_qquicktextinput
6-62
4238 Command& cmd = m_history[m_undoState++];-
4239 switch (cmd.type) {-
4240 case Insert:
executed 44 times by 1 test: case Insert:
Executed by:
  • tst_qquicktextinput
44
4241 m_text.insert(cmd.pos, cmd.uc);-
4242 m_cursor = cmd.pos + 1;-
4243 break;
executed 44 times by 1 test: break;
Executed by:
  • tst_qquicktextinput
44
4244 case SetSelection:
executed 2 times by 1 test: case SetSelection:
Executed by:
  • tst_qquicktextinput
2
4245 m_selstart = cmd.selStart;-
4246 m_selend = cmd.selEnd;-
4247 m_cursor = cmd.pos;-
4248 break;
executed 2 times by 1 test: break;
Executed by:
  • tst_qquicktextinput
2
4249 case Remove:
never executed: case Remove:
0
4250 case Delete:
never executed: case Delete:
0
4251 case RemoveSelection:
never executed: case RemoveSelection:
0
4252 case DeleteSelection:
executed 10 times by 1 test: case DeleteSelection:
Executed by:
  • tst_qquicktextinput
10
4253 m_text.remove(cmd.pos, 1);-
4254 m_selstart = cmd.selStart;-
4255 m_selend = cmd.selEnd;-
4256 m_cursor = cmd.pos;-
4257 break;
executed 10 times by 1 test: break;
Executed by:
  • tst_qquicktextinput
10
4258 case Separator:
executed 6 times by 1 test: case Separator:
Executed by:
  • tst_qquicktextinput
6
4259 m_selstart = cmd.selStart;-
4260 m_selend = cmd.selEnd;-
4261 m_cursor = cmd.pos;-
4262 break;
executed 6 times by 1 test: break;
Executed by:
  • tst_qquicktextinput
6
4263 }-
4264 if (m_undoState < m_history.size()) {
m_undoState < m_history.size()Description
TRUEevaluated 56 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEevaluated 6 times by 1 test
Evaluated by:
  • tst_qquicktextinput
6-56
4265 Command& next = m_history[m_undoState];-
4266 if (next.type != cmd.type
next.type != cmd.typeDescription
TRUEevaluated 14 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEevaluated 42 times by 1 test
Evaluated by:
  • tst_qquicktextinput
14-42
4267 && cmd.type < RemoveSelection
cmd.type < RemoveSelectionDescription
TRUEevaluated 12 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEevaluated 2 times by 1 test
Evaluated by:
  • tst_qquicktextinput
2-12
4268 && next.type != Separator
next.type != SeparatorDescription
TRUEevaluated 6 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEevaluated 6 times by 1 test
Evaluated by:
  • tst_qquicktextinput
6
4269 && (next.type < RemoveSelection || cmd.type == Separator)) {
next.type < RemoveSelectionDescription
TRUEevaluated 6 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEnever evaluated
cmd.type == SeparatorDescription
TRUEnever evaluated
FALSEnever evaluated
0-6
4270 break;
executed 6 times by 1 test: break;
Executed by:
  • tst_qquicktextinput
6
4271 }-
4272 }
executed 50 times by 1 test: end of block
Executed by:
  • tst_qquicktextinput
50
4273 }
executed 56 times by 1 test: end of block
Executed by:
  • tst_qquicktextinput
56
4274 m_textDirty = true;-
4275}
executed 12 times by 1 test: end of block
Executed by:
  • tst_qquicktextinput
12
4276-
4277void QQuickTextInputPrivate::emitUndoRedoChanged()-
4278{-
4279 Q_Q(QQuickTextInput);-
4280 const bool previousUndo = canUndo;-
4281 const bool previousRedo = canRedo;-
4282-
4283 canUndo = isUndoAvailable();-
4284 canRedo = isRedoAvailable();-
4285-
4286 if (previousUndo != canUndo)
previousUndo != canUndoDescription
TRUEevaluated 474 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEevaluated 3246 times by 4 tests
Evaluated by:
  • tst_examples
  • tst_qquickitem
  • tst_qquickitem2
  • tst_qquicktextinput
474-3246
4287 emit q->canUndoChanged();
executed 474 times by 1 test: q->canUndoChanged();
Executed by:
  • tst_qquicktextinput
474
4288 if (previousRedo != canRedo)
previousRedo != canRedoDescription
TRUEevaluated 90 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEevaluated 3630 times by 4 tests
Evaluated by:
  • tst_examples
  • tst_qquickitem
  • tst_qquickitem2
  • tst_qquicktextinput
90-3630
4289 emit q->canRedoChanged();
executed 90 times by 1 test: q->canRedoChanged();
Executed by:
  • tst_qquicktextinput
90
4290}
executed 3720 times by 4 tests: end of block
Executed by:
  • tst_examples
  • tst_qquickitem
  • tst_qquickitem2
  • tst_qquicktextinput
3720
4291-
4292/*!-
4293 \internal-
4294-
4295 If the current cursor position differs from the last emitted cursor-
4296 position, emits cursorPositionChanged().-
4297*/-
4298bool QQuickTextInputPrivate::emitCursorPositionChanged()-
4299{-
4300 Q_Q(QQuickTextInput);-
4301 if (m_cursor != m_lastCursorPos) {
m_cursor != m_lastCursorPosDescription
TRUEevaluated 4792 times by 4 tests
Evaluated by:
  • tst_examples
  • tst_qquickitem
  • tst_qquickitem2
  • tst_qquicktextinput
FALSEevaluated 1296 times by 1 test
Evaluated by:
  • tst_qquicktextinput
1296-4792
4302 m_lastCursorPos = m_cursor;-
4303-
4304 q->updateCursorRectangle();-
4305 emit q->cursorPositionChanged();-
4306-
4307 if (!hasSelectedText()) {
!hasSelectedText()Description
TRUEevaluated 4200 times by 4 tests
Evaluated by:
  • tst_examples
  • tst_qquickitem
  • tst_qquickitem2
  • tst_qquicktextinput
FALSEevaluated 592 times by 1 test
Evaluated by:
  • tst_qquicktextinput
592-4200
4308 if (lastSelectionStart != m_cursor) {
lastSelectionStart != m_cursorDescription
TRUEevaluated 3970 times by 4 tests
Evaluated by:
  • tst_examples
  • tst_qquickitem
  • tst_qquickitem2
  • tst_qquicktextinput
FALSEevaluated 230 times by 2 tests
Evaluated by:
  • tst_qquickitem2
  • tst_qquicktextinput
230-3970
4309 lastSelectionStart = m_cursor;-
4310 emit q->selectionStartChanged();-
4311 }
executed 3970 times by 4 tests: end of block
Executed by:
  • tst_examples
  • tst_qquickitem
  • tst_qquickitem2
  • tst_qquicktextinput
3970
4312 if (lastSelectionEnd != m_cursor) {
lastSelectionEnd != m_cursorDescription
TRUEevaluated 3970 times by 4 tests
Evaluated by:
  • tst_examples
  • tst_qquickitem
  • tst_qquickitem2
  • tst_qquicktextinput
FALSEevaluated 230 times by 2 tests
Evaluated by:
  • tst_qquickitem2
  • tst_qquicktextinput
230-3970
4313 lastSelectionEnd = m_cursor;-
4314 emit q->selectionEndChanged();-
4315 }
executed 3970 times by 4 tests: end of block
Executed by:
  • tst_examples
  • tst_qquickitem
  • tst_qquickitem2
  • tst_qquicktextinput
3970
4316 }
executed 4200 times by 4 tests: end of block
Executed by:
  • tst_examples
  • tst_qquickitem
  • tst_qquickitem2
  • tst_qquicktextinput
4200
4317-
4318#if QT_CONFIG(accessibility)-
4319 if (QAccessible::isActive()) {
QAccessible::isActive()Description
TRUEnever evaluated
FALSEevaluated 4792 times by 4 tests
Evaluated by:
  • tst_examples
  • tst_qquickitem
  • tst_qquickitem2
  • tst_qquicktextinput
0-4792
4320 if (QObject *acc = QQuickAccessibleAttached::findAccessible(q, QAccessible::EditableText)) {
QObject *acc =...:EditableText)Description
TRUEnever evaluated
FALSEnever evaluated
0
4321 QAccessibleTextCursorEvent ev(acc, m_cursor);-
4322 QAccessible::updateAccessibility(&ev);-
4323 }
never executed: end of block
0
4324 }
never executed: end of block
0
4325#endif-
4326-
4327 return true;
executed 4792 times by 4 tests: return true;
Executed by:
  • tst_examples
  • tst_qquickitem
  • tst_qquickitem2
  • tst_qquicktextinput
4792
4328 }-
4329 return false;
executed 1296 times by 1 test: return false;
Executed by:
  • tst_qquicktextinput
1296
4330}-
4331-
4332-
4333void QQuickTextInputPrivate::setBlinkingCursorEnabled(bool enable)-
4334{-
4335 if (enable == m_blinkEnabled)
enable == m_blinkEnabledDescription
TRUEevaluated 6 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEevaluated 496 times by 3 tests
Evaluated by:
  • tst_qquickitem
  • tst_qquickitem2
  • tst_qquicktextinput
6-496
4336 return;
executed 6 times by 1 test: return;
Executed by:
  • tst_qquicktextinput
6
4337-
4338 m_blinkEnabled = enable;-
4339 updateCursorBlinking();-
4340-
4341 if (enable)
enableDescription
TRUEevaluated 372 times by 3 tests
Evaluated by:
  • tst_qquickitem
  • tst_qquickitem2
  • tst_qquicktextinput
FALSEevaluated 124 times by 3 tests
Evaluated by:
  • tst_qquickitem
  • tst_qquickitem2
  • tst_qquicktextinput
124-372
4342 connect(qApp->styleHints(), &QStyleHints::cursorFlashTimeChanged, this, &QQuickTextInputPrivate::updateCursorBlinking);
executed 372 times by 3 tests: connect((static_cast<QGuiApplication *>(QCoreApplication::instance()))->styleHints(), &QStyleHints::cursorFlashTimeChanged, this, &QQuickTextInputPrivate::updateCursorBlinking);
Executed by:
  • tst_qquickitem
  • tst_qquickitem2
  • tst_qquicktextinput
372
4343 else-
4344 disconnect(qApp->styleHints(), &QStyleHints::cursorFlashTimeChanged, this, &QQuickTextInputPrivate::updateCursorBlinking);
executed 124 times by 3 tests: disconnect((static_cast<QGuiApplication *>(QCoreApplication::instance()))->styleHints(), &QStyleHints::cursorFlashTimeChanged, this, &QQuickTextInputPrivate::updateCursorBlinking);
Executed by:
  • tst_qquickitem
  • tst_qquickitem2
  • tst_qquicktextinput
124
4345}-
4346-
4347void QQuickTextInputPrivate::updateCursorBlinking()-
4348{-
4349 Q_Q(QQuickTextInput);-
4350-
4351 if (m_blinkTimer) {
m_blinkTimerDescription
TRUEevaluated 1868 times by 3 tests
Evaluated by:
  • tst_qquickitem
  • tst_qquickitem2
  • tst_qquicktextinput
FALSEevaluated 1024 times by 4 tests
Evaluated by:
  • tst_examples
  • tst_qquickitem
  • tst_qquickitem2
  • tst_qquicktextinput
1024-1868
4352 q->killTimer(m_blinkTimer);-
4353 m_blinkTimer = 0;-
4354 }
executed 1868 times by 3 tests: end of block
Executed by:
  • tst_qquickitem
  • tst_qquickitem2
  • tst_qquicktextinput
1868
4355-
4356 if (m_blinkEnabled && cursorVisible && !cursorItem && !m_readOnly) {
m_blinkEnabledDescription
TRUEevaluated 2374 times by 3 tests
Evaluated by:
  • tst_qquickitem
  • tst_qquickitem2
  • tst_qquicktextinput
FALSEevaluated 518 times by 4 tests
Evaluated by:
  • tst_examples
  • tst_qquickitem
  • tst_qquickitem2
  • tst_qquicktextinput
cursorVisibleDescription
TRUEevaluated 2254 times by 3 tests
Evaluated by:
  • tst_qquickitem
  • tst_qquickitem2
  • tst_qquicktextinput
FALSEevaluated 120 times by 3 tests
Evaluated by:
  • tst_qquickitem
  • tst_qquickitem2
  • tst_qquicktextinput
!cursorItemDescription
TRUEevaluated 2112 times by 3 tests
Evaluated by:
  • tst_qquickitem
  • tst_qquickitem2
  • tst_qquicktextinput
FALSEevaluated 142 times by 1 test
Evaluated by:
  • tst_qquicktextinput
!m_readOnlyDescription
TRUEevaluated 2112 times by 3 tests
Evaluated by:
  • tst_qquickitem
  • tst_qquickitem2
  • tst_qquicktextinput
FALSEnever evaluated
0-2374
4357 int flashTime = QGuiApplication::styleHints()->cursorFlashTime();-
4358 if (flashTime >= 2)
flashTime >= 2Description
TRUEevaluated 2112 times by 3 tests
Evaluated by:
  • tst_qquickitem
  • tst_qquickitem2
  • tst_qquicktextinput
FALSEnever evaluated
0-2112
4359 m_blinkTimer = q->startTimer(flashTime / 2);
executed 2112 times by 3 tests: m_blinkTimer = q->startTimer(flashTime / 2);
Executed by:
  • tst_qquickitem
  • tst_qquickitem2
  • tst_qquicktextinput
2112
4360 }
executed 2112 times by 3 tests: end of block
Executed by:
  • tst_qquickitem
  • tst_qquickitem2
  • tst_qquicktextinput
2112
4361-
4362 m_blinkStatus = 1;-
4363 updateType = UpdatePaintNode;-
4364 q->polish();-
4365 q->update();-
4366}
executed 2892 times by 4 tests: end of block
Executed by:
  • tst_examples
  • tst_qquickitem
  • tst_qquickitem2
  • tst_qquicktextinput
2892
4367-
4368void QQuickTextInput::timerEvent(QTimerEvent *event)-
4369{-
4370 Q_D(QQuickTextInput);-
4371 if (event->timerId() == d->m_blinkTimer) {
event->timerId...->m_blinkTimerDescription
TRUEevaluated 565 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEnever evaluated
0-565
4372 d->m_blinkStatus = !d->m_blinkStatus;-
4373 d->updateType = QQuickTextInputPrivate::UpdatePaintNode;-
4374 polish();-
4375 update();-
4376 } else if (event->timerId() == d->m_passwordEchoTimer.timerId()) {
executed 565 times by 1 test: end of block
Executed by:
  • tst_qquicktextinput
event->timerId...imer.timerId()Description
TRUEnever evaluated
FALSEnever evaluated
0-565
4377 d->m_passwordEchoTimer.stop();-
4378 d->updateDisplayText();-
4379 updateCursorRectangle();-
4380 }
never executed: end of block
0
4381}
executed 565 times by 1 test: end of block
Executed by:
  • tst_qquicktextinput
565
4382-
4383void QQuickTextInputPrivate::processKeyEvent(QKeyEvent* event)-
4384{-
4385 Q_Q(QQuickTextInput);-
4386-
4387 if (event->key() == Qt::Key_Enter || event->key() == Qt::Key_Return) {
event->key() == Qt::Key_EnterDescription
TRUEevaluated 10 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEevaluated 1966 times by 2 tests
Evaluated by:
  • tst_qquickitem2
  • tst_qquicktextinput
event->key() == Qt::Key_ReturnDescription
TRUEevaluated 2 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEevaluated 1964 times by 2 tests
Evaluated by:
  • tst_qquickitem2
  • tst_qquicktextinput
2-1966
4388 if (hasAcceptableInput(m_text) == AcceptableInput || fixup()) {
hasAcceptableI...cceptableInputDescription
TRUEevaluated 6 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEevaluated 6 times by 1 test
Evaluated by:
  • tst_qquicktextinput
fixup()Description
TRUEevaluated 2 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEevaluated 4 times by 1 test
Evaluated by:
  • tst_qquicktextinput
2-6
4389-
4390 QInputMethod *inputMethod = QGuiApplication::inputMethod();-
4391 inputMethod->commit();-
4392 if (!(q->inputMethodHints() & Qt::ImhMultiLine))
!(q->inputMeth...:ImhMultiLine)Description
TRUEevaluated 8 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEnever evaluated
0-8
4393 inputMethod->hide();
executed 8 times by 1 test: inputMethod->hide();
Executed by:
  • tst_qquicktextinput
8
4394-
4395 if (activeFocus) {
activeFocusDescription
TRUEevaluated 8 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEnever evaluated
0-8
4396 // If we lost focus after hiding the virtual keyboard, we've already emitted-
4397 // editingFinished from handleFocusEvent. Otherwise we emit it now.-
4398 emit q->editingFinished();-
4399 }
executed 8 times by 1 test: end of block
Executed by:
  • tst_qquicktextinput
8
4400-
4401 emit q->accepted();-
4402 }
executed 8 times by 1 test: end of block
Executed by:
  • tst_qquicktextinput
8
4403 event->ignore();-
4404 return;
executed 12 times by 1 test: return;
Executed by:
  • tst_qquicktextinput
12
4405 }-
4406-
4407 if (m_blinkEnabled)
m_blinkEnabledDescription
TRUEevaluated 1870 times by 2 tests
Evaluated by:
  • tst_qquickitem2
  • tst_qquicktextinput
FALSEevaluated 94 times by 2 tests
Evaluated by:
  • tst_qquickitem2
  • tst_qquicktextinput
94-1870
4408 updateCursorBlinking();
executed 1870 times by 2 tests: updateCursorBlinking();
Executed by:
  • tst_qquickitem2
  • tst_qquicktextinput
1870
4409-
4410 if (m_echoMode == QQuickTextInput::PasswordEchoOnEdit
m_echoMode == ...wordEchoOnEditDescription
TRUEevaluated 6 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEevaluated 1958 times by 2 tests
Evaluated by:
  • tst_qquickitem2
  • tst_qquicktextinput
6-1958
4411 && !m_passwordEchoEditing
!m_passwordEchoEditingDescription
TRUEevaluated 6 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEnever evaluated
0-6
4412 && !m_readOnly
!m_readOnlyDescription
TRUEevaluated 6 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEnever evaluated
0-6
4413 && !event->text().isEmpty()
!event->text().isEmpty()Description
TRUEevaluated 4 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEevaluated 2 times by 1 test
Evaluated by:
  • tst_qquicktextinput
2-4
4414 && !(event->modifiers() & Qt::ControlModifier)) {
!(event->modif...ntrolModifier)Description
TRUEevaluated 2 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEevaluated 2 times by 1 test
Evaluated by:
  • tst_qquicktextinput
2
4415 // Clear the edit and reset to normal echo mode while editing; the-
4416 // echo mode switches back when the edit loses focus-
4417 // ### resets current content. dubious code; you can-
4418 // navigate with keys up, down, back, and select(?), but if you press-
4419 // "left" or "right" it clears?-
4420 updatePasswordEchoEditing(true);-
4421 clear();-
4422 }
executed 2 times by 1 test: end of block
Executed by:
  • tst_qquicktextinput
2
4423-
4424 bool unknown = false;-
4425#if QT_CONFIG(shortcut)-
4426 bool visual = cursorMoveStyle() == Qt::VisualMoveStyle;-
4427#endif-
4428-
4429 if (false) {
dead code: { }
-
4430 }
dead code: { }
-
4431#if QT_CONFIG(shortcut)-
4432 else if (event == QKeySequence::Undo) {
event == QKeySequence::UndoDescription
TRUEevaluated 18 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEevaluated 1946 times by 2 tests
Evaluated by:
  • tst_qquickitem2
  • tst_qquicktextinput
18-1946
4433 q->undo();-
4434 }
executed 18 times by 1 test: end of block
Executed by:
  • tst_qquicktextinput
18
4435 else if (event == QKeySequence::Redo) {
event == QKeySequence::RedoDescription
TRUEevaluated 4 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEevaluated 1942 times by 2 tests
Evaluated by:
  • tst_qquickitem2
  • tst_qquicktextinput
4-1942
4436 q->redo();-
4437 }
executed 4 times by 1 test: end of block
Executed by:
  • tst_qquicktextinput
4
4438 else if (event == QKeySequence::SelectAll) {
event == QKeyS...nce::SelectAllDescription
TRUEevaluated 4 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEevaluated 1938 times by 2 tests
Evaluated by:
  • tst_qquickitem2
  • tst_qquicktextinput
4-1938
4439 selectAll();-
4440 }
executed 4 times by 1 test: end of block
Executed by:
  • tst_qquicktextinput
4
4441#if QT_CONFIG(clipboard)-
4442 else if (event == QKeySequence::Copy) {
event == QKeySequence::CopyDescription
TRUEevaluated 12 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEevaluated 1926 times by 2 tests
Evaluated by:
  • tst_qquickitem2
  • tst_qquicktextinput
12-1926
4443 copy();-
4444 }
executed 12 times by 1 test: end of block
Executed by:
  • tst_qquicktextinput
12
4445 else if (event == QKeySequence::Paste) {
event == QKeySequence::PasteDescription
TRUEevaluated 8 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEevaluated 1918 times by 2 tests
Evaluated by:
  • tst_qquickitem2
  • tst_qquicktextinput
8-1918
4446 if (!m_readOnly) {
!m_readOnlyDescription
TRUEevaluated 8 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEnever evaluated
0-8
4447 QClipboard::Mode mode = QClipboard::Clipboard;-
4448 paste(mode);-
4449 }
executed 8 times by 1 test: end of block
Executed by:
  • tst_qquicktextinput
8
4450 }
executed 8 times by 1 test: end of block
Executed by:
  • tst_qquicktextinput
8
4451 else if (event == QKeySequence::Cut) {
event == QKeySequence::CutDescription
TRUEevaluated 4 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEevaluated 1914 times by 2 tests
Evaluated by:
  • tst_qquickitem2
  • tst_qquicktextinput
4-1914
4452 q->cut();-
4453 }
executed 4 times by 1 test: end of block
Executed by:
  • tst_qquicktextinput
4
4454 else if (event == QKeySequence::DeleteEndOfLine) {
event == QKeyS...eleteEndOfLineDescription
TRUEevaluated 4 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEevaluated 1910 times by 2 tests
Evaluated by:
  • tst_qquickitem2
  • tst_qquicktextinput
4-1910
4455 if (!m_readOnly)
!m_readOnlyDescription
TRUEevaluated 4 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEnever evaluated
0-4
4456 deleteEndOfLine();
executed 4 times by 1 test: deleteEndOfLine();
Executed by:
  • tst_qquicktextinput
4
4457 }
executed 4 times by 1 test: end of block
Executed by:
  • tst_qquicktextinput
4
4458#endif // clipboard-
4459 else if (event == QKeySequence::MoveToStartOfLine || event == QKeySequence::MoveToStartOfBlock) {
event == QKeyS...eToStartOfLineDescription
TRUEevaluated 92 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEevaluated 1818 times by 2 tests
Evaluated by:
  • tst_qquickitem2
  • tst_qquicktextinput
event == QKeyS...ToStartOfBlockDescription
TRUEnever evaluated
FALSEevaluated 1818 times by 2 tests
Evaluated by:
  • tst_qquickitem2
  • tst_qquicktextinput
0-1818
4460 home(0);-
4461 }
executed 92 times by 1 test: end of block
Executed by:
  • tst_qquicktextinput
92
4462 else if (event == QKeySequence::MoveToEndOfLine || event == QKeySequence::MoveToEndOfBlock) {
event == QKeyS...oveToEndOfLineDescription
TRUEevaluated 2 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEevaluated 1816 times by 2 tests
Evaluated by:
  • tst_qquickitem2
  • tst_qquicktextinput
event == QKeyS...veToEndOfBlockDescription
TRUEnever evaluated
FALSEevaluated 1816 times by 2 tests
Evaluated by:
  • tst_qquickitem2
  • tst_qquicktextinput
0-1816
4463 end(0);-
4464 }
executed 2 times by 1 test: end of block
Executed by:
  • tst_qquicktextinput
2
4465 else if (event == QKeySequence::SelectStartOfLine || event == QKeySequence::SelectStartOfBlock) {
event == QKeyS...ectStartOfLineDescription
TRUEevaluated 6 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEevaluated 1810 times by 2 tests
Evaluated by:
  • tst_qquickitem2
  • tst_qquicktextinput
event == QKeyS...ctStartOfBlockDescription
TRUEnever evaluated
FALSEevaluated 1810 times by 2 tests
Evaluated by:
  • tst_qquickitem2
  • tst_qquicktextinput
0-1810
4466 home(1);-
4467 }
executed 6 times by 1 test: end of block
Executed by:
  • tst_qquicktextinput
6
4468 else if (event == QKeySequence::SelectEndOfLine || event == QKeySequence::SelectEndOfBlock) {
event == QKeyS...electEndOfLineDescription
TRUEevaluated 4 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEevaluated 1806 times by 2 tests
Evaluated by:
  • tst_qquickitem2
  • tst_qquicktextinput
event == QKeyS...lectEndOfBlockDescription
TRUEnever evaluated
FALSEevaluated 1806 times by 2 tests
Evaluated by:
  • tst_qquickitem2
  • tst_qquicktextinput
0-1806
4469 end(1);-
4470 }
executed 4 times by 1 test: end of block
Executed by:
  • tst_qquicktextinput
4
4471 else if (event == QKeySequence::MoveToNextChar) {
event == QKeyS...MoveToNextCharDescription
TRUEevaluated 16 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEevaluated 1790 times by 2 tests
Evaluated by:
  • tst_qquickitem2
  • tst_qquicktextinput
16-1790
4472 if (hasSelectedText()) {
hasSelectedText()Description
TRUEevaluated 4 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEevaluated 12 times by 1 test
Evaluated by:
  • tst_qquicktextinput
4-12
4473 moveCursor(selectionEnd(), false);-
4474 } else {
executed 4 times by 1 test: end of block
Executed by:
  • tst_qquicktextinput
4
4475 cursorForward(0, visual ? 1 : (layoutDirection() == Qt::LeftToRight ? 1 : -1));-
4476 }
executed 12 times by 1 test: end of block
Executed by:
  • tst_qquicktextinput
12
4477 }-
4478 else if (event == QKeySequence::SelectNextChar) {
event == QKeyS...SelectNextCharDescription
TRUEevaluated 16 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEevaluated 1774 times by 2 tests
Evaluated by:
  • tst_qquickitem2
  • tst_qquicktextinput
16-1774
4479 cursorForward(1, visual ? 1 : (layoutDirection() == Qt::LeftToRight ? 1 : -1));-
4480 }
executed 16 times by 1 test: end of block
Executed by:
  • tst_qquicktextinput
16
4481 else if (event == QKeySequence::MoveToPreviousChar) {
event == QKeyS...ToPreviousCharDescription
TRUEevaluated 18 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEevaluated 1756 times by 2 tests
Evaluated by:
  • tst_qquickitem2
  • tst_qquicktextinput
18-1756
4482 if (hasSelectedText()) {
hasSelectedText()Description
TRUEevaluated 2 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEevaluated 16 times by 1 test
Evaluated by:
  • tst_qquicktextinput
2-16
4483 moveCursor(selectionStart(), false);-
4484 } else {
executed 2 times by 1 test: end of block
Executed by:
  • tst_qquicktextinput
2
4485 cursorForward(0, visual ? -1 : (layoutDirection() == Qt::LeftToRight ? -1 : 1));-
4486 }
executed 16 times by 1 test: end of block
Executed by:
  • tst_qquicktextinput
16
4487 }-
4488 else if (event == QKeySequence::SelectPreviousChar) {
event == QKeyS...ctPreviousCharDescription
TRUEevaluated 16 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEevaluated 1740 times by 2 tests
Evaluated by:
  • tst_qquickitem2
  • tst_qquicktextinput
16-1740
4489 cursorForward(1, visual ? -1 : (layoutDirection() == Qt::LeftToRight ? -1 : 1));-
4490 }
executed 16 times by 1 test: end of block
Executed by:
  • tst_qquicktextinput
16
4491 else if (event == QKeySequence::MoveToNextWord) {
event == QKeyS...MoveToNextWordDescription
TRUEevaluated 8 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEevaluated 1732 times by 2 tests
Evaluated by:
  • tst_qquickitem2
  • tst_qquicktextinput
8-1732
4492 if (m_echoMode == QQuickTextInput::Normal)
m_echoMode == ...tInput::NormalDescription
TRUEevaluated 4 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEevaluated 4 times by 1 test
Evaluated by:
  • tst_qquicktextinput
4
4493 layoutDirection() == Qt::LeftToRight ? cursorWordForward(0) : cursorWordBackward(0);
executed 4 times by 1 test: layoutDirection() == Qt::LeftToRight ? cursorWordForward(0) : cursorWordBackward(0);
Executed by:
  • tst_qquicktextinput
4
4494 else-
4495 layoutDirection() == Qt::LeftToRight ? end(0) : home(0);
executed 4 times by 1 test: layoutDirection() == Qt::LeftToRight ? end(0) : home(0);
Executed by:
  • tst_qquicktextinput
4
4496 }-
4497 else if (event == QKeySequence::MoveToPreviousWord) {
event == QKeyS...ToPreviousWordDescription
TRUEevaluated 12 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEevaluated 1720 times by 2 tests
Evaluated by:
  • tst_qquickitem2
  • tst_qquicktextinput
12-1720
4498 if (m_echoMode == QQuickTextInput::Normal)
m_echoMode == ...tInput::NormalDescription
TRUEevaluated 8 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEevaluated 4 times by 1 test
Evaluated by:
  • tst_qquicktextinput
4-8
4499 layoutDirection() == Qt::LeftToRight ? cursorWordBackward(0) : cursorWordForward(0);
executed 8 times by 1 test: layoutDirection() == Qt::LeftToRight ? cursorWordBackward(0) : cursorWordForward(0);
Executed by:
  • tst_qquicktextinput
8
4500 else if (!m_readOnly) {
!m_readOnlyDescription
TRUEevaluated 4 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEnever evaluated
0-4
4501 layoutDirection() == Qt::LeftToRight ? home(0) : end(0);-
4502 }
executed 4 times by 1 test: end of block
Executed by:
  • tst_qquicktextinput
4
4503 }
executed 12 times by 1 test: end of block
Executed by:
  • tst_qquicktextinput
12
4504 else if (event == QKeySequence::SelectNextWord) {
event == QKeyS...SelectNextWordDescription
TRUEevaluated 2 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEevaluated 1718 times by 2 tests
Evaluated by:
  • tst_qquickitem2
  • tst_qquicktextinput
2-1718
4505 if (m_echoMode == QQuickTextInput::Normal)
m_echoMode == ...tInput::NormalDescription
TRUEevaluated 2 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEnever evaluated
0-2
4506 layoutDirection() == Qt::LeftToRight ? cursorWordForward(1) : cursorWordBackward(1);
executed 2 times by 1 test: layoutDirection() == Qt::LeftToRight ? cursorWordForward(1) : cursorWordBackward(1);
Executed by:
  • tst_qquicktextinput
2
4507 else-
4508 layoutDirection() == Qt::LeftToRight ? end(1) : home(1);
never executed: layoutDirection() == Qt::LeftToRight ? end(1) : home(1);
0
4509 }-
4510 else if (event == QKeySequence::SelectPreviousWord) {
event == QKeyS...ctPreviousWordDescription
TRUEevaluated 4 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEevaluated 1714 times by 2 tests
Evaluated by:
  • tst_qquickitem2
  • tst_qquicktextinput
4-1714
4511 if (m_echoMode == QQuickTextInput::Normal)
m_echoMode == ...tInput::NormalDescription
TRUEevaluated 4 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEnever evaluated
0-4
4512 layoutDirection() == Qt::LeftToRight ? cursorWordBackward(1) : cursorWordForward(1);
executed 4 times by 1 test: layoutDirection() == Qt::LeftToRight ? cursorWordBackward(1) : cursorWordForward(1);
Executed by:
  • tst_qquicktextinput
4
4513 else-
4514 layoutDirection() == Qt::LeftToRight ? home(1) : end(1);
never executed: layoutDirection() == Qt::LeftToRight ? home(1) : end(1);
0
4515 }-
4516 else if (event == QKeySequence::Delete) {
event == QKeySequence::DeleteDescription
TRUEevaluated 22 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEevaluated 1692 times by 2 tests
Evaluated by:
  • tst_qquickitem2
  • tst_qquicktextinput
22-1692
4517 if (!m_readOnly)
!m_readOnlyDescription
TRUEevaluated 22 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEnever evaluated
0-22
4518 del();
executed 22 times by 1 test: del();
Executed by:
  • tst_qquicktextinput
22
4519 }
executed 22 times by 1 test: end of block
Executed by:
  • tst_qquicktextinput
22
4520 else if (event == QKeySequence::DeleteEndOfWord) {
event == QKeyS...eleteEndOfWordDescription
TRUEevaluated 6 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEevaluated 1686 times by 2 tests
Evaluated by:
  • tst_qquickitem2
  • tst_qquicktextinput
6-1686
4521 if (!m_readOnly)
!m_readOnlyDescription
TRUEevaluated 6 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEnever evaluated
0-6
4522 deleteEndOfWord();
executed 6 times by 1 test: deleteEndOfWord();
Executed by:
  • tst_qquicktextinput
6
4523 }
executed 6 times by 1 test: end of block
Executed by:
  • tst_qquicktextinput
6
4524 else if (event == QKeySequence::DeleteStartOfWord) {
event == QKeyS...eteStartOfWordDescription
TRUEevaluated 6 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEevaluated 1680 times by 2 tests
Evaluated by:
  • tst_qquickitem2
  • tst_qquicktextinput
6-1680
4525 if (!m_readOnly)
!m_readOnlyDescription
TRUEevaluated 6 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEnever evaluated
0-6
4526 deleteStartOfWord();
executed 6 times by 1 test: deleteStartOfWord();
Executed by:
  • tst_qquicktextinput
6
4527 } else if (event == QKeySequence::DeleteCompleteLine) {
executed 6 times by 1 test: end of block
Executed by:
  • tst_qquicktextinput
event == QKeyS...teCompleteLineDescription
TRUEevaluated 2 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEevaluated 1678 times by 2 tests
Evaluated by:
  • tst_qquickitem2
  • tst_qquicktextinput
2-1678
4528 if (!m_readOnly) {
!m_readOnlyDescription
TRUEevaluated 2 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEnever evaluated
0-2
4529 selectAll();-
4530#if QT_CONFIG(clipboard)-
4531 copy();-
4532#endif-
4533 del();-
4534 }
executed 2 times by 1 test: end of block
Executed by:
  • tst_qquicktextinput
2
4535 }
executed 2 times by 1 test: end of block
Executed by:
  • tst_qquicktextinput
2
4536#endif // shortcut-
4537 else {-
4538 bool handled = false;-
4539 if (event->modifiers() & Qt::ControlModifier) {
event->modifie...ontrolModifierDescription
TRUEevaluated 52 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEevaluated 1626 times by 2 tests
Evaluated by:
  • tst_qquickitem2
  • tst_qquicktextinput
52-1626
4540 switch (event->key()) {-
4541 case Qt::Key_Backspace:
never executed: case Qt::Key_Backspace:
0
4542 if (!m_readOnly)
!m_readOnlyDescription
TRUEnever evaluated
FALSEnever evaluated
0
4543 deleteStartOfWord();
never executed: deleteStartOfWord();
0
4544 break;
never executed: break;
0
4545 default:
executed 52 times by 1 test: default:
Executed by:
  • tst_qquicktextinput
52
4546 if (!handled)
!handledDescription
TRUEevaluated 52 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEnever evaluated
0-52
4547 unknown = true;
executed 52 times by 1 test: unknown = true;
Executed by:
  • tst_qquicktextinput
52
4548 }
executed 52 times by 1 test: end of block
Executed by:
  • tst_qquicktextinput
52
4549 } else { // ### check for *no* modifier-
4550 switch (event->key()) {-
4551 case Qt::Key_Backspace:
executed 60 times by 1 test: case Qt::Key_Backspace:
Executed by:
  • tst_qquicktextinput
60
4552 if (!m_readOnly) {
!m_readOnlyDescription
TRUEevaluated 60 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEnever evaluated
0-60
4553 backspace();-
4554 }
executed 60 times by 1 test: end of block
Executed by:
  • tst_qquicktextinput
60
4555 break;
executed 60 times by 1 test: break;
Executed by:
  • tst_qquicktextinput
60
4556 default:
executed 1566 times by 2 tests: default:
Executed by:
  • tst_qquickitem2
  • tst_qquicktextinput
1566
4557 if (!handled)
!handledDescription
TRUEevaluated 1566 times by 2 tests
Evaluated by:
  • tst_qquickitem2
  • tst_qquicktextinput
FALSEnever evaluated
0-1566
4558 unknown = true;
executed 1566 times by 2 tests: unknown = true;
Executed by:
  • tst_qquickitem2
  • tst_qquicktextinput
1566
4559 }
executed 1566 times by 2 tests: end of block
Executed by:
  • tst_qquickitem2
  • tst_qquicktextinput
1566
4560 }-
4561 }-
4562-
4563 if (event->key() == Qt::Key_Direction_L || event->key() == Qt::Key_Direction_R) {
event->key() =...ey_Direction_LDescription
TRUEevaluated 44 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEevaluated 1920 times by 2 tests
Evaluated by:
  • tst_qquickitem2
  • tst_qquicktextinput
event->key() =...ey_Direction_RDescription
TRUEevaluated 14 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEevaluated 1906 times by 2 tests
Evaluated by:
  • tst_qquickitem2
  • tst_qquicktextinput
14-1920
4564 setLayoutDirection((event->key() == Qt::Key_Direction_L) ? Qt::LeftToRight : Qt::RightToLeft);-
4565 unknown = false;-
4566 }
executed 58 times by 1 test: end of block
Executed by:
  • tst_qquicktextinput
58
4567-
4568 if (unknown && !m_readOnly) {
unknownDescription
TRUEevaluated 1560 times by 2 tests
Evaluated by:
  • tst_qquickitem2
  • tst_qquicktextinput
FALSEevaluated 404 times by 1 test
Evaluated by:
  • tst_qquicktextinput
!m_readOnlyDescription
TRUEevaluated 1466 times by 2 tests
Evaluated by:
  • tst_qquickitem2
  • tst_qquicktextinput
FALSEevaluated 94 times by 2 tests
Evaluated by:
  • tst_qquickitem2
  • tst_qquicktextinput
94-1560
4569 if (m_inputControl->isAcceptableInput(event)) {
m_inputControl...leInput(event)Description
TRUEevaluated 1360 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEevaluated 106 times by 2 tests
Evaluated by:
  • tst_qquickitem2
  • tst_qquicktextinput
106-1360
4570 if (overwriteMode
overwriteModeDescription
TRUEevaluated 10 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEevaluated 1350 times by 1 test
Evaluated by:
  • tst_qquicktextinput
10-1350
4571 // no need to call del() if we have a selection, insert-
4572 // does it already-
4573 && !hasSelectedText()
!hasSelectedText()Description
TRUEevaluated 10 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEnever evaluated
0-10
4574 && !(m_cursor == q_func()->text().length())) {
!(m_cursor == ...xt().length())Description
TRUEevaluated 10 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEnever evaluated
0-10
4575 del();-
4576 }
executed 10 times by 1 test: end of block
Executed by:
  • tst_qquicktextinput
10
4577-
4578 insert(event->text());-
4579 event->accept();-
4580 return;
executed 1360 times by 1 test: return;
Executed by:
  • tst_qquicktextinput
1360
4581 }-
4582 }
executed 106 times by 2 tests: end of block
Executed by:
  • tst_qquickitem2
  • tst_qquicktextinput
106
4583-
4584 if (unknown)
unknownDescription
TRUEevaluated 200 times by 2 tests
Evaluated by:
  • tst_qquickitem2
  • tst_qquicktextinput
FALSEevaluated 404 times by 1 test
Evaluated by:
  • tst_qquicktextinput
200-404
4585 event->ignore();
executed 200 times by 2 tests: event->ignore();
Executed by:
  • tst_qquickitem2
  • tst_qquicktextinput
200
4586 else-
4587 event->accept();
executed 404 times by 1 test: event->accept();
Executed by:
  • tst_qquicktextinput
404
4588}-
4589-
4590/*!-
4591 \internal-
4592-
4593 Deletes the portion of the word before the current cursor position.-
4594*/-
4595-
4596void QQuickTextInputPrivate::deleteStartOfWord()-
4597{-
4598 int priorState = m_undoState;-
4599 Command cmd(SetSelection, m_cursor, 0, m_selstart, m_selend);-
4600 separate();-
4601 cursorWordBackward(true);-
4602 addCommand(cmd);-
4603 removeSelectedText();-
4604 finishChange(priorState);-
4605}
executed 6 times by 1 test: end of block
Executed by:
  • tst_qquicktextinput
6
4606-
4607/*!-
4608 \internal-
4609-
4610 Deletes the portion of the word after the current cursor position.-
4611*/-
4612-
4613void QQuickTextInputPrivate::deleteEndOfWord()-
4614{-
4615 int priorState = m_undoState;-
4616 Command cmd(SetSelection, m_cursor, 0, m_selstart, m_selend);-
4617 separate();-
4618 cursorWordForward(true);-
4619 // moveCursor (sometimes) calls separate() so we need to add the command after that so the-
4620 // cursor position and selection are restored in the same undo operation as the remove.-
4621 addCommand(cmd);-
4622 removeSelectedText();-
4623 finishChange(priorState);-
4624}
executed 6 times by 1 test: end of block
Executed by:
  • tst_qquicktextinput
6
4625-
4626/*!-
4627 \internal-
4628-
4629 Deletes all text from the cursor position to the end of the line.-
4630*/-
4631-
4632void QQuickTextInputPrivate::deleteEndOfLine()-
4633{-
4634 int priorState = m_undoState;-
4635 Command cmd(SetSelection, m_cursor, 0, m_selstart, m_selend);-
4636 separate();-
4637 setSelection(m_cursor, end());-
4638 addCommand(cmd);-
4639 removeSelectedText();-
4640 finishChange(priorState);-
4641}
executed 4 times by 1 test: end of block
Executed by:
  • tst_qquicktextinput
4
4642-
4643/*!-
4644 \qmlmethod QtQuick::TextInput::ensureVisible(int position)-
4645 \since 5.4-
4646-
4647 Scrolls the contents of the text input so that the specified character-
4648 \a position is visible inside the boundaries of the text input.-
4649-
4650 \sa autoScroll-
4651*/-
4652void QQuickTextInput::ensureVisible(int position)-
4653{-
4654 Q_D(QQuickTextInput);-
4655 d->ensureVisible(position);-
4656 updateCursorRectangle(false);-
4657}
executed 4 times by 1 test: end of block
Executed by:
  • tst_qquicktextinput
4
4658-
4659/*!-
4660 \qmlmethod QtQuick::TextInput::clear()-
4661 \since 5.7-
4662-
4663 Clears the contents of the text input-
4664 and resets partial text input from an input method.-
4665-
4666 Use this method instead of setting the \l text property to an empty string.-
4667-
4668 \sa QInputMethod::reset()-
4669*/-
4670void QQuickTextInput::clear()-
4671{-
4672 Q_D(QQuickTextInput);-
4673 d->resetInputMethod();-
4674 d->clear();-
4675}
executed 6 times by 1 test: end of block
Executed by:
  • tst_qquicktextinput
6
4676-
4677/*!-
4678 \since 5.6-
4679 \qmlproperty real QtQuick::TextInput::padding-
4680 \qmlproperty real QtQuick::TextInput::topPadding-
4681 \qmlproperty real QtQuick::TextInput::leftPadding-
4682 \qmlproperty real QtQuick::TextInput::bottomPadding-
4683 \qmlproperty real QtQuick::TextInput::rightPadding-
4684-
4685 These properties hold the padding around the content. This space is reserved-
4686 in addition to the contentWidth and contentHeight.-
4687*/-
4688qreal QQuickTextInput::padding() const-
4689{-
4690 Q_D(const QQuickTextInput);-
4691 return d->padding();
executed 4 times by 1 test: return d->padding();
Executed by:
  • tst_qquicktextinput
4
4692}-
4693-
4694void QQuickTextInput::setPadding(qreal padding)-
4695{-
4696 Q_D(QQuickTextInput);-
4697 if (qFuzzyCompare(d->padding(), padding))
qFuzzyCompare(...ng(), padding)Description
TRUEnever evaluated
FALSEevaluated 4 times by 1 test
Evaluated by:
  • tst_qquicktextinput
0-4
4698 return;
never executed: return;
0
4699-
4700 d->extra.value().padding = padding;-
4701 d->updateLayout();-
4702 emit paddingChanged();-
4703 if (!d->extra.isAllocated() || !d->extra->explicitTopPadding)
!d->extra.isAllocated()Description
TRUEnever evaluated
FALSEevaluated 4 times by 1 test
Evaluated by:
  • tst_qquicktextinput
!d->extra->explicitTopPaddingDescription
TRUEevaluated 2 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEevaluated 2 times by 1 test
Evaluated by:
  • tst_qquicktextinput
0-4
4704 emit topPaddingChanged();
executed 2 times by 1 test: topPaddingChanged();
Executed by:
  • tst_qquicktextinput
2
4705 if (!d->extra.isAllocated() || !d->extra->explicitLeftPadding)
!d->extra.isAllocated()Description
TRUEnever evaluated
FALSEevaluated 4 times by 1 test
Evaluated by:
  • tst_qquicktextinput
!d->extra->explicitLeftPaddingDescription
TRUEevaluated 2 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEevaluated 2 times by 1 test
Evaluated by:
  • tst_qquicktextinput
0-4
4706 emit leftPaddingChanged();
executed 2 times by 1 test: leftPaddingChanged();
Executed by:
  • tst_qquicktextinput
2
4707 if (!d->extra.isAllocated() || !d->extra->explicitRightPadding)
!d->extra.isAllocated()Description
TRUEnever evaluated
FALSEevaluated 4 times by 1 test
Evaluated by:
  • tst_qquicktextinput
!d->extra->exp...itRightPaddingDescription
TRUEevaluated 2 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEevaluated 2 times by 1 test
Evaluated by:
  • tst_qquicktextinput
0-4
4708 emit rightPaddingChanged();
executed 2 times by 1 test: rightPaddingChanged();
Executed by:
  • tst_qquicktextinput
2
4709 if (!d->extra.isAllocated() || !d->extra->explicitBottomPadding)
!d->extra.isAllocated()Description
TRUEnever evaluated
FALSEevaluated 4 times by 1 test
Evaluated by:
  • tst_qquicktextinput
!d->extra->exp...tBottomPaddingDescription
TRUEevaluated 2 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEevaluated 2 times by 1 test
Evaluated by:
  • tst_qquicktextinput
0-4
4710 emit bottomPaddingChanged();
executed 2 times by 1 test: bottomPaddingChanged();
Executed by:
  • tst_qquicktextinput
2
4711}
executed 4 times by 1 test: end of block
Executed by:
  • tst_qquicktextinput
4
4712-
4713void QQuickTextInput::resetPadding()-
4714{-
4715 setPadding(0);-
4716}
executed 2 times by 1 test: end of block
Executed by:
  • tst_qquicktextinput
2
4717-
4718qreal QQuickTextInput::topPadding() const-
4719{-
4720 Q_D(const QQuickTextInput);-
4721 if (d->extra.isAllocated() && d->extra->explicitTopPadding)
d->extra.isAllocated()Description
TRUEevaluated 434 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEevaluated 24248 times by 5 tests
Evaluated by:
  • tst_examples
  • tst_qquickitem
  • tst_qquickitem2
  • tst_qquicktextedit
  • tst_qquicktextinput
d->extra->explicitTopPaddingDescription
TRUEevaluated 356 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEevaluated 78 times by 1 test
Evaluated by:
  • tst_qquicktextinput
78-24248
4722 return d->extra->topPadding;
executed 356 times by 1 test: return d->extra->topPadding;
Executed by:
  • tst_qquicktextinput
356
4723 return d->padding();
executed 24326 times by 5 tests: return d->padding();
Executed by:
  • tst_examples
  • tst_qquickitem
  • tst_qquickitem2
  • tst_qquicktextedit
  • tst_qquicktextinput
24326
4724}-
4725-
4726void QQuickTextInput::setTopPadding(qreal padding)-
4727{-
4728 Q_D(QQuickTextInput);-
4729 d->setTopPadding(padding);-
4730}
executed 14 times by 1 test: end of block
Executed by:
  • tst_qquicktextinput
14
4731-
4732void QQuickTextInput::resetTopPadding()-
4733{-
4734 Q_D(QQuickTextInput);-
4735 d->setTopPadding(0, true);-
4736}
executed 2 times by 1 test: end of block
Executed by:
  • tst_qquicktextinput
2
4737-
4738qreal QQuickTextInput::leftPadding() const-
4739{-
4740 Q_D(const QQuickTextInput);-
4741 if (d->extra.isAllocated() && d->extra->explicitLeftPadding)
d->extra.isAllocated()Description
TRUEevaluated 242 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEevaluated 17434 times by 5 tests
Evaluated by:
  • tst_examples
  • tst_qquickitem
  • tst_qquickitem2
  • tst_qquicktextedit
  • tst_qquicktextinput
d->extra->explicitLeftPaddingDescription
TRUEevaluated 58 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEevaluated 184 times by 1 test
Evaluated by:
  • tst_qquicktextinput
58-17434
4742 return d->extra->leftPadding;
executed 58 times by 1 test: return d->extra->leftPadding;
Executed by:
  • tst_qquicktextinput
58
4743 return d->padding();
executed 17618 times by 5 tests: return d->padding();
Executed by:
  • tst_examples
  • tst_qquickitem
  • tst_qquickitem2
  • tst_qquicktextedit
  • tst_qquicktextinput
17618
4744}-
4745-
4746void QQuickTextInput::setLeftPadding(qreal padding)-
4747{-
4748 Q_D(QQuickTextInput);-
4749 d->setLeftPadding(padding);-
4750}
executed 4 times by 1 test: end of block
Executed by:
  • tst_qquicktextinput
4
4751-
4752void QQuickTextInput::resetLeftPadding()-
4753{-
4754 Q_D(QQuickTextInput);-
4755 d->setLeftPadding(0, true);-
4756}
executed 2 times by 1 test: end of block
Executed by:
  • tst_qquicktextinput
2
4757-
4758qreal QQuickTextInput::rightPadding() const-
4759{-
4760 Q_D(const QQuickTextInput);-
4761 if (d->extra.isAllocated() && d->extra->explicitRightPadding)
d->extra.isAllocated()Description
TRUEevaluated 240 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEevaluated 14345 times by 5 tests
Evaluated by:
  • tst_examples
  • tst_qquickitem
  • tst_qquickitem2
  • tst_qquicktextedit
  • tst_qquicktextinput
d->extra->explicitRightPaddingDescription
TRUEevaluated 60 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEevaluated 180 times by 1 test
Evaluated by:
  • tst_qquicktextinput
60-14345
4762 return d->extra->rightPadding;
executed 60 times by 1 test: return d->extra->rightPadding;
Executed by:
  • tst_qquicktextinput
60
4763 return d->padding();
executed 14525 times by 5 tests: return d->padding();
Executed by:
  • tst_examples
  • tst_qquickitem
  • tst_qquickitem2
  • tst_qquicktextedit
  • tst_qquicktextinput
14525
4764}-
4765-
4766void QQuickTextInput::setRightPadding(qreal padding)-
4767{-
4768 Q_D(QQuickTextInput);-
4769 d->setRightPadding(padding);-
4770}
executed 4 times by 1 test: end of block
Executed by:
  • tst_qquicktextinput
4
4771-
4772void QQuickTextInput::resetRightPadding()-
4773{-
4774 Q_D(QQuickTextInput);-
4775 d->setRightPadding(0, true);-
4776}
executed 2 times by 1 test: end of block
Executed by:
  • tst_qquicktextinput
2
4777-
4778qreal QQuickTextInput::bottomPadding() const-
4779{-
4780 Q_D(const QQuickTextInput);-
4781 if (d->extra.isAllocated() && d->extra->explicitBottomPadding)
d->extra.isAllocated()Description
TRUEevaluated 308 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEevaluated 15165 times by 5 tests
Evaluated by:
  • tst_examples
  • tst_qquickitem
  • tst_qquickitem2
  • tst_qquicktextedit
  • tst_qquicktextinput
d->extra->expl...tBottomPaddingDescription
TRUEevaluated 280 times by 1 test
Evaluated by:
  • tst_qquicktextinput
FALSEevaluated 28 times by 1 test
Evaluated by:
  • tst_qquicktextinput
28-15165
4782 return d->extra->bottomPadding;
executed 280 times by 1 test: return d->extra->bottomPadding;
Executed by:
  • tst_qquicktextinput
280
4783 return d->padding();
executed 15193 times by 5 tests: return d->padding();
Executed by:
  • tst_examples
  • tst_qquickitem
  • tst_qquickitem2
  • tst_qquicktextedit
  • tst_qquicktextinput
15193
4784}-
4785-
4786void QQuickTextInput::setBottomPadding(qreal padding)-
4787{-
4788 Q_D(QQuickTextInput);-
4789 d->setBottomPadding(padding);-
4790}
executed 14 times by 1 test: end of block
Executed by:
  • tst_qquicktextinput
14
4791-
4792void QQuickTextInput::resetBottomPadding()-
4793{-
4794 Q_D(QQuickTextInput);-
4795 d->setBottomPadding(0, true);-
4796}
executed 2 times by 1 test: end of block
Executed by:
  • tst_qquicktextinput
2
4797-
4798QT_END_NAMESPACE-
4799-
4800#include "moc_qquicktextinput_p.cpp"-
Source codeSwitch to Preprocessed file

Generated by Squish Coco 4.2.0