OpenCoverage

qquicktextcontrol.cpp

Absolute File Name:/home/opencoverage/opencoverage/guest-scripts/qtdeclarative/src/qtdeclarative/src/quick/items/qquicktextcontrol.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 QtGui module of the Qt Toolkit.-
7**-
8** $QT_BEGIN_LICENSE:LGPL$-
9** Commercial License Usage-
10** Licensees holding valid commercial Qt licenses may use this file in-
11** accordance with the commercial license agreement provided with the-
12** Software or, alternatively, in accordance with the terms contained in-
13** a written agreement between you and 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 "qquicktextcontrol_p.h"-
41#include "qquicktextcontrol_p_p.h"-
42-
43#ifndef QT_NO_TEXTCONTROL-
44-
45#include <qcoreapplication.h>-
46#include <qfont.h>-
47#include <qfontmetrics.h>-
48#include <qevent.h>-
49#include <qdebug.h>-
50#include <qclipboard.h>-
51#include <qtimer.h>-
52#include <qinputmethod.h>-
53#include "private/qtextdocumentlayout_p.h"-
54#include "private/qabstracttextdocumentlayout_p.h"-
55#include "qtextdocument.h"-
56#include "private/qtextdocument_p.h"-
57#include "qtextlist.h"-
58#include "qtextdocumentwriter.h"-
59#include "private/qtextcursor_p.h"-
60#include <QtCore/qloggingcategory.h>-
61-
62#include <qtextformat.h>-
63#include <qdatetime.h>-
64#include <qbuffer.h>-
65#include <qguiapplication.h>-
66#include <limits.h>-
67#include <qtexttable.h>-
68#include <qvariant.h>-
69#include <qurl.h>-
70#include <qstylehints.h>-
71#include <qmetaobject.h>-
72-
73#include <private/qqmlglobal_p.h>-
74-
75// ### these should come from QStyleHints-
76const int textCursorWidth = 1;-
77-
78QT_BEGIN_NAMESPACE-
79Q_DECLARE_LOGGING_CATEGORY(DBG_HOVER_TRACE)-
80-
81// could go into QTextCursor...-
82static QTextLine currentTextLine(const QTextCursor &cursor)-
83{-
84 const QTextBlock block = cursor.block();-
85 if (!block.isValid())
!block.isValid()Description
TRUEnever evaluated
FALSEevaluated 232 times by 1 test
Evaluated by:
  • tst_qquicktextedit
0-232
86 return QTextLine();
never executed: return QTextLine();
0
87-
88 const QTextLayout *layout = block.layout();-
89 if (!layout)
!layoutDescription
TRUEnever evaluated
FALSEevaluated 232 times by 1 test
Evaluated by:
  • tst_qquicktextedit
0-232
90 return QTextLine();
never executed: return QTextLine();
0
91-
92 const int relativePos = cursor.position() - block.position();-
93 return layout->lineForTextPosition(relativePos);
executed 232 times by 1 test: return layout->lineForTextPosition(relativePos);
Executed by:
  • tst_qquicktextedit
232
94}-
95-
96QQuickTextControlPrivate::QQuickTextControlPrivate()-
97 : doc(nullptr),-
98#if QT_CONFIG(im)-
99 preeditCursor(0),-
100#endif-
101 interactionFlags(Qt::TextEditorInteraction),-
102 cursorOn(false),-
103 cursorIsFocusIndicator(false),-
104 mousePressed(false),-
105 lastSelectionState(false),-
106 ignoreAutomaticScrollbarAdjustement(false),-
107 overwriteMode(false),-
108 acceptRichText(true),-
109 cursorVisible(false),-
110 cursorBlinkingEnabled(false),-
111 hasFocus(false),-
112 hadSelectionOnMousePress(false),-
113 wordSelectionEnabled(false),-
114 hasImState(false),-
115 cursorRectangleChanged(false),-
116 lastSelectionStart(-1),-
117 lastSelectionEnd(-1)-
118{}
executed 1080 times by 6 tests: end of block
Executed by:
  • tst_examples
  • tst_qquickfocusscope
  • tst_qquickitem2
  • tst_qquicktextdocument
  • tst_qquicktextedit
  • tst_qquicktextinput
1080
119-
120bool QQuickTextControlPrivate::cursorMoveKeyEvent(QKeyEvent *e)-
121{-
122#if !QT_CONFIG(shortcut)-
123 Q_UNUSED(e);-
124#endif-
125-
126 Q_Q(QQuickTextControl);-
127 if (cursor.isNull())
cursor.isNull()Description
TRUEnever evaluated
FALSEevaluated 890 times by 3 tests
Evaluated by:
  • tst_qquickfocusscope
  • tst_qquickitem2
  • tst_qquicktextedit
0-890
128 return false;
never executed: return false;
0
129-
130 const QTextCursor oldSelection = cursor;-
131 const int oldCursorPos = cursor.position();-
132-
133 QTextCursor::MoveMode mode = QTextCursor::MoveAnchor;-
134 QTextCursor::MoveOperation op = QTextCursor::NoMove;-
135-
136 if (false) {
dead code: { }
-
137 }
dead code: { }
-
138#if QT_CONFIG(shortcut)-
139 if (e == QKeySequence::MoveToNextChar) {
e == QKeySeque...MoveToNextCharDescription
TRUEevaluated 28 times by 2 tests
Evaluated by:
  • tst_qquickfocusscope
  • tst_qquicktextedit
FALSEevaluated 862 times by 2 tests
Evaluated by:
  • tst_qquickitem2
  • tst_qquicktextedit
28-862
140 op = QTextCursor::Right;-
141 }
executed 28 times by 2 tests: end of block
Executed by:
  • tst_qquickfocusscope
  • tst_qquicktextedit
28
142 else if (e == QKeySequence::MoveToPreviousChar) {
e == QKeySeque...ToPreviousCharDescription
TRUEevaluated 26 times by 1 test
Evaluated by:
  • tst_qquicktextedit
FALSEevaluated 836 times by 2 tests
Evaluated by:
  • tst_qquickitem2
  • tst_qquicktextedit
26-836
143 op = QTextCursor::Left;-
144 }
executed 26 times by 1 test: end of block
Executed by:
  • tst_qquicktextedit
26
145 else if (e == QKeySequence::SelectNextChar) {
e == QKeySeque...SelectNextCharDescription
TRUEevaluated 22 times by 1 test
Evaluated by:
  • tst_qquicktextedit
FALSEevaluated 814 times by 2 tests
Evaluated by:
  • tst_qquickitem2
  • tst_qquicktextedit
22-814
146 op = QTextCursor::Right;-
147 mode = QTextCursor::KeepAnchor;-
148 }
executed 22 times by 1 test: end of block
Executed by:
  • tst_qquicktextedit
22
149 else if (e == QKeySequence::SelectPreviousChar) {
e == QKeySeque...ctPreviousCharDescription
TRUEevaluated 26 times by 1 test
Evaluated by:
  • tst_qquicktextedit
FALSEevaluated 788 times by 2 tests
Evaluated by:
  • tst_qquickitem2
  • tst_qquicktextedit
26-788
150 op = QTextCursor::Left;-
151 mode = QTextCursor::KeepAnchor;-
152 }
executed 26 times by 1 test: end of block
Executed by:
  • tst_qquicktextedit
26
153 else if (e == QKeySequence::SelectNextWord) {
e == QKeySeque...SelectNextWordDescription
TRUEevaluated 6 times by 1 test
Evaluated by:
  • tst_qquicktextedit
FALSEevaluated 782 times by 2 tests
Evaluated by:
  • tst_qquickitem2
  • tst_qquicktextedit
6-782
154 op = QTextCursor::WordRight;-
155 mode = QTextCursor::KeepAnchor;-
156 }
executed 6 times by 1 test: end of block
Executed by:
  • tst_qquicktextedit
6
157 else if (e == QKeySequence::SelectPreviousWord) {
e == QKeySeque...ctPreviousWordDescription
TRUEevaluated 6 times by 1 test
Evaluated by:
  • tst_qquicktextedit
FALSEevaluated 776 times by 2 tests
Evaluated by:
  • tst_qquickitem2
  • tst_qquicktextedit
6-776
158 op = QTextCursor::WordLeft;-
159 mode = QTextCursor::KeepAnchor;-
160 }
executed 6 times by 1 test: end of block
Executed by:
  • tst_qquicktextedit
6
161 else if (e == QKeySequence::SelectStartOfLine) {
e == QKeySeque...ectStartOfLineDescription
TRUEevaluated 6 times by 1 test
Evaluated by:
  • tst_qquicktextedit
FALSEevaluated 770 times by 2 tests
Evaluated by:
  • tst_qquickitem2
  • tst_qquicktextedit
6-770
162 op = QTextCursor::StartOfLine;-
163 mode = QTextCursor::KeepAnchor;-
164 }
executed 6 times by 1 test: end of block
Executed by:
  • tst_qquicktextedit
6
165 else if (e == QKeySequence::SelectEndOfLine) {
e == QKeySeque...electEndOfLineDescription
TRUEevaluated 4 times by 1 test
Evaluated by:
  • tst_qquicktextedit
FALSEevaluated 766 times by 2 tests
Evaluated by:
  • tst_qquickitem2
  • tst_qquicktextedit
4-766
166 op = QTextCursor::EndOfLine;-
167 mode = QTextCursor::KeepAnchor;-
168 }
executed 4 times by 1 test: end of block
Executed by:
  • tst_qquicktextedit
4
169 else if (e == QKeySequence::SelectStartOfBlock) {
e == QKeySeque...ctStartOfBlockDescription
TRUEnever evaluated
FALSEevaluated 766 times by 2 tests
Evaluated by:
  • tst_qquickitem2
  • tst_qquicktextedit
0-766
170 op = QTextCursor::StartOfBlock;-
171 mode = QTextCursor::KeepAnchor;-
172 }
never executed: end of block
0
173 else if (e == QKeySequence::SelectEndOfBlock) {
e == QKeySeque...lectEndOfBlockDescription
TRUEnever evaluated
FALSEevaluated 766 times by 2 tests
Evaluated by:
  • tst_qquickitem2
  • tst_qquicktextedit
0-766
174 op = QTextCursor::EndOfBlock;-
175 mode = QTextCursor::KeepAnchor;-
176 }
never executed: end of block
0
177 else if (e == QKeySequence::SelectStartOfDocument) {
e == QKeySeque...tartOfDocumentDescription
TRUEnever evaluated
FALSEevaluated 766 times by 2 tests
Evaluated by:
  • tst_qquickitem2
  • tst_qquicktextedit
0-766
178 op = QTextCursor::Start;-
179 mode = QTextCursor::KeepAnchor;-
180 }
never executed: end of block
0
181 else if (e == QKeySequence::SelectEndOfDocument) {
e == QKeySeque...tEndOfDocumentDescription
TRUEevaluated 2 times by 1 test
Evaluated by:
  • tst_qquicktextedit
FALSEevaluated 764 times by 2 tests
Evaluated by:
  • tst_qquickitem2
  • tst_qquicktextedit
2-764
182 op = QTextCursor::End;-
183 mode = QTextCursor::KeepAnchor;-
184 }
executed 2 times by 1 test: end of block
Executed by:
  • tst_qquicktextedit
2
185 else if (e == QKeySequence::SelectPreviousLine) {
e == QKeySeque...ctPreviousLineDescription
TRUEnever evaluated
FALSEevaluated 764 times by 2 tests
Evaluated by:
  • tst_qquickitem2
  • tst_qquicktextedit
0-764
186 op = QTextCursor::Up;-
187 mode = QTextCursor::KeepAnchor;-
188 }
never executed: end of block
0
189 else if (e == QKeySequence::SelectNextLine) {
e == QKeySeque...SelectNextLineDescription
TRUEnever evaluated
FALSEevaluated 764 times by 2 tests
Evaluated by:
  • tst_qquickitem2
  • tst_qquicktextedit
0-764
190 op = QTextCursor::Down;-
191 mode = QTextCursor::KeepAnchor;-
192 {-
193 QTextBlock block = cursor.block();-
194 QTextLine line = currentTextLine(cursor);-
195 if (!block.next().isValid()
!block.next().isValid()Description
TRUEnever evaluated
FALSEnever evaluated
0
196 && line.isValid()
line.isValid()Description
TRUEnever evaluated
FALSEnever evaluated
0
197 && line.lineNumber() == block.layout()->lineCount() - 1)
line.lineNumbe...ineCount() - 1Description
TRUEnever evaluated
FALSEnever evaluated
0
198 op = QTextCursor::End;
never executed: op = QTextCursor::End;
0
199 }-
200 }
never executed: end of block
0
201 else if (e == QKeySequence::MoveToNextWord) {
e == QKeySeque...MoveToNextWordDescription
TRUEevaluated 4 times by 1 test
Evaluated by:
  • tst_qquicktextedit
FALSEevaluated 760 times by 2 tests
Evaluated by:
  • tst_qquickitem2
  • tst_qquicktextedit
4-760
202 op = QTextCursor::WordRight;-
203 }
executed 4 times by 1 test: end of block
Executed by:
  • tst_qquicktextedit
4
204 else if (e == QKeySequence::MoveToPreviousWord) {
e == QKeySeque...ToPreviousWordDescription
TRUEevaluated 4 times by 1 test
Evaluated by:
  • tst_qquicktextedit
FALSEevaluated 756 times by 2 tests
Evaluated by:
  • tst_qquickitem2
  • tst_qquicktextedit
4-756
205 op = QTextCursor::WordLeft;-
206 }
executed 4 times by 1 test: end of block
Executed by:
  • tst_qquicktextedit
4
207 else if (e == QKeySequence::MoveToEndOfBlock) {
e == QKeySeque...veToEndOfBlockDescription
TRUEnever evaluated
FALSEevaluated 756 times by 2 tests
Evaluated by:
  • tst_qquickitem2
  • tst_qquicktextedit
0-756
208 op = QTextCursor::EndOfBlock;-
209 }
never executed: end of block
0
210 else if (e == QKeySequence::MoveToStartOfBlock) {
e == QKeySeque...ToStartOfBlockDescription
TRUEnever evaluated
FALSEevaluated 756 times by 2 tests
Evaluated by:
  • tst_qquickitem2
  • tst_qquicktextedit
0-756
211 op = QTextCursor::StartOfBlock;-
212 }
never executed: end of block
0
213 else if (e == QKeySequence::MoveToNextLine) {
e == QKeySeque...MoveToNextLineDescription
TRUEnever evaluated
FALSEevaluated 756 times by 2 tests
Evaluated by:
  • tst_qquickitem2
  • tst_qquicktextedit
0-756
214 op = QTextCursor::Down;-
215 }
never executed: end of block
0
216 else if (e == QKeySequence::MoveToPreviousLine) {
e == QKeySeque...ToPreviousLineDescription
TRUEnever evaluated
FALSEevaluated 756 times by 2 tests
Evaluated by:
  • tst_qquickitem2
  • tst_qquicktextedit
0-756
217 op = QTextCursor::Up;-
218 }
never executed: end of block
0
219 else if (e == QKeySequence::MoveToStartOfLine) {
e == QKeySeque...eToStartOfLineDescription
TRUEevaluated 10 times by 1 test
Evaluated by:
  • tst_qquicktextedit
FALSEevaluated 746 times by 2 tests
Evaluated by:
  • tst_qquickitem2
  • tst_qquicktextedit
10-746
220 op = QTextCursor::StartOfLine;-
221 }
executed 10 times by 1 test: end of block
Executed by:
  • tst_qquicktextedit
10
222 else if (e == QKeySequence::MoveToEndOfLine) {
e == QKeySeque...oveToEndOfLineDescription
TRUEevaluated 2 times by 1 test
Evaluated by:
  • tst_qquicktextedit
FALSEevaluated 744 times by 2 tests
Evaluated by:
  • tst_qquickitem2
  • tst_qquicktextedit
2-744
223 op = QTextCursor::EndOfLine;-
224 }
executed 2 times by 1 test: end of block
Executed by:
  • tst_qquicktextedit
2
225 else if (e == QKeySequence::MoveToStartOfDocument) {
e == QKeySeque...tartOfDocumentDescription
TRUEnever evaluated
FALSEevaluated 744 times by 2 tests
Evaluated by:
  • tst_qquickitem2
  • tst_qquicktextedit
0-744
226 op = QTextCursor::Start;-
227 }
never executed: end of block
0
228 else if (e == QKeySequence::MoveToEndOfDocument) {
e == QKeySeque...oEndOfDocumentDescription
TRUEnever evaluated
FALSEevaluated 744 times by 2 tests
Evaluated by:
  • tst_qquickitem2
  • tst_qquicktextedit
0-744
229 op = QTextCursor::End;-
230 }
never executed: end of block
0
231#endif // shortcut-
232 else {-
233 return false;
executed 744 times by 2 tests: return false;
Executed by:
  • tst_qquickitem2
  • tst_qquicktextedit
744
234 }-
235-
236// Except for pageup and pagedown, OS X has very different behavior, we don't do it all, but-
237// here's the breakdown:-
238// Shift still works as an anchor, but only one of the other keys can be down Ctrl (Command),-
239// Alt (Option), or Meta (Control).-
240// Command/Control + Left/Right -- Move to left or right of the line-
241// + Up/Down -- Move to top bottom of the file. (Control doesn't move the cursor)-
242// Option + Left/Right -- Move one word Left/right.-
243// + Up/Down -- Begin/End of Paragraph.-
244// Home/End Top/Bottom of file. (usually don't move the cursor, but will select)-
245-
246 bool visualNavigation = cursor.visualNavigation();-
247 cursor.setVisualNavigation(true);-
248 const bool moved = cursor.movePosition(op, mode);-
249 cursor.setVisualNavigation(visualNavigation);-
250-
251 bool isNavigationEvent-
252 = e->key() == Qt::Key_Up
e->key() == Qt::Key_UpDescription
TRUEnever evaluated
FALSEevaluated 146 times by 2 tests
Evaluated by:
  • tst_qquickfocusscope
  • tst_qquicktextedit
0-146
253 || e->key() == Qt::Key_Down
e->key() == Qt::Key_DownDescription
TRUEnever evaluated
FALSEevaluated 146 times by 2 tests
Evaluated by:
  • tst_qquickfocusscope
  • tst_qquicktextedit
0-146
254 || e->key() == Qt::Key_Left
e->key() == Qt::Key_LeftDescription
TRUEevaluated 46 times by 1 test
Evaluated by:
  • tst_qquicktextedit
FALSEevaluated 100 times by 2 tests
Evaluated by:
  • tst_qquickfocusscope
  • tst_qquicktextedit
46-100
255 || e->key() == Qt::Key_Right;
e->key() == Qt::Key_RightDescription
TRUEevaluated 48 times by 2 tests
Evaluated by:
  • tst_qquickfocusscope
  • tst_qquicktextedit
FALSEevaluated 52 times by 1 test
Evaluated by:
  • tst_qquicktextedit
48-52
256-
257 if (moved) {
movedDescription
TRUEevaluated 128 times by 2 tests
Evaluated by:
  • tst_qquickfocusscope
  • tst_qquicktextedit
FALSEevaluated 18 times by 2 tests
Evaluated by:
  • tst_qquickfocusscope
  • tst_qquicktextedit
18-128
258 if (cursor.position() != oldCursorPos)
cursor.positio...= oldCursorPosDescription
TRUEevaluated 128 times by 2 tests
Evaluated by:
  • tst_qquickfocusscope
  • tst_qquicktextedit
FALSEnever evaluated
0-128
259 emit q->cursorPositionChanged();
executed 128 times by 2 tests: q->cursorPositionChanged();
Executed by:
  • tst_qquickfocusscope
  • tst_qquicktextedit
128
260 q->updateCursorRectangle(true);-
261 } else if (isNavigationEvent && oldSelection.anchor() == cursor.anchor()) {
executed 128 times by 2 tests: end of block
Executed by:
  • tst_qquickfocusscope
  • tst_qquicktextedit
isNavigationEventDescription
TRUEevaluated 18 times by 2 tests
Evaluated by:
  • tst_qquickfocusscope
  • tst_qquicktextedit
FALSEnever evaluated
oldSelection.a...ursor.anchor()Description
TRUEevaluated 14 times by 2 tests
Evaluated by:
  • tst_qquickfocusscope
  • tst_qquicktextedit
FALSEevaluated 4 times by 1 test
Evaluated by:
  • tst_qquicktextedit
0-128
262 return false;
executed 14 times by 2 tests: return false;
Executed by:
  • tst_qquickfocusscope
  • tst_qquicktextedit
14
263 }-
264-
265 selectionChanged(/*forceEmitSelectionChanged =*/(mode == QTextCursor::KeepAnchor));-
266-
267 repaintOldAndNewSelection(oldSelection);-
268-
269 return true;
executed 132 times by 2 tests: return true;
Executed by:
  • tst_qquickfocusscope
  • tst_qquicktextedit
132
270}-
271-
272void QQuickTextControlPrivate::updateCurrentCharFormat()-
273{-
274 Q_Q(QQuickTextControl);-
275-
276 QTextCharFormat fmt = cursor.charFormat();-
277 if (fmt == lastCharFormat)
fmt == lastCharFormatDescription
TRUEevaluated 7560 times by 6 tests
Evaluated by:
  • tst_examples
  • tst_qquickfocusscope
  • tst_qquickitem2
  • tst_qquicktextdocument
  • tst_qquicktextedit
  • tst_qquicktextinput
FALSEevaluated 10 times by 1 test
Evaluated by:
  • tst_qquicktextedit
10-7560
278 return;
executed 7560 times by 6 tests: return;
Executed by:
  • tst_examples
  • tst_qquickfocusscope
  • tst_qquickitem2
  • tst_qquicktextdocument
  • tst_qquicktextedit
  • tst_qquicktextinput
7560
279 lastCharFormat = fmt;-
280-
281 emit q->currentCharFormatChanged(fmt);-
282 cursorRectangleChanged = true;-
283}
executed 10 times by 1 test: end of block
Executed by:
  • tst_qquicktextedit
10
284-
285void QQuickTextControlPrivate::setContent(Qt::TextFormat format, const QString &text)-
286{-
287 Q_Q(QQuickTextControl);-
288-
289#if QT_CONFIG(im)-
290 cancelPreedit();-
291#endif-
292-
293 // for use when called from setPlainText. we may want to re-use the currently-
294 // set char format then.-
295 const QTextCharFormat charFormatForInsertion = cursor.charFormat();-
296-
297 bool previousUndoRedoState = doc->isUndoRedoEnabled();-
298 doc->setUndoRedoEnabled(false);-
299-
300 const int oldCursorPos = cursor.position();-
301-
302 // avoid multiple textChanged() signals being emitted-
303 qmlobject_disconnect(doc, QTextDocument, SIGNAL(contentsChanged()), q, QQuickTextControl, SIGNAL(textChanged()));
executed 10 times by 5 tests: end of block
Executed by:
  • tst_examples
  • tst_qquickfocusscope
  • tst_qquickitem2
  • tst_qquicktextdocument
  • tst_qquicktextedit
never executed: methodIdx = QQuickTextControl::staticMetaObject.indexOfSlot(method+1);
executed 10 times by 5 tests: methodIdx = QQuickTextControl::staticMetaObject.indexOfSignal(method+1);
Executed by:
  • tst_examples
  • tst_qquickfocusscope
  • tst_qquickitem2
  • tst_qquicktextdocument
  • tst_qquicktextedit
signalIdx < 0Description
TRUEevaluated 10 times by 5 tests
Evaluated by:
  • tst_examples
  • tst_qquickfocusscope
  • tst_qquickitem2
  • tst_qquicktextdocument
  • tst_qquicktextedit
FALSEevaluated 1058 times by 4 tests
Evaluated by:
  • tst_examples
  • tst_qquickfocusscope
  • tst_qquickitem2
  • tst_qquicktextedit
methodIdx < 0Description
TRUEevaluated 10 times by 5 tests
Evaluated by:
  • tst_examples
  • tst_qquickfocusscope
  • tst_qquickitem2
  • tst_qquicktextdocument
  • tst_qquicktextedit
FALSEevaluated 1058 times by 4 tests
Evaluated by:
  • tst_examples
  • tst_qquickfocusscope
  • tst_qquickitem2
  • tst_qquicktextedit
code == 1Description
TRUEnever evaluated
FALSEevaluated 10 times by 5 tests
Evaluated by:
  • tst_examples
  • tst_qquickfocusscope
  • tst_qquickitem2
  • tst_qquicktextdocument
  • tst_qquicktextedit
0-1058
304-
305 if (!text.isEmpty()) {
!text.isEmpty()Description
TRUEevaluated 1044 times by 5 tests
Evaluated by:
  • tst_examples
  • tst_qquickfocusscope
  • tst_qquickitem2
  • tst_qquicktextdocument
  • tst_qquicktextedit
FALSEevaluated 24 times by 1 test
Evaluated by:
  • tst_qquicktextedit
24-1044
306 // clear 'our' cursor for insertion to prevent-
307 // the emission of the cursorPositionChanged() signal.-
308 // instead we emit it only once at the end instead of-
309 // at the end of the document after loading and when-
310 // positioning the cursor again to the start of the-
311 // document.-
312 cursor = QTextCursor();-
313 if (format == Qt::PlainText) {
format == Qt::PlainTextDescription
TRUEevaluated 950 times by 5 tests
Evaluated by:
  • tst_examples
  • tst_qquickfocusscope
  • tst_qquickitem2
  • tst_qquicktextdocument
  • tst_qquicktextedit
FALSEevaluated 94 times by 3 tests
Evaluated by:
  • tst_examples
  • tst_qquickitem2
  • tst_qquicktextedit
94-950
314 QTextCursor formatCursor(doc);-
315 // put the setPlainText and the setCharFormat into one edit block,-
316 // so that the syntax highlight triggers only /once/ for the entire-
317 // document, not twice.-
318 formatCursor.beginEditBlock();-
319 doc->setPlainText(text);-
320 doc->setUndoRedoEnabled(false);-
321 formatCursor.select(QTextCursor::Document);-
322 formatCursor.setCharFormat(charFormatForInsertion);-
323 formatCursor.endEditBlock();-
324 } else {
executed 950 times by 5 tests: end of block
Executed by:
  • tst_examples
  • tst_qquickfocusscope
  • tst_qquickitem2
  • tst_qquicktextdocument
  • tst_qquicktextedit
950
325#if QT_CONFIG(texthtmlparser)-
326 doc->setHtml(text);-
327#else-
328 doc->setPlainText(text);-
329#endif-
330 doc->setUndoRedoEnabled(false);-
331 }
executed 94 times by 3 tests: end of block
Executed by:
  • tst_examples
  • tst_qquickitem2
  • tst_qquicktextedit
94
332 cursor = QTextCursor(doc);-
333 } else {
executed 1044 times by 5 tests: end of block
Executed by:
  • tst_examples
  • tst_qquickfocusscope
  • tst_qquickitem2
  • tst_qquicktextdocument
  • tst_qquicktextedit
1044
334 doc->clear();-
335 }
executed 24 times by 1 test: end of block
Executed by:
  • tst_qquicktextedit
24
336 cursor.setCharFormat(charFormatForInsertion);-
337-
338 qmlobject_connect(doc, QTextDocument, SIGNAL(contentsChanged()), q, QQuickTextControl, SIGNAL(textChanged()));
executed 10 times by 5 tests: end of block
Executed by:
  • tst_examples
  • tst_qquickfocusscope
  • tst_qquickitem2
  • tst_qquicktextdocument
  • tst_qquicktextedit
never executed: methodIdx = QQuickTextControl::staticMetaObject.indexOfSlot(method+1);
executed 10 times by 5 tests: methodIdx = QQuickTextControl::staticMetaObject.indexOfSignal(method+1);
Executed by:
  • tst_examples
  • tst_qquickfocusscope
  • tst_qquickitem2
  • tst_qquicktextdocument
  • tst_qquicktextedit
signalIdx < 0Description
TRUEevaluated 10 times by 5 tests
Evaluated by:
  • tst_examples
  • tst_qquickfocusscope
  • tst_qquickitem2
  • tst_qquicktextdocument
  • tst_qquicktextedit
FALSEevaluated 1058 times by 4 tests
Evaluated by:
  • tst_examples
  • tst_qquickfocusscope
  • tst_qquickitem2
  • tst_qquicktextedit
methodIdx < 0Description
TRUEevaluated 10 times by 5 tests
Evaluated by:
  • tst_examples
  • tst_qquickfocusscope
  • tst_qquickitem2
  • tst_qquicktextdocument
  • tst_qquicktextedit
FALSEevaluated 1058 times by 4 tests
Evaluated by:
  • tst_examples
  • tst_qquickfocusscope
  • tst_qquickitem2
  • tst_qquicktextedit
code == 1Description
TRUEnever evaluated
FALSEevaluated 10 times by 5 tests
Evaluated by:
  • tst_examples
  • tst_qquickfocusscope
  • tst_qquickitem2
  • tst_qquicktextdocument
  • tst_qquicktextedit
0-1058
339 emit q->textChanged();-
340 doc->setUndoRedoEnabled(previousUndoRedoState);-
341 _q_updateCurrentCharFormatAndSelection();-
342 doc->setModified(false);-
343-
344 q->updateCursorRectangle(true);-
345 if (cursor.position() != oldCursorPos)
cursor.positio...= oldCursorPosDescription
TRUEevaluated 20 times by 1 test
Evaluated by:
  • tst_qquicktextedit
FALSEevaluated 1048 times by 5 tests
Evaluated by:
  • tst_examples
  • tst_qquickfocusscope
  • tst_qquickitem2
  • tst_qquicktextdocument
  • tst_qquicktextedit
20-1048
346 emit q->cursorPositionChanged();
executed 20 times by 1 test: q->cursorPositionChanged();
Executed by:
  • tst_qquicktextedit
20
347}
executed 1068 times by 5 tests: end of block
Executed by:
  • tst_examples
  • tst_qquickfocusscope
  • tst_qquickitem2
  • tst_qquicktextdocument
  • tst_qquicktextedit
1068
348-
349void QQuickTextControlPrivate::setCursorPosition(const QPointF &pos)-
350{-
351 Q_Q(QQuickTextControl);-
352 const int cursorPos = q->hitTest(pos, Qt::FuzzyHit);-
353 if (cursorPos == -1)
cursorPos == -1Description
TRUEnever evaluated
FALSEevaluated 106 times by 1 test
Evaluated by:
  • tst_qquicktextedit
0-106
354 return;
never executed: return;
0
355 cursor.setPosition(cursorPos);-
356}
executed 106 times by 1 test: end of block
Executed by:
  • tst_qquicktextedit
106
357-
358void QQuickTextControlPrivate::setCursorPosition(int pos, QTextCursor::MoveMode mode)-
359{-
360 cursor.setPosition(pos, mode);-
361-
362 if (mode != QTextCursor::KeepAnchor) {
mode != QTextC...or::KeepAnchorDescription
TRUEevaluated 332 times by 1 test
Evaluated by:
  • tst_qquicktextedit
FALSEevaluated 132 times by 1 test
Evaluated by:
  • tst_qquicktextedit
132-332
363 selectedWordOnDoubleClick = QTextCursor();-
364 selectedBlockOnTripleClick = QTextCursor();-
365 }
executed 332 times by 1 test: end of block
Executed by:
  • tst_qquicktextedit
332
366}
executed 464 times by 1 test: end of block
Executed by:
  • tst_qquicktextedit
464
367-
368void QQuickTextControlPrivate::repaintCursor()-
369{-
370 Q_Q(QQuickTextControl);-
371 emit q->updateCursorRequest();-
372}
executed 2022 times by 6 tests: end of block
Executed by:
  • tst_examples
  • tst_qquickfocusscope
  • tst_qquickitem2
  • tst_qquicktextdocument
  • tst_qquicktextedit
  • tst_qquicktextinput
2022
373-
374void QQuickTextControlPrivate::repaintOldAndNewSelection(const QTextCursor &oldSelection)-
375{-
376 Q_Q(QQuickTextControl);-
377 if (cursor.hasSelection()
cursor.hasSelection()Description
TRUEevaluated 1376 times by 1 test
Evaluated by:
  • tst_qquicktextedit
FALSEevaluated 2266 times by 3 tests
Evaluated by:
  • tst_qquickfocusscope
  • tst_qquickitem2
  • tst_qquicktextedit
1376-2266
378 && oldSelection.hasSelection()
oldSelection.hasSelection()Description
TRUEevaluated 808 times by 1 test
Evaluated by:
  • tst_qquicktextedit
FALSEevaluated 568 times by 1 test
Evaluated by:
  • tst_qquicktextedit
568-808
379 && cursor.currentFrame() == oldSelection.currentFrame()
cursor.current...currentFrame()Description
TRUEevaluated 808 times by 1 test
Evaluated by:
  • tst_qquicktextedit
FALSEnever evaluated
0-808
380 && !cursor.hasComplexSelection()
!cursor.hasComplexSelection()Description
TRUEevaluated 808 times by 1 test
Evaluated by:
  • tst_qquicktextedit
FALSEnever evaluated
0-808
381 && !oldSelection.hasComplexSelection()
!oldSelection....lexSelection()Description
TRUEevaluated 808 times by 1 test
Evaluated by:
  • tst_qquicktextedit
FALSEnever evaluated
0-808
382 && cursor.anchor() == oldSelection.anchor()
cursor.anchor(...ction.anchor()Description
TRUEevaluated 652 times by 1 test
Evaluated by:
  • tst_qquicktextedit
FALSEevaluated 156 times by 1 test
Evaluated by:
  • tst_qquicktextedit
156-652
383 ) {-
384 QTextCursor differenceSelection(doc);-
385 differenceSelection.setPosition(oldSelection.position());-
386 differenceSelection.setPosition(cursor.position(), QTextCursor::KeepAnchor);-
387 emit q->updateRequest();-
388 } else {
executed 652 times by 1 test: end of block
Executed by:
  • tst_qquicktextedit
652
389 if (!oldSelection.hasSelection() && !cursor.hasSelection()) {
!oldSelection.hasSelection()Description
TRUEevaluated 2646 times by 3 tests
Evaluated by:
  • tst_qquickfocusscope
  • tst_qquickitem2
  • tst_qquicktextedit
FALSEevaluated 344 times by 1 test
Evaluated by:
  • tst_qquicktextedit
!cursor.hasSelection()Description
TRUEevaluated 2078 times by 3 tests
Evaluated by:
  • tst_qquickfocusscope
  • tst_qquickitem2
  • tst_qquicktextedit
FALSEevaluated 568 times by 1 test
Evaluated by:
  • tst_qquicktextedit
344-2646
390 if (!oldSelection.isNull())
!oldSelection.isNull()Description
TRUEevaluated 1142 times by 3 tests
Evaluated by:
  • tst_qquickfocusscope
  • tst_qquickitem2
  • tst_qquicktextedit
FALSEevaluated 936 times by 3 tests
Evaluated by:
  • tst_qquickfocusscope
  • tst_qquickitem2
  • tst_qquicktextedit
936-1142
391 emit q->updateCursorRequest();
executed 1142 times by 3 tests: q->updateCursorRequest();
Executed by:
  • tst_qquickfocusscope
  • tst_qquickitem2
  • tst_qquicktextedit
1142
392 emit q->updateCursorRequest();-
393-
394 } else {
executed 2078 times by 3 tests: end of block
Executed by:
  • tst_qquickfocusscope
  • tst_qquickitem2
  • tst_qquicktextedit
2078
395 if (!oldSelection.isNull())
!oldSelection.isNull()Description
TRUEevaluated 886 times by 1 test
Evaluated by:
  • tst_qquicktextedit
FALSEevaluated 26 times by 1 test
Evaluated by:
  • tst_qquicktextedit
26-886
396 emit q->updateRequest();
executed 886 times by 1 test: q->updateRequest();
Executed by:
  • tst_qquicktextedit
886
397 emit q->updateRequest();-
398 }
executed 912 times by 1 test: end of block
Executed by:
  • tst_qquicktextedit
912
399 }-
400}-
401-
402void QQuickTextControlPrivate::selectionChanged(bool forceEmitSelectionChanged /*=false*/)-
403{-
404 Q_Q(QQuickTextControl);-
405 if (forceEmitSelectionChanged) {
forceEmitSelectionChangedDescription
TRUEevaluated 792 times by 1 test
Evaluated by:
  • tst_qquicktextedit
FALSEevaluated 7852 times by 6 tests
Evaluated by:
  • tst_examples
  • tst_qquickfocusscope
  • tst_qquickitem2
  • tst_qquicktextdocument
  • tst_qquicktextedit
  • tst_qquicktextinput
792-7852
406#if QT_CONFIG(im)-
407 if (hasFocus)
hasFocusDescription
TRUEevaluated 770 times by 1 test
Evaluated by:
  • tst_qquicktextedit
FALSEevaluated 22 times by 1 test
Evaluated by:
  • tst_qquicktextedit
22-770
408 qGuiApp->inputMethod()->update(Qt::ImCurrentSelection);
executed 770 times by 1 test: (static_cast<QGuiApplication *>(QCoreApplication::instance()))->inputMethod()->update(Qt::ImCurrentSelection);
Executed by:
  • tst_qquicktextedit
770
409#endif-
410 emit q->selectionChanged();-
411 }
executed 792 times by 1 test: end of block
Executed by:
  • tst_qquicktextedit
792
412-
413 bool current = cursor.hasSelection();-
414 int selectionStart = cursor.selectionStart();-
415 int selectionEnd = cursor.selectionEnd();-
416 if (current == lastSelectionState && (!current || (selectionStart == lastSelectionStart && selectionEnd == lastSelectionEnd)))
current == lastSelectionStateDescription
TRUEevaluated 7890 times by 6 tests
Evaluated by:
  • tst_examples
  • tst_qquickfocusscope
  • tst_qquickitem2
  • tst_qquicktextdocument
  • tst_qquicktextedit
  • tst_qquicktextinput
FALSEevaluated 754 times by 1 test
Evaluated by:
  • tst_qquicktextedit
!currentDescription
TRUEevaluated 6622 times by 6 tests
Evaluated by:
  • tst_examples
  • tst_qquickfocusscope
  • tst_qquickitem2
  • tst_qquicktextdocument
  • tst_qquicktextedit
  • tst_qquicktextinput
FALSEevaluated 1268 times by 1 test
Evaluated by:
  • tst_qquicktextedit
selectionStart...SelectionStartDescription
TRUEevaluated 1084 times by 1 test
Evaluated by:
  • tst_qquicktextedit
FALSEevaluated 184 times by 1 test
Evaluated by:
  • tst_qquicktextedit
selectionEnd =...stSelectionEndDescription
TRUEevaluated 862 times by 1 test
Evaluated by:
  • tst_qquicktextedit
FALSEevaluated 222 times by 1 test
Evaluated by:
  • tst_qquicktextedit
184-7890
417 return;
executed 7484 times by 6 tests: return;
Executed by:
  • tst_examples
  • tst_qquickfocusscope
  • tst_qquickitem2
  • tst_qquicktextdocument
  • tst_qquicktextedit
  • tst_qquicktextinput
7484
418-
419 if (lastSelectionState != current) {
lastSelectionState != currentDescription
TRUEevaluated 754 times by 1 test
Evaluated by:
  • tst_qquicktextedit
FALSEevaluated 406 times by 1 test
Evaluated by:
  • tst_qquicktextedit
406-754
420 lastSelectionState = current;-
421 emit q->copyAvailable(current);-
422 }
executed 754 times by 1 test: end of block
Executed by:
  • tst_qquicktextedit
754
423-
424 lastSelectionStart = selectionStart;-
425 lastSelectionEnd = selectionEnd;-
426-
427 if (!forceEmitSelectionChanged) {
!forceEmitSelectionChangedDescription
TRUEevaluated 976 times by 1 test
Evaluated by:
  • tst_qquicktextedit
FALSEevaluated 184 times by 1 test
Evaluated by:
  • tst_qquicktextedit
184-976
428#if QT_CONFIG(im)-
429 if (hasFocus)
hasFocusDescription
TRUEevaluated 422 times by 1 test
Evaluated by:
  • tst_qquicktextedit
FALSEevaluated 554 times by 1 test
Evaluated by:
  • tst_qquicktextedit
422-554
430 qGuiApp->inputMethod()->update(Qt::ImCurrentSelection);
executed 422 times by 1 test: (static_cast<QGuiApplication *>(QCoreApplication::instance()))->inputMethod()->update(Qt::ImCurrentSelection);
Executed by:
  • tst_qquicktextedit
422
431#endif-
432 emit q->selectionChanged();-
433 }
executed 976 times by 1 test: end of block
Executed by:
  • tst_qquicktextedit
976
434 q->updateCursorRectangle(true);-
435}
executed 1160 times by 1 test: end of block
Executed by:
  • tst_qquicktextedit
1160
436-
437void QQuickTextControlPrivate::_q_updateCurrentCharFormatAndSelection()-
438{-
439 updateCurrentCharFormat();-
440 selectionChanged();-
441}
executed 6768 times by 6 tests: end of block
Executed by:
  • tst_examples
  • tst_qquickfocusscope
  • tst_qquickitem2
  • tst_qquicktextdocument
  • tst_qquicktextedit
  • tst_qquicktextinput
6768
442-
443#if QT_CONFIG(clipboard)-
444void QQuickTextControlPrivate::setClipboardSelection()-
445{-
446 QClipboard *clipboard = QGuiApplication::clipboard();-
447 if (!cursor.hasSelection() || !clipboard->supportsSelection())
!cursor.hasSelection()Description
TRUEevaluated 872 times by 2 tests
Evaluated by:
  • tst_qquickfocusscope
  • tst_qquicktextedit
FALSEevaluated 604 times by 1 test
Evaluated by:
  • tst_qquicktextedit
!clipboard->su...rtsSelection()Description
TRUEnever evaluated
FALSEevaluated 604 times by 1 test
Evaluated by:
  • tst_qquicktextedit
0-872
448 return;
executed 872 times by 2 tests: return;
Executed by:
  • tst_qquickfocusscope
  • tst_qquicktextedit
872
449 Q_Q(QQuickTextControl);-
450 QMimeData *data = q->createMimeDataFromSelection();-
451 clipboard->setMimeData(data, QClipboard::Selection);-
452}
executed 604 times by 1 test: end of block
Executed by:
  • tst_qquicktextedit
604
453#endif-
454-
455void QQuickTextControlPrivate::_q_updateCursorPosChanged(const QTextCursor &someCursor)-
456{-
457 Q_Q(QQuickTextControl);-
458 if (someCursor.isCopyOf(cursor)) {
someCursor.isCopyOf(cursor)Description
TRUEevaluated 1042 times by 1 test
Evaluated by:
  • tst_qquicktextedit
FALSEevaluated 1056 times by 5 tests
Evaluated by:
  • tst_examples
  • tst_qquickfocusscope
  • tst_qquickitem2
  • tst_qquicktextdocument
  • tst_qquicktextedit
1042-1056
459 emit q->cursorPositionChanged();-
460 q->updateCursorRectangle(true);-
461 }
executed 1042 times by 1 test: end of block
Executed by:
  • tst_qquicktextedit
1042
462}
executed 2098 times by 5 tests: end of block
Executed by:
  • tst_examples
  • tst_qquickfocusscope
  • tst_qquickitem2
  • tst_qquicktextdocument
  • tst_qquicktextedit
2098
463-
464void QQuickTextControlPrivate::setBlinkingCursorEnabled(bool enable)-
465{-
466 if (cursorBlinkingEnabled == enable)
cursorBlinking...bled == enableDescription
TRUEevaluated 454 times by 3 tests
Evaluated by:
  • tst_qquickfocusscope
  • tst_qquickitem2
  • tst_qquicktextedit
FALSEevaluated 490 times by 4 tests
Evaluated by:
  • tst_examples
  • tst_qquickfocusscope
  • tst_qquickitem2
  • tst_qquicktextedit
454-490
467 return;
executed 454 times by 3 tests: return;
Executed by:
  • tst_qquickfocusscope
  • tst_qquickitem2
  • tst_qquicktextedit
454
468-
469 cursorBlinkingEnabled = enable;-
470 updateCursorFlashTime();-
471-
472 if (enable)
enableDescription
TRUEevaluated 378 times by 4 tests
Evaluated by:
  • tst_examples
  • tst_qquickfocusscope
  • tst_qquickitem2
  • tst_qquicktextedit
FALSEevaluated 112 times by 3 tests
Evaluated by:
  • tst_qquickfocusscope
  • tst_qquickitem2
  • tst_qquicktextedit
112-378
473 connect(qApp->styleHints(), &QStyleHints::cursorFlashTimeChanged, this, &QQuickTextControlPrivate::updateCursorFlashTime);
executed 378 times by 4 tests: connect((static_cast<QGuiApplication *>(QCoreApplication::instance()))->styleHints(), &QStyleHints::cursorFlashTimeChanged, this, &QQuickTextControlPrivate::updateCursorFlashTime);
Executed by:
  • tst_examples
  • tst_qquickfocusscope
  • tst_qquickitem2
  • tst_qquicktextedit
378
474 else-
475 disconnect(qApp->styleHints(), &QStyleHints::cursorFlashTimeChanged, this, &QQuickTextControlPrivate::updateCursorFlashTime);
executed 112 times by 3 tests: disconnect((static_cast<QGuiApplication *>(QCoreApplication::instance()))->styleHints(), &QStyleHints::cursorFlashTimeChanged, this, &QQuickTextControlPrivate::updateCursorFlashTime);
Executed by:
  • tst_qquickfocusscope
  • tst_qquickitem2
  • tst_qquicktextedit
112
476}-
477-
478void QQuickTextControlPrivate::updateCursorFlashTime()-
479{-
480 // Note: cursorOn represents the current blinking state controlled by a timer, and-
481 // should not be confused with cursorVisible or cursorBlinkingEnabled. However, we-
482 // interpretate a cursorFlashTime of 0 to mean "always on, never blink".-
483 cursorOn = true;-
484 int flashTime = QGuiApplication::styleHints()->cursorFlashTime();-
485-
486 if (cursorBlinkingEnabled && flashTime >= 2)
cursorBlinkingEnabledDescription
TRUEevaluated 378 times by 4 tests
Evaluated by:
  • tst_examples
  • tst_qquickfocusscope
  • tst_qquickitem2
  • tst_qquicktextedit
FALSEevaluated 112 times by 3 tests
Evaluated by:
  • tst_qquickfocusscope
  • tst_qquickitem2
  • tst_qquicktextedit
flashTime >= 2Description
TRUEevaluated 378 times by 4 tests
Evaluated by:
  • tst_examples
  • tst_qquickfocusscope
  • tst_qquickitem2
  • tst_qquicktextedit
FALSEnever evaluated
0-378
487 cursorBlinkTimer.start(flashTime / 2, q_func());
executed 378 times by 4 tests: cursorBlinkTimer.start(flashTime / 2, q_func());
Executed by:
  • tst_examples
  • tst_qquickfocusscope
  • tst_qquickitem2
  • tst_qquicktextedit
378
488 else-
489 cursorBlinkTimer.stop();
executed 112 times by 3 tests: cursorBlinkTimer.stop();
Executed by:
  • tst_qquickfocusscope
  • tst_qquickitem2
  • tst_qquicktextedit
112
490-
491 repaintCursor();-
492}
executed 490 times by 4 tests: end of block
Executed by:
  • tst_examples
  • tst_qquickfocusscope
  • tst_qquickitem2
  • tst_qquicktextedit
490
493-
494void QQuickTextControlPrivate::extendWordwiseSelection(int suggestedNewPosition, qreal mouseXPosition)-
495{-
496 Q_Q(QQuickTextControl);-
497-
498 // if inside the initial selected word keep that-
499 if (suggestedNewPosition >= selectedWordOnDoubleClick.selectionStart()
suggestedNewPo...lectionStart()Description
TRUEevaluated 50 times by 1 test
Evaluated by:
  • tst_qquicktextedit
FALSEevaluated 32 times by 1 test
Evaluated by:
  • tst_qquicktextedit
32-50
500 && suggestedNewPosition <= selectedWordOnDoubleClick.selectionEnd()) {
suggestedNewPo...selectionEnd()Description
TRUEevaluated 18 times by 1 test
Evaluated by:
  • tst_qquicktextedit
FALSEevaluated 32 times by 1 test
Evaluated by:
  • tst_qquicktextedit
18-32
501 q->setTextCursor(selectedWordOnDoubleClick);-
502 return;
executed 18 times by 1 test: return;
Executed by:
  • tst_qquicktextedit
18
503 }-
504-
505 QTextCursor curs = selectedWordOnDoubleClick;-
506 curs.setPosition(suggestedNewPosition, QTextCursor::KeepAnchor);-
507-
508 if (!curs.movePosition(QTextCursor::StartOfWord))
!curs.movePosi...::StartOfWord)Description
TRUEnever evaluated
FALSEevaluated 64 times by 1 test
Evaluated by:
  • tst_qquicktextedit
0-64
509 return;
never executed: return;
0
510 const int wordStartPos = curs.position();-
511-
512 const int blockPos = curs.block().position();-
513 const QPointF blockCoordinates = q->blockBoundingRect(curs.block()).topLeft();-
514-
515 QTextLine line = currentTextLine(curs);-
516 if (!line.isValid())
!line.isValid()Description
TRUEnever evaluated
FALSEevaluated 64 times by 1 test
Evaluated by:
  • tst_qquicktextedit
0-64
517 return;
never executed: return;
0
518-
519 const qreal wordStartX = line.cursorToX(curs.position() - blockPos) + blockCoordinates.x();-
520-
521 if (!curs.movePosition(QTextCursor::EndOfWord))
!curs.movePosi...or::EndOfWord)Description
TRUEnever evaluated
FALSEevaluated 64 times by 1 test
Evaluated by:
  • tst_qquicktextedit
0-64
522 return;
never executed: return;
0
523 const int wordEndPos = curs.position();-
524-
525 const QTextLine otherLine = currentTextLine(curs);-
526 if (otherLine.textStart() != line.textStart()
otherLine.text...ne.textStart()Description
TRUEnever evaluated
FALSEevaluated 64 times by 1 test
Evaluated by:
  • tst_qquicktextedit
0-64
527 || wordEndPos == wordStartPos)
wordEndPos == wordStartPosDescription
TRUEnever evaluated
FALSEevaluated 64 times by 1 test
Evaluated by:
  • tst_qquicktextedit
0-64
528 return;
never executed: return;
0
529-
530 const qreal wordEndX = line.cursorToX(curs.position() - blockPos) + blockCoordinates.x();-
531-
532 if (!wordSelectionEnabled && (mouseXPosition < wordStartX || mouseXPosition > wordEndX))
!wordSelectionEnabledDescription
TRUEevaluated 32 times by 1 test
Evaluated by:
  • tst_qquicktextedit
FALSEevaluated 32 times by 1 test
Evaluated by:
  • tst_qquicktextedit
mouseXPosition < wordStartXDescription
TRUEnever evaluated
FALSEevaluated 32 times by 1 test
Evaluated by:
  • tst_qquicktextedit
mouseXPosition > wordEndXDescription
TRUEnever evaluated
FALSEevaluated 32 times by 1 test
Evaluated by:
  • tst_qquicktextedit
0-32
533 return;
never executed: return;
0
534-
535 if (suggestedNewPosition < selectedWordOnDoubleClick.position()) {
suggestedNewPo...ick.position()Description
TRUEevaluated 32 times by 1 test
Evaluated by:
  • tst_qquicktextedit
FALSEevaluated 32 times by 1 test
Evaluated by:
  • tst_qquicktextedit
32
536 cursor.setPosition(selectedWordOnDoubleClick.selectionEnd());-
537 setCursorPosition(wordStartPos, QTextCursor::KeepAnchor);-
538 } else {
executed 32 times by 1 test: end of block
Executed by:
  • tst_qquicktextedit
32
539 cursor.setPosition(selectedWordOnDoubleClick.selectionStart());-
540 setCursorPosition(wordEndPos, QTextCursor::KeepAnchor);-
541 }
executed 32 times by 1 test: end of block
Executed by:
  • tst_qquicktextedit
32
542-
543 if (interactionFlags & Qt::TextSelectableByMouse) {
interactionFla...ectableByMouseDescription
TRUEevaluated 64 times by 1 test
Evaluated by:
  • tst_qquicktextedit
FALSEnever evaluated
0-64
544#if QT_CONFIG(clipboard)-
545 setClipboardSelection();-
546#endif-
547 selectionChanged(true);-
548 }
executed 64 times by 1 test: end of block
Executed by:
  • tst_qquicktextedit
64
549}
executed 64 times by 1 test: end of block
Executed by:
  • tst_qquicktextedit
64
550-
551void QQuickTextControlPrivate::extendBlockwiseSelection(int suggestedNewPosition)-
552{-
553 Q_Q(QQuickTextControl);-
554-
555 // if inside the initial selected line keep that-
556 if (suggestedNewPosition >= selectedBlockOnTripleClick.selectionStart()
suggestedNewPo...lectionStart()Description
TRUEevaluated 56 times by 1 test
Evaluated by:
  • tst_qquicktextedit
FALSEevaluated 12 times by 1 test
Evaluated by:
  • tst_qquicktextedit
12-56
557 && suggestedNewPosition <= selectedBlockOnTripleClick.selectionEnd()) {
suggestedNewPo...selectionEnd()Description
TRUEevaluated 36 times by 1 test
Evaluated by:
  • tst_qquicktextedit
FALSEevaluated 20 times by 1 test
Evaluated by:
  • tst_qquicktextedit
20-36
558 q->setTextCursor(selectedBlockOnTripleClick);-
559 return;
executed 36 times by 1 test: return;
Executed by:
  • tst_qquicktextedit
36
560 }-
561-
562 if (suggestedNewPosition < selectedBlockOnTripleClick.position()) {
suggestedNewPo...ick.position()Description
TRUEevaluated 12 times by 1 test
Evaluated by:
  • tst_qquicktextedit
FALSEevaluated 20 times by 1 test
Evaluated by:
  • tst_qquicktextedit
12-20
563 cursor.setPosition(selectedBlockOnTripleClick.selectionEnd());-
564 cursor.setPosition(suggestedNewPosition, QTextCursor::KeepAnchor);-
565 cursor.movePosition(QTextCursor::StartOfBlock, QTextCursor::KeepAnchor);-
566 } else {
executed 12 times by 1 test: end of block
Executed by:
  • tst_qquicktextedit
12
567 cursor.setPosition(selectedBlockOnTripleClick.selectionStart());-
568 cursor.setPosition(suggestedNewPosition, QTextCursor::KeepAnchor);-
569 cursor.movePosition(QTextCursor::EndOfBlock, QTextCursor::KeepAnchor);-
570 cursor.movePosition(QTextCursor::NextCharacter, QTextCursor::KeepAnchor);-
571 }
executed 20 times by 1 test: end of block
Executed by:
  • tst_qquicktextedit
20
572-
573 if (interactionFlags & Qt::TextSelectableByMouse) {
interactionFla...ectableByMouseDescription
TRUEevaluated 32 times by 1 test
Evaluated by:
  • tst_qquicktextedit
FALSEnever evaluated
0-32
574#if QT_CONFIG(clipboard)-
575 setClipboardSelection();-
576#endif-
577 selectionChanged(true);-
578 }
executed 32 times by 1 test: end of block
Executed by:
  • tst_qquicktextedit
32
579}
executed 32 times by 1 test: end of block
Executed by:
  • tst_qquicktextedit
32
580-
581void QQuickTextControl::undo()-
582{-
583 Q_D(QQuickTextControl);-
584 d->repaintSelection();-
585 const int oldCursorPos = d->cursor.position();-
586 d->doc->undo(&d->cursor);-
587 if (d->cursor.position() != oldCursorPos)
d->cursor.posi...= oldCursorPosDescription
TRUEevaluated 88 times by 1 test
Evaluated by:
  • tst_qquicktextedit
FALSEevaluated 24 times by 1 test
Evaluated by:
  • tst_qquicktextedit
24-88
588 emit cursorPositionChanged();
executed 88 times by 1 test: cursorPositionChanged();
Executed by:
  • tst_qquicktextedit
88
589 updateCursorRectangle(true);-
590}
executed 112 times by 1 test: end of block
Executed by:
  • tst_qquicktextedit
112
591-
592void QQuickTextControl::redo()-
593{-
594 Q_D(QQuickTextControl);-
595 d->repaintSelection();-
596 const int oldCursorPos = d->cursor.position();-
597 d->doc->redo(&d->cursor);-
598 if (d->cursor.position() != oldCursorPos)
d->cursor.posi...= oldCursorPosDescription
TRUEevaluated 6 times by 1 test
Evaluated by:
  • tst_qquicktextedit
FALSEevaluated 2 times by 1 test
Evaluated by:
  • tst_qquicktextedit
2-6
599 emit cursorPositionChanged();
executed 6 times by 1 test: cursorPositionChanged();
Executed by:
  • tst_qquicktextedit
6
600 updateCursorRectangle(true);-
601}
executed 8 times by 1 test: end of block
Executed by:
  • tst_qquicktextedit
8
602-
603void QQuickTextControl::clear()-
604{-
605 Q_D(QQuickTextControl);-
606 d->cursor.select(QTextCursor::Document);-
607 d->cursor.removeSelectedText();-
608}
executed 6 times by 1 test: end of block
Executed by:
  • tst_qquicktextedit
6
609-
610QQuickTextControl::QQuickTextControl(QTextDocument *doc, QObject *parent)-
611 : QInputControl(TextEdit, *new QQuickTextControlPrivate, parent)-
612{-
613 Q_D(QQuickTextControl);-
614 Q_ASSERT(doc);-
615-
616 QAbstractTextDocumentLayout *layout = doc->documentLayout();-
617 qmlobject_connect(layout, QAbstractTextDocumentLayout, SIGNAL(update(QRectF)), this, QQuickTextControl, SIGNAL(updateRequest()));
executed 12 times by 6 tests: end of block
Executed by:
  • tst_examples
  • tst_qquickfocusscope
  • tst_qquickitem2
  • tst_qquicktextdocument
  • tst_qquicktextedit
  • tst_qquicktextinput
never executed: methodIdx = QQuickTextControl::staticMetaObject.indexOfSlot(method+1);
executed 12 times by 6 tests: methodIdx = QQuickTextControl::staticMetaObject.indexOfSignal(method+1);
Executed by:
  • tst_examples
  • tst_qquickfocusscope
  • tst_qquickitem2
  • tst_qquicktextdocument
  • tst_qquicktextedit
  • tst_qquicktextinput
signalIdx < 0Description
TRUEevaluated 12 times by 6 tests
Evaluated by:
  • tst_examples
  • tst_qquickfocusscope
  • tst_qquickitem2
  • tst_qquicktextdocument
  • tst_qquicktextedit
  • tst_qquicktextinput
FALSEevaluated 1068 times by 4 tests
Evaluated by:
  • tst_examples
  • tst_qquickfocusscope
  • tst_qquickitem2
  • tst_qquicktextedit
methodIdx < 0Description
TRUEevaluated 12 times by 6 tests
Evaluated by:
  • tst_examples
  • tst_qquickfocusscope
  • tst_qquickitem2
  • tst_qquicktextdocument
  • tst_qquicktextedit
  • tst_qquicktextinput
FALSEevaluated 1068 times by 4 tests
Evaluated by:
  • tst_examples
  • tst_qquickfocusscope
  • tst_qquickitem2
  • tst_qquicktextedit
code == 1Description
TRUEnever evaluated
FALSEevaluated 12 times by 6 tests
Evaluated by:
  • tst_examples
  • tst_qquickfocusscope
  • tst_qquickitem2
  • tst_qquicktextdocument
  • tst_qquicktextedit
  • tst_qquicktextinput
0-1068
618 qmlobject_connect(layout, QAbstractTextDocumentLayout, SIGNAL(updateBlock(QTextBlock)), this, QQuickTextControl, SIGNAL(updateRequest()));
executed 12 times by 6 tests: end of block
Executed by:
  • tst_examples
  • tst_qquickfocusscope
  • tst_qquickitem2
  • tst_qquicktextdocument
  • tst_qquicktextedit
  • tst_qquicktextinput
never executed: methodIdx = QQuickTextControl::staticMetaObject.indexOfSlot(method+1);
executed 12 times by 6 tests: methodIdx = QQuickTextControl::staticMetaObject.indexOfSignal(method+1);
Executed by:
  • tst_examples
  • tst_qquickfocusscope
  • tst_qquickitem2
  • tst_qquicktextdocument
  • tst_qquicktextedit
  • tst_qquicktextinput
signalIdx < 0Description
TRUEevaluated 12 times by 6 tests
Evaluated by:
  • tst_examples
  • tst_qquickfocusscope
  • tst_qquickitem2
  • tst_qquicktextdocument
  • tst_qquicktextedit
  • tst_qquicktextinput
FALSEevaluated 1068 times by 4 tests
Evaluated by:
  • tst_examples
  • tst_qquickfocusscope
  • tst_qquickitem2
  • tst_qquicktextedit
methodIdx < 0Description
TRUEevaluated 12 times by 6 tests
Evaluated by:
  • tst_examples
  • tst_qquickfocusscope
  • tst_qquickitem2
  • tst_qquicktextdocument
  • tst_qquicktextedit
  • tst_qquicktextinput
FALSEevaluated 1068 times by 4 tests
Evaluated by:
  • tst_examples
  • tst_qquickfocusscope
  • tst_qquickitem2
  • tst_qquicktextedit
code == 1Description
TRUEnever evaluated
FALSEevaluated 12 times by 6 tests
Evaluated by:
  • tst_examples
  • tst_qquickfocusscope
  • tst_qquickitem2
  • tst_qquicktextdocument
  • tst_qquicktextedit
  • tst_qquicktextinput
0-1068
619 qmlobject_connect(doc, QTextDocument, SIGNAL(contentsChanged()), this, QQuickTextControl, SIGNAL(textChanged()));
executed 12 times by 6 tests: end of block
Executed by:
  • tst_examples
  • tst_qquickfocusscope
  • tst_qquickitem2
  • tst_qquicktextdocument
  • tst_qquicktextedit
  • tst_qquicktextinput
never executed: methodIdx = QQuickTextControl::staticMetaObject.indexOfSlot(method+1);
executed 12 times by 6 tests: methodIdx = QQuickTextControl::staticMetaObject.indexOfSignal(method+1);
Executed by:
  • tst_examples
  • tst_qquickfocusscope
  • tst_qquickitem2
  • tst_qquicktextdocument
  • tst_qquicktextedit
  • tst_qquicktextinput
signalIdx < 0Description
TRUEevaluated 12 times by 6 tests
Evaluated by:
  • tst_examples
  • tst_qquickfocusscope
  • tst_qquickitem2
  • tst_qquicktextdocument
  • tst_qquicktextedit
  • tst_qquicktextinput
FALSEevaluated 1068 times by 4 tests
Evaluated by:
  • tst_examples
  • tst_qquickfocusscope
  • tst_qquickitem2
  • tst_qquicktextedit
methodIdx < 0Description
TRUEevaluated 12 times by 6 tests
Evaluated by:
  • tst_examples
  • tst_qquickfocusscope
  • tst_qquickitem2
  • tst_qquicktextdocument
  • tst_qquicktextedit
  • tst_qquicktextinput
FALSEevaluated 1068 times by 4 tests
Evaluated by:
  • tst_examples
  • tst_qquickfocusscope
  • tst_qquickitem2
  • tst_qquicktextedit
code == 1Description
TRUEnever evaluated
FALSEevaluated 12 times by 6 tests
Evaluated by:
  • tst_examples
  • tst_qquickfocusscope
  • tst_qquickitem2
  • tst_qquicktextdocument
  • tst_qquicktextedit
  • tst_qquicktextinput
0-1068
620 qmlobject_connect(doc, QTextDocument, SIGNAL(contentsChanged()), this, QQuickTextControl, SLOT(_q_updateCurrentCharFormatAndSelection()));
executed 12 times by 6 tests: end of block
Executed by:
  • tst_examples
  • tst_qquickfocusscope
  • tst_qquickitem2
  • tst_qquicktextdocument
  • tst_qquicktextedit
  • tst_qquicktextinput
executed 12 times by 6 tests: methodIdx = QQuickTextControl::staticMetaObject.indexOfSlot(method+1);
Executed by:
  • tst_examples
  • tst_qquickfocusscope
  • tst_qquickitem2
  • tst_qquicktextdocument
  • tst_qquicktextedit
  • tst_qquicktextinput
never executed: methodIdx = QQuickTextControl::staticMetaObject.indexOfSignal(method+1);
signalIdx < 0Description
TRUEevaluated 12 times by 6 tests
Evaluated by:
  • tst_examples
  • tst_qquickfocusscope
  • tst_qquickitem2
  • tst_qquicktextdocument
  • tst_qquicktextedit
  • tst_qquicktextinput
FALSEevaluated 1068 times by 4 tests
Evaluated by:
  • tst_examples
  • tst_qquickfocusscope
  • tst_qquickitem2
  • tst_qquicktextedit
methodIdx < 0Description
TRUEevaluated 12 times by 6 tests
Evaluated by:
  • tst_examples
  • tst_qquickfocusscope
  • tst_qquickitem2
  • tst_qquicktextdocument
  • tst_qquicktextedit
  • tst_qquicktextinput
FALSEevaluated 1068 times by 4 tests
Evaluated by:
  • tst_examples
  • tst_qquickfocusscope
  • tst_qquickitem2
  • tst_qquicktextedit
code == 1Description
TRUEevaluated 12 times by 6 tests
Evaluated by:
  • tst_examples
  • tst_qquickfocusscope
  • tst_qquickitem2
  • tst_qquicktextdocument
  • tst_qquicktextedit
  • tst_qquicktextinput
FALSEnever evaluated
0-1068
621 qmlobject_connect(doc, QTextDocument, SIGNAL(cursorPositionChanged(QTextCursor)), this, QQuickTextControl, SLOT(_q_updateCursorPosChanged(QTextCursor)));
executed 12 times by 6 tests: end of block
Executed by:
  • tst_examples
  • tst_qquickfocusscope
  • tst_qquickitem2
  • tst_qquicktextdocument
  • tst_qquicktextedit
  • tst_qquicktextinput
executed 12 times by 6 tests: methodIdx = QQuickTextControl::staticMetaObject.indexOfSlot(method+1);
Executed by:
  • tst_examples
  • tst_qquickfocusscope
  • tst_qquickitem2
  • tst_qquicktextdocument
  • tst_qquicktextedit
  • tst_qquicktextinput
never executed: methodIdx = QQuickTextControl::staticMetaObject.indexOfSignal(method+1);
signalIdx < 0Description
TRUEevaluated 12 times by 6 tests
Evaluated by:
  • tst_examples
  • tst_qquickfocusscope
  • tst_qquickitem2
  • tst_qquicktextdocument
  • tst_qquicktextedit
  • tst_qquicktextinput
FALSEevaluated 1068 times by 4 tests
Evaluated by:
  • tst_examples
  • tst_qquickfocusscope
  • tst_qquickitem2
  • tst_qquicktextedit
methodIdx < 0Description
TRUEevaluated 12 times by 6 tests
Evaluated by:
  • tst_examples
  • tst_qquickfocusscope
  • tst_qquickitem2
  • tst_qquicktextdocument
  • tst_qquicktextedit
  • tst_qquicktextinput
FALSEevaluated 1068 times by 4 tests
Evaluated by:
  • tst_examples
  • tst_qquickfocusscope
  • tst_qquickitem2
  • tst_qquicktextedit
code == 1Description
TRUEevaluated 12 times by 6 tests
Evaluated by:
  • tst_examples
  • tst_qquickfocusscope
  • tst_qquickitem2
  • tst_qquicktextdocument
  • tst_qquicktextedit
  • tst_qquicktextinput
FALSEnever evaluated
0-1068
622 connect(doc, &QTextDocument::contentsChange, this, &QQuickTextControl::contentsChange);-
623-
624 layout->setProperty("cursorWidth", textCursorWidth);-
625-
626 d->doc = doc;-
627 d->cursor = QTextCursor(doc);-
628 d->lastCharFormat = d->cursor.charFormat();-
629 doc->setPageSize(QSizeF(0, 0));-
630 doc->setModified(false);-
631 doc->setUndoRedoEnabled(true);-
632}
executed 1080 times by 6 tests: end of block
Executed by:
  • tst_examples
  • tst_qquickfocusscope
  • tst_qquickitem2
  • tst_qquicktextdocument
  • tst_qquicktextedit
  • tst_qquicktextinput
1080
633-
634QQuickTextControl::~QQuickTextControl()-
635{-
636}-
637-
638QTextDocument *QQuickTextControl::document() const-
639{-
640 Q_D(const QQuickTextControl);-
641 return d->doc;
executed 548 times by 2 tests: return d->doc;
Executed by:
  • tst_qquicktextdocument
  • tst_qquicktextedit
548
642}-
643-
644void QQuickTextControl::updateCursorRectangle(bool force)-
645{-
646 Q_D(QQuickTextControl);-
647 const bool update = d->cursorRectangleChanged || force;
d->cursorRectangleChangedDescription
TRUEevaluated 8 times by 1 test
Evaluated by:
  • tst_qquicktextedit
FALSEevaluated 7102 times by 5 tests
Evaluated by:
  • tst_examples
  • tst_qquickfocusscope
  • tst_qquickitem2
  • tst_qquicktextdocument
  • tst_qquicktextedit
forceDescription
TRUEevaluated 6994 times by 5 tests
Evaluated by:
  • tst_examples
  • tst_qquickfocusscope
  • tst_qquickitem2
  • tst_qquicktextdocument
  • tst_qquicktextedit
FALSEevaluated 108 times by 1 test
Evaluated by:
  • tst_qquicktextedit
8-7102
648 d->cursorRectangleChanged = false;-
649 if (update)
updateDescription
TRUEevaluated 7002 times by 5 tests
Evaluated by:
  • tst_examples
  • tst_qquickfocusscope
  • tst_qquickitem2
  • tst_qquicktextdocument
  • tst_qquicktextedit
FALSEevaluated 108 times by 1 test
Evaluated by:
  • tst_qquicktextedit
108-7002
650 emit cursorRectangleChanged();
executed 7002 times by 5 tests: cursorRectangleChanged();
Executed by:
  • tst_examples
  • tst_qquickfocusscope
  • tst_qquickitem2
  • tst_qquicktextdocument
  • tst_qquicktextedit
7002
651}
executed 7110 times by 5 tests: end of block
Executed by:
  • tst_examples
  • tst_qquickfocusscope
  • tst_qquickitem2
  • tst_qquicktextdocument
  • tst_qquicktextedit
7110
652-
653void QQuickTextControl::setTextCursor(const QTextCursor &cursor)-
654{-
655 Q_D(QQuickTextControl);-
656#if QT_CONFIG(im)-
657 d->commitPreedit();-
658#endif-
659 d->cursorIsFocusIndicator = false;-
660 const bool posChanged = cursor.position() != d->cursor.position();-
661 const QTextCursor oldSelection = d->cursor;-
662 d->cursor = cursor;-
663 d->cursorOn = d->hasFocus && (d->interactionFlags & Qt::TextEditable);
d->hasFocusDescription
TRUEevaluated 358 times by 1 test
Evaluated by:
  • tst_qquicktextedit
FALSEevaluated 866 times by 1 test
Evaluated by:
  • tst_qquicktextedit
358-866
664 d->_q_updateCurrentCharFormatAndSelection();-
665 updateCursorRectangle(true);-
666 d->repaintOldAndNewSelection(oldSelection);-
667 if (posChanged)
posChangedDescription
TRUEevaluated 984 times by 1 test
Evaluated by:
  • tst_qquicktextedit
FALSEevaluated 240 times by 1 test
Evaluated by:
  • tst_qquicktextedit
240-984
668 emit cursorPositionChanged();
executed 984 times by 1 test: cursorPositionChanged();
Executed by:
  • tst_qquicktextedit
984
669}
executed 1224 times by 1 test: end of block
Executed by:
  • tst_qquicktextedit
1224
670-
671QTextCursor QQuickTextControl::textCursor() const-
672{-
673 Q_D(const QQuickTextControl);-
674 return d->cursor;
executed 37450 times by 6 tests: return d->cursor;
Executed by:
  • tst_examples
  • tst_qquickfocusscope
  • tst_qquickitem2
  • tst_qquicktextdocument
  • tst_qquicktextedit
  • tst_qquicktextinput
37450
675}-
676-
677#if QT_CONFIG(clipboard)-
678-
679void QQuickTextControl::cut()-
680{-
681 Q_D(QQuickTextControl);-
682 if (!(d->interactionFlags & Qt::TextEditable) || !d->cursor.hasSelection())
!(d->interacti...:TextEditable)Description
TRUEevaluated 2 times by 1 test
Evaluated by:
  • tst_qquicktextedit
FALSEevaluated 6 times by 1 test
Evaluated by:
  • tst_qquicktextedit
!d->cursor.hasSelection()Description
TRUEevaluated 2 times by 1 test
Evaluated by:
  • tst_qquicktextedit
FALSEevaluated 4 times by 1 test
Evaluated by:
  • tst_qquicktextedit
2-6
683 return;
executed 4 times by 1 test: return;
Executed by:
  • tst_qquicktextedit
4
684 copy();-
685 d->cursor.removeSelectedText();-
686}
executed 4 times by 1 test: end of block
Executed by:
  • tst_qquicktextedit
4
687-
688void QQuickTextControl::copy()-
689{-
690 Q_D(QQuickTextControl);-
691 if (!d->cursor.hasSelection())
!d->cursor.hasSelection()Description
TRUEevaluated 2 times by 1 test
Evaluated by:
  • tst_qquicktextedit
FALSEevaluated 10 times by 1 test
Evaluated by:
  • tst_qquicktextedit
2-10
692 return;
executed 2 times by 1 test: return;
Executed by:
  • tst_qquicktextedit
2
693 QMimeData *data = createMimeDataFromSelection();-
694 QGuiApplication::clipboard()->setMimeData(data);-
695}
executed 10 times by 1 test: end of block
Executed by:
  • tst_qquicktextedit
10
696-
697void QQuickTextControl::paste(QClipboard::Mode mode)-
698{-
699 const QMimeData *md = QGuiApplication::clipboard()->mimeData(mode);-
700 if (md)
mdDescription
TRUEevaluated 14 times by 1 test
Evaluated by:
  • tst_qquicktextedit
FALSEnever evaluated
0-14
701 insertFromMimeData(md);
executed 14 times by 1 test: insertFromMimeData(md);
Executed by:
  • tst_qquicktextedit
14
702}
executed 14 times by 1 test: end of block
Executed by:
  • tst_qquicktextedit
14
703#endif-
704-
705void QQuickTextControl::selectAll()-
706{-
707 Q_D(QQuickTextControl);-
708 const int selectionLength = qAbs(d->cursor.position() - d->cursor.anchor());-
709 d->cursor.select(QTextCursor::Document);-
710 d->selectionChanged(selectionLength != qAbs(d->cursor.position() - d->cursor.anchor()));-
711 d->cursorIsFocusIndicator = false;-
712 emit updateRequest();-
713}
executed 16 times by 1 test: end of block
Executed by:
  • tst_qquicktextedit
16
714-
715void QQuickTextControl::processEvent(QEvent *e, const QPointF &coordinateOffset)-
716{-
717 QMatrix m;-
718 m.translate(coordinateOffset.x(), coordinateOffset.y());-
719 processEvent(e, m);-
720}
executed 4734 times by 3 tests: end of block
Executed by:
  • tst_qquickfocusscope
  • tst_qquickitem2
  • tst_qquicktextedit
4734
721-
722void QQuickTextControl::processEvent(QEvent *e, const QMatrix &matrix)-
723{-
724 Q_D(QQuickTextControl);-
725 if (d->interactionFlags == Qt::NoTextInteraction) {
d->interaction...extInteractionDescription
TRUEnever evaluated
FALSEevaluated 4734 times by 3 tests
Evaluated by:
  • tst_qquickfocusscope
  • tst_qquickitem2
  • tst_qquicktextedit
0-4734
726 e->ignore();-
727 return;
never executed: return;
0
728 }-
729-
730 switch (e->type()) {-
731 case QEvent::KeyPress:
executed 1028 times by 3 tests: case QEvent::KeyPress:
Executed by:
  • tst_qquickfocusscope
  • tst_qquickitem2
  • tst_qquicktextedit
1028
732 d->keyPressEvent(static_cast<QKeyEvent *>(e));-
733 break;
executed 1028 times by 3 tests: break;
Executed by:
  • tst_qquickfocusscope
  • tst_qquickitem2
  • tst_qquicktextedit
1028
734 case QEvent::KeyRelease:
executed 1012 times by 2 tests: case QEvent::KeyRelease:
Executed by:
  • tst_qquickfocusscope
  • tst_qquicktextedit
1012
735 d->keyReleaseEvent(static_cast<QKeyEvent *>(e));-
736 break;
executed 1012 times by 2 tests: break;
Executed by:
  • tst_qquickfocusscope
  • tst_qquicktextedit
1012
737 case QEvent::MouseButtonPress: {
executed 514 times by 1 test: case QEvent::MouseButtonPress:
Executed by:
  • tst_qquicktextedit
514
738 QMouseEvent *ev = static_cast<QMouseEvent *>(e);-
739 d->mousePressEvent(ev, matrix.map(ev->localPos()));-
740 break; }
executed 514 times by 1 test: break;
Executed by:
  • tst_qquicktextedit
514
741 case QEvent::MouseMove: {
executed 138 times by 1 test: case QEvent::MouseMove:
Executed by:
  • tst_qquicktextedit
138
742 QMouseEvent *ev = static_cast<QMouseEvent *>(e);-
743 d->mouseMoveEvent(ev, matrix.map(ev->localPos()));-
744 break; }
executed 138 times by 1 test: break;
Executed by:
  • tst_qquicktextedit
138
745 case QEvent::MouseButtonRelease: {
executed 514 times by 1 test: case QEvent::MouseButtonRelease:
Executed by:
  • tst_qquicktextedit
514
746 QMouseEvent *ev = static_cast<QMouseEvent *>(e);-
747 d->mouseReleaseEvent(ev, matrix.map(ev->localPos()));-
748 break; }
executed 514 times by 1 test: break;
Executed by:
  • tst_qquicktextedit
514
749 case QEvent::MouseButtonDblClick: {
executed 104 times by 1 test: case QEvent::MouseButtonDblClick:
Executed by:
  • tst_qquicktextedit
104
750 QMouseEvent *ev = static_cast<QMouseEvent *>(e);-
751 d->mouseDoubleClickEvent(ev, matrix.map(ev->localPos()));-
752 break; }
executed 104 times by 1 test: break;
Executed by:
  • tst_qquicktextedit
104
753 case QEvent::HoverEnter:
executed 2 times by 1 test: case QEvent::HoverEnter:
Executed by:
  • tst_qquicktextedit
2
754 case QEvent::HoverMove:
executed 6 times by 1 test: case QEvent::HoverMove:
Executed by:
  • tst_qquicktextedit
6
755 case QEvent::HoverLeave: {
never executed: case QEvent::HoverLeave:
0
756 QHoverEvent *ev = static_cast<QHoverEvent *>(e);-
757 d->hoverEvent(ev, matrix.map(ev->posF()));-
758 break; }
executed 8 times by 1 test: break;
Executed by:
  • tst_qquicktextedit
8
759#if QT_CONFIG(im)-
760 case QEvent::InputMethod:
executed 324 times by 1 test: case QEvent::InputMethod:
Executed by:
  • tst_qquicktextedit
324
761 d->inputMethodEvent(static_cast<QInputMethodEvent *>(e));-
762 break;
executed 324 times by 1 test: break;
Executed by:
  • tst_qquicktextedit
324
763#endif-
764 case QEvent::FocusIn:
executed 338 times by 3 tests: case QEvent::FocusIn:
Executed by:
  • tst_qquickfocusscope
  • tst_qquickitem2
  • tst_qquicktextedit
338
765 case QEvent::FocusOut:
executed 94 times by 3 tests: case QEvent::FocusOut:
Executed by:
  • tst_qquickfocusscope
  • tst_qquickitem2
  • tst_qquicktextedit
94
766 d->focusEvent(static_cast<QFocusEvent *>(e));-
767 break;
executed 432 times by 3 tests: break;
Executed by:
  • tst_qquickfocusscope
  • tst_qquickitem2
  • tst_qquicktextedit
432
768-
769 case QEvent::ShortcutOverride:
executed 660 times by 2 tests: case QEvent::ShortcutOverride:
Executed by:
  • tst_qquickfocusscope
  • tst_qquicktextedit
660
770 if (d->interactionFlags & Qt::TextEditable) {
d->interaction...::TextEditableDescription
TRUEevaluated 620 times by 2 tests
Evaluated by:
  • tst_qquickfocusscope
  • tst_qquicktextedit
FALSEevaluated 40 times by 1 test
Evaluated by:
  • tst_qquicktextedit
40-620
771 QKeyEvent* ke = static_cast<QKeyEvent *>(e);-
772 if (isCommonTextEditShortcut(ke))
isCommonTextEditShortcut(ke)Description
TRUEevaluated 550 times by 2 tests
Evaluated by:
  • tst_qquickfocusscope
  • tst_qquicktextedit
FALSEevaluated 70 times by 1 test
Evaluated by:
  • tst_qquicktextedit
70-550
773 ke->accept();
executed 550 times by 2 tests: ke->accept();
Executed by:
  • tst_qquickfocusscope
  • tst_qquicktextedit
550
774 }
executed 620 times by 2 tests: end of block
Executed by:
  • tst_qquickfocusscope
  • tst_qquicktextedit
620
775 break;
executed 660 times by 2 tests: break;
Executed by:
  • tst_qquickfocusscope
  • tst_qquicktextedit
660
776 default:
never executed: default:
0
777 break;
never executed: break;
0
778 }-
779}-
780-
781bool QQuickTextControl::event(QEvent *e)-
782{-
783 return QObject::event(e);
executed 346 times by 1 test: return QObject::event(e);
Executed by:
  • tst_qquicktextedit
346
784}-
785-
786void QQuickTextControl::timerEvent(QTimerEvent *e)-
787{-
788 Q_D(QQuickTextControl);-
789 if (e->timerId() == d->cursorBlinkTimer.timerId()) {
e->timerId() =...imer.timerId()Description
TRUEevaluated 346 times by 1 test
Evaluated by:
  • tst_qquicktextedit
FALSEnever evaluated
0-346
790 d->cursorOn = !d->cursorOn;-
791-
792 d->repaintCursor();-
793 } else if (e->timerId() == d->tripleClickTimer.timerId()) {
executed 346 times by 1 test: end of block
Executed by:
  • tst_qquicktextedit
e->timerId() =...imer.timerId()Description
TRUEnever evaluated
FALSEnever evaluated
0-346
794 d->tripleClickTimer.stop();-
795 }
never executed: end of block
0
796}
executed 346 times by 1 test: end of block
Executed by:
  • tst_qquicktextedit
346
797-
798void QQuickTextControl::setPlainText(const QString &text)-
799{-
800 Q_D(QQuickTextControl);-
801 d->setContent(Qt::PlainText, text);-
802}
executed 968 times by 5 tests: end of block
Executed by:
  • tst_examples
  • tst_qquickfocusscope
  • tst_qquickitem2
  • tst_qquicktextdocument
  • tst_qquicktextedit
968
803-
804void QQuickTextControl::setHtml(const QString &text)-
805{-
806 Q_D(QQuickTextControl);-
807 d->setContent(Qt::RichText, text);-
808}
executed 100 times by 3 tests: end of block
Executed by:
  • tst_examples
  • tst_qquickitem2
  • tst_qquicktextedit
100
809-
810-
811void QQuickTextControlPrivate::keyReleaseEvent(QKeyEvent *e)-
812{-
813 if (e->key() == Qt::Key_Back) {
e->key() == Qt::Key_BackDescription
TRUEnever evaluated
FALSEevaluated 1012 times by 2 tests
Evaluated by:
  • tst_qquickfocusscope
  • tst_qquicktextedit
0-1012
814 e->ignore();-
815 return;
never executed: return;
0
816 }-
817 return;
executed 1012 times by 2 tests: return;
Executed by:
  • tst_qquickfocusscope
  • tst_qquicktextedit
1012
818}-
819-
820void QQuickTextControlPrivate::keyPressEvent(QKeyEvent *e)-
821{-
822 Q_Q(QQuickTextControl);-
823-
824 if (e->key() == Qt::Key_Back) {
e->key() == Qt::Key_BackDescription
TRUEnever evaluated
FALSEevaluated 1028 times by 3 tests
Evaluated by:
  • tst_qquickfocusscope
  • tst_qquickitem2
  • tst_qquicktextedit
0-1028
825 e->ignore();-
826 return;
never executed: return;
0
827 }-
828-
829#if QT_CONFIG(shortcut)-
830 if (e == QKeySequence::SelectAll) {
e == QKeySequence::SelectAllDescription
TRUEevaluated 2 times by 1 test
Evaluated by:
  • tst_qquicktextedit
FALSEevaluated 1026 times by 3 tests
Evaluated by:
  • tst_qquickfocusscope
  • tst_qquickitem2
  • tst_qquicktextedit
2-1026
831 e->accept();-
832 q->selectAll();-
833#if QT_CONFIG(clipboard)-
834 setClipboardSelection();-
835#endif-
836 return;
executed 2 times by 1 test: return;
Executed by:
  • tst_qquicktextedit
2
837 }-
838#if QT_CONFIG(clipboard)-
839 else if (e == QKeySequence::Copy) {
e == QKeySequence::CopyDescription
TRUEevaluated 2 times by 1 test
Evaluated by:
  • tst_qquicktextedit
FALSEevaluated 1024 times by 3 tests
Evaluated by:
  • tst_qquickfocusscope
  • tst_qquickitem2
  • tst_qquicktextedit
2-1024
840 e->accept();-
841 q->copy();-
842 return;
executed 2 times by 1 test: return;
Executed by:
  • tst_qquicktextedit
2
843 }-
844#endif-
845#endif // shortcut-
846-
847 if (interactionFlags & Qt::TextSelectableByKeyboard-
848 && cursorMoveKeyEvent(e))
cursorMoveKeyEvent(e)Description
TRUEevaluated 132 times by 2 tests
Evaluated by:
  • tst_qquickfocusscope
  • tst_qquicktextedit
FALSEevaluated 758 times by 3 tests
Evaluated by:
  • tst_qquickfocusscope
  • tst_qquickitem2
  • tst_qquicktextedit
132-758
849 goto accept;
executed 132 times by 2 tests: goto accept;
Executed by:
  • tst_qquickfocusscope
  • tst_qquicktextedit
132
850-
851 if (!(interactionFlags & Qt::TextEditable)) {
!(interactionF...:TextEditable)Description
TRUEevaluated 126 times by 2 tests
Evaluated by:
  • tst_qquickitem2
  • tst_qquicktextedit
FALSEevaluated 766 times by 3 tests
Evaluated by:
  • tst_qquickfocusscope
  • tst_qquickitem2
  • tst_qquicktextedit
126-766
852 e->ignore();-
853 return;
executed 126 times by 2 tests: return;
Executed by:
  • tst_qquickitem2
  • tst_qquicktextedit
126
854 }-
855-
856 if (e->key() == Qt::Key_Direction_L || e->key() == Qt::Key_Direction_R) {
e->key() == Qt...ey_Direction_LDescription
TRUEevaluated 38 times by 1 test
Evaluated by:
  • tst_qquicktextedit
FALSEevaluated 728 times by 3 tests
Evaluated by:
  • tst_qquickfocusscope
  • tst_qquickitem2
  • tst_qquicktextedit
e->key() == Qt...ey_Direction_RDescription
TRUEevaluated 10 times by 1 test
Evaluated by:
  • tst_qquicktextedit
FALSEevaluated 718 times by 3 tests
Evaluated by:
  • tst_qquickfocusscope
  • tst_qquickitem2
  • tst_qquicktextedit
10-728
857 QTextBlockFormat fmt;-
858 fmt.setLayoutDirection((e->key() == Qt::Key_Direction_L) ? Qt::LeftToRight : Qt::RightToLeft);-
859 cursor.mergeBlockFormat(fmt);-
860 goto accept;
executed 48 times by 1 test: goto accept;
Executed by:
  • tst_qquicktextedit
48
861 }-
862-
863 // schedule a repaint of the region of the cursor, as when we move it we-
864 // want to make sure the old cursor disappears (not noticeable when moving-
865 // only a few pixels but noticeable when jumping between cells in tables for-
866 // example)-
867 repaintSelection();-
868-
869 if (e->key() == Qt::Key_Backspace && !(e->modifiers() & ~Qt::ShiftModifier)) {
e->key() == Qt::Key_BackspaceDescription
TRUEevaluated 8 times by 1 test
Evaluated by:
  • tst_qquicktextedit
FALSEevaluated 710 times by 3 tests
Evaluated by:
  • tst_qquickfocusscope
  • tst_qquickitem2
  • tst_qquicktextedit
!(e->modifiers...ShiftModifier)Description
TRUEevaluated 6 times by 1 test
Evaluated by:
  • tst_qquicktextedit
FALSEevaluated 2 times by 1 test
Evaluated by:
  • tst_qquicktextedit
2-710
870 QTextBlockFormat blockFmt = cursor.blockFormat();-
871 QTextList *list = cursor.currentList();-
872 if (list && cursor.atBlockStart() && !cursor.hasSelection()) {
listDescription
TRUEnever evaluated
FALSEevaluated 6 times by 1 test
Evaluated by:
  • tst_qquicktextedit
cursor.atBlockStart()Description
TRUEnever evaluated
FALSEnever evaluated
!cursor.hasSelection()Description
TRUEnever evaluated
FALSEnever evaluated
0-6
873 list->remove(cursor.block());-
874 } else if (cursor.atBlockStart() && blockFmt.indent() > 0) {
never executed: end of block
cursor.atBlockStart()Description
TRUEnever evaluated
FALSEevaluated 6 times by 1 test
Evaluated by:
  • tst_qquicktextedit
blockFmt.indent() > 0Description
TRUEnever evaluated
FALSEnever evaluated
0-6
875 blockFmt.setIndent(blockFmt.indent() - 1);-
876 cursor.setBlockFormat(blockFmt);-
877 } else {
never executed: end of block
0
878 QTextCursor localCursor = cursor;-
879 localCursor.deletePreviousChar();-
880 }
executed 6 times by 1 test: end of block
Executed by:
  • tst_qquicktextedit
6
881 goto accept;
executed 6 times by 1 test: goto accept;
Executed by:
  • tst_qquicktextedit
6
882 }-
883#if QT_CONFIG(shortcut)-
884 else if (e == QKeySequence::InsertParagraphSeparator) {
e == QKeySeque...graphSeparatorDescription
TRUEevaluated 2 times by 1 test
Evaluated by:
  • tst_qquicktextedit
FALSEevaluated 710 times by 3 tests
Evaluated by:
  • tst_qquickfocusscope
  • tst_qquickitem2
  • tst_qquicktextedit
2-710
885 cursor.insertBlock();-
886 e->accept();-
887 goto accept;
executed 2 times by 1 test: goto accept;
Executed by:
  • tst_qquicktextedit
2
888 } else if (e == QKeySequence::InsertLineSeparator) {
e == QKeySeque...tLineSeparatorDescription
TRUEnever evaluated
FALSEevaluated 710 times by 3 tests
Evaluated by:
  • tst_qquickfocusscope
  • tst_qquickitem2
  • tst_qquicktextedit
0-710
889 cursor.insertText(QString(QChar::LineSeparator));-
890 e->accept();-
891 goto accept;
never executed: goto accept;
0
892 }-
893#endif-
894 if (false) {
dead code: { }
-
895 }
dead code: { }
-
896#if QT_CONFIG(shortcut)-
897 else if (e == QKeySequence::Undo) {
e == QKeySequence::UndoDescription
TRUEevaluated 4 times by 1 test
Evaluated by:
  • tst_qquicktextedit
FALSEevaluated 706 times by 3 tests
Evaluated by:
  • tst_qquickfocusscope
  • tst_qquickitem2
  • tst_qquicktextedit
4-706
898 q->undo();-
899 }
executed 4 times by 1 test: end of block
Executed by:
  • tst_qquicktextedit
4
900 else if (e == QKeySequence::Redo) {
e == QKeySequence::RedoDescription
TRUEnever evaluated
FALSEevaluated 706 times by 3 tests
Evaluated by:
  • tst_qquickfocusscope
  • tst_qquickitem2
  • tst_qquicktextedit
0-706
901 q->redo();-
902 }
never executed: end of block
0
903#if QT_CONFIG(clipboard)-
904 else if (e == QKeySequence::Cut) {
e == QKeySequence::CutDescription
TRUEevaluated 2 times by 1 test
Evaluated by:
  • tst_qquicktextedit
FALSEevaluated 704 times by 3 tests
Evaluated by:
  • tst_qquickfocusscope
  • tst_qquickitem2
  • tst_qquicktextedit
2-704
905 q->cut();-
906 }
executed 2 times by 1 test: end of block
Executed by:
  • tst_qquicktextedit
2
907 else if (e == QKeySequence::Paste) {
e == QKeySequence::PasteDescription
TRUEevaluated 4 times by 1 test
Evaluated by:
  • tst_qquicktextedit
FALSEevaluated 700 times by 3 tests
Evaluated by:
  • tst_qquickfocusscope
  • tst_qquickitem2
  • tst_qquicktextedit
4-700
908 QClipboard::Mode mode = QClipboard::Clipboard;-
909 q->paste(mode);-
910 }
executed 4 times by 1 test: end of block
Executed by:
  • tst_qquicktextedit
4
911#endif-
912 else if (e == QKeySequence::Delete) {
e == QKeySequence::DeleteDescription
TRUEevaluated 10 times by 1 test
Evaluated by:
  • tst_qquicktextedit
FALSEevaluated 690 times by 3 tests
Evaluated by:
  • tst_qquickfocusscope
  • tst_qquickitem2
  • tst_qquicktextedit
10-690
913 QTextCursor localCursor = cursor;-
914 localCursor.deleteChar();-
915 }
executed 10 times by 1 test: end of block
Executed by:
  • tst_qquicktextedit
10
916 else if (e == QKeySequence::DeleteEndOfWord) {
e == QKeySeque...eleteEndOfWordDescription
TRUEevaluated 2 times by 1 test
Evaluated by:
  • tst_qquicktextedit
FALSEevaluated 688 times by 3 tests
Evaluated by:
  • tst_qquickfocusscope
  • tst_qquickitem2
  • tst_qquicktextedit
2-688
917 if (!cursor.hasSelection())
!cursor.hasSelection()Description
TRUEevaluated 2 times by 1 test
Evaluated by:
  • tst_qquicktextedit
FALSEnever evaluated
0-2
918 cursor.movePosition(QTextCursor::NextWord, QTextCursor::KeepAnchor);
executed 2 times by 1 test: cursor.movePosition(QTextCursor::NextWord, QTextCursor::KeepAnchor);
Executed by:
  • tst_qquicktextedit
2
919 cursor.removeSelectedText();-
920 }
executed 2 times by 1 test: end of block
Executed by:
  • tst_qquicktextedit
2
921 else if (e == QKeySequence::DeleteStartOfWord) {
e == QKeySeque...eteStartOfWordDescription
TRUEevaluated 2 times by 1 test
Evaluated by:
  • tst_qquicktextedit
FALSEevaluated 686 times by 3 tests
Evaluated by:
  • tst_qquickfocusscope
  • tst_qquickitem2
  • tst_qquicktextedit
2-686
922 if (!cursor.hasSelection())
!cursor.hasSelection()Description
TRUEevaluated 2 times by 1 test
Evaluated by:
  • tst_qquicktextedit
FALSEnever evaluated
0-2
923 cursor.movePosition(QTextCursor::PreviousWord, QTextCursor::KeepAnchor);
executed 2 times by 1 test: cursor.movePosition(QTextCursor::PreviousWord, QTextCursor::KeepAnchor);
Executed by:
  • tst_qquicktextedit
2
924 cursor.removeSelectedText();-
925 }
executed 2 times by 1 test: end of block
Executed by:
  • tst_qquicktextedit
2
926 else if (e == QKeySequence::DeleteEndOfLine) {
e == QKeySeque...eleteEndOfLineDescription
TRUEevaluated 2 times by 1 test
Evaluated by:
  • tst_qquicktextedit
FALSEevaluated 684 times by 3 tests
Evaluated by:
  • tst_qquickfocusscope
  • tst_qquickitem2
  • tst_qquicktextedit
2-684
927 QTextBlock block = cursor.block();-
928 if (cursor.position() == block.position() + block.length() - 2)
cursor.positio...k.length() - 2Description
TRUEnever evaluated
FALSEevaluated 2 times by 1 test
Evaluated by:
  • tst_qquicktextedit
0-2
929 cursor.movePosition(QTextCursor::Right, QTextCursor::KeepAnchor);
never executed: cursor.movePosition(QTextCursor::Right, QTextCursor::KeepAnchor);
0
930 else-
931 cursor.movePosition(QTextCursor::EndOfBlock, QTextCursor::KeepAnchor);
executed 2 times by 1 test: cursor.movePosition(QTextCursor::EndOfBlock, QTextCursor::KeepAnchor);
Executed by:
  • tst_qquicktextedit
2
932 cursor.removeSelectedText();-
933 }
executed 2 times by 1 test: end of block
Executed by:
  • tst_qquicktextedit
2
934#endif // shortcut-
935 else {-
936 goto process;
executed 684 times by 3 tests: goto process;
Executed by:
  • tst_qquickfocusscope
  • tst_qquickitem2
  • tst_qquicktextedit
684
937 }-
938 goto accept;
executed 26 times by 1 test: goto accept;
Executed by:
  • tst_qquicktextedit
26
939-
940process:-
941 {-
942 if (q->isAcceptableInput(e)) {
q->isAcceptableInput(e)Description
TRUEevaluated 588 times by 1 test
Evaluated by:
  • tst_qquicktextedit
FALSEevaluated 96 times by 3 tests
Evaluated by:
  • tst_qquickfocusscope
  • tst_qquickitem2
  • tst_qquicktextedit
96-588
943 if (overwriteMode
overwriteModeDescription
TRUEevaluated 20 times by 1 test
Evaluated by:
  • tst_qquicktextedit
FALSEevaluated 568 times by 1 test
Evaluated by:
  • tst_qquicktextedit
20-568
944 // no need to call deleteChar() if we have a selection, insertText-
945 // does it already-
946 && !cursor.hasSelection()
!cursor.hasSelection()Description
TRUEevaluated 20 times by 1 test
Evaluated by:
  • tst_qquicktextedit
FALSEnever evaluated
0-20
947 && !cursor.atBlockEnd()) {
!cursor.atBlockEnd()Description
TRUEevaluated 10 times by 1 test
Evaluated by:
  • tst_qquicktextedit
FALSEevaluated 10 times by 1 test
Evaluated by:
  • tst_qquicktextedit
10
948 cursor.deleteChar();-
949 }
executed 10 times by 1 test: end of block
Executed by:
  • tst_qquicktextedit
10
950-
951 cursor.insertText(e->text());-
952 selectionChanged();-
953 } else {
executed 588 times by 1 test: end of block
Executed by:
  • tst_qquicktextedit
588
954 e->ignore();-
955 return;
executed 96 times by 3 tests: return;
Executed by:
  • tst_qquickfocusscope
  • tst_qquickitem2
  • tst_qquicktextedit
96
956 }-
957 }-
958-
959 accept:
code before this statement executed 588 times by 1 test: accept:
Executed by:
  • tst_qquicktextedit
588
960-
961#if QT_CONFIG(clipboard)-
962 setClipboardSelection();-
963#endif-
964-
965 e->accept();-
966 cursorOn = true;-
967-
968 q->updateCursorRectangle(true);-
969 updateCurrentCharFormat();-
970}
executed 802 times by 2 tests: end of block
Executed by:
  • tst_qquickfocusscope
  • tst_qquicktextedit
802
971-
972QRectF QQuickTextControlPrivate::rectForPosition(int position) const-
973{-
974 Q_Q(const QQuickTextControl);-
975 const QTextBlock block = doc->findBlock(position);-
976 if (!block.isValid())
!block.isValid()Description
TRUEnever evaluated
FALSEevaluated 2696 times by 3 tests
Evaluated by:
  • tst_examples
  • tst_qquickfocusscope
  • tst_qquicktextedit
0-2696
977 return QRectF();
never executed: return QRectF();
0
978 const QTextLayout *layout = block.layout();-
979 const QPointF layoutPos = q->blockBoundingRect(block).topLeft();-
980 int relativePos = position - block.position();-
981#if QT_CONFIG(im)-
982 if (preeditCursor != 0) {
preeditCursor != 0Description
TRUEevaluated 58 times by 1 test
Evaluated by:
  • tst_qquicktextedit
FALSEevaluated 2638 times by 3 tests
Evaluated by:
  • tst_examples
  • tst_qquickfocusscope
  • tst_qquicktextedit
58-2638
983 int preeditPos = layout->preeditAreaPosition();-
984 if (relativePos == preeditPos)
relativePos == preeditPosDescription
TRUEevaluated 46 times by 1 test
Evaluated by:
  • tst_qquicktextedit
FALSEevaluated 12 times by 1 test
Evaluated by:
  • tst_qquicktextedit
12-46
985 relativePos += preeditCursor;
executed 46 times by 1 test: relativePos += preeditCursor;
Executed by:
  • tst_qquicktextedit
46
986 else if (relativePos > preeditPos)
relativePos > preeditPosDescription
TRUEevaluated 12 times by 1 test
Evaluated by:
  • tst_qquicktextedit
FALSEnever evaluated
0-12
987 relativePos += layout->preeditAreaText().length();
executed 12 times by 1 test: relativePos += layout->preeditAreaText().length();
Executed by:
  • tst_qquicktextedit
12
988 }
executed 58 times by 1 test: end of block
Executed by:
  • tst_qquicktextedit
58
989#endif-
990 QTextLine line = layout->lineForTextPosition(relativePos);-
991-
992 QRectF r;-
993-
994 if (line.isValid()) {
line.isValid()Description
TRUEevaluated 2696 times by 3 tests
Evaluated by:
  • tst_examples
  • tst_qquickfocusscope
  • tst_qquicktextedit
FALSEnever evaluated
0-2696
995 qreal x = line.cursorToX(relativePos);-
996 qreal w = 0;-
997 if (overwriteMode) {
overwriteModeDescription
TRUEnever evaluated
FALSEevaluated 2696 times by 3 tests
Evaluated by:
  • tst_examples
  • tst_qquickfocusscope
  • tst_qquicktextedit
0-2696
998 if (relativePos < line.textLength() - line.textStart())
relativePos < ...ne.textStart()Description
TRUEnever evaluated
FALSEnever evaluated
0
999 w = line.cursorToX(relativePos + 1) - x;
never executed: w = line.cursorToX(relativePos + 1) - x;
0
1000 else-
1001 w = QFontMetrics(block.layout()->font()).width(QLatin1Char(' ')); // in sync with QTextLine::draw()
never executed: w = QFontMetrics(block.layout()->font()).width(QLatin1Char(' '));
0
1002 }-
1003 r = QRectF(layoutPos.x() + x, layoutPos.y() + line.y(), textCursorWidth + w, line.height());-
1004 } else {
executed 2696 times by 3 tests: end of block
Executed by:
  • tst_examples
  • tst_qquickfocusscope
  • tst_qquicktextedit
2696
1005 r = QRectF(layoutPos.x(), layoutPos.y(), textCursorWidth, 10); // #### correct height-
1006 }
never executed: end of block
0
1007-
1008 return r;
executed 2696 times by 3 tests: return r;
Executed by:
  • tst_examples
  • tst_qquickfocusscope
  • tst_qquicktextedit
2696
1009}-
1010-
1011void QQuickTextControlPrivate::mousePressEvent(QMouseEvent *e, const QPointF &pos)-
1012{-
1013 Q_Q(QQuickTextControl);-
1014-
1015 mousePressed = (interactionFlags & Qt::TextSelectableByMouse) && (e->button() & Qt::LeftButton);
(e->button() & Qt::LeftButton)Description
TRUEevaluated 472 times by 1 test
Evaluated by:
  • tst_qquicktextedit
FALSEevaluated 2 times by 1 test
Evaluated by:
  • tst_qquicktextedit
2-472
1016 mousePressPos = pos.toPoint();-
1017-
1018 if (sendMouseEventToInputContext(e, pos))
sendMouseEvent...ontext(e, pos)Description
TRUEnever evaluated
FALSEevaluated 514 times by 1 test
Evaluated by:
  • tst_qquicktextedit
0-514
1019 return;
never executed: return;
0
1020-
1021 if (interactionFlags & Qt::LinksAccessibleByMouse) {
interactionFla...essibleByMouseDescription
TRUEevaluated 514 times by 1 test
Evaluated by:
  • tst_qquicktextedit
FALSEnever evaluated
0-514
1022 anchorOnMousePress = q->anchorAt(pos);-
1023-
1024 if (cursorIsFocusIndicator) {
cursorIsFocusIndicatorDescription
TRUEevaluated 124 times by 1 test
Evaluated by:
  • tst_qquicktextedit
FALSEevaluated 390 times by 1 test
Evaluated by:
  • tst_qquicktextedit
124-390
1025 cursorIsFocusIndicator = false;-
1026 repaintSelection();-
1027 cursor.clearSelection();-
1028 }
executed 124 times by 1 test: end of block
Executed by:
  • tst_qquicktextedit
124
1029 }
executed 514 times by 1 test: end of block
Executed by:
  • tst_qquicktextedit
514
1030 if (e->button() & Qt::MiddleButton) {
e->button() & Qt::MiddleButtonDescription
TRUEevaluated 2 times by 1 test
Evaluated by:
  • tst_qquicktextedit
FALSEevaluated 512 times by 1 test
Evaluated by:
  • tst_qquicktextedit
2-512
1031 return;
executed 2 times by 1 test: return;
Executed by:
  • tst_qquicktextedit
2
1032 } else if (!(e->button() & Qt::LeftButton)) {
!(e->button() ...t::LeftButton)Description
TRUEnever evaluated
FALSEevaluated 512 times by 1 test
Evaluated by:
  • tst_qquicktextedit
0-512
1033 e->ignore();-
1034 return;
never executed: return;
0
1035 } else if (!(interactionFlags & (Qt::TextSelectableByMouse | Qt::TextEditable))) {
!(interactionF...TextEditable))Description
TRUEevaluated 8 times by 1 test
Evaluated by:
  • tst_qquicktextedit
FALSEevaluated 504 times by 1 test
Evaluated by:
  • tst_qquicktextedit
8-504
1036 if (!(interactionFlags & Qt::LinksAccessibleByMouse))
!(interactionF...ssibleByMouse)Description
TRUEnever evaluated
FALSEevaluated 8 times by 1 test
Evaluated by:
  • tst_qquicktextedit
0-8
1037 e->ignore();
never executed: e->ignore();
0
1038 return;
executed 8 times by 1 test: return;
Executed by:
  • tst_qquicktextedit
8
1039 }-
1040-
1041 cursorIsFocusIndicator = false;-
1042 const QTextCursor oldSelection = cursor;-
1043 const int oldCursorPos = cursor.position();-
1044-
1045#if QT_CONFIG(im)-
1046 commitPreedit();-
1047#endif-
1048-
1049 if (tripleClickTimer.isActive()
tripleClickTimer.isActive()Description
TRUEevaluated 104 times by 1 test
Evaluated by:
  • tst_qquicktextedit
FALSEevaluated 400 times by 1 test
Evaluated by:
  • tst_qquicktextedit
104-400
1050 && ((pos - tripleClickPoint).toPoint().manhattanLength() < QGuiApplication::styleHints()->startDragDistance())) {
((pos - triple...ragDistance())Description
TRUEevaluated 86 times by 1 test
Evaluated by:
  • tst_qquicktextedit
FALSEevaluated 18 times by 1 test
Evaluated by:
  • tst_qquicktextedit
18-86
1051-
1052 cursor.movePosition(QTextCursor::StartOfBlock);-
1053 cursor.movePosition(QTextCursor::EndOfBlock, QTextCursor::KeepAnchor);-
1054 cursor.movePosition(QTextCursor::NextCharacter, QTextCursor::KeepAnchor);-
1055 selectedBlockOnTripleClick = cursor;-
1056-
1057 anchorOnMousePress = QString();-
1058-
1059 tripleClickTimer.stop();-
1060 } else {
executed 86 times by 1 test: end of block
Executed by:
  • tst_qquicktextedit
86
1061 int cursorPos = q->hitTest(pos, Qt::FuzzyHit);-
1062 if (cursorPos == -1) {
cursorPos == -1Description
TRUEnever evaluated
FALSEevaluated 418 times by 1 test
Evaluated by:
  • tst_qquicktextedit
0-418
1063 e->ignore();-
1064 return;
never executed: return;
0
1065 }-
1066-
1067 if (e->modifiers() == Qt::ShiftModifier && (interactionFlags & Qt::TextSelectableByMouse)) {
e->modifiers()...:ShiftModifierDescription
TRUEevaluated 92 times by 1 test
Evaluated by:
  • tst_qquicktextedit
FALSEevaluated 326 times by 1 test
Evaluated by:
  • tst_qquicktextedit
92-326
1068 if (wordSelectionEnabled && !selectedWordOnDoubleClick.hasSelection()) {
wordSelectionEnabledDescription
TRUEevaluated 22 times by 1 test
Evaluated by:
  • tst_qquicktextedit
FALSEevaluated 64 times by 1 test
Evaluated by:
  • tst_qquicktextedit
!selectedWordO...hasSelection()Description
TRUEevaluated 22 times by 1 test
Evaluated by:
  • tst_qquicktextedit
FALSEnever evaluated
0-64
1069 selectedWordOnDoubleClick = cursor;-
1070 selectedWordOnDoubleClick.select(QTextCursor::WordUnderCursor);-
1071 }
executed 22 times by 1 test: end of block
Executed by:
  • tst_qquicktextedit
22
1072-
1073 if (selectedBlockOnTripleClick.hasSelection())
selectedBlockO...hasSelection()Description
TRUEevaluated 34 times by 1 test
Evaluated by:
  • tst_qquicktextedit
FALSEevaluated 52 times by 1 test
Evaluated by:
  • tst_qquicktextedit
34-52
1074 extendBlockwiseSelection(cursorPos);
executed 34 times by 1 test: extendBlockwiseSelection(cursorPos);
Executed by:
  • tst_qquicktextedit
34
1075 else if (selectedWordOnDoubleClick.hasSelection())
selectedWordOn...hasSelection()Description
TRUEevaluated 40 times by 1 test
Evaluated by:
  • tst_qquicktextedit
FALSEevaluated 12 times by 1 test
Evaluated by:
  • tst_qquicktextedit
12-40
1076 extendWordwiseSelection(cursorPos, pos.x());
executed 40 times by 1 test: extendWordwiseSelection(cursorPos, pos.x());
Executed by:
  • tst_qquicktextedit
40
1077 else if (!wordSelectionEnabled)
!wordSelectionEnabledDescription
TRUEevaluated 12 times by 1 test
Evaluated by:
  • tst_qquicktextedit
FALSEnever evaluated
0-12
1078 setCursorPosition(cursorPos, QTextCursor::KeepAnchor);
executed 12 times by 1 test: setCursorPosition(cursorPos, QTextCursor::KeepAnchor);
Executed by:
  • tst_qquicktextedit
12
1079 } else {
executed 86 times by 1 test: end of block
Executed by:
  • tst_qquicktextedit
86
1080 setCursorPosition(cursorPos);-
1081 }
executed 332 times by 1 test: end of block
Executed by:
  • tst_qquicktextedit
332
1082 }-
1083-
1084 if (cursor.position() != oldCursorPos) {
cursor.positio...= oldCursorPosDescription
TRUEevaluated 390 times by 1 test
Evaluated by:
  • tst_qquicktextedit
FALSEevaluated 114 times by 1 test
Evaluated by:
  • tst_qquicktextedit
114-390
1085 q->updateCursorRectangle(true);-
1086 emit q->cursorPositionChanged();-
1087 }
executed 390 times by 1 test: end of block
Executed by:
  • tst_qquicktextedit
390
1088 if (interactionFlags & Qt::TextEditable)
interactionFla...::TextEditableDescription
TRUEevaluated 492 times by 1 test
Evaluated by:
  • tst_qquicktextedit
FALSEevaluated 12 times by 1 test
Evaluated by:
  • tst_qquicktextedit
12-492
1089 _q_updateCurrentCharFormatAndSelection();
executed 492 times by 1 test: _q_updateCurrentCharFormatAndSelection();
Executed by:
  • tst_qquicktextedit
492
1090 else-
1091 selectionChanged();
executed 12 times by 1 test: selectionChanged();
Executed by:
  • tst_qquicktextedit
12
1092 repaintOldAndNewSelection(oldSelection);-
1093 hadSelectionOnMousePress = cursor.hasSelection();-
1094}
executed 504 times by 1 test: end of block
Executed by:
  • tst_qquicktextedit
504
1095-
1096void QQuickTextControlPrivate::mouseMoveEvent(QMouseEvent *e, const QPointF &mousePos)-
1097{-
1098 Q_Q(QQuickTextControl);-
1099-
1100 if ((e->buttons() & Qt::LeftButton)) {
(e->buttons() ...t::LeftButton)Description
TRUEevaluated 138 times by 1 test
Evaluated by:
  • tst_qquicktextedit
FALSEnever evaluated
0-138
1101 const bool editable = interactionFlags & Qt::TextEditable;-
1102-
1103 if (!(mousePressed
mousePressedDescription
TRUEevaluated 132 times by 1 test
Evaluated by:
  • tst_qquicktextedit
FALSEevaluated 6 times by 1 test
Evaluated by:
  • tst_qquicktextedit
6-132
1104 || editable
editableDescription
TRUEevaluated 6 times by 1 test
Evaluated by:
  • tst_qquicktextedit
FALSEnever evaluated
0-6
1105 || selectedWordOnDoubleClick.hasSelection()
selectedWordOn...hasSelection()Description
TRUEnever evaluated
FALSEnever evaluated
0
1106 || selectedBlockOnTripleClick.hasSelection()))
selectedBlockO...hasSelection()Description
TRUEnever evaluated
FALSEnever evaluated
0
1107 return;
never executed: return;
0
1108-
1109 const QTextCursor oldSelection = cursor;-
1110 const int oldCursorPos = cursor.position();-
1111-
1112 if (!mousePressed)
!mousePressedDescription
TRUEevaluated 6 times by 1 test
Evaluated by:
  • tst_qquicktextedit
FALSEevaluated 132 times by 1 test
Evaluated by:
  • tst_qquicktextedit
6-132
1113 return;
executed 6 times by 1 test: return;
Executed by:
  • tst_qquicktextedit
6
1114-
1115 const qreal mouseX = qreal(mousePos.x());-
1116-
1117 int newCursorPos = q->hitTest(mousePos, Qt::FuzzyHit);-
1118-
1119#if QT_CONFIG(im)-
1120 if (isPreediting()) {
isPreediting()Description
TRUEnever evaluated
FALSEevaluated 132 times by 1 test
Evaluated by:
  • tst_qquicktextedit
0-132
1121 // note: oldCursorPos not including preedit-
1122 int selectionStartPos = q->hitTest(mousePressPos, Qt::FuzzyHit);-
1123 if (newCursorPos != selectionStartPos) {
newCursorPos !...ectionStartPosDescription
TRUEnever evaluated
FALSEnever evaluated
0
1124 commitPreedit();-
1125 // commit invalidates positions-
1126 newCursorPos = q->hitTest(mousePos, Qt::FuzzyHit);-
1127 selectionStartPos = q->hitTest(mousePressPos, Qt::FuzzyHit);-
1128 setCursorPosition(selectionStartPos);-
1129 }
never executed: end of block
0
1130 }
never executed: end of block
0
1131#endif-
1132-
1133 if (newCursorPos == -1)
newCursorPos == -1Description
TRUEnever evaluated
FALSEevaluated 132 times by 1 test
Evaluated by:
  • tst_qquicktextedit
0-132
1134 return;
never executed: return;
0
1135-
1136 if (wordSelectionEnabled && !selectedWordOnDoubleClick.hasSelection()) {
wordSelectionEnabledDescription
TRUEevaluated 24 times by 1 test
Evaluated by:
  • tst_qquicktextedit
FALSEevaluated 108 times by 1 test
Evaluated by:
  • tst_qquicktextedit
!selectedWordO...hasSelection()Description
TRUEevaluated 24 times by 1 test
Evaluated by:
  • tst_qquicktextedit
FALSEnever evaluated
0-108
1137 selectedWordOnDoubleClick = cursor;-
1138 selectedWordOnDoubleClick.select(QTextCursor::WordUnderCursor);-
1139 }
executed 24 times by 1 test: end of block
Executed by:
  • tst_qquicktextedit
24
1140-
1141 if (selectedBlockOnTripleClick.hasSelection())
selectedBlockO...hasSelection()Description
TRUEevaluated 34 times by 1 test
Evaluated by:
  • tst_qquicktextedit
FALSEevaluated 98 times by 1 test
Evaluated by:
  • tst_qquicktextedit
34-98
1142 extendBlockwiseSelection(newCursorPos);
executed 34 times by 1 test: extendBlockwiseSelection(newCursorPos);
Executed by:
  • tst_qquicktextedit
34
1143 else if (selectedWordOnDoubleClick.hasSelection())
selectedWordOn...hasSelection()Description
TRUEevaluated 42 times by 1 test
Evaluated by:
  • tst_qquicktextedit
FALSEevaluated 56 times by 1 test
Evaluated by:
  • tst_qquicktextedit
42-56
1144 extendWordwiseSelection(newCursorPos, mouseX);
executed 42 times by 1 test: extendWordwiseSelection(newCursorPos, mouseX);
Executed by:
  • tst_qquicktextedit
42
1145#if QT_CONFIG(im)-
1146 else if (!isPreediting())
!isPreediting()Description
TRUEevaluated 56 times by 1 test
Evaluated by:
  • tst_qquicktextedit
FALSEnever evaluated
0-56
1147 setCursorPosition(newCursorPos, QTextCursor::KeepAnchor);
executed 56 times by 1 test: setCursorPosition(newCursorPos, QTextCursor::KeepAnchor);
Executed by:
  • tst_qquicktextedit
56
1148#endif-
1149-
1150 if (interactionFlags & Qt::TextEditable) {
interactionFla...::TextEditableDescription
TRUEevaluated 132 times by 1 test
Evaluated by:
  • tst_qquicktextedit
FALSEnever evaluated
0-132
1151 if (cursor.position() != oldCursorPos) {
cursor.positio...= oldCursorPosDescription
TRUEevaluated 106 times by 1 test
Evaluated by:
  • tst_qquicktextedit
FALSEevaluated 26 times by 1 test
Evaluated by:
  • tst_qquicktextedit
26-106
1152 emit q->cursorPositionChanged();-
1153 }
executed 106 times by 1 test: end of block
Executed by:
  • tst_qquicktextedit
106
1154 _q_updateCurrentCharFormatAndSelection();-
1155#if QT_CONFIG(im)-
1156 if (qGuiApp)
(static_cast<Q...::instance()))Description
TRUEevaluated 132 times by 1 test
Evaluated by:
  • tst_qquicktextedit
FALSEnever evaluated
0-132
1157 qGuiApp->inputMethod()->update(Qt::ImQueryInput);
executed 132 times by 1 test: (static_cast<QGuiApplication *>(QCoreApplication::instance()))->inputMethod()->update(Qt::ImQueryInput);
Executed by:
  • tst_qquicktextedit
132
1158#endif-
1159 } else if (cursor.position() != oldCursorPos) {
executed 132 times by 1 test: end of block
Executed by:
  • tst_qquicktextedit
cursor.positio...= oldCursorPosDescription
TRUEnever evaluated
FALSEnever evaluated
0-132
1160 emit q->cursorPositionChanged();-
1161 }
never executed: end of block
0
1162 selectionChanged(true);-
1163 repaintOldAndNewSelection(oldSelection);-
1164 }
executed 132 times by 1 test: end of block
Executed by:
  • tst_qquicktextedit
132
1165-
1166 sendMouseEventToInputContext(e, mousePos);-
1167}
executed 132 times by 1 test: end of block
Executed by:
  • tst_qquicktextedit
132
1168-
1169void QQuickTextControlPrivate::mouseReleaseEvent(QMouseEvent *e, const QPointF &pos)-
1170{-
1171 Q_Q(QQuickTextControl);-
1172-
1173 if (sendMouseEventToInputContext(e, pos))
sendMouseEvent...ontext(e, pos)Description
TRUEnever evaluated
FALSEevaluated 514 times by 1 test
Evaluated by:
  • tst_qquicktextedit
0-514
1174 return;
never executed: return;
0
1175-
1176 const QTextCursor oldSelection = cursor;-
1177 const int oldCursorPos = cursor.position();-
1178-
1179 if (mousePressed) {
mousePressedDescription
TRUEevaluated 472 times by 1 test
Evaluated by:
  • tst_qquicktextedit
FALSEevaluated 42 times by 1 test
Evaluated by:
  • tst_qquicktextedit
42-472
1180 mousePressed = false;-
1181#if QT_CONFIG(clipboard)-
1182 setClipboardSelection();-
1183 selectionChanged(true);-
1184 } else if (e->button() == Qt::MidButton
executed 472 times by 1 test: end of block
Executed by:
  • tst_qquicktextedit
e->button() == Qt::MidButtonDescription
TRUEevaluated 2 times by 1 test
Evaluated by:
  • tst_qquicktextedit
FALSEevaluated 40 times by 1 test
Evaluated by:
  • tst_qquicktextedit
2-472
1185 && (interactionFlags & Qt::TextEditable)-
1186 && QGuiApplication::clipboard()->supportsSelection()) {
QGuiApplicatio...rtsSelection()Description
TRUEevaluated 2 times by 1 test
Evaluated by:
  • tst_qquicktextedit
FALSEnever evaluated
0-2
1187 setCursorPosition(pos);-
1188 const QMimeData *md = QGuiApplication::clipboard()->mimeData(QClipboard::Selection);-
1189 if (md)
mdDescription
TRUEevaluated 2 times by 1 test
Evaluated by:
  • tst_qquicktextedit
FALSEnever evaluated
0-2
1190 q->insertFromMimeData(md);
executed 2 times by 1 test: q->insertFromMimeData(md);
Executed by:
  • tst_qquicktextedit
2
1191#endif-
1192 }
executed 2 times by 1 test: end of block
Executed by:
  • tst_qquicktextedit
2
1193-
1194 repaintOldAndNewSelection(oldSelection);-
1195-
1196 if (cursor.position() != oldCursorPos) {
cursor.positio...= oldCursorPosDescription
TRUEevaluated 2 times by 1 test
Evaluated by:
  • tst_qquicktextedit
FALSEevaluated 512 times by 1 test
Evaluated by:
  • tst_qquicktextedit
2-512
1197 emit q->cursorPositionChanged();-
1198 q->updateCursorRectangle(true);-
1199 }
executed 2 times by 1 test: end of block
Executed by:
  • tst_qquicktextedit
2
1200-
1201 if (interactionFlags & Qt::LinksAccessibleByMouse) {
interactionFla...essibleByMouseDescription
TRUEevaluated 514 times by 1 test
Evaluated by:
  • tst_qquicktextedit
FALSEnever evaluated
0-514
1202 if (!(e->button() & Qt::LeftButton))
!(e->button() ...t::LeftButton)Description
TRUEevaluated 2 times by 1 test
Evaluated by:
  • tst_qquicktextedit
FALSEevaluated 512 times by 1 test
Evaluated by:
  • tst_qquicktextedit
2-512
1203 return;
executed 2 times by 1 test: return;
Executed by:
  • tst_qquicktextedit
2
1204-
1205 const QString anchor = q->anchorAt(pos);-
1206-
1207 if (anchor.isEmpty())
anchor.isEmpty()Description
TRUEevaluated 508 times by 1 test
Evaluated by:
  • tst_qquicktextedit
FALSEevaluated 4 times by 1 test
Evaluated by:
  • tst_qquicktextedit
4-508
1208 return;
executed 508 times by 1 test: return;
Executed by:
  • tst_qquicktextedit
508
1209-
1210 if (!cursor.hasSelection()
!cursor.hasSelection()Description
TRUEevaluated 4 times by 1 test
Evaluated by:
  • tst_qquicktextedit
FALSEnever evaluated
0-4
1211 || (anchor == anchorOnMousePress && hadSelectionOnMousePress)) {
anchor == anchorOnMousePressDescription
TRUEnever evaluated
FALSEnever evaluated
hadSelectionOnMousePressDescription
TRUEnever evaluated
FALSEnever evaluated
0
1212-
1213 const int anchorPos = q->hitTest(pos, Qt::ExactHit);-
1214 if (anchorPos != -1) {
anchorPos != -1Description
TRUEevaluated 4 times by 1 test
Evaluated by:
  • tst_qquicktextedit
FALSEnever evaluated
0-4
1215 cursor.setPosition(anchorPos);-
1216-
1217 QString anchor = anchorOnMousePress;-
1218 anchorOnMousePress = QString();-
1219 activateLinkUnderCursor(anchor);-
1220 }
executed 4 times by 1 test: end of block
Executed by:
  • tst_qquicktextedit
4
1221 }
executed 4 times by 1 test: end of block
Executed by:
  • tst_qquicktextedit
4
1222 }
executed 4 times by 1 test: end of block
Executed by:
  • tst_qquicktextedit
4
1223}
executed 4 times by 1 test: end of block
Executed by:
  • tst_qquicktextedit
4
1224-
1225void QQuickTextControlPrivate::mouseDoubleClickEvent(QMouseEvent *e, const QPointF &pos)-
1226{-
1227 Q_Q(QQuickTextControl);-
1228-
1229 if (e->button() == Qt::LeftButton && (interactionFlags & Qt::TextSelectableByMouse)) {
e->button() == Qt::LeftButtonDescription
TRUEevaluated 104 times by 1 test
Evaluated by:
  • tst_qquicktextedit
FALSEnever evaluated
0-104
1230#if QT_CONFIG(im)-
1231 commitPreedit();-
1232#endif-
1233-
1234 const QTextCursor oldSelection = cursor;-
1235 setCursorPosition(pos);-
1236 QTextLine line = currentTextLine(cursor);-
1237 bool doEmit = false;-
1238 if (line.isValid() && line.textLength()) {
line.isValid()Description
TRUEevaluated 104 times by 1 test
Evaluated by:
  • tst_qquicktextedit
FALSEnever evaluated
line.textLength()Description
TRUEevaluated 104 times by 1 test
Evaluated by:
  • tst_qquicktextedit
FALSEnever evaluated
0-104
1239 cursor.select(QTextCursor::WordUnderCursor);-
1240 doEmit = true;-
1241 }
executed 104 times by 1 test: end of block
Executed by:
  • tst_qquicktextedit
104
1242 repaintOldAndNewSelection(oldSelection);-
1243-
1244 cursorIsFocusIndicator = false;-
1245 selectedWordOnDoubleClick = cursor;-
1246-
1247 tripleClickPoint = pos;-
1248 tripleClickTimer.start(QGuiApplication::styleHints()->mouseDoubleClickInterval(), q);-
1249 if (doEmit) {
doEmitDescription
TRUEevaluated 104 times by 1 test
Evaluated by:
  • tst_qquicktextedit
FALSEnever evaluated
0-104
1250 selectionChanged();-
1251#if QT_CONFIG(clipboard)-
1252 setClipboardSelection();-
1253#endif-
1254 emit q->cursorPositionChanged();-
1255 q->updateCursorRectangle(true);-
1256 }
executed 104 times by 1 test: end of block
Executed by:
  • tst_qquicktextedit
104
1257 } else if (!sendMouseEventToInputContext(e, pos)) {
executed 104 times by 1 test: end of block
Executed by:
  • tst_qquicktextedit
!sendMouseEven...ontext(e, pos)Description
TRUEnever evaluated
FALSEnever evaluated
0-104
1258 e->ignore();-
1259 }
never executed: end of block
0
1260}
executed 104 times by 1 test: end of block
Executed by:
  • tst_qquicktextedit
104
1261-
1262bool QQuickTextControlPrivate::sendMouseEventToInputContext(QMouseEvent *e, const QPointF &pos)-
1263{-
1264#if QT_CONFIG(im)-
1265 Q_Q(QQuickTextControl);-
1266-
1267 Q_UNUSED(e);-
1268-
1269 if (isPreediting()) {
isPreediting()Description
TRUEnever evaluated
FALSEevaluated 1160 times by 1 test
Evaluated by:
  • tst_qquicktextedit
0-1160
1270 QTextLayout *layout = cursor.block().layout();-
1271 int cursorPos = q->hitTest(pos, Qt::FuzzyHit) - cursor.position();-
1272-
1273 if (cursorPos >= 0 && cursorPos <= layout->preeditAreaText().length()) {
cursorPos >= 0Description
TRUEnever evaluated
FALSEnever evaluated
cursorPos <= l...ext().length()Description
TRUEnever evaluated
FALSEnever evaluated
0
1274 if (e->type() == QEvent::MouseButtonRelease) {
e->type() == Q...eButtonReleaseDescription
TRUEnever evaluated
FALSEnever evaluated
0
1275 QGuiApplication::inputMethod()->invokeAction(QInputMethod::Click, cursorPos);-
1276 }
never executed: end of block
0
1277-
1278 return true;
never executed: return true;
0
1279 }-
1280 }
never executed: end of block
0
1281#else-
1282 Q_UNUSED(e);-
1283 Q_UNUSED(pos);-
1284#endif-
1285 return false;
executed 1160 times by 1 test: return false;
Executed by:
  • tst_qquicktextedit
1160
1286}-
1287-
1288#if QT_CONFIG(im)-
1289void QQuickTextControlPrivate::inputMethodEvent(QInputMethodEvent *e)-
1290{-
1291 Q_Q(QQuickTextControl);-
1292 if (!(interactionFlags & Qt::TextEditable) || cursor.isNull()) {
!(interactionF...:TextEditable)Description
TRUEnever evaluated
FALSEevaluated 324 times by 1 test
Evaluated by:
  • tst_qquicktextedit
cursor.isNull()Description
TRUEnever evaluated
FALSEevaluated 324 times by 1 test
Evaluated by:
  • tst_qquicktextedit
0-324
1293 e->ignore();-
1294 return;
never executed: return;
0
1295 }-
1296 bool isGettingInput = !e->commitString().isEmpty()
!e->commitString().isEmpty()Description
TRUEevaluated 136 times by 1 test
Evaluated by:
  • tst_qquicktextedit
FALSEevaluated 188 times by 1 test
Evaluated by:
  • tst_qquicktextedit
136-188
1297 || e->preeditString() != cursor.block().layout()->preeditAreaText()
e->preeditStri...editAreaText()Description
TRUEevaluated 44 times by 1 test
Evaluated by:
  • tst_qquicktextedit
FALSEevaluated 144 times by 1 test
Evaluated by:
  • tst_qquicktextedit
44-144
1298 || e->replacementLength() > 0;
e->replacementLength() > 0Description
TRUEevaluated 108 times by 1 test
Evaluated by:
  • tst_qquicktextedit
FALSEevaluated 36 times by 1 test
Evaluated by:
  • tst_qquicktextedit
36-108
1299 bool forceSelectionChanged = false;-
1300-
1301 cursor.beginEditBlock();-
1302 if (isGettingInput) {
isGettingInputDescription
TRUEevaluated 288 times by 1 test
Evaluated by:
  • tst_qquicktextedit
FALSEevaluated 36 times by 1 test
Evaluated by:
  • tst_qquicktextedit
36-288
1303 cursor.removeSelectedText();-
1304 }
executed 288 times by 1 test: end of block
Executed by:
  • tst_qquicktextedit
288
1305-
1306 QTextBlock block;-
1307-
1308 // insert commit string-
1309 if (!e->commitString().isEmpty() || e->replacementLength()) {
!e->commitString().isEmpty()Description
TRUEevaluated 136 times by 1 test
Evaluated by:
  • tst_qquicktextedit
FALSEevaluated 188 times by 1 test
Evaluated by:
  • tst_qquicktextedit
e->replacementLength()Description
TRUEevaluated 108 times by 1 test
Evaluated by:
  • tst_qquicktextedit
FALSEevaluated 80 times by 1 test
Evaluated by:
  • tst_qquicktextedit
80-188
1310 if (e->commitString().endsWith(QChar::LineFeed))
e->commitStrin...har::LineFeed)Description
TRUEnever evaluated
FALSEevaluated 244 times by 1 test
Evaluated by:
  • tst_qquicktextedit
0-244
1311 block = cursor.block(); // Remember the block where the preedit text is
never executed: block = cursor.block();
0
1312 QTextCursor c = cursor;-
1313 c.setPosition(c.position() + e->replacementStart());-
1314 c.setPosition(c.position() + e->replacementLength(), QTextCursor::KeepAnchor);-
1315 c.insertText(e->commitString());-
1316 }
executed 244 times by 1 test: end of block
Executed by:
  • tst_qquicktextedit
244
1317-
1318 for (int i = 0; i < e->attributes().size(); ++i) {
i < e->attributes().size()Description
TRUEevaluated 34 times by 1 test
Evaluated by:
  • tst_qquicktextedit
FALSEevaluated 324 times by 1 test
Evaluated by:
  • tst_qquicktextedit
34-324
1319 const QInputMethodEvent::Attribute &a = e->attributes().at(i);-
1320 if (a.type == QInputMethodEvent::Selection) {
a.type == QInp...ent::SelectionDescription
TRUEevaluated 4 times by 1 test
Evaluated by:
  • tst_qquicktextedit
FALSEevaluated 30 times by 1 test
Evaluated by:
  • tst_qquicktextedit
4-30
1321 QTextCursor oldCursor = cursor;-
1322 int blockStart = a.start + cursor.block().position();-
1323 cursor.setPosition(blockStart, QTextCursor::MoveAnchor);-
1324 cursor.setPosition(blockStart + a.length, QTextCursor::KeepAnchor);-
1325 repaintOldAndNewSelection(oldCursor);-
1326 forceSelectionChanged = true;-
1327 }
executed 4 times by 1 test: end of block
Executed by:
  • tst_qquicktextedit
4
1328 }
executed 34 times by 1 test: end of block
Executed by:
  • tst_qquicktextedit
34
1329-
1330 if (!block.isValid())
!block.isValid()Description
TRUEevaluated 324 times by 1 test
Evaluated by:
  • tst_qquicktextedit
FALSEnever evaluated
0-324
1331 block = cursor.block();
executed 324 times by 1 test: block = cursor.block();
Executed by:
  • tst_qquicktextedit
324
1332-
1333 QTextLayout *layout = block.layout();-
1334 if (isGettingInput) {
isGettingInputDescription
TRUEevaluated 288 times by 1 test
Evaluated by:
  • tst_qquicktextedit
FALSEevaluated 36 times by 1 test
Evaluated by:
  • tst_qquicktextedit
36-288
1335 layout->setPreeditArea(cursor.position() - block.position(), e->preeditString());-
1336 emit q->preeditTextChanged();-
1337 }
executed 288 times by 1 test: end of block
Executed by:
  • tst_qquicktextedit
288
1338 QVector<QTextLayout::FormatRange> overrides;-
1339 const int oldPreeditCursor = preeditCursor;-
1340 preeditCursor = e->preeditString().length();-
1341 hasImState = !e->preeditString().isEmpty();-
1342 cursorVisible = true;-
1343 for (int i = 0; i < e->attributes().size(); ++i) {
i < e->attributes().size()Description
TRUEevaluated 34 times by 1 test
Evaluated by:
  • tst_qquicktextedit
FALSEevaluated 324 times by 1 test
Evaluated by:
  • tst_qquicktextedit
34-324
1344 const QInputMethodEvent::Attribute &a = e->attributes().at(i);-
1345 if (a.type == QInputMethodEvent::Cursor) {
a.type == QInp...dEvent::CursorDescription
TRUEevaluated 28 times by 1 test
Evaluated by:
  • tst_qquicktextedit
FALSEevaluated 6 times by 1 test
Evaluated by:
  • tst_qquicktextedit
6-28
1346 hasImState = true;-
1347 preeditCursor = a.start;-
1348 cursorVisible = a.length != 0;-
1349 } else if (a.type == QInputMethodEvent::TextFormat) {
executed 28 times by 1 test: end of block
Executed by:
  • tst_qquicktextedit
a.type == QInp...nt::TextFormatDescription
TRUEevaluated 2 times by 1 test
Evaluated by:
  • tst_qquicktextedit
FALSEevaluated 4 times by 1 test
Evaluated by:
  • tst_qquicktextedit
2-28
1350 hasImState = true;-
1351 QTextCharFormat f = qvariant_cast<QTextFormat>(a.value).toCharFormat();-
1352 if (f.isValid()) {
f.isValid()Description
TRUEevaluated 2 times by 1 test
Evaluated by:
  • tst_qquicktextedit
FALSEnever evaluated
0-2
1353 QTextLayout::FormatRange o;-
1354 o.start = a.start + cursor.position() - block.position();-
1355 o.length = a.length;-
1356 o.format = f;-
1357 overrides.append(o);-
1358 }
executed 2 times by 1 test: end of block
Executed by:
  • tst_qquicktextedit
2
1359 }
executed 2 times by 1 test: end of block
Executed by:
  • tst_qquicktextedit
2
1360 }
executed 34 times by 1 test: end of block
Executed by:
  • tst_qquicktextedit
34
1361 layout->setFormats(overrides);-
1362-
1363 cursor.endEditBlock();-
1364-
1365 QTextCursorPrivate *cursor_d = QTextCursorPrivate::getPrivate(&cursor);-
1366 if (cursor_d)
cursor_dDescription
TRUEevaluated 324 times by 1 test
Evaluated by:
  • tst_qquicktextedit
FALSEnever evaluated
0-324
1367 cursor_d->setX();
executed 324 times by 1 test: cursor_d->setX();
Executed by:
  • tst_qquicktextedit
324
1368 q->updateCursorRectangle(oldPreeditCursor != preeditCursor || forceSelectionChanged || isGettingInput);-
1369 selectionChanged(forceSelectionChanged);-
1370}
executed 324 times by 1 test: end of block
Executed by:
  • tst_qquicktextedit
324
1371-
1372QVariant QQuickTextControl::inputMethodQuery(Qt::InputMethodQuery property) const-
1373{-
1374 return inputMethodQuery(property, QVariant());
never executed: return inputMethodQuery(property, QVariant());
0
1375}-
1376-
1377QVariant QQuickTextControl::inputMethodQuery(Qt::InputMethodQuery property, QVariant argument) const-
1378{-
1379 Q_D(const QQuickTextControl);-
1380 QTextBlock block = d->cursor.block();-
1381 switch (property) {-
1382 case Qt::ImCursorRectangle:
executed 26 times by 1 test: case Qt::ImCursorRectangle:
Executed by:
  • tst_qquicktextedit
26
1383 return cursorRect();
executed 26 times by 1 test: return cursorRect();
Executed by:
  • tst_qquicktextedit
26
1384 case Qt::ImAnchorRectangle:
never executed: case Qt::ImAnchorRectangle:
0
1385 return anchorRect();
never executed: return anchorRect();
0
1386 case Qt::ImFont:
never executed: case Qt::ImFont:
0
1387 return QVariant(d->cursor.charFormat().font());
never executed: return QVariant(d->cursor.charFormat().font());
0
1388 case Qt::ImCursorPosition: {
never executed: case Qt::ImCursorPosition:
0
1389 const QPointF pt = argument.toPointF();-
1390 if (!pt.isNull())
!pt.isNull()Description
TRUEnever evaluated
FALSEnever evaluated
0
1391 return QVariant(d->doc->documentLayout()->hitTest(pt, Qt::FuzzyHit) - block.position());
never executed: return QVariant(d->doc->documentLayout()->hitTest(pt, Qt::FuzzyHit) - block.position());
0
1392 return QVariant(d->cursor.position() - block.position());
never executed: return QVariant(d->cursor.position() - block.position());
0
1393 }-
1394 case Qt::ImSurroundingText:
never executed: case Qt::ImSurroundingText:
0
1395 return QVariant(block.text());
never executed: return QVariant(block.text());
0
1396 case Qt::ImCurrentSelection:
never executed: case Qt::ImCurrentSelection:
0
1397 return QVariant(d->cursor.selectedText());
never executed: return QVariant(d->cursor.selectedText());
0
1398 case Qt::ImMaximumTextLength:
never executed: case Qt::ImMaximumTextLength:
0
1399 return QVariant(); // No limit.
never executed: return QVariant();
0
1400 case Qt::ImAnchorPosition:
never executed: case Qt::ImAnchorPosition:
0
1401 return QVariant(d->cursor.anchor() - block.position());
never executed: return QVariant(d->cursor.anchor() - block.position());
0
1402 case Qt::ImAbsolutePosition:
never executed: case Qt::ImAbsolutePosition:
0
1403 return QVariant(d->cursor.anchor());
never executed: return QVariant(d->cursor.anchor());
0
1404 case Qt::ImTextAfterCursor:
never executed: case Qt::ImTextAfterCursor:
0
1405 {-
1406 int maxLength = argument.isValid() ? argument.toInt() : 1024;
argument.isValid()Description
TRUEnever evaluated
FALSEnever evaluated
0
1407 QTextCursor tmpCursor = d->cursor;-
1408 int localPos = d->cursor.position() - block.position();-
1409 QString result = block.text().mid(localPos);-
1410 while (result.length() < maxLength) {
result.length() < maxLengthDescription
TRUEnever evaluated
FALSEnever evaluated
0
1411 int currentBlock = tmpCursor.blockNumber();-
1412 tmpCursor.movePosition(QTextCursor::NextBlock);-
1413 if (tmpCursor.blockNumber() == currentBlock)
tmpCursor.bloc...= currentBlockDescription
TRUEnever evaluated
FALSEnever evaluated
0
1414 break;
never executed: break;
0
1415 result += QLatin1Char('\n') + tmpCursor.block().text();-
1416 }
never executed: end of block
0
1417 return QVariant(result);
never executed: return QVariant(result);
0
1418 }-
1419 case Qt::ImTextBeforeCursor:
never executed: case Qt::ImTextBeforeCursor:
0
1420 {-
1421 int maxLength = argument.isValid() ? argument.toInt() : 1024;
argument.isValid()Description
TRUEnever evaluated
FALSEnever evaluated
0
1422 QTextCursor tmpCursor = d->cursor;-
1423 int localPos = d->cursor.position() - block.position();-
1424 int numBlocks = 0;-
1425 int resultLen = localPos;-
1426 while (resultLen < maxLength) {
resultLen < maxLengthDescription
TRUEnever evaluated
FALSEnever evaluated
0
1427 int currentBlock = tmpCursor.blockNumber();-
1428 tmpCursor.movePosition(QTextCursor::PreviousBlock);-
1429 if (tmpCursor.blockNumber() == currentBlock)
tmpCursor.bloc...= currentBlockDescription
TRUEnever evaluated
FALSEnever evaluated
0
1430 break;
never executed: break;
0
1431 numBlocks++;-
1432 resultLen += tmpCursor.block().length();-
1433 }
never executed: end of block
0
1434 QString result;-
1435 while (numBlocks) {
numBlocksDescription
TRUEnever evaluated
FALSEnever evaluated
0
1436 result += tmpCursor.block().text() + QLatin1Char('\n');-
1437 tmpCursor.movePosition(QTextCursor::NextBlock);-
1438 --numBlocks;-
1439 }
never executed: end of block
0
1440 result += block.text().midRef(0,localPos);-
1441 return QVariant(result);
never executed: return QVariant(result);
0
1442 }-
1443 default:
never executed: default:
0
1444 return QVariant();
never executed: return QVariant();
0
1445 }-
1446}-
1447#endif // im-
1448-
1449void QQuickTextControlPrivate::focusEvent(QFocusEvent *e)-
1450{-
1451 Q_Q(QQuickTextControl);-
1452 emit q->updateRequest();-
1453 hasFocus = e->gotFocus();-
1454 if (e->gotFocus()) {
e->gotFocus()Description
TRUEevaluated 338 times by 3 tests
Evaluated by:
  • tst_qquickfocusscope
  • tst_qquickitem2
  • tst_qquicktextedit
FALSEevaluated 94 times by 3 tests
Evaluated by:
  • tst_qquickfocusscope
  • tst_qquickitem2
  • tst_qquicktextedit
94-338
1455 setBlinkingCursorEnabled(interactionFlags & (Qt::TextEditable | Qt::TextSelectableByKeyboard));-
1456 } else {
executed 338 times by 3 tests: end of block
Executed by:
  • tst_qquickfocusscope
  • tst_qquickitem2
  • tst_qquicktextedit
338
1457 setBlinkingCursorEnabled(false);-
1458-
1459 if (cursorIsFocusIndicator
cursorIsFocusIndicatorDescription
TRUEevaluated 90 times by 3 tests
Evaluated by:
  • tst_qquickfocusscope
  • tst_qquickitem2
  • tst_qquicktextedit
FALSEevaluated 4 times by 1 test
Evaluated by:
  • tst_qquicktextedit
4-90
1460 && e->reason() != Qt::ActiveWindowFocusReason
e->reason() !=...dowFocusReasonDescription
TRUEevaluated 84 times by 3 tests
Evaluated by:
  • tst_qquickfocusscope
  • tst_qquickitem2
  • tst_qquicktextedit
FALSEevaluated 6 times by 1 test
Evaluated by:
  • tst_qquicktextedit
6-84
1461 && e->reason() != Qt::PopupFocusReason
e->reason() !=...pupFocusReasonDescription
TRUEevaluated 84 times by 3 tests
Evaluated by:
  • tst_qquickfocusscope
  • tst_qquickitem2
  • tst_qquicktextedit
FALSEnever evaluated
0-84
1462 && cursor.hasSelection()) {
cursor.hasSelection()Description
TRUEevaluated 8 times by 1 test
Evaluated by:
  • tst_qquicktextedit
FALSEevaluated 76 times by 3 tests
Evaluated by:
  • tst_qquickfocusscope
  • tst_qquickitem2
  • tst_qquicktextedit
8-76
1463 cursor.clearSelection();-
1464 emit q->selectionChanged();-
1465 }
executed 8 times by 1 test: end of block
Executed by:
  • tst_qquicktextedit
8
1466 }
executed 94 times by 3 tests: end of block
Executed by:
  • tst_qquickfocusscope
  • tst_qquickitem2
  • tst_qquicktextedit
94
1467}-
1468-
1469void QQuickTextControlPrivate::hoverEvent(QHoverEvent *e, const QPointF &pos)-
1470{-
1471 Q_Q(QQuickTextControl);-
1472-
1473 QString link;-
1474 if (e->type() != QEvent::HoverLeave)
e->type() != Q...nt::HoverLeaveDescription
TRUEevaluated 8 times by 1 test
Evaluated by:
  • tst_qquicktextedit
FALSEnever evaluated
0-8
1475 link = q->anchorAt(pos);
executed 8 times by 1 test: link = q->anchorAt(pos);
Executed by:
  • tst_qquicktextedit
8
1476-
1477 if (hoveredLink != link) {
hoveredLink != linkDescription
TRUEevaluated 8 times by 1 test
Evaluated by:
  • tst_qquicktextedit
FALSEnever evaluated
0-8
1478 hoveredLink = link;-
1479 emit q->linkHovered(link);-
1480 }
executed 8 times by 1 test: end of block
Executed by:
  • tst_qquicktextedit
8
1481 qCDebug(DBG_HOVER_TRACE) << q << e->type() << pos << "hoveredLink" << hoveredLink;
never executed: QMessageLogger(__FILE__, 1481, __PRETTY_FUNCTION__, DBG_HOVER_TRACE().categoryName()).debug() << q << e->type() << pos << "hoveredLink" << hoveredLink;
qt_category_enabledDescription
TRUEnever evaluated
FALSEevaluated 8 times by 1 test
Evaluated by:
  • tst_qquicktextedit
0-8
1482}
executed 8 times by 1 test: end of block
Executed by:
  • tst_qquicktextedit
8
1483-
1484bool QQuickTextControl::hasImState() const-
1485{-
1486 Q_D(const QQuickTextControl);-
1487 return d->hasImState;
executed 672 times by 1 test: return d->hasImState;
Executed by:
  • tst_qquicktextedit
672
1488}-
1489-
1490bool QQuickTextControl::overwriteMode() const-
1491{-
1492 Q_D(const QQuickTextControl);-
1493 return d->overwriteMode;
executed 6 times by 1 test: return d->overwriteMode;
Executed by:
  • tst_qquicktextedit
6
1494}-
1495-
1496void QQuickTextControl::setOverwriteMode(bool overwrite)-
1497{-
1498 Q_D(QQuickTextControl);-
1499 if (d->overwriteMode == overwrite)
d->overwriteMode == overwriteDescription
TRUEnever evaluated
FALSEevaluated 10 times by 1 test
Evaluated by:
  • tst_qquicktextedit
0-10
1500 return;
never executed: return;
0
1501 d->overwriteMode = overwrite;-
1502 emit overwriteModeChanged(overwrite);-
1503}
executed 10 times by 1 test: end of block
Executed by:
  • tst_qquicktextedit
10
1504-
1505bool QQuickTextControl::cursorVisible() const-
1506{-
1507 Q_D(const QQuickTextControl);-
1508 return d->cursorVisible;
executed 324 times by 1 test: return d->cursorVisible;
Executed by:
  • tst_qquicktextedit
324
1509}-
1510-
1511void QQuickTextControl::setCursorVisible(bool visible)-
1512{-
1513 Q_D(QQuickTextControl);-
1514 d->cursorVisible = visible;-
1515 d->setBlinkingCursorEnabled(d->cursorVisible-
1516 && (d->interactionFlags & (Qt::TextEditable | Qt::TextSelectableByKeyboard)));-
1517}
executed 482 times by 4 tests: end of block
Executed by:
  • tst_examples
  • tst_qquickfocusscope
  • tst_qquickitem2
  • tst_qquicktextedit
482
1518-
1519QRectF QQuickTextControl::anchorRect() const-
1520{-
1521 Q_D(const QQuickTextControl);-
1522 QRectF rect;-
1523 QTextCursor cursor = d->cursor;-
1524 if (!cursor.isNull()) {
!cursor.isNull()Description
TRUEnever evaluated
FALSEnever evaluated
0
1525 rect = d->rectForPosition(cursor.anchor());-
1526 }
never executed: end of block
0
1527 return rect;
never executed: return rect;
0
1528}-
1529-
1530QRectF QQuickTextControl::cursorRect(const QTextCursor &cursor) const-
1531{-
1532 Q_D(const QQuickTextControl);-
1533 if (cursor.isNull())
cursor.isNull()Description
TRUEnever evaluated
FALSEevaluated 2696 times by 3 tests
Evaluated by:
  • tst_examples
  • tst_qquickfocusscope
  • tst_qquicktextedit
0-2696
1534 return QRectF();
never executed: return QRectF();
0
1535-
1536 return d->rectForPosition(cursor.position());
executed 2696 times by 3 tests: return d->rectForPosition(cursor.position());
Executed by:
  • tst_examples
  • tst_qquickfocusscope
  • tst_qquicktextedit
2696
1537}-
1538-
1539QRectF QQuickTextControl::cursorRect() const-
1540{-
1541 Q_D(const QQuickTextControl);-
1542 return cursorRect(d->cursor);
executed 2356 times by 3 tests: return cursorRect(d->cursor);
Executed by:
  • tst_examples
  • tst_qquickfocusscope
  • tst_qquicktextedit
2356
1543}-
1544-
1545QString QQuickTextControl::hoveredLink() const-
1546{-
1547 Q_D(const QQuickTextControl);-
1548 return d->hoveredLink;
executed 8 times by 1 test: return d->hoveredLink;
Executed by:
  • tst_qquicktextedit
8
1549}-
1550-
1551QString QQuickTextControl::anchorAt(const QPointF &pos) const-
1552{-
1553 Q_D(const QQuickTextControl);-
1554 return d->doc->documentLayout()->anchorAt(pos);
executed 1042 times by 1 test: return d->doc->documentLayout()->anchorAt(pos);
Executed by:
  • tst_qquicktextedit
1042
1555}-
1556-
1557void QQuickTextControl::setAcceptRichText(bool accept)-
1558{-
1559 Q_D(QQuickTextControl);-
1560 d->acceptRichText = accept;-
1561}
executed 1212 times by 6 tests: end of block
Executed by:
  • tst_examples
  • tst_qquickfocusscope
  • tst_qquickitem2
  • tst_qquicktextdocument
  • tst_qquicktextedit
  • tst_qquicktextinput
1212
1562-
1563void QQuickTextControl::moveCursor(QTextCursor::MoveOperation op, QTextCursor::MoveMode mode)-
1564{-
1565 Q_D(QQuickTextControl);-
1566 const QTextCursor oldSelection = d->cursor;-
1567 const bool moved = d->cursor.movePosition(op, mode);-
1568 d->_q_updateCurrentCharFormatAndSelection();-
1569 updateCursorRectangle(true);-
1570 d->repaintOldAndNewSelection(oldSelection);-
1571 if (moved)
movedDescription
TRUEevaluated 36 times by 1 test
Evaluated by:
  • tst_qquicktextedit
FALSEevaluated 26 times by 2 tests
Evaluated by:
  • tst_qquickitem2
  • tst_qquicktextedit
26-36
1572 emit cursorPositionChanged();
executed 36 times by 1 test: cursorPositionChanged();
Executed by:
  • tst_qquicktextedit
36
1573}
executed 62 times by 2 tests: end of block
Executed by:
  • tst_qquickitem2
  • tst_qquicktextedit
62
1574-
1575bool QQuickTextControl::canPaste() const-
1576{-
1577#if QT_CONFIG(clipboard)-
1578 Q_D(const QQuickTextControl);-
1579 if (d->interactionFlags & Qt::TextEditable) {
d->interaction...::TextEditableDescription
TRUEevaluated 4992 times by 1 test
Evaluated by:
  • tst_qquicktextedit
FALSEevaluated 44 times by 2 tests
Evaluated by:
  • tst_qquickitem2
  • tst_qquicktextedit
44-4992
1580 const QMimeData *md = QGuiApplication::clipboard()->mimeData();-
1581 return md && canInsertFromMimeData(md);
executed 4992 times by 1 test: return md && canInsertFromMimeData(md);
Executed by:
  • tst_qquicktextedit
4992
1582 }-
1583#endif-
1584 return false;
executed 44 times by 2 tests: return false;
Executed by:
  • tst_qquickitem2
  • tst_qquicktextedit
44
1585}-
1586-
1587void QQuickTextControl::setCursorIsFocusIndicator(bool b)-
1588{-
1589 Q_D(QQuickTextControl);-
1590 d->cursorIsFocusIndicator = b;-
1591 d->repaintCursor();-
1592}
executed 1186 times by 6 tests: end of block
Executed by:
  • tst_examples
  • tst_qquickfocusscope
  • tst_qquickitem2
  • tst_qquicktextdocument
  • tst_qquicktextedit
  • tst_qquicktextinput
1186
1593-
1594void QQuickTextControl::setWordSelectionEnabled(bool enabled)-
1595{-
1596 Q_D(QQuickTextControl);-
1597 d->wordSelectionEnabled = enabled;-
1598}
executed 30 times by 1 test: end of block
Executed by:
  • tst_qquicktextedit
30
1599-
1600QMimeData *QQuickTextControl::createMimeDataFromSelection() const-
1601{-
1602 Q_D(const QQuickTextControl);-
1603 const QTextDocumentFragment fragment(d->cursor);-
1604 return new QQuickTextEditMimeData(fragment);
executed 614 times by 1 test: return new QQuickTextEditMimeData(fragment);
Executed by:
  • tst_qquicktextedit
614
1605}-
1606-
1607bool QQuickTextControl::canInsertFromMimeData(const QMimeData *source) const-
1608{-
1609 Q_D(const QQuickTextControl);-
1610 if (d->acceptRichText)
d->acceptRichTextDescription
TRUEevaluated 386 times by 1 test
Evaluated by:
  • tst_qquicktextedit
FALSEevaluated 4606 times by 1 test
Evaluated by:
  • tst_qquicktextedit
386-4606
1611 return source->hasText()
executed 386 times by 1 test: return source->hasText() || source->hasHtml() || source->hasFormat(QLatin1String("application/x-qrichtext")) || source->hasFormat(QLatin1String("application/x-qt-richtext"));
Executed by:
  • tst_qquicktextedit
386
1612 || source->hasHtml()
executed 386 times by 1 test: return source->hasText() || source->hasHtml() || source->hasFormat(QLatin1String("application/x-qrichtext")) || source->hasFormat(QLatin1String("application/x-qt-richtext"));
Executed by:
  • tst_qquicktextedit
386
1613 || source->hasFormat(QLatin1String("application/x-qrichtext"))
executed 386 times by 1 test: return source->hasText() || source->hasHtml() || source->hasFormat(QLatin1String("application/x-qrichtext")) || source->hasFormat(QLatin1String("application/x-qt-richtext"));
Executed by:
  • tst_qquicktextedit
386
1614 || source->hasFormat(QLatin1String("application/x-qt-richtext"));
executed 386 times by 1 test: return source->hasText() || source->hasHtml() || source->hasFormat(QLatin1String("application/x-qrichtext")) || source->hasFormat(QLatin1String("application/x-qt-richtext"));
Executed by:
  • tst_qquicktextedit
386
1615 else-
1616 return source->hasText();
executed 4606 times by 1 test: return source->hasText();
Executed by:
  • tst_qquicktextedit
4606
1617}-
1618-
1619void QQuickTextControl::insertFromMimeData(const QMimeData *source)-
1620{-
1621 Q_D(QQuickTextControl);-
1622 if (!(d->interactionFlags & Qt::TextEditable) || !source)
!(d->interacti...:TextEditable)Description
TRUEevaluated 2 times by 1 test
Evaluated by:
  • tst_qquicktextedit
FALSEevaluated 14 times by 1 test
Evaluated by:
  • tst_qquicktextedit
!sourceDescription
TRUEnever evaluated
FALSEevaluated 14 times by 1 test
Evaluated by:
  • tst_qquicktextedit
0-14
1623 return;
executed 2 times by 1 test: return;
Executed by:
  • tst_qquicktextedit
2
1624-
1625 bool hasData = false;-
1626 QTextDocumentFragment fragment;-
1627#if QT_CONFIG(texthtmlparser)-
1628 if (source->hasFormat(QLatin1String("application/x-qrichtext")) && d->acceptRichText) {
source->hasFor...x-qrichtext"))Description
TRUEnever evaluated
FALSEevaluated 14 times by 1 test
Evaluated by:
  • tst_qquicktextedit
d->acceptRichTextDescription
TRUEnever evaluated
FALSEnever evaluated
0-14
1629 // x-qrichtext is always UTF-8 (taken from Qt3 since we don't use it anymore).-
1630 const QString richtext = QLatin1String("<meta name=\"qrichtext\" content=\"1\" />")-
1631 + QString::fromUtf8(source->data(QLatin1String("application/x-qrichtext")));-
1632 fragment = QTextDocumentFragment::fromHtml(richtext, d->doc);-
1633 hasData = true;-
1634 } else if (source->hasHtml() && d->acceptRichText) {
never executed: end of block
source->hasHtml()Description
TRUEevaluated 14 times by 1 test
Evaluated by:
  • tst_qquicktextedit
FALSEnever evaluated
d->acceptRichTextDescription
TRUEnever evaluated
FALSEevaluated 14 times by 1 test
Evaluated by:
  • tst_qquicktextedit
0-14
1635 fragment = QTextDocumentFragment::fromHtml(source->html(), d->doc);-
1636 hasData = true;-
1637 } else {
never executed: end of block
0
1638 QString text = source->text();-
1639 if (!text.isNull()) {
!text.isNull()Description
TRUEevaluated 12 times by 1 test
Evaluated by:
  • tst_qquicktextedit
FALSEevaluated 2 times by 1 test
Evaluated by:
  • tst_qquicktextedit
2-12
1640 fragment = QTextDocumentFragment::fromPlainText(text);-
1641 hasData = true;-
1642 }
executed 12 times by 1 test: end of block
Executed by:
  • tst_qquicktextedit
12
1643 }
executed 14 times by 1 test: end of block
Executed by:
  • tst_qquicktextedit
14
1644#else-
1645 fragment = QTextDocumentFragment::fromPlainText(source->text());-
1646#endif // texthtmlparser-
1647-
1648 if (hasData)
hasDataDescription
TRUEevaluated 12 times by 1 test
Evaluated by:
  • tst_qquicktextedit
FALSEevaluated 2 times by 1 test
Evaluated by:
  • tst_qquicktextedit
2-12
1649 d->cursor.insertFragment(fragment);
executed 12 times by 1 test: d->cursor.insertFragment(fragment);
Executed by:
  • tst_qquicktextedit
12
1650 updateCursorRectangle(true);-
1651}
executed 14 times by 1 test: end of block
Executed by:
  • tst_qquicktextedit
14
1652-
1653void QQuickTextControlPrivate::activateLinkUnderCursor(QString href)-
1654{-
1655 QTextCursor oldCursor = cursor;-
1656-
1657 if (href.isEmpty()) {
href.isEmpty()Description
TRUEnever evaluated
FALSEevaluated 4 times by 1 test
Evaluated by:
  • tst_qquicktextedit
0-4
1658 QTextCursor tmp = cursor;-
1659 if (tmp.selectionStart() != tmp.position())
tmp.selectionS...tmp.position()Description
TRUEnever evaluated
FALSEnever evaluated
0
1660 tmp.setPosition(tmp.selectionStart());
never executed: tmp.setPosition(tmp.selectionStart());
0
1661 tmp.movePosition(QTextCursor::NextCharacter);-
1662 href = tmp.charFormat().anchorHref();-
1663 }
never executed: end of block
0
1664 if (href.isEmpty())
href.isEmpty()Description
TRUEnever evaluated
FALSEevaluated 4 times by 1 test
Evaluated by:
  • tst_qquicktextedit
0-4
1665 return;
never executed: return;
0
1666-
1667 if (!cursor.hasSelection()) {
!cursor.hasSelection()Description
TRUEevaluated 4 times by 1 test
Evaluated by:
  • tst_qquicktextedit
FALSEnever evaluated
0-4
1668 QTextBlock block = cursor.block();-
1669 const int cursorPos = cursor.position();-
1670-
1671 QTextBlock::Iterator it = block.begin();-
1672 QTextBlock::Iterator linkFragment;-
1673-
1674 for (; !it.atEnd(); ++it) {
!it.atEnd()Description
TRUEevaluated 8 times by 1 test
Evaluated by:
  • tst_qquicktextedit
FALSEnever evaluated
0-8
1675 QTextFragment fragment = it.fragment();-
1676 const int fragmentPos = fragment.position();-
1677 if (fragmentPos <= cursorPos &&
fragmentPos <= cursorPosDescription
TRUEevaluated 8 times by 1 test
Evaluated by:
  • tst_qquicktextedit
FALSEnever evaluated
0-8
1678 fragmentPos + fragment.length() > cursorPos) {
fragmentPos + ...() > cursorPosDescription
TRUEevaluated 4 times by 1 test
Evaluated by:
  • tst_qquicktextedit
FALSEevaluated 4 times by 1 test
Evaluated by:
  • tst_qquicktextedit
4
1679 linkFragment = it;-
1680 break;
executed 4 times by 1 test: break;
Executed by:
  • tst_qquicktextedit
4
1681 }-
1682 }
executed 4 times by 1 test: end of block
Executed by:
  • tst_qquicktextedit
4
1683-
1684 if (!linkFragment.atEnd()) {
!linkFragment.atEnd()Description
TRUEevaluated 4 times by 1 test
Evaluated by:
  • tst_qquicktextedit
FALSEnever evaluated
0-4
1685 it = linkFragment;-
1686 cursor.setPosition(it.fragment().position());-
1687 if (it != block.begin()) {
it != block.begin()Description
TRUEevaluated 4 times by 1 test
Evaluated by:
  • tst_qquicktextedit
FALSEnever evaluated
0-4
1688 do {-
1689 --it;-
1690 QTextFragment fragment = it.fragment();-
1691 if (fragment.charFormat().anchorHref() != href)
fragment.charF...Href() != hrefDescription
TRUEevaluated 4 times by 1 test
Evaluated by:
  • tst_qquicktextedit
FALSEnever evaluated
0-4
1692 break;
executed 4 times by 1 test: break;
Executed by:
  • tst_qquicktextedit
4
1693 cursor.setPosition(fragment.position());-
1694 } while (it != block.begin());
never executed: end of block
it != block.begin()Description
TRUEnever evaluated
FALSEnever evaluated
0
1695 }
executed 4 times by 1 test: end of block
Executed by:
  • tst_qquicktextedit
4
1696-
1697 for (it = linkFragment; !it.atEnd(); ++it) {
!it.atEnd()Description
TRUEevaluated 4 times by 1 test
Evaluated by:
  • tst_qquicktextedit
FALSEevaluated 4 times by 1 test
Evaluated by:
  • tst_qquicktextedit
4
1698 QTextFragment fragment = it.fragment();-
1699 if (fragment.charFormat().anchorHref() != href)
fragment.charF...Href() != hrefDescription
TRUEnever evaluated
FALSEevaluated 4 times by 1 test
Evaluated by:
  • tst_qquicktextedit
0-4
1700 break;
never executed: break;
0
1701 cursor.setPosition(fragment.position() + fragment.length(), QTextCursor::KeepAnchor);-
1702 }
executed 4 times by 1 test: end of block
Executed by:
  • tst_qquicktextedit
4
1703 }
executed 4 times by 1 test: end of block
Executed by:
  • tst_qquicktextedit
4
1704 }
executed 4 times by 1 test: end of block
Executed by:
  • tst_qquicktextedit
4
1705-
1706 if (hasFocus) {
hasFocusDescription
TRUEevaluated 4 times by 1 test
Evaluated by:
  • tst_qquicktextedit
FALSEnever evaluated
0-4
1707 cursorIsFocusIndicator = true;-
1708 } else {
executed 4 times by 1 test: end of block
Executed by:
  • tst_qquicktextedit
4
1709 cursorIsFocusIndicator = false;-
1710 cursor.clearSelection();-
1711 }
never executed: end of block
0
1712 repaintOldAndNewSelection(oldCursor);-
1713-
1714 emit q_func()->linkActivated(href);-
1715}
executed 4 times by 1 test: end of block
Executed by:
  • tst_qquicktextedit
4
1716-
1717#if QT_CONFIG(im)-
1718bool QQuickTextControlPrivate::isPreediting() const-
1719{-
1720 QTextLayout *layout = cursor.block().layout();-
1721 if (layout && !layout->preeditAreaText().isEmpty())
layoutDescription
TRUEevaluated 1348 times by 1 test
Evaluated by:
  • tst_qquicktextedit
FALSEnever evaluated
!layout->preed...xt().isEmpty()Description
TRUEnever evaluated
FALSEevaluated 1348 times by 1 test
Evaluated by:
  • tst_qquicktextedit
0-1348
1722 return true;
never executed: return true;
0
1723-
1724 return false;
executed 1348 times by 1 test: return false;
Executed by:
  • tst_qquicktextedit
1348
1725}-
1726-
1727void QQuickTextControlPrivate::commitPreedit()-
1728{-
1729 Q_Q(QQuickTextControl);-
1730-
1731 if (!hasImState)
!hasImStateDescription
TRUEevaluated 1830 times by 1 test
Evaluated by:
  • tst_qquicktextedit
FALSEevaluated 2 times by 1 test
Evaluated by:
  • tst_qquicktextedit
2-1830
1732 return;
executed 1830 times by 1 test: return;
Executed by:
  • tst_qquicktextedit
1830
1733-
1734 QGuiApplication::inputMethod()->commit();-
1735-
1736 if (!hasImState)
!hasImStateDescription
TRUEnever evaluated
FALSEevaluated 2 times by 1 test
Evaluated by:
  • tst_qquicktextedit
0-2
1737 return;
never executed: return;
0
1738-
1739 QInputMethodEvent event;-
1740 QCoreApplication::sendEvent(q->parent(), &event);-
1741}
executed 2 times by 1 test: end of block
Executed by:
  • tst_qquicktextedit
2
1742-
1743void QQuickTextControlPrivate::cancelPreedit()-
1744{-
1745 Q_Q(QQuickTextControl);-
1746-
1747 if (!hasImState)
!hasImStateDescription
TRUEevaluated 1062 times by 5 tests
Evaluated by:
  • tst_examples
  • tst_qquickfocusscope
  • tst_qquickitem2
  • tst_qquicktextdocument
  • tst_qquicktextedit
FALSEevaluated 6 times by 1 test
Evaluated by:
  • tst_qquicktextedit
6-1062
1748 return;
executed 1062 times by 5 tests: return;
Executed by:
  • tst_examples
  • tst_qquickfocusscope
  • tst_qquickitem2
  • tst_qquicktextdocument
  • tst_qquicktextedit
1062
1749-
1750 QGuiApplication::inputMethod()->reset();-
1751-
1752 QInputMethodEvent event;-
1753 QCoreApplication::sendEvent(q->parent(), &event);-
1754}
executed 6 times by 1 test: end of block
Executed by:
  • tst_qquicktextedit
6
1755#endif // im-
1756-
1757void QQuickTextControl::setTextInteractionFlags(Qt::TextInteractionFlags flags)-
1758{-
1759 Q_D(QQuickTextControl);-
1760 if (flags == d->interactionFlags)
flags == d->interactionFlagsDescription
TRUEevaluated 16 times by 1 test
Evaluated by:
  • tst_qquicktextedit
FALSEevaluated 1272 times by 6 tests
Evaluated by:
  • tst_examples
  • tst_qquickfocusscope
  • tst_qquickitem2
  • tst_qquicktextdocument
  • tst_qquicktextedit
  • tst_qquicktextinput
16-1272
1761 return;
executed 16 times by 1 test: return;
Executed by:
  • tst_qquicktextedit
16
1762 d->interactionFlags = flags;-
1763-
1764 if (d->hasFocus)
d->hasFocusDescription
TRUEevaluated 30 times by 1 test
Evaluated by:
  • tst_qquicktextedit
FALSEevaluated 1242 times by 6 tests
Evaluated by:
  • tst_examples
  • tst_qquickfocusscope
  • tst_qquickitem2
  • tst_qquicktextdocument
  • tst_qquicktextedit
  • tst_qquicktextinput
30-1242
1765 d->setBlinkingCursorEnabled(flags & (Qt::TextEditable | Qt::TextSelectableByKeyboard));
executed 30 times by 1 test: d->setBlinkingCursorEnabled(flags & (Qt::TextEditable | Qt::TextSelectableByKeyboard));
Executed by:
  • tst_qquicktextedit
30
1766}
executed 1272 times by 6 tests: end of block
Executed by:
  • tst_examples
  • tst_qquickfocusscope
  • tst_qquickitem2
  • tst_qquicktextdocument
  • tst_qquicktextedit
  • tst_qquicktextinput
1272
1767-
1768Qt::TextInteractionFlags QQuickTextControl::textInteractionFlags() const-
1769{-
1770 Q_D(const QQuickTextControl);-
1771 return d->interactionFlags;
executed 1882 times by 4 tests: return d->interactionFlags;
Executed by:
  • tst_examples
  • tst_qquickfocusscope
  • tst_qquickitem2
  • tst_qquicktextedit
1882
1772}-
1773-
1774QString QQuickTextControl::toPlainText() const-
1775{-
1776 return document()->toPlainText();
executed 524 times by 2 tests: return document()->toPlainText();
Executed by:
  • tst_qquicktextdocument
  • tst_qquicktextedit
524
1777}-
1778-
1779#if QT_CONFIG(texthtmlparser)-
1780QString QQuickTextControl::toHtml() const-
1781{-
1782 return document()->toHtml();
executed 24 times by 1 test: return document()->toHtml();
Executed by:
  • tst_qquicktextedit
24
1783}-
1784#endif-
1785-
1786bool QQuickTextControl::cursorOn() const-
1787{-
1788 Q_D(const QQuickTextControl);-
1789 return d->cursorOn;
executed 142 times by 3 tests: return d->cursorOn;
Executed by:
  • tst_examples
  • tst_qquickfocusscope
  • tst_qquicktextedit
142
1790}-
1791-
1792int QQuickTextControl::hitTest(const QPointF &point, Qt::HitTestAccuracy accuracy) const-
1793{-
1794 Q_D(const QQuickTextControl);-
1795 return d->doc->documentLayout()->hitTest(point, accuracy);
executed 660 times by 1 test: return d->doc->documentLayout()->hitTest(point, accuracy);
Executed by:
  • tst_qquicktextedit
660
1796}-
1797-
1798QRectF QQuickTextControl::blockBoundingRect(const QTextBlock &block) const-
1799{-
1800 Q_D(const QQuickTextControl);-
1801 return d->doc->documentLayout()->blockBoundingRect(block);
executed 2760 times by 3 tests: return d->doc->documentLayout()->blockBoundingRect(block);
Executed by:
  • tst_examples
  • tst_qquickfocusscope
  • tst_qquicktextedit
2760
1802}-
1803-
1804QString QQuickTextControl::preeditText() const-
1805{-
1806#if QT_CONFIG(im)-
1807 Q_D(const QQuickTextControl);-
1808 QTextLayout *layout = d->cursor.block().layout();-
1809 if (!layout)
!layoutDescription
TRUEnever evaluated
FALSEevaluated 8 times by 1 test
Evaluated by:
  • tst_qquicktextedit
0-8
1810 return QString();
never executed: return QString();
0
1811-
1812 return layout->preeditAreaText();
executed 8 times by 1 test: return layout->preeditAreaText();
Executed by:
  • tst_qquicktextedit
8
1813#else-
1814 return QString();-
1815#endif-
1816}-
1817-
1818-
1819QStringList QQuickTextEditMimeData::formats() const-
1820{-
1821 if (!fragment.isEmpty())
!fragment.isEmpty()Description
TRUEevaluated 3000 times by 1 test
Evaluated by:
  • tst_qquicktextedit
FALSEevaluated 4 times by 1 test
Evaluated by:
  • tst_qquicktextedit
4-3000
1822 return QStringList() << QString::fromLatin1("text/plain") << QString::fromLatin1("text/html")
executed 3000 times by 1 test: return QStringList() << QString::fromLatin1("text/plain") << QString::fromLatin1("text/html") << QString::fromLatin1("application/vnd.oasis.opendocument.text") ;
Executed by:
  • tst_qquicktextedit
3000
1823#if QT_CONFIG(textodfwriter)
executed 3000 times by 1 test: return QStringList() << QString::fromLatin1("text/plain") << QString::fromLatin1("text/html") << QString::fromLatin1("application/vnd.oasis.opendocument.text") ;
Executed by:
  • tst_qquicktextedit
3000
1824 << QString::fromLatin1("application/vnd.oasis.opendocument.text")
executed 3000 times by 1 test: return QStringList() << QString::fromLatin1("text/plain") << QString::fromLatin1("text/html") << QString::fromLatin1("application/vnd.oasis.opendocument.text") ;
Executed by:
  • tst_qquicktextedit
3000
1825#endif
executed 3000 times by 1 test: return QStringList() << QString::fromLatin1("text/plain") << QString::fromLatin1("text/html") << QString::fromLatin1("application/vnd.oasis.opendocument.text") ;
Executed by:
  • tst_qquicktextedit
3000
1826 ;
executed 3000 times by 1 test: return QStringList() << QString::fromLatin1("text/plain") << QString::fromLatin1("text/html") << QString::fromLatin1("application/vnd.oasis.opendocument.text") ;
Executed by:
  • tst_qquicktextedit
3000
1827 else-
1828 return QMimeData::formats();
executed 4 times by 1 test: return QMimeData::formats();
Executed by:
  • tst_qquicktextedit
4
1829}-
1830-
1831QVariant QQuickTextEditMimeData::retrieveData(const QString &mimeType, QVariant::Type type) const-
1832{-
1833 if (!fragment.isEmpty())
!fragment.isEmpty()Description
TRUEevaluated 12 times by 1 test
Evaluated by:
  • tst_qquicktextedit
FALSEnever evaluated
0-12
1834 setup();
executed 12 times by 1 test: setup();
Executed by:
  • tst_qquicktextedit
12
1835 return QMimeData::retrieveData(mimeType, type);
executed 12 times by 1 test: return QMimeData::retrieveData(mimeType, type);
Executed by:
  • tst_qquicktextedit
12
1836}-
1837-
1838void QQuickTextEditMimeData::setup() const-
1839{-
1840 QQuickTextEditMimeData *that = const_cast<QQuickTextEditMimeData *>(this);-
1841#if QT_CONFIG(texthtmlparser)-
1842 that->setData(QLatin1String("text/html"), fragment.toHtml("utf-8").toUtf8());-
1843#endif-
1844#if QT_CONFIG(textodfwriter)-
1845 {-
1846 QBuffer buffer;-
1847 QTextDocumentWriter writer(&buffer, "ODF");-
1848 writer.write(fragment);-
1849 buffer.close();-
1850 that->setData(QLatin1String("application/vnd.oasis.opendocument.text"), buffer.data());-
1851 }-
1852#endif-
1853 that->setText(fragment.toPlainText());-
1854 fragment = QTextDocumentFragment();-
1855}
executed 12 times by 1 test: end of block
Executed by:
  • tst_qquicktextedit
12
1856-
1857-
1858QT_END_NAMESPACE-
1859-
1860#include "moc_qquicktextcontrol_p.cpp"-
1861-
1862#endif // QT_NO_TEXTCONTROL-
Source codeSwitch to Preprocessed file

Generated by Squish Coco 4.2.0