widgets/qwidgettextcontrol.cpp

Source codeSwitch to Preprocessed file
LineSource CodeCoverage
1/**************************************************************************** -
2** -
3** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). -
4** Contact: http://www.qt-project.org/legal -
5** -
6** This file is part of the QtGui module of the Qt Toolkit. -
7** -
8** $QT_BEGIN_LICENSE:LGPL$ -
9** Commercial License Usage -
10** Licensees holding valid commercial Qt licenses may use this file in -
11** accordance with the commercial license agreement provided with the -
12** Software or, alternatively, in accordance with the terms contained in -
13** a written agreement between you and Digia. For licensing terms and -
14** conditions see http://qt.digia.com/licensing. For further information -
15** use the contact form at http://qt.digia.com/contact-us. -
16** -
17** GNU Lesser General Public License Usage -
18** Alternatively, this file may be used under the terms of the GNU Lesser -
19** General Public License version 2.1 as published by the Free Software -
20** Foundation and appearing in the file LICENSE.LGPL included in the -
21** packaging of this file. Please review the following information to -
22** ensure the GNU Lesser General Public License version 2.1 requirements -
23** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -
24** -
25** In addition, as a special exception, Digia gives you certain additional -
26** rights. These rights are described in the Digia Qt LGPL Exception -
27** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -
28** -
29** GNU General Public License Usage -
30** Alternatively, this file may be used under the terms of the GNU -
31** General Public License version 3.0 as published by the Free Software -
32** Foundation and appearing in the file LICENSE.GPL included in the -
33** packaging of this file. Please review the following information to -
34** ensure the GNU General Public License version 3.0 requirements will be -
35** met: http://www.gnu.org/copyleft/gpl.html. -
36** -
37** -
38** $QT_END_LICENSE$ -
39** -
40****************************************************************************/ -
41 -
42#include "qwidgettextcontrol_p.h" -
43#include "qwidgettextcontrol_p_p.h" -
44 -
45#ifndef QT_NO_TEXTCONTROL -
46 -
47#include <qfont.h> -
48#include <qpainter.h> -
49#include <qevent.h> -
50#include <qdebug.h> -
51#include <qdrag.h> -
52#include <qclipboard.h> -
53#include <qmenu.h> -
54#include <qstyle.h> -
55#include <qtimer.h> -
56#include "private/qtextdocumentlayout_p.h" -
57#include "private/qabstracttextdocumentlayout_p.h" -
58#include "private/qtextedit_p.h" -
59#include "qtextdocument.h" -
60#include "private/qtextdocument_p.h" -
61#include "qtextlist.h" -
62#include "private/qwidgettextcontrol_p.h" -
63#include "qgraphicssceneevent.h" -
64#include "qpagedpaintdevice.h" -
65#include "private/qpagedpaintdevice_p.h" -
66#include "qtextdocumentwriter.h" -
67#include "qstylehints.h" -
68#include "private/qtextcursor_p.h" -
69 -
70#include <qtextformat.h> -
71#include <qdatetime.h> -
72#include <qbuffer.h> -
73#include <qapplication.h> -
74#include <limits.h> -
75#include <qtexttable.h> -
76#include <qvariant.h> -
77#include <qurl.h> -
78#include <qdesktopservices.h> -
79#include <qinputmethod.h> -
80#include <qtooltip.h> -
81#include <qstyleoption.h> -
82#include <QtWidgets/qlineedit.h> -
83#include <QtGui/qaccessible.h> -
84#include <QtCore/qmetaobject.h> -
85 -
86#ifndef QT_NO_SHORTCUT -
87#include "private/qapplication_p.h" -
88#include "private/qshortcutmap_p.h" -
89#include <qkeysequence.h> -
90#define ACCEL_KEY(k) (!qApp->d_func()->shortcutMap.hasShortcutForKeySequence(k) ? \ -
91 QLatin1Char('\t') + QKeySequence(k).toString(QKeySequence::NativeText) : QString()) -
92 -
93#else -
94#define ACCEL_KEY(k) QString() -
95#endif -
96 -
97#include <algorithm> -
98 -
99QT_BEGIN_NAMESPACE -
100 -
101// could go into QTextCursor... -
102static QTextLine currentTextLine(const QTextCursor &cursor) -
103{ -
104 const QTextBlock block = cursor.block();
executed (the execution status of this line is deduced): const QTextBlock block = cursor.block();
-
105 if (!block.isValid())
partially evaluated: !block.isValid()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:5
0-5
106 return QTextLine();
never executed: return QTextLine();
0
107 -
108 const QTextLayout *layout = block.layout();
executed (the execution status of this line is deduced): const QTextLayout *layout = block.layout();
-
109 if (!layout)
partially evaluated: !layout
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:5
0-5
110 return QTextLine();
never executed: return QTextLine();
0
111 -
112 const int relativePos = cursor.position() - block.position();
executed (the execution status of this line is deduced): const int relativePos = cursor.position() - block.position();
-
113 return layout->lineForTextPosition(relativePos);
executed: return layout->lineForTextPosition(relativePos);
Execution Count:5
5
114} -
115 -
116QWidgetTextControlPrivate::QWidgetTextControlPrivate() -
117 : doc(0), cursorOn(false), cursorIsFocusIndicator(false), -
118 interactionFlags(Qt::TextEditorInteraction), -
119 dragEnabled(true), -
120#ifndef QT_NO_DRAGANDDROP -
121 mousePressed(false), mightStartDrag(false), -
122#endif -
123 lastSelectionPosition(0), lastSelectionAnchor(0), -
124 ignoreAutomaticScrollbarAdjustement(false), -
125 overwriteMode(false), -
126 acceptRichText(true), -
127 preeditCursor(0), hideCursor(false), -
128 hasFocus(false), -
129#ifdef QT_KEYPAD_NAVIGATION -
130 hasEditFocus(false), -
131#endif -
132 isEnabled(true), -
133 hadSelectionOnMousePress(false), -
134 ignoreUnusedNavigationEvents(false), -
135 openExternalLinks(false), -
136 wordSelectionEnabled(false) -
137{}
executed: }
Execution Count:291
291
138 -
139bool QWidgetTextControlPrivate::cursorMoveKeyEvent(QKeyEvent *e) -
140{ -
141#ifdef QT_NO_SHORTCUT -
142 Q_UNUSED(e); -
143#endif -
144 -
145 Q_Q(QWidgetTextControl);
executed (the execution status of this line is deduced): QWidgetTextControl * const q = q_func();
-
146 if (cursor.isNull())
partially evaluated: cursor.isNull()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:154
0-154
147 return false;
never executed: return false;
0
148 -
149 const QTextCursor oldSelection = cursor;
executed (the execution status of this line is deduced): const QTextCursor oldSelection = cursor;
-
150 const int oldCursorPos = cursor.position();
executed (the execution status of this line is deduced): const int oldCursorPos = cursor.position();
-
151 -
152 QTextCursor::MoveMode mode = QTextCursor::MoveAnchor;
executed (the execution status of this line is deduced): QTextCursor::MoveMode mode = QTextCursor::MoveAnchor;
-
153 QTextCursor::MoveOperation op = QTextCursor::NoMove;
executed (the execution status of this line is deduced): QTextCursor::MoveOperation op = QTextCursor::NoMove;
-
154 -
155 if (false) {
partially evaluated: false
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:154
0-154
156 }
never executed: }
0
157#ifndef QT_NO_SHORTCUT -
158 if (e == QKeySequence::MoveToNextChar) {
evaluated: e == QKeySequence::MoveToNextChar
TRUEFALSE
yes
Evaluation Count:4
yes
Evaluation Count:150
4-150
159 op = QTextCursor::Right;
executed (the execution status of this line is deduced): op = QTextCursor::Right;
-
160 }
executed: }
Execution Count:4
4
161 else if (e == QKeySequence::MoveToPreviousChar) {
evaluated: e == QKeySequence::MoveToPreviousChar
TRUEFALSE
yes
Evaluation Count:3
yes
Evaluation Count:147
3-147
162 op = QTextCursor::Left;
executed (the execution status of this line is deduced): op = QTextCursor::Left;
-
163 }
executed: }
Execution Count:3
3
164 else if (e == QKeySequence::SelectNextChar) {
evaluated: e == QKeySequence::SelectNextChar
TRUEFALSE
yes
Evaluation Count:4
yes
Evaluation Count:143
4-143
165 op = QTextCursor::Right;
executed (the execution status of this line is deduced): op = QTextCursor::Right;
-
166 mode = QTextCursor::KeepAnchor;
executed (the execution status of this line is deduced): mode = QTextCursor::KeepAnchor;
-
167 }
executed: }
Execution Count:4
4
168 else if (e == QKeySequence::SelectPreviousChar) {
evaluated: e == QKeySequence::SelectPreviousChar
TRUEFALSE
yes
Evaluation Count:13
yes
Evaluation Count:130
13-130
169 op = QTextCursor::Left;
executed (the execution status of this line is deduced): op = QTextCursor::Left;
-
170 mode = QTextCursor::KeepAnchor;
executed (the execution status of this line is deduced): mode = QTextCursor::KeepAnchor;
-
171 }
executed: }
Execution Count:13
13
172 else if (e == QKeySequence::SelectNextWord) {
partially evaluated: e == QKeySequence::SelectNextWord
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:130
0-130
173 op = QTextCursor::WordRight;
never executed (the execution status of this line is deduced): op = QTextCursor::WordRight;
-
174 mode = QTextCursor::KeepAnchor;
never executed (the execution status of this line is deduced): mode = QTextCursor::KeepAnchor;
-
175 }
never executed: }
0
176 else if (e == QKeySequence::SelectPreviousWord) {
partially evaluated: e == QKeySequence::SelectPreviousWord
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:130
0-130
177 op = QTextCursor::WordLeft;
never executed (the execution status of this line is deduced): op = QTextCursor::WordLeft;
-
178 mode = QTextCursor::KeepAnchor;
never executed (the execution status of this line is deduced): mode = QTextCursor::KeepAnchor;
-
179 }
never executed: }
0
180 else if (e == QKeySequence::SelectStartOfLine) {
partially evaluated: e == QKeySequence::SelectStartOfLine
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:130
0-130
181 op = QTextCursor::StartOfLine;
never executed (the execution status of this line is deduced): op = QTextCursor::StartOfLine;
-
182 mode = QTextCursor::KeepAnchor;
never executed (the execution status of this line is deduced): mode = QTextCursor::KeepAnchor;
-
183 }
never executed: }
0
184 else if (e == QKeySequence::SelectEndOfLine) {
partially evaluated: e == QKeySequence::SelectEndOfLine
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:130
0-130
185 op = QTextCursor::EndOfLine;
never executed (the execution status of this line is deduced): op = QTextCursor::EndOfLine;
-
186 mode = QTextCursor::KeepAnchor;
never executed (the execution status of this line is deduced): mode = QTextCursor::KeepAnchor;
-
187 }
never executed: }
0
188 else if (e == QKeySequence::SelectStartOfBlock) {
partially evaluated: e == QKeySequence::SelectStartOfBlock
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:130
0-130
189 op = QTextCursor::StartOfBlock;
never executed (the execution status of this line is deduced): op = QTextCursor::StartOfBlock;
-
190 mode = QTextCursor::KeepAnchor;
never executed (the execution status of this line is deduced): mode = QTextCursor::KeepAnchor;
-
191 }
never executed: }
0
192 else if (e == QKeySequence::SelectEndOfBlock) {
partially evaluated: e == QKeySequence::SelectEndOfBlock
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:130
0-130
193 op = QTextCursor::EndOfBlock;
never executed (the execution status of this line is deduced): op = QTextCursor::EndOfBlock;
-
194 mode = QTextCursor::KeepAnchor;
never executed (the execution status of this line is deduced): mode = QTextCursor::KeepAnchor;
-
195 }
never executed: }
0
196 else if (e == QKeySequence::SelectStartOfDocument) {
partially evaluated: e == QKeySequence::SelectStartOfDocument
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:130
0-130
197 op = QTextCursor::Start;
never executed (the execution status of this line is deduced): op = QTextCursor::Start;
-
198 mode = QTextCursor::KeepAnchor;
never executed (the execution status of this line is deduced): mode = QTextCursor::KeepAnchor;
-
199 }
never executed: }
0
200 else if (e == QKeySequence::SelectEndOfDocument) {
partially evaluated: e == QKeySequence::SelectEndOfDocument
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:130
0-130
201 op = QTextCursor::End;
never executed (the execution status of this line is deduced): op = QTextCursor::End;
-
202 mode = QTextCursor::KeepAnchor;
never executed (the execution status of this line is deduced): mode = QTextCursor::KeepAnchor;
-
203 }
never executed: }
0
204 else if (e == QKeySequence::SelectPreviousLine) {
partially evaluated: e == QKeySequence::SelectPreviousLine
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:130
0-130
205 op = QTextCursor::Up;
never executed (the execution status of this line is deduced): op = QTextCursor::Up;
-
206 mode = QTextCursor::KeepAnchor;
never executed (the execution status of this line is deduced): mode = QTextCursor::KeepAnchor;
-
207 }
never executed: }
0
208 else if (e == QKeySequence::SelectNextLine) {
evaluated: e == QKeySequence::SelectNextLine
TRUEFALSE
yes
Evaluation Count:5
yes
Evaluation Count:125
5-125
209 op = QTextCursor::Down;
executed (the execution status of this line is deduced): op = QTextCursor::Down;
-
210 mode = QTextCursor::KeepAnchor;
executed (the execution status of this line is deduced): mode = QTextCursor::KeepAnchor;
-
211 { -
212 QTextBlock block = cursor.block();
executed (the execution status of this line is deduced): QTextBlock block = cursor.block();
-
213 QTextLine line = currentTextLine(cursor);
executed (the execution status of this line is deduced): QTextLine line = currentTextLine(cursor);
-
214 if (!block.next().isValid()
evaluated: !block.next().isValid()
TRUEFALSE
yes
Evaluation Count:3
yes
Evaluation Count:2
2-3
215 && line.isValid()
partially evaluated: line.isValid()
TRUEFALSE
yes
Evaluation Count:3
no
Evaluation Count:0
0-3
216 && line.lineNumber() == block.layout()->lineCount() - 1)
evaluated: line.lineNumber() == block.layout()->lineCount() - 1
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:1
1-2
217 op = QTextCursor::End;
executed: op = QTextCursor::End;
Execution Count:2
2
218 } -
219 }
executed: }
Execution Count:5
5
220 else if (e == QKeySequence::MoveToNextWord) {
partially evaluated: e == QKeySequence::MoveToNextWord
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:125
0-125
221 op = QTextCursor::WordRight;
never executed (the execution status of this line is deduced): op = QTextCursor::WordRight;
-
222 }
never executed: }
0
223 else if (e == QKeySequence::MoveToPreviousWord) {
partially evaluated: e == QKeySequence::MoveToPreviousWord
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:125
0-125
224 op = QTextCursor::WordLeft;
never executed (the execution status of this line is deduced): op = QTextCursor::WordLeft;
-
225 }
never executed: }
0
226 else if (e == QKeySequence::MoveToEndOfBlock) {
partially evaluated: e == QKeySequence::MoveToEndOfBlock
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:125
0-125
227 op = QTextCursor::EndOfBlock;
never executed (the execution status of this line is deduced): op = QTextCursor::EndOfBlock;
-
228 }
never executed: }
0
229 else if (e == QKeySequence::MoveToStartOfBlock) {
partially evaluated: e == QKeySequence::MoveToStartOfBlock
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:125
0-125
230 op = QTextCursor::StartOfBlock;
never executed (the execution status of this line is deduced): op = QTextCursor::StartOfBlock;
-
231 }
never executed: }
0
232 else if (e == QKeySequence::MoveToNextLine) {
evaluated: e == QKeySequence::MoveToNextLine
TRUEFALSE
yes
Evaluation Count:5
yes
Evaluation Count:120
5-120
233 op = QTextCursor::Down;
executed (the execution status of this line is deduced): op = QTextCursor::Down;
-
234 }
executed: }
Execution Count:5
5
235 else if (e == QKeySequence::MoveToPreviousLine) {
partially evaluated: e == QKeySequence::MoveToPreviousLine
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:120
0-120
236 op = QTextCursor::Up;
never executed (the execution status of this line is deduced): op = QTextCursor::Up;
-
237 }
never executed: }
0
238 else if (e == QKeySequence::MoveToPreviousLine) {
partially evaluated: e == QKeySequence::MoveToPreviousLine
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:120
0-120
239 op = QTextCursor::Up;
never executed (the execution status of this line is deduced): op = QTextCursor::Up;
-
240 }
never executed: }
0
241 else if (e == QKeySequence::MoveToStartOfLine) {
partially evaluated: e == QKeySequence::MoveToStartOfLine
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:120
0-120
242 op = QTextCursor::StartOfLine;
never executed (the execution status of this line is deduced): op = QTextCursor::StartOfLine;
-
243 }
never executed: }
0
244 else if (e == QKeySequence::MoveToEndOfLine) {
partially evaluated: e == QKeySequence::MoveToEndOfLine
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:120
0-120
245 op = QTextCursor::EndOfLine;
never executed (the execution status of this line is deduced): op = QTextCursor::EndOfLine;
-
246 }
never executed: }
0
247 else if (e == QKeySequence::MoveToStartOfDocument) {
partially evaluated: e == QKeySequence::MoveToStartOfDocument
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:120
0-120
248 op = QTextCursor::Start;
never executed (the execution status of this line is deduced): op = QTextCursor::Start;
-
249 }
never executed: }
0
250 else if (e == QKeySequence::MoveToEndOfDocument) {
partially evaluated: e == QKeySequence::MoveToEndOfDocument
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:120
0-120
251 op = QTextCursor::End;
never executed (the execution status of this line is deduced): op = QTextCursor::End;
-
252 }
never executed: }
0
253#endif // QT_NO_SHORTCUT -
254 else { -
255 return false;
executed: return false;
Execution Count:120
120
256 } -
257 -
258// Except for pageup and pagedown, Mac OS X has very different behavior, we don't do it all, but -
259// here's the breakdown: -
260// Shift still works as an anchor, but only one of the other keys can be down Ctrl (Command), -
261// Alt (Option), or Meta (Control). -
262// Command/Control + Left/Right -- Move to left or right of the line -
263// + Up/Down -- Move to top bottom of the file. (Control doesn't move the cursor) -
264// Option + Left/Right -- Move one word Left/right. -
265// + Up/Down -- Begin/End of Paragraph. -
266// Home/End Top/Bottom of file. (usually don't move the cursor, but will select) -
267 -
268 bool visualNavigation = cursor.visualNavigation();
executed (the execution status of this line is deduced): bool visualNavigation = cursor.visualNavigation();
-
269 cursor.setVisualNavigation(true);
executed (the execution status of this line is deduced): cursor.setVisualNavigation(true);
-
270 const bool moved = cursor.movePosition(op, mode);
executed (the execution status of this line is deduced): const bool moved = cursor.movePosition(op, mode);
-
271 cursor.setVisualNavigation(visualNavigation);
executed (the execution status of this line is deduced): cursor.setVisualNavigation(visualNavigation);
-
272 q->ensureCursorVisible();
executed (the execution status of this line is deduced): q->ensureCursorVisible();
-
273 -
274 bool ignoreNavigationEvents = ignoreUnusedNavigationEvents;
executed (the execution status of this line is deduced): bool ignoreNavigationEvents = ignoreUnusedNavigationEvents;
-
275 bool isNavigationEvent = e->key() == Qt::Key_Up || e->key() == Qt::Key_Down;
partially evaluated: e->key() == Qt::Key_Up
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:34
evaluated: e->key() == Qt::Key_Down
TRUEFALSE
yes
Evaluation Count:10
yes
Evaluation Count:24
0-34
276 -
277#ifdef QT_KEYPAD_NAVIGATION -
278 ignoreNavigationEvents = ignoreNavigationEvents || QApplication::keypadNavigationEnabled(); -
279 isNavigationEvent = isNavigationEvent || -
280 (QApplication::navigationMode() == Qt::NavigationModeKeypadDirectional -
281 && (e->key() == Qt::Key_Left || e->key() == Qt::Key_Right)); -
282#else -
283 isNavigationEvent = isNavigationEvent || e->key() == Qt::Key_Left || e->key() == Qt::Key_Right;
evaluated: isNavigationEvent
TRUEFALSE
yes
Evaluation Count:10
yes
Evaluation Count:24
evaluated: e->key() == Qt::Key_Left
TRUEFALSE
yes
Evaluation Count:16
yes
Evaluation Count:8
partially evaluated: e->key() == Qt::Key_Right
TRUEFALSE
yes
Evaluation Count:8
no
Evaluation Count:0
0-24
284#endif -
285 -
286 if (moved) {
evaluated: moved
TRUEFALSE
yes
Evaluation Count:29
yes
Evaluation Count:5
5-29
287 if (cursor.position() != oldCursorPos)
partially evaluated: cursor.position() != oldCursorPos
TRUEFALSE
yes
Evaluation Count:29
no
Evaluation Count:0
0-29
288 emit q->cursorPositionChanged();
executed: q->cursorPositionChanged();
Execution Count:29
29
289 emit q->microFocusChanged();
executed (the execution status of this line is deduced): q->microFocusChanged();
-
290 } else if (ignoreNavigationEvents && isNavigationEvent && oldSelection.anchor() == cursor.anchor()) {
executed: }
Execution Count:29
partially evaluated: ignoreNavigationEvents
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:5
never evaluated: isNavigationEvent
never evaluated: oldSelection.anchor() == cursor.anchor()
0-29
291 return false;
never executed: return false;
0
292 } -
293 -
294 selectionChanged(/*forceEmitSelectionChanged =*/(mode == QTextCursor::KeepAnchor));
executed (the execution status of this line is deduced): selectionChanged( (mode == QTextCursor::KeepAnchor));
-
295 -
296 repaintOldAndNewSelection(oldSelection);
executed (the execution status of this line is deduced): repaintOldAndNewSelection(oldSelection);
-
297 -
298 return true;
executed: return true;
Execution Count:34
34
299} -
300 -
301void QWidgetTextControlPrivate::updateCurrentCharFormat() -
302{ -
303 Q_Q(QWidgetTextControl);
executed (the execution status of this line is deduced): QWidgetTextControl * const q = q_func();
-
304 -
305 QTextCharFormat fmt = cursor.charFormat();
executed (the execution status of this line is deduced): QTextCharFormat fmt = cursor.charFormat();
-
306 if (fmt == lastCharFormat)
evaluated: fmt == lastCharFormat
TRUEFALSE
yes
Evaluation Count:1558
yes
Evaluation Count:44
44-1558
307 return;
executed: return;
Execution Count:1558
1558
308 lastCharFormat = fmt;
executed (the execution status of this line is deduced): lastCharFormat = fmt;
-
309 -
310 emit q->currentCharFormatChanged(fmt);
executed (the execution status of this line is deduced): q->currentCharFormatChanged(fmt);
-
311 emit q->microFocusChanged();
executed (the execution status of this line is deduced): q->microFocusChanged();
-
312}
executed: }
Execution Count:44
44
313 -
314void QWidgetTextControlPrivate::indent() -
315{ -
316 QTextBlockFormat blockFmt = cursor.blockFormat();
never executed (the execution status of this line is deduced): QTextBlockFormat blockFmt = cursor.blockFormat();
-
317 -
318 QTextList *list = cursor.currentList();
never executed (the execution status of this line is deduced): QTextList *list = cursor.currentList();
-
319 if (!list) {
never evaluated: !list
0
320 QTextBlockFormat modifier;
never executed (the execution status of this line is deduced): QTextBlockFormat modifier;
-
321 modifier.setIndent(blockFmt.indent() + 1);
never executed (the execution status of this line is deduced): modifier.setIndent(blockFmt.indent() + 1);
-
322 cursor.mergeBlockFormat(modifier);
never executed (the execution status of this line is deduced): cursor.mergeBlockFormat(modifier);
-
323 } else {
never executed: }
0
324 QTextListFormat format = list->format();
never executed (the execution status of this line is deduced): QTextListFormat format = list->format();
-
325 format.setIndent(format.indent() + 1);
never executed (the execution status of this line is deduced): format.setIndent(format.indent() + 1);
-
326 -
327 if (list->itemNumber(cursor.block()) == 1)
never evaluated: list->itemNumber(cursor.block()) == 1
0
328 list->setFormat(format);
never executed: list->setFormat(format);
0
329 else -
330 cursor.createList(format);
never executed: cursor.createList(format);
0
331 } -
332} -
333 -
334void QWidgetTextControlPrivate::outdent() -
335{ -
336 QTextBlockFormat blockFmt = cursor.blockFormat();
never executed (the execution status of this line is deduced): QTextBlockFormat blockFmt = cursor.blockFormat();
-
337 -
338 QTextList *list = cursor.currentList();
never executed (the execution status of this line is deduced): QTextList *list = cursor.currentList();
-
339 -
340 if (!list) {
never evaluated: !list
0
341 QTextBlockFormat modifier;
never executed (the execution status of this line is deduced): QTextBlockFormat modifier;
-
342 modifier.setIndent(blockFmt.indent() - 1);
never executed (the execution status of this line is deduced): modifier.setIndent(blockFmt.indent() - 1);
-
343 cursor.mergeBlockFormat(modifier);
never executed (the execution status of this line is deduced): cursor.mergeBlockFormat(modifier);
-
344 } else {
never executed: }
0
345 QTextListFormat listFmt = list->format();
never executed (the execution status of this line is deduced): QTextListFormat listFmt = list->format();
-
346 listFmt.setIndent(listFmt.indent() - 1);
never executed (the execution status of this line is deduced): listFmt.setIndent(listFmt.indent() - 1);
-
347 list->setFormat(listFmt);
never executed (the execution status of this line is deduced): list->setFormat(listFmt);
-
348 }
never executed: }
0
349} -
350 -
351void QWidgetTextControlPrivate::gotoNextTableCell() -
352{ -
353 QTextTable *table = cursor.currentTable();
never executed (the execution status of this line is deduced): QTextTable *table = cursor.currentTable();
-
354 QTextTableCell cell = table->cellAt(cursor);
never executed (the execution status of this line is deduced): QTextTableCell cell = table->cellAt(cursor);
-
355 -
356 int newColumn = cell.column() + cell.columnSpan();
never executed (the execution status of this line is deduced): int newColumn = cell.column() + cell.columnSpan();
-
357 int newRow = cell.row();
never executed (the execution status of this line is deduced): int newRow = cell.row();
-
358 -
359 if (newColumn >= table->columns()) {
never evaluated: newColumn >= table->columns()
0
360 newColumn = 0;
never executed (the execution status of this line is deduced): newColumn = 0;
-
361 ++newRow;
never executed (the execution status of this line is deduced): ++newRow;
-
362 if (newRow >= table->rows())
never evaluated: newRow >= table->rows()
0
363 table->insertRows(table->rows(), 1);
never executed: table->insertRows(table->rows(), 1);
0
364 }
never executed: }
0
365 -
366 cell = table->cellAt(newRow, newColumn);
never executed (the execution status of this line is deduced): cell = table->cellAt(newRow, newColumn);
-
367 cursor = cell.firstCursorPosition();
never executed (the execution status of this line is deduced): cursor = cell.firstCursorPosition();
-
368}
never executed: }
0
369 -
370void QWidgetTextControlPrivate::gotoPreviousTableCell() -
371{ -
372 QTextTable *table = cursor.currentTable();
never executed (the execution status of this line is deduced): QTextTable *table = cursor.currentTable();
-
373 QTextTableCell cell = table->cellAt(cursor);
never executed (the execution status of this line is deduced): QTextTableCell cell = table->cellAt(cursor);
-
374 -
375 int newColumn = cell.column() - 1;
never executed (the execution status of this line is deduced): int newColumn = cell.column() - 1;
-
376 int newRow = cell.row();
never executed (the execution status of this line is deduced): int newRow = cell.row();
-
377 -
378 if (newColumn < 0) {
never evaluated: newColumn < 0
0
379 newColumn = table->columns() - 1;
never executed (the execution status of this line is deduced): newColumn = table->columns() - 1;
-
380 --newRow;
never executed (the execution status of this line is deduced): --newRow;
-
381 if (newRow < 0)
never evaluated: newRow < 0
0
382 return;
never executed: return;
0
383 }
never executed: }
0
384 -
385 cell = table->cellAt(newRow, newColumn);
never executed (the execution status of this line is deduced): cell = table->cellAt(newRow, newColumn);
-
386 cursor = cell.firstCursorPosition();
never executed (the execution status of this line is deduced): cursor = cell.firstCursorPosition();
-
387}
never executed: }
0
388 -
389void QWidgetTextControlPrivate::createAutoBulletList() -
390{ -
391 cursor.beginEditBlock();
never executed (the execution status of this line is deduced): cursor.beginEditBlock();
-
392 -
393 QTextBlockFormat blockFmt = cursor.blockFormat();
never executed (the execution status of this line is deduced): QTextBlockFormat blockFmt = cursor.blockFormat();
-
394 -
395 QTextListFormat listFmt;
never executed (the execution status of this line is deduced): QTextListFormat listFmt;
-
396 listFmt.setStyle(QTextListFormat::ListDisc);
never executed (the execution status of this line is deduced): listFmt.setStyle(QTextListFormat::ListDisc);
-
397 listFmt.setIndent(blockFmt.indent() + 1);
never executed (the execution status of this line is deduced): listFmt.setIndent(blockFmt.indent() + 1);
-
398 -
399 blockFmt.setIndent(0);
never executed (the execution status of this line is deduced): blockFmt.setIndent(0);
-
400 cursor.setBlockFormat(blockFmt);
never executed (the execution status of this line is deduced): cursor.setBlockFormat(blockFmt);
-
401 -
402 cursor.createList(listFmt);
never executed (the execution status of this line is deduced): cursor.createList(listFmt);
-
403 -
404 cursor.endEditBlock();
never executed (the execution status of this line is deduced): cursor.endEditBlock();
-
405}
never executed: }
0
406 -
407void QWidgetTextControlPrivate::init(Qt::TextFormat format, const QString &text, QTextDocument *document) -
408{ -
409 Q_Q(QWidgetTextControl);
executed (the execution status of this line is deduced): QWidgetTextControl * const q = q_func();
-
410 setContent(format, text, document);
executed (the execution status of this line is deduced): setContent(format, text, document);
-
411 -
412 doc->setUndoRedoEnabled(interactionFlags & Qt::TextEditable);
executed (the execution status of this line is deduced): doc->setUndoRedoEnabled(interactionFlags & Qt::TextEditable);
-
413 q->setCursorWidth(-1);
executed (the execution status of this line is deduced): q->setCursorWidth(-1);
-
414}
executed: }
Execution Count:291
291
415 -
416void QWidgetTextControlPrivate::setContent(Qt::TextFormat format, const QString &text, QTextDocument *document) -
417{ -
418 Q_Q(QWidgetTextControl);
executed (the execution status of this line is deduced): QWidgetTextControl * const q = q_func();
-
419 -
420 // for use when called from setPlainText. we may want to re-use the currently -
421 // set char format then. -
422 const QTextCharFormat charFormatForInsertion = cursor.charFormat();
executed (the execution status of this line is deduced): const QTextCharFormat charFormatForInsertion = cursor.charFormat();
-
423 -
424 bool clearDocument = true;
executed (the execution status of this line is deduced): bool clearDocument = true;
-
425 if (!doc) {
evaluated: !doc
TRUEFALSE
yes
Evaluation Count:387
yes
Evaluation Count:267
267-387
426 if (document) {
evaluated: document
TRUEFALSE
yes
Evaluation Count:96
yes
Evaluation Count:291
96-291
427 doc = document;
executed (the execution status of this line is deduced): doc = document;
-
428 clearDocument = false;
executed (the execution status of this line is deduced): clearDocument = false;
-
429 } else {
executed: }
Execution Count:96
96
430 palette = QApplication::palette("QWidgetTextControl");
executed (the execution status of this line is deduced): palette = QApplication::palette("QWidgetTextControl");
-
431 doc = new QTextDocument(q);
executed (the execution status of this line is deduced): doc = new QTextDocument(q);
-
432 }
executed: }
Execution Count:291
291
433 _q_documentLayoutChanged();
executed (the execution status of this line is deduced): _q_documentLayoutChanged();
-
434 cursor = QTextCursor(doc);
executed (the execution status of this line is deduced): cursor = QTextCursor(doc);
-
435 -
436// #### doc->documentLayout()->setPaintDevice(viewport); -
437 -
438 QObject::connect(doc, SIGNAL(contentsChanged()), q, SLOT(_q_updateCurrentCharFormatAndSelection()));
executed (the execution status of this line is deduced): QObject::connect(doc, "2""contentsChanged()", q, "1""_q_updateCurrentCharFormatAndSelection()");
-
439 QObject::connect(doc, SIGNAL(cursorPositionChanged(QTextCursor)), q, SLOT(_q_emitCursorPosChanged(QTextCursor)));
executed (the execution status of this line is deduced): QObject::connect(doc, "2""cursorPositionChanged(QTextCursor)", q, "1""_q_emitCursorPosChanged(QTextCursor)");
-
440 QObject::connect(doc, SIGNAL(documentLayoutChanged()), q, SLOT(_q_documentLayoutChanged()));
executed (the execution status of this line is deduced): QObject::connect(doc, "2""documentLayoutChanged()", q, "1""_q_documentLayoutChanged()");
-
441 -
442 // convenience signal forwards -
443 QObject::connect(doc, SIGNAL(undoAvailable(bool)), q, SIGNAL(undoAvailable(bool)));
executed (the execution status of this line is deduced): QObject::connect(doc, "2""undoAvailable(bool)", q, "2""undoAvailable(bool)");
-
444 QObject::connect(doc, SIGNAL(redoAvailable(bool)), q, SIGNAL(redoAvailable(bool)));
executed (the execution status of this line is deduced): QObject::connect(doc, "2""redoAvailable(bool)", q, "2""redoAvailable(bool)");
-
445 QObject::connect(doc, SIGNAL(modificationChanged(bool)), q, SIGNAL(modificationChanged(bool)));
executed (the execution status of this line is deduced): QObject::connect(doc, "2""modificationChanged(bool)", q, "2""modificationChanged(bool)");
-
446 QObject::connect(doc, SIGNAL(blockCountChanged(int)), q, SIGNAL(blockCountChanged(int)));
executed (the execution status of this line is deduced): QObject::connect(doc, "2""blockCountChanged(int)", q, "2""blockCountChanged(int)");
-
447 }
executed: }
Execution Count:387
387
448 -
449 bool previousUndoRedoState = doc->isUndoRedoEnabled();
executed (the execution status of this line is deduced): bool previousUndoRedoState = doc->isUndoRedoEnabled();
-
450 if (!document)
evaluated: !document
TRUEFALSE
yes
Evaluation Count:558
yes
Evaluation Count:96
96-558
451 doc->setUndoRedoEnabled(false);
executed: doc->setUndoRedoEnabled(false);
Execution Count:558
558
452 -
453 //Saving the index save some time. -
454 static int contentsChangedIndex = QMetaMethod::fromSignal(&QTextDocument::contentsChanged).methodIndex(); -
455 static int textChangedIndex = QMetaMethod::fromSignal(&QWidgetTextControl::textChanged).methodIndex(); -
456 // avoid multiple textChanged() signals being emitted -
457 QMetaObject::disconnect(doc, contentsChangedIndex, q, textChangedIndex);
executed (the execution status of this line is deduced): QMetaObject::disconnect(doc, contentsChangedIndex, q, textChangedIndex);
-
458 -
459 if (!text.isEmpty()) {
evaluated: !text.isEmpty()
TRUEFALSE
yes
Evaluation Count:232
yes
Evaluation Count:422
232-422
460 // clear 'our' cursor for insertion to prevent -
461 // the emission of the cursorPositionChanged() signal. -
462 // instead we emit it only once at the end instead of -
463 // at the end of the document after loading and when -
464 // positioning the cursor again to the start of the -
465 // document. -
466 cursor = QTextCursor();
executed (the execution status of this line is deduced): cursor = QTextCursor();
-
467 if (format == Qt::PlainText) {
evaluated: format == Qt::PlainText
TRUEFALSE
yes
Evaluation Count:161
yes
Evaluation Count:71
71-161
468 QTextCursor formatCursor(doc);
executed (the execution status of this line is deduced): QTextCursor formatCursor(doc);
-
469 // put the setPlainText and the setCharFormat into one edit block, -
470 // so that the syntax highlight triggers only /once/ for the entire -
471 // document, not twice. -
472 formatCursor.beginEditBlock();
executed (the execution status of this line is deduced): formatCursor.beginEditBlock();
-
473 doc->setPlainText(text);
executed (the execution status of this line is deduced): doc->setPlainText(text);
-
474 doc->setUndoRedoEnabled(false);
executed (the execution status of this line is deduced): doc->setUndoRedoEnabled(false);
-
475 formatCursor.select(QTextCursor::Document);
executed (the execution status of this line is deduced): formatCursor.select(QTextCursor::Document);
-
476 formatCursor.setCharFormat(charFormatForInsertion);
executed (the execution status of this line is deduced): formatCursor.setCharFormat(charFormatForInsertion);
-
477 formatCursor.endEditBlock();
executed (the execution status of this line is deduced): formatCursor.endEditBlock();
-
478 } else {
executed: }
Execution Count:161
161
479#ifndef QT_NO_TEXTHTMLPARSER -
480 doc->setHtml(text);
executed (the execution status of this line is deduced): doc->setHtml(text);
-
481#else -
482 doc->setPlainText(text); -
483#endif -
484 doc->setUndoRedoEnabled(false);
executed (the execution status of this line is deduced): doc->setUndoRedoEnabled(false);
-
485 }
executed: }
Execution Count:71
71
486 cursor = QTextCursor(doc);
executed (the execution status of this line is deduced): cursor = QTextCursor(doc);
-
487 } else if (clearDocument) {
executed: }
Execution Count:232
evaluated: clearDocument
TRUEFALSE
yes
Evaluation Count:326
yes
Evaluation Count:96
96-326
488 doc->clear();
executed (the execution status of this line is deduced): doc->clear();
-
489 }
executed: }
Execution Count:326
326
490 cursor.setCharFormat(charFormatForInsertion);
executed (the execution status of this line is deduced): cursor.setCharFormat(charFormatForInsertion);
-
491 -
492 QMetaObject::connect(doc, contentsChangedIndex, q, textChangedIndex);
executed (the execution status of this line is deduced): QMetaObject::connect(doc, contentsChangedIndex, q, textChangedIndex);
-
493 emit q->textChanged();
executed (the execution status of this line is deduced): q->textChanged();
-
494 if (!document)
evaluated: !document
TRUEFALSE
yes
Evaluation Count:558
yes
Evaluation Count:96
96-558
495 doc->setUndoRedoEnabled(previousUndoRedoState);
executed: doc->setUndoRedoEnabled(previousUndoRedoState);
Execution Count:558
558
496 _q_updateCurrentCharFormatAndSelection();
executed (the execution status of this line is deduced): _q_updateCurrentCharFormatAndSelection();
-
497 if (!document)
evaluated: !document
TRUEFALSE
yes
Evaluation Count:558
yes
Evaluation Count:96
96-558
498 doc->setModified(false);
executed: doc->setModified(false);
Execution Count:558
558
499 -
500 q->ensureCursorVisible();
executed (the execution status of this line is deduced): q->ensureCursorVisible();
-
501 emit q->cursorPositionChanged();
executed (the execution status of this line is deduced): q->cursorPositionChanged();
-
502}
executed: }
Execution Count:654
654
503 -
504void QWidgetTextControlPrivate::startDrag() -
505{ -
506#ifndef QT_NO_DRAGANDDROP -
507 Q_Q(QWidgetTextControl);
never executed (the execution status of this line is deduced): QWidgetTextControl * const q = q_func();
-
508 mousePressed = false;
never executed (the execution status of this line is deduced): mousePressed = false;
-
509 if (!contextWidget)
never evaluated: !contextWidget
0
510 return;
never executed: return;
0
511 QMimeData *data = q->createMimeDataFromSelection();
never executed (the execution status of this line is deduced): QMimeData *data = q->createMimeDataFromSelection();
-
512 -
513 QDrag *drag = new QDrag(contextWidget);
never executed (the execution status of this line is deduced): QDrag *drag = new QDrag(contextWidget);
-
514 drag->setMimeData(data);
never executed (the execution status of this line is deduced): drag->setMimeData(data);
-
515 -
516 Qt::DropActions actions = Qt::CopyAction;
never executed (the execution status of this line is deduced): Qt::DropActions actions = Qt::CopyAction;
-
517 Qt::DropAction action;
never executed (the execution status of this line is deduced): Qt::DropAction action;
-
518 if (interactionFlags & Qt::TextEditable) {
never evaluated: interactionFlags & Qt::TextEditable
0
519 actions |= Qt::MoveAction;
never executed (the execution status of this line is deduced): actions |= Qt::MoveAction;
-
520 action = drag->exec(actions, Qt::MoveAction);
never executed (the execution status of this line is deduced): action = drag->exec(actions, Qt::MoveAction);
-
521 } else {
never executed: }
0
522 action = drag->exec(actions, Qt::CopyAction);
never executed (the execution status of this line is deduced): action = drag->exec(actions, Qt::CopyAction);
-
523 }
never executed: }
0
524 -
525 if (action == Qt::MoveAction && drag->target() != contextWidget)
never evaluated: action == Qt::MoveAction
never evaluated: drag->target() != contextWidget
0
526 cursor.removeSelectedText();
never executed: cursor.removeSelectedText();
0
527#endif -
528}
never executed: }
0
529 -
530void QWidgetTextControlPrivate::setCursorPosition(const QPointF &pos) -
531{ -
532 Q_Q(QWidgetTextControl);
never executed (the execution status of this line is deduced): QWidgetTextControl * const q = q_func();
-
533 const int cursorPos = q->hitTest(pos, Qt::FuzzyHit);
never executed (the execution status of this line is deduced): const int cursorPos = q->hitTest(pos, Qt::FuzzyHit);
-
534 if (cursorPos == -1)
never evaluated: cursorPos == -1
0
535 return;
never executed: return;
0
536 cursor.setPosition(cursorPos);
never executed (the execution status of this line is deduced): cursor.setPosition(cursorPos);
-
537}
never executed: }
0
538 -
539void QWidgetTextControlPrivate::setCursorPosition(int pos, QTextCursor::MoveMode mode) -
540{ -
541 cursor.setPosition(pos, mode);
executed (the execution status of this line is deduced): cursor.setPosition(pos, mode);
-
542 -
543 if (mode != QTextCursor::KeepAnchor) {
partially evaluated: mode != QTextCursor::KeepAnchor
TRUEFALSE
yes
Evaluation Count:2
no
Evaluation Count:0
0-2
544 selectedWordOnDoubleClick = QTextCursor();
executed (the execution status of this line is deduced): selectedWordOnDoubleClick = QTextCursor();
-
545 selectedBlockOnTrippleClick = QTextCursor();
executed (the execution status of this line is deduced): selectedBlockOnTrippleClick = QTextCursor();
-
546 }
executed: }
Execution Count:2
2
547}
executed: }
Execution Count:2
2
548 -
549void QWidgetTextControlPrivate::repaintCursor() -
550{ -
551 Q_Q(QWidgetTextControl);
executed (the execution status of this line is deduced): QWidgetTextControl * const q = q_func();
-
552 emit q->updateRequest(cursorRectPlusUnicodeDirectionMarkers(cursor));
executed (the execution status of this line is deduced): q->updateRequest(cursorRectPlusUnicodeDirectionMarkers(cursor));
-
553}
executed: }
Execution Count:428
428
554 -
555void QWidgetTextControlPrivate::repaintOldAndNewSelection(const QTextCursor &oldSelection) -
556{ -
557 Q_Q(QWidgetTextControl);
executed (the execution status of this line is deduced): QWidgetTextControl * const q = q_func();
-
558 if (cursor.hasSelection()
evaluated: cursor.hasSelection()
TRUEFALSE
yes
Evaluation Count:59
yes
Evaluation Count:155
59-155
559 && oldSelection.hasSelection()
evaluated: oldSelection.hasSelection()
TRUEFALSE
yes
Evaluation Count:18
yes
Evaluation Count:41
18-41
560 && cursor.currentFrame() == oldSelection.currentFrame()
partially evaluated: cursor.currentFrame() == oldSelection.currentFrame()
TRUEFALSE
yes
Evaluation Count:18
no
Evaluation Count:0
0-18
561 && !cursor.hasComplexSelection()
partially evaluated: !cursor.hasComplexSelection()
TRUEFALSE
yes
Evaluation Count:18
no
Evaluation Count:0
0-18
562 && !oldSelection.hasComplexSelection()
partially evaluated: !oldSelection.hasComplexSelection()
TRUEFALSE
yes
Evaluation Count:18
no
Evaluation Count:0
0-18
563 && cursor.anchor() == oldSelection.anchor()
evaluated: cursor.anchor() == oldSelection.anchor()
TRUEFALSE
yes
Evaluation Count:17
yes
Evaluation Count:1
1-17
564 ) { -
565 QTextCursor differenceSelection(doc);
executed (the execution status of this line is deduced): QTextCursor differenceSelection(doc);
-
566 differenceSelection.setPosition(oldSelection.position());
executed (the execution status of this line is deduced): differenceSelection.setPosition(oldSelection.position());
-
567 differenceSelection.setPosition(cursor.position(), QTextCursor::KeepAnchor);
executed (the execution status of this line is deduced): differenceSelection.setPosition(cursor.position(), QTextCursor::KeepAnchor);
-
568 emit q->updateRequest(q->selectionRect(differenceSelection));
executed (the execution status of this line is deduced): q->updateRequest(q->selectionRect(differenceSelection));
-
569 } else {
executed: }
Execution Count:17
17
570 if (!oldSelection.isNull())
evaluated: !oldSelection.isNull()
TRUEFALSE
yes
Evaluation Count:67
yes
Evaluation Count:130
67-130
571 emit q->updateRequest(q->selectionRect(oldSelection) | cursorRectPlusUnicodeDirectionMarkers(oldSelection));
executed: q->updateRequest(q->selectionRect(oldSelection) | cursorRectPlusUnicodeDirectionMarkers(oldSelection));
Execution Count:67
67
572 emit q->updateRequest(q->selectionRect() | cursorRectPlusUnicodeDirectionMarkers(cursor));
executed (the execution status of this line is deduced): q->updateRequest(q->selectionRect() | cursorRectPlusUnicodeDirectionMarkers(cursor));
-
573 }
executed: }
Execution Count:197
197
574} -
575 -
576void QWidgetTextControlPrivate::selectionChanged(bool forceEmitSelectionChanged /*=false*/) -
577{ -
578 Q_Q(QWidgetTextControl);
executed (the execution status of this line is deduced): QWidgetTextControl * const q = q_func();
-
579 if (forceEmitSelectionChanged) {
evaluated: forceEmitSelectionChanged
TRUEFALSE
yes
Evaluation Count:27
yes
Evaluation Count:1564
27-1564
580 emit q->selectionChanged();
executed (the execution status of this line is deduced): q->selectionChanged();
-
581#ifndef QT_NO_ACCESSIBILITY -
582 if (q->parent()) {
partially evaluated: q->parent()
TRUEFALSE
yes
Evaluation Count:27
no
Evaluation Count:0
0-27
583 QAccessibleTextSelectionEvent ev(q->parent(), cursor.anchor(), cursor.position());
executed (the execution status of this line is deduced): QAccessibleTextSelectionEvent ev(q->parent(), cursor.anchor(), cursor.position());
-
584 QAccessible::updateAccessibility(&ev);
executed (the execution status of this line is deduced): QAccessible::updateAccessibility(&ev);
-
585 }
executed: }
Execution Count:27
27
586#endif -
587 }
executed: }
Execution Count:27
27
588 -
589 if (cursor.position() == lastSelectionPosition
evaluated: cursor.position() == lastSelectionPosition
TRUEFALSE
yes
Evaluation Count:908
yes
Evaluation Count:683
683-908
590 && cursor.anchor() == lastSelectionAnchor)
evaluated: cursor.anchor() == lastSelectionAnchor
TRUEFALSE
yes
Evaluation Count:901
yes
Evaluation Count:7
7-901
591 return;
executed: return;
Execution Count:901
901
592 -
593 bool selectionStateChange = (cursor.hasSelection()
executed (the execution status of this line is deduced): bool selectionStateChange = (cursor.hasSelection()
-
594 != (lastSelectionPosition != lastSelectionAnchor));
executed (the execution status of this line is deduced): != (lastSelectionPosition != lastSelectionAnchor));
-
595 if (selectionStateChange)
evaluated: selectionStateChange
TRUEFALSE
yes
Evaluation Count:47
yes
Evaluation Count:643
47-643
596 emit q->copyAvailable(cursor.hasSelection());
executed: q->copyAvailable(cursor.hasSelection());
Execution Count:47
47
597 -
598 if (!forceEmitSelectionChanged
evaluated: !forceEmitSelectionChanged
TRUEFALSE
yes
Evaluation Count:663
yes
Evaluation Count:27
27-663
599 && (selectionStateChange
evaluated: selectionStateChange
TRUEFALSE
yes
Evaluation Count:33
yes
Evaluation Count:630
33-630
600 || (cursor.hasSelection()
evaluated: cursor.hasSelection()
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:629
1-629
601 && (cursor.position() != lastSelectionPosition
partially evaluated: cursor.position() != lastSelectionPosition
TRUEFALSE
yes
Evaluation Count:1
no
Evaluation Count:0
0-1
602 || cursor.anchor() != lastSelectionAnchor)))) {
never evaluated: cursor.anchor() != lastSelectionAnchor
0
603 emit q->selectionChanged();
executed (the execution status of this line is deduced): q->selectionChanged();
-
604#ifndef QT_NO_ACCESSIBILITY -
605 if (q->parent()) {
partially evaluated: q->parent()
TRUEFALSE
yes
Evaluation Count:34
no
Evaluation Count:0
0-34
606 QAccessibleTextSelectionEvent ev(q->parent(), cursor.anchor(), cursor.position());
executed (the execution status of this line is deduced): QAccessibleTextSelectionEvent ev(q->parent(), cursor.anchor(), cursor.position());
-
607 QAccessible::updateAccessibility(&ev);
executed (the execution status of this line is deduced): QAccessible::updateAccessibility(&ev);
-
608 }
executed: }
Execution Count:34
34
609#endif -
610 }
executed: }
Execution Count:34
34
611 emit q->microFocusChanged();
executed (the execution status of this line is deduced): q->microFocusChanged();
-
612 lastSelectionPosition = cursor.position();
executed (the execution status of this line is deduced): lastSelectionPosition = cursor.position();
-
613 lastSelectionAnchor = cursor.anchor();
executed (the execution status of this line is deduced): lastSelectionAnchor = cursor.anchor();
-
614}
executed: }
Execution Count:690
690
615 -
616void QWidgetTextControlPrivate::_q_updateCurrentCharFormatAndSelection() -
617{ -
618 updateCurrentCharFormat();
executed (the execution status of this line is deduced): updateCurrentCharFormat();
-
619 selectionChanged();
executed (the execution status of this line is deduced): selectionChanged();
-
620}
executed: }
Execution Count:1479
1479
621 -
622#ifndef QT_NO_CLIPBOARD -
623void QWidgetTextControlPrivate::setClipboardSelection() -
624{ -
625 QClipboard *clipboard = QApplication::clipboard();
never executed (the execution status of this line is deduced): QClipboard *clipboard = QApplication::clipboard();
-
626 if (!cursor.hasSelection() || !clipboard->supportsSelection())
never evaluated: !cursor.hasSelection()
never evaluated: !clipboard->supportsSelection()
0
627 return;
never executed: return;
0
628 Q_Q(QWidgetTextControl);
never executed (the execution status of this line is deduced): QWidgetTextControl * const q = q_func();
-
629 QMimeData *data = q->createMimeDataFromSelection();
never executed (the execution status of this line is deduced): QMimeData *data = q->createMimeDataFromSelection();
-
630 clipboard->setMimeData(data, QClipboard::Selection);
never executed (the execution status of this line is deduced): clipboard->setMimeData(data, QClipboard::Selection);
-
631}
never executed: }
0
632#endif -
633 -
634void QWidgetTextControlPrivate::_q_emitCursorPosChanged(const QTextCursor &someCursor) -
635{ -
636 Q_Q(QWidgetTextControl);
executed (the execution status of this line is deduced): QWidgetTextControl * const q = q_func();
-
637 if (someCursor.isCopyOf(cursor)) {
evaluated: someCursor.isCopyOf(cursor)
TRUEFALSE
yes
Evaluation Count:147
yes
Evaluation Count:240
147-240
638 emit q->cursorPositionChanged();
executed (the execution status of this line is deduced): q->cursorPositionChanged();
-
639 emit q->microFocusChanged();
executed (the execution status of this line is deduced): q->microFocusChanged();
-
640 }
executed: }
Execution Count:147
147
641}
executed: }
Execution Count:387
387
642 -
643void QWidgetTextControlPrivate::_q_documentLayoutChanged() -
644{ -
645 Q_Q(QWidgetTextControl);
executed (the execution status of this line is deduced): QWidgetTextControl * const q = q_func();
-
646 QAbstractTextDocumentLayout *layout = doc->documentLayout();
executed (the execution status of this line is deduced): QAbstractTextDocumentLayout *layout = doc->documentLayout();
-
647 QObject::connect(layout, SIGNAL(update(QRectF)), q, SIGNAL(updateRequest(QRectF)));
executed (the execution status of this line is deduced): QObject::connect(layout, "2""update(QRectF)", q, "2""updateRequest(QRectF)");
-
648 QObject::connect(layout, SIGNAL(updateBlock(QTextBlock)), q, SLOT(_q_updateBlock(QTextBlock)));
executed (the execution status of this line is deduced): QObject::connect(layout, "2""updateBlock(QTextBlock)", q, "1""_q_updateBlock(QTextBlock)");
-
649 QObject::connect(layout, SIGNAL(documentSizeChanged(QSizeF)), q, SIGNAL(documentSizeChanged(QSizeF)));
executed (the execution status of this line is deduced): QObject::connect(layout, "2""documentSizeChanged(QSizeF)", q, "2""documentSizeChanged(QSizeF)");
-
650 -
651}
executed: }
Execution Count:387
387
652 -
653void QWidgetTextControlPrivate::setBlinkingCursorEnabled(bool enable) -
654{ -
655 Q_Q(QWidgetTextControl);
executed (the execution status of this line is deduced): QWidgetTextControl * const q = q_func();
-
656 -
657 if (enable && QApplication::cursorFlashTime() > 0)
evaluated: enable
TRUEFALSE
yes
Evaluation Count:53
yes
Evaluation Count:73
partially evaluated: QApplication::cursorFlashTime() > 0
TRUEFALSE
yes
Evaluation Count:53
no
Evaluation Count:0
0-73
658 cursorBlinkTimer.start(QApplication::cursorFlashTime() / 2, q);
executed: cursorBlinkTimer.start(QApplication::cursorFlashTime() / 2, q);
Execution Count:53
53
659 else -
660 cursorBlinkTimer.stop();
executed: cursorBlinkTimer.stop();
Execution Count:73
73
661 -
662 cursorOn = enable;
executed (the execution status of this line is deduced): cursorOn = enable;
-
663 -
664 repaintCursor();
executed (the execution status of this line is deduced): repaintCursor();
-
665}
executed: }
Execution Count:126
126
666 -
667void QWidgetTextControlPrivate::extendWordwiseSelection(int suggestedNewPosition, qreal mouseXPosition) -
668{ -
669 Q_Q(QWidgetTextControl);
never executed (the execution status of this line is deduced): QWidgetTextControl * const q = q_func();
-
670 -
671 // if inside the initial selected word keep that -
672 if (suggestedNewPosition >= selectedWordOnDoubleClick.selectionStart()
never evaluated: suggestedNewPosition >= selectedWordOnDoubleClick.selectionStart()
0
673 && suggestedNewPosition <= selectedWordOnDoubleClick.selectionEnd()) {
never evaluated: suggestedNewPosition <= selectedWordOnDoubleClick.selectionEnd()
0
674 q->setTextCursor(selectedWordOnDoubleClick);
never executed (the execution status of this line is deduced): q->setTextCursor(selectedWordOnDoubleClick);
-
675 return;
never executed: return;
0
676 } -
677 -
678 QTextCursor curs = selectedWordOnDoubleClick;
never executed (the execution status of this line is deduced): QTextCursor curs = selectedWordOnDoubleClick;
-
679 curs.setPosition(suggestedNewPosition, QTextCursor::KeepAnchor);
never executed (the execution status of this line is deduced): curs.setPosition(suggestedNewPosition, QTextCursor::KeepAnchor);
-
680 -
681 if (!curs.movePosition(QTextCursor::StartOfWord))
never evaluated: !curs.movePosition(QTextCursor::StartOfWord)
0
682 return;
never executed: return;
0
683 const int wordStartPos = curs.position();
never executed (the execution status of this line is deduced): const int wordStartPos = curs.position();
-
684 -
685 const int blockPos = curs.block().position();
never executed (the execution status of this line is deduced): const int blockPos = curs.block().position();
-
686 const QPointF blockCoordinates = q->blockBoundingRect(curs.block()).topLeft();
never executed (the execution status of this line is deduced): const QPointF blockCoordinates = q->blockBoundingRect(curs.block()).topLeft();
-
687 -
688 QTextLine line = currentTextLine(curs);
never executed (the execution status of this line is deduced): QTextLine line = currentTextLine(curs);
-
689 if (!line.isValid())
never evaluated: !line.isValid()
0
690 return;
never executed: return;
0
691 -
692 const qreal wordStartX = line.cursorToX(curs.position() - blockPos) + blockCoordinates.x();
never executed (the execution status of this line is deduced): const qreal wordStartX = line.cursorToX(curs.position() - blockPos) + blockCoordinates.x();
-
693 -
694 if (!curs.movePosition(QTextCursor::EndOfWord))
never evaluated: !curs.movePosition(QTextCursor::EndOfWord)
0
695 return;
never executed: return;
0
696 const int wordEndPos = curs.position();
never executed (the execution status of this line is deduced): const int wordEndPos = curs.position();
-
697 -
698 const QTextLine otherLine = currentTextLine(curs);
never executed (the execution status of this line is deduced): const QTextLine otherLine = currentTextLine(curs);
-
699 if (otherLine.textStart() != line.textStart()
never evaluated: otherLine.textStart() != line.textStart()
0
700 || wordEndPos == wordStartPos)
never evaluated: wordEndPos == wordStartPos
0
701 return;
never executed: return;
0
702 -
703 const qreal wordEndX = line.cursorToX(curs.position() - blockPos) + blockCoordinates.x();
never executed (the execution status of this line is deduced): const qreal wordEndX = line.cursorToX(curs.position() - blockPos) + blockCoordinates.x();
-
704 -
705 if (!wordSelectionEnabled && (mouseXPosition < wordStartX || mouseXPosition > wordEndX))
never evaluated: !wordSelectionEnabled
never evaluated: mouseXPosition < wordStartX
never evaluated: mouseXPosition > wordEndX
0
706 return;
never executed: return;
0
707 -
708 if (wordSelectionEnabled) {
never evaluated: wordSelectionEnabled
0
709 if (suggestedNewPosition < selectedWordOnDoubleClick.position()) {
never evaluated: suggestedNewPosition < selectedWordOnDoubleClick.position()
0
710 cursor.setPosition(selectedWordOnDoubleClick.selectionEnd());
never executed (the execution status of this line is deduced): cursor.setPosition(selectedWordOnDoubleClick.selectionEnd());
-
711 setCursorPosition(wordStartPos, QTextCursor::KeepAnchor);
never executed (the execution status of this line is deduced): setCursorPosition(wordStartPos, QTextCursor::KeepAnchor);
-
712 } else {
never executed: }
0
713 cursor.setPosition(selectedWordOnDoubleClick.selectionStart());
never executed (the execution status of this line is deduced): cursor.setPosition(selectedWordOnDoubleClick.selectionStart());
-
714 setCursorPosition(wordEndPos, QTextCursor::KeepAnchor);
never executed (the execution status of this line is deduced): setCursorPosition(wordEndPos, QTextCursor::KeepAnchor);
-
715 }
never executed: }
0
716 } else { -
717 // keep the already selected word even when moving to the left -
718 // (#39164) -
719 if (suggestedNewPosition < selectedWordOnDoubleClick.position())
never evaluated: suggestedNewPosition < selectedWordOnDoubleClick.position()
0
720 cursor.setPosition(selectedWordOnDoubleClick.selectionEnd());
never executed: cursor.setPosition(selectedWordOnDoubleClick.selectionEnd());
0
721 else -
722 cursor.setPosition(selectedWordOnDoubleClick.selectionStart());
never executed: cursor.setPosition(selectedWordOnDoubleClick.selectionStart());
0
723 -
724 const qreal differenceToStart = mouseXPosition - wordStartX;
never executed (the execution status of this line is deduced): const qreal differenceToStart = mouseXPosition - wordStartX;
-
725 const qreal differenceToEnd = wordEndX - mouseXPosition;
never executed (the execution status of this line is deduced): const qreal differenceToEnd = wordEndX - mouseXPosition;
-
726 -
727 if (differenceToStart < differenceToEnd)
never evaluated: differenceToStart < differenceToEnd
0
728 setCursorPosition(wordStartPos, QTextCursor::KeepAnchor);
never executed: setCursorPosition(wordStartPos, QTextCursor::KeepAnchor);
0
729 else -
730 setCursorPosition(wordEndPos, QTextCursor::KeepAnchor);
never executed: setCursorPosition(wordEndPos, QTextCursor::KeepAnchor);
0
731 } -
732 -
733 if (interactionFlags & Qt::TextSelectableByMouse) {
never evaluated: interactionFlags & Qt::TextSelectableByMouse
0
734#ifndef QT_NO_CLIPBOARD -
735 setClipboardSelection();
never executed (the execution status of this line is deduced): setClipboardSelection();
-
736#endif -
737 selectionChanged(true);
never executed (the execution status of this line is deduced): selectionChanged(true);
-
738 }
never executed: }
0
739}
never executed: }
0
740 -
741void QWidgetTextControlPrivate::extendBlockwiseSelection(int suggestedNewPosition) -
742{ -
743 Q_Q(QWidgetTextControl);
never executed (the execution status of this line is deduced): QWidgetTextControl * const q = q_func();
-
744 -
745 // if inside the initial selected line keep that -
746 if (suggestedNewPosition >= selectedBlockOnTrippleClick.selectionStart()
never evaluated: suggestedNewPosition >= selectedBlockOnTrippleClick.selectionStart()
0
747 && suggestedNewPosition <= selectedBlockOnTrippleClick.selectionEnd()) {
never evaluated: suggestedNewPosition <= selectedBlockOnTrippleClick.selectionEnd()
0
748 q->setTextCursor(selectedBlockOnTrippleClick);
never executed (the execution status of this line is deduced): q->setTextCursor(selectedBlockOnTrippleClick);
-
749 return;
never executed: return;
0
750 } -
751 -
752 if (suggestedNewPosition < selectedBlockOnTrippleClick.position()) {
never evaluated: suggestedNewPosition < selectedBlockOnTrippleClick.position()
0
753 cursor.setPosition(selectedBlockOnTrippleClick.selectionEnd());
never executed (the execution status of this line is deduced): cursor.setPosition(selectedBlockOnTrippleClick.selectionEnd());
-
754 cursor.setPosition(suggestedNewPosition, QTextCursor::KeepAnchor);
never executed (the execution status of this line is deduced): cursor.setPosition(suggestedNewPosition, QTextCursor::KeepAnchor);
-
755 cursor.movePosition(QTextCursor::StartOfBlock, QTextCursor::KeepAnchor);
never executed (the execution status of this line is deduced): cursor.movePosition(QTextCursor::StartOfBlock, QTextCursor::KeepAnchor);
-
756 } else {
never executed: }
0
757 cursor.setPosition(selectedBlockOnTrippleClick.selectionStart());
never executed (the execution status of this line is deduced): cursor.setPosition(selectedBlockOnTrippleClick.selectionStart());
-
758 cursor.setPosition(suggestedNewPosition, QTextCursor::KeepAnchor);
never executed (the execution status of this line is deduced): cursor.setPosition(suggestedNewPosition, QTextCursor::KeepAnchor);
-
759 cursor.movePosition(QTextCursor::EndOfBlock, QTextCursor::KeepAnchor);
never executed (the execution status of this line is deduced): cursor.movePosition(QTextCursor::EndOfBlock, QTextCursor::KeepAnchor);
-
760 cursor.movePosition(QTextCursor::NextCharacter, QTextCursor::KeepAnchor);
never executed (the execution status of this line is deduced): cursor.movePosition(QTextCursor::NextCharacter, QTextCursor::KeepAnchor);
-
761 }
never executed: }
0
762 -
763 if (interactionFlags & Qt::TextSelectableByMouse) {
never evaluated: interactionFlags & Qt::TextSelectableByMouse
0
764#ifndef QT_NO_CLIPBOARD -
765 setClipboardSelection();
never executed (the execution status of this line is deduced): setClipboardSelection();
-
766#endif -
767 selectionChanged(true);
never executed (the execution status of this line is deduced): selectionChanged(true);
-
768 }
never executed: }
0
769}
never executed: }
0
770 -
771void QWidgetTextControlPrivate::_q_deleteSelected() -
772{ -
773 if (!(interactionFlags & Qt::TextEditable) || !cursor.hasSelection())
never evaluated: !(interactionFlags & Qt::TextEditable)
never evaluated: !cursor.hasSelection()
0
774 return;
never executed: return;
0
775 cursor.removeSelectedText();
never executed (the execution status of this line is deduced): cursor.removeSelectedText();
-
776}
never executed: }
0
777 -
778void QWidgetTextControl::undo() -
779{ -
780 Q_D(QWidgetTextControl);
executed (the execution status of this line is deduced): QWidgetTextControlPrivate * const d = d_func();
-
781 d->repaintSelection();
executed (the execution status of this line is deduced): d->repaintSelection();
-
782 const int oldCursorPos = d->cursor.position();
executed (the execution status of this line is deduced): const int oldCursorPos = d->cursor.position();
-
783 d->doc->undo(&d->cursor);
executed (the execution status of this line is deduced): d->doc->undo(&d->cursor);
-
784 if (d->cursor.position() != oldCursorPos)
partially evaluated: d->cursor.position() != oldCursorPos
TRUEFALSE
yes
Evaluation Count:5
no
Evaluation Count:0
0-5
785 emit cursorPositionChanged();
executed: cursorPositionChanged();
Execution Count:5
5
786 emit microFocusChanged();
executed (the execution status of this line is deduced): microFocusChanged();
-
787 ensureCursorVisible();
executed (the execution status of this line is deduced): ensureCursorVisible();
-
788}
executed: }
Execution Count:5
5
789 -
790void QWidgetTextControl::redo() -
791{ -
792 Q_D(QWidgetTextControl);
executed (the execution status of this line is deduced): QWidgetTextControlPrivate * const d = d_func();
-
793 d->repaintSelection();
executed (the execution status of this line is deduced): d->repaintSelection();
-
794 const int oldCursorPos = d->cursor.position();
executed (the execution status of this line is deduced): const int oldCursorPos = d->cursor.position();
-
795 d->doc->redo(&d->cursor);
executed (the execution status of this line is deduced): d->doc->redo(&d->cursor);
-
796 if (d->cursor.position() != oldCursorPos)
partially evaluated: d->cursor.position() != oldCursorPos
TRUEFALSE
yes
Evaluation Count:5
no
Evaluation Count:0
0-5
797 emit cursorPositionChanged();
executed: cursorPositionChanged();
Execution Count:5
5
798 emit microFocusChanged();
executed (the execution status of this line is deduced): microFocusChanged();
-
799 ensureCursorVisible();
executed (the execution status of this line is deduced): ensureCursorVisible();
-
800}
executed: }
Execution Count:5
5
801 -
802QWidgetTextControl::QWidgetTextControl(QObject *parent) -
803 : QObject(*new QWidgetTextControlPrivate, parent) -
804{ -
805 Q_D(QWidgetTextControl);
executed (the execution status of this line is deduced): QWidgetTextControlPrivate * const d = d_func();
-
806 d->init();
executed (the execution status of this line is deduced): d->init();
-
807}
executed: }
Execution Count:291
291
808 -
809QWidgetTextControl::QWidgetTextControl(const QString &text, QObject *parent) -
810 : QObject(*new QWidgetTextControlPrivate, parent) -
811{ -
812 Q_D(QWidgetTextControl);
never executed (the execution status of this line is deduced): QWidgetTextControlPrivate * const d = d_func();
-
813 d->init(Qt::RichText, text);
never executed (the execution status of this line is deduced): d->init(Qt::RichText, text);
-
814}
never executed: }
0
815 -
816QWidgetTextControl::QWidgetTextControl(QTextDocument *doc, QObject *parent) -
817 : QObject(*new QWidgetTextControlPrivate, parent) -
818{ -
819 Q_D(QWidgetTextControl);
never executed (the execution status of this line is deduced): QWidgetTextControlPrivate * const d = d_func();
-
820 d->init(Qt::RichText, QString(), doc);
never executed (the execution status of this line is deduced): d->init(Qt::RichText, QString(), doc);
-
821}
never executed: }
0
822 -
823QWidgetTextControl::~QWidgetTextControl() -
824{ -
825} -
826 -
827void QWidgetTextControl::setDocument(QTextDocument *document) -
828{ -
829 Q_D(QWidgetTextControl);
executed (the execution status of this line is deduced): QWidgetTextControlPrivate * const d = d_func();
-
830 if (d->doc == document)
partially evaluated: d->doc == document
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:96
0-96
831 return;
never executed: return;
0
832 -
833 d->doc->disconnect(this);
executed (the execution status of this line is deduced): d->doc->disconnect(this);
-
834 d->doc->documentLayout()->disconnect(this);
executed (the execution status of this line is deduced): d->doc->documentLayout()->disconnect(this);
-
835 d->doc->documentLayout()->setPaintDevice(0);
executed (the execution status of this line is deduced): d->doc->documentLayout()->setPaintDevice(0);
-
836 -
837 if (d->doc->parent() == this)
evaluated: d->doc->parent() == this
TRUEFALSE
yes
Evaluation Count:95
yes
Evaluation Count:1
1-95
838 delete d->doc;
executed: delete d->doc;
Execution Count:95
95
839 -
840 d->doc = 0;
executed (the execution status of this line is deduced): d->doc = 0;
-
841 d->setContent(Qt::RichText, QString(), document);
executed (the execution status of this line is deduced): d->setContent(Qt::RichText, QString(), document);
-
842}
executed: }
Execution Count:96
96
843 -
844QTextDocument *QWidgetTextControl::document() const -
845{ -
846 Q_D(const QWidgetTextControl);
executed (the execution status of this line is deduced): const QWidgetTextControlPrivate * const d = d_func();
-
847 return d->doc;
executed: return d->doc;
Execution Count:7884
7884
848} -
849 -
850void QWidgetTextControl::setTextCursor(const QTextCursor &cursor) -
851{ -
852 Q_D(QWidgetTextControl);
executed (the execution status of this line is deduced): QWidgetTextControlPrivate * const d = d_func();
-
853 d->cursorIsFocusIndicator = false;
executed (the execution status of this line is deduced): d->cursorIsFocusIndicator = false;
-
854 const bool posChanged = cursor.position() != d->cursor.position();
executed (the execution status of this line is deduced): const bool posChanged = cursor.position() != d->cursor.position();
-
855 const QTextCursor oldSelection = d->cursor;
executed (the execution status of this line is deduced): const QTextCursor oldSelection = d->cursor;
-
856 d->cursor = cursor;
executed (the execution status of this line is deduced): d->cursor = cursor;
-
857 d->cursorOn = d->hasFocus && (d->interactionFlags & Qt::TextEditable);
evaluated: d->hasFocus
TRUEFALSE
yes
Evaluation Count:12
yes
Evaluation Count:18
evaluated: (d->interactionFlags & Qt::TextEditable)
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:10
2-18
858 d->_q_updateCurrentCharFormatAndSelection();
executed (the execution status of this line is deduced): d->_q_updateCurrentCharFormatAndSelection();
-
859 ensureCursorVisible();
executed (the execution status of this line is deduced): ensureCursorVisible();
-
860 d->repaintOldAndNewSelection(oldSelection);
executed (the execution status of this line is deduced): d->repaintOldAndNewSelection(oldSelection);
-
861 if (posChanged)
evaluated: posChanged
TRUEFALSE
yes
Evaluation Count:25
yes
Evaluation Count:5
5-25
862 emit cursorPositionChanged();
executed: cursorPositionChanged();
Execution Count:25
25
863}
executed: }
Execution Count:30
30
864 -
865QTextCursor QWidgetTextControl::textCursor() const -
866{ -
867 Q_D(const QWidgetTextControl);
executed (the execution status of this line is deduced): const QWidgetTextControlPrivate * const d = d_func();
-
868 return d->cursor;
executed: return d->cursor;
Execution Count:1025
1025
869} -
870 -
871#ifndef QT_NO_CLIPBOARD -
872 -
873void QWidgetTextControl::cut() -
874{ -
875 Q_D(QWidgetTextControl);
executed (the execution status of this line is deduced): QWidgetTextControlPrivate * const d = d_func();
-
876 if (!(d->interactionFlags & Qt::TextEditable) || !d->cursor.hasSelection())
partially evaluated: !(d->interactionFlags & Qt::TextEditable)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:4
partially evaluated: !d->cursor.hasSelection()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:4
0-4
877 return;
never executed: return;
0
878 copy();
executed (the execution status of this line is deduced): copy();
-
879 d->cursor.removeSelectedText();
executed (the execution status of this line is deduced): d->cursor.removeSelectedText();
-
880}
executed: }
Execution Count:4
4
881 -
882void QWidgetTextControl::copy() -
883{ -
884 Q_D(QWidgetTextControl);
executed (the execution status of this line is deduced): QWidgetTextControlPrivate * const d = d_func();
-
885 if (!d->cursor.hasSelection())
partially evaluated: !d->cursor.hasSelection()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:7
0-7
886 return;
never executed: return;
0
887 QMimeData *data = createMimeDataFromSelection();
executed (the execution status of this line is deduced): QMimeData *data = createMimeDataFromSelection();
-
888 QApplication::clipboard()->setMimeData(data);
executed (the execution status of this line is deduced): QApplication::clipboard()->setMimeData(data);
-
889}
executed: }
Execution Count:7
7
890 -
891void QWidgetTextControl::paste(QClipboard::Mode mode) -
892{ -
893 const QMimeData *md = QApplication::clipboard()->mimeData(mode);
executed (the execution status of this line is deduced): const QMimeData *md = QApplication::clipboard()->mimeData(mode);
-
894 if (md)
partially evaluated: md
TRUEFALSE
yes
Evaluation Count:3
no
Evaluation Count:0
0-3
895 insertFromMimeData(md);
executed: insertFromMimeData(md);
Execution Count:3
3
896}
executed: }
Execution Count:3
3
897#endif -
898 -
899void QWidgetTextControl::clear() -
900{ -
901 Q_D(QWidgetTextControl);
executed (the execution status of this line is deduced): QWidgetTextControlPrivate * const d = d_func();
-
902 // clears and sets empty content -
903 d->extraSelections.clear();
executed (the execution status of this line is deduced): d->extraSelections.clear();
-
904 d->setContent();
executed (the execution status of this line is deduced): d->setContent();
-
905}
executed: }
Execution Count:28
28
906 -
907 -
908void QWidgetTextControl::selectAll() -
909{ -
910 Q_D(QWidgetTextControl);
executed (the execution status of this line is deduced): QWidgetTextControlPrivate * const d = d_func();
-
911 const int selectionLength = qAbs(d->cursor.position() - d->cursor.anchor());
executed (the execution status of this line is deduced): const int selectionLength = qAbs(d->cursor.position() - d->cursor.anchor());
-
912 d->cursor.select(QTextCursor::Document);
executed (the execution status of this line is deduced): d->cursor.select(QTextCursor::Document);
-
913 d->selectionChanged(selectionLength != qAbs(d->cursor.position() - d->cursor.anchor()));
executed (the execution status of this line is deduced): d->selectionChanged(selectionLength != qAbs(d->cursor.position() - d->cursor.anchor()));
-
914 d->cursorIsFocusIndicator = false;
executed (the execution status of this line is deduced): d->cursorIsFocusIndicator = false;
-
915 emit updateRequest();
executed (the execution status of this line is deduced): updateRequest();
-
916}
executed: }
Execution Count:5
5
917 -
918void QWidgetTextControl::processEvent(QEvent *e, const QPointF &coordinateOffset, QWidget *contextWidget) -
919{ -
920 QMatrix m;
executed (the execution status of this line is deduced): QMatrix m;
-
921 m.translate(coordinateOffset.x(), coordinateOffset.y());
executed (the execution status of this line is deduced): m.translate(coordinateOffset.x(), coordinateOffset.y());
-
922 processEvent(e, m, contextWidget);
executed (the execution status of this line is deduced): processEvent(e, m, contextWidget);
-
923}
executed: }
Execution Count:496
496
924 -
925void QWidgetTextControl::processEvent(QEvent *e, const QMatrix &matrix, QWidget *contextWidget) -
926{ -
927 Q_D(QWidgetTextControl);
executed (the execution status of this line is deduced): QWidgetTextControlPrivate * const d = d_func();
-
928 if (d->interactionFlags == Qt::NoTextInteraction) {
evaluated: d->interactionFlags == Qt::NoTextInteraction
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:494
2-494
929 e->ignore();
executed (the execution status of this line is deduced): e->ignore();
-
930 return;
executed: return;
Execution Count:2
2
931 } -
932 -
933 d->contextWidget = contextWidget;
executed (the execution status of this line is deduced): d->contextWidget = contextWidget;
-
934 -
935 if (!d->contextWidget) {
evaluated: !d->contextWidget
TRUEFALSE
yes
Evaluation Count:22
yes
Evaluation Count:472
22-472
936 switch (e->type()) { -
937#ifndef QT_NO_GRAPHICSVIEW -
938 case QEvent::GraphicsSceneMouseMove: -
939 case QEvent::GraphicsSceneMousePress: -
940 case QEvent::GraphicsSceneMouseRelease: -
941 case QEvent::GraphicsSceneMouseDoubleClick: -
942 case QEvent::GraphicsSceneContextMenu: -
943 case QEvent::GraphicsSceneHoverEnter: -
944 case QEvent::GraphicsSceneHoverMove: -
945 case QEvent::GraphicsSceneHoverLeave: -
946 case QEvent::GraphicsSceneHelp: -
947 case QEvent::GraphicsSceneDragEnter: -
948 case QEvent::GraphicsSceneDragMove: -
949 case QEvent::GraphicsSceneDragLeave: -
950 case QEvent::GraphicsSceneDrop: { -
951 QGraphicsSceneEvent *ev = static_cast<QGraphicsSceneEvent *>(e);
never executed (the execution status of this line is deduced): QGraphicsSceneEvent *ev = static_cast<QGraphicsSceneEvent *>(e);
-
952 d->contextWidget = ev->widget();
never executed (the execution status of this line is deduced): d->contextWidget = ev->widget();
-
953 break;
never executed: break;
0
954 } -
955#endif // QT_NO_GRAPHICSVIEW -
956 default: break;
executed: break;
Execution Count:22
22
957 }; -
958 }
executed: }
Execution Count:22
22
959 -
960 switch (e->type()) { -
961 case QEvent::KeyPress: -
962 d->keyPressEvent(static_cast<QKeyEvent *>(e));
executed (the execution status of this line is deduced): d->keyPressEvent(static_cast<QKeyEvent *>(e));
-
963 break;
executed: break;
Execution Count:165
165
964 case QEvent::MouseButtonPress: { -
965 QMouseEvent *ev = static_cast<QMouseEvent *>(e);
executed (the execution status of this line is deduced): QMouseEvent *ev = static_cast<QMouseEvent *>(e);
-
966 d->mousePressEvent(ev, ev->button(), matrix.map(ev->pos()), ev->modifiers(),
executed (the execution status of this line is deduced): d->mousePressEvent(ev, ev->button(), matrix.map(ev->pos()), ev->modifiers(),
-
967 ev->buttons(), ev->globalPos());
executed (the execution status of this line is deduced): ev->buttons(), ev->globalPos());
-
968 break; }
executed: break;
Execution Count:7
7
969 case QEvent::MouseMove: { -
970 QMouseEvent *ev = static_cast<QMouseEvent *>(e);
executed (the execution status of this line is deduced): QMouseEvent *ev = static_cast<QMouseEvent *>(e);
-
971 d->mouseMoveEvent(ev, ev->button(), matrix.map(ev->pos()), ev->modifiers(),
executed (the execution status of this line is deduced): d->mouseMoveEvent(ev, ev->button(), matrix.map(ev->pos()), ev->modifiers(),
-
972 ev->buttons(), ev->globalPos());
executed (the execution status of this line is deduced): ev->buttons(), ev->globalPos());
-
973 break; }
executed: break;
Execution Count:1
1
974 case QEvent::MouseButtonRelease: { -
975 QMouseEvent *ev = static_cast<QMouseEvent *>(e);
executed (the execution status of this line is deduced): QMouseEvent *ev = static_cast<QMouseEvent *>(e);
-
976 d->mouseReleaseEvent(ev, ev->button(), matrix.map(ev->pos()), ev->modifiers(),
executed (the execution status of this line is deduced): d->mouseReleaseEvent(ev, ev->button(), matrix.map(ev->pos()), ev->modifiers(),
-
977 ev->buttons(), ev->globalPos());
executed (the execution status of this line is deduced): ev->buttons(), ev->globalPos());
-
978 break; }
executed: break;
Execution Count:1
1
979 case QEvent::MouseButtonDblClick: { -
980 QMouseEvent *ev = static_cast<QMouseEvent *>(e);
never executed (the execution status of this line is deduced): QMouseEvent *ev = static_cast<QMouseEvent *>(e);
-
981 d->mouseDoubleClickEvent(ev, ev->button(), matrix.map(ev->pos()), ev->modifiers(),
never executed (the execution status of this line is deduced): d->mouseDoubleClickEvent(ev, ev->button(), matrix.map(ev->pos()), ev->modifiers(),
-
982 ev->buttons(), ev->globalPos());
never executed (the execution status of this line is deduced): ev->buttons(), ev->globalPos());
-
983 break; }
never executed: break;
0
984 case QEvent::InputMethod: -
985 d->inputMethodEvent(static_cast<QInputMethodEvent *>(e));
never executed (the execution status of this line is deduced): d->inputMethodEvent(static_cast<QInputMethodEvent *>(e));
-
986 break;
never executed: break;
0
987#ifndef QT_NO_CONTEXTMENU -
988 case QEvent::ContextMenu: { -
989 QContextMenuEvent *ev = static_cast<QContextMenuEvent *>(e);
never executed (the execution status of this line is deduced): QContextMenuEvent *ev = static_cast<QContextMenuEvent *>(e);
-
990 d->contextMenuEvent(ev->globalPos(), matrix.map(ev->pos()), contextWidget);
never executed (the execution status of this line is deduced): d->contextMenuEvent(ev->globalPos(), matrix.map(ev->pos()), contextWidget);
-
991 break; }
never executed: break;
0
992#endif // QT_NO_CONTEXTMENU -
993 case QEvent::FocusIn: -
994 case QEvent::FocusOut: -
995 d->focusEvent(static_cast<QFocusEvent *>(e));
executed (the execution status of this line is deduced): d->focusEvent(static_cast<QFocusEvent *>(e));
-
996 break;
executed: break;
Execution Count:149
149
997 -
998 case QEvent::EnabledChange: -
999 d->isEnabled = e->isAccepted();
never executed (the execution status of this line is deduced): d->isEnabled = e->isAccepted();
-
1000 break;
never executed: break;
0
1001 -
1002#ifndef QT_NO_TOOLTIP -
1003 case QEvent::ToolTip: { -
1004 QHelpEvent *ev = static_cast<QHelpEvent *>(e);
never executed (the execution status of this line is deduced): QHelpEvent *ev = static_cast<QHelpEvent *>(e);
-
1005 d->showToolTip(ev->globalPos(), matrix.map(ev->pos()), contextWidget);
never executed (the execution status of this line is deduced): d->showToolTip(ev->globalPos(), matrix.map(ev->pos()), contextWidget);
-
1006 break;
never executed: break;
0
1007 } -
1008#endif // QT_NO_TOOLTIP -
1009 -
1010#ifndef QT_NO_DRAGANDDROP -
1011 case QEvent::DragEnter: { -
1012 QDragEnterEvent *ev = static_cast<QDragEnterEvent *>(e);
never executed (the execution status of this line is deduced): QDragEnterEvent *ev = static_cast<QDragEnterEvent *>(e);
-
1013 if (d->dragEnterEvent(e, ev->mimeData()))
never evaluated: d->dragEnterEvent(e, ev->mimeData())
0
1014 ev->acceptProposedAction();
never executed: ev->acceptProposedAction();
0
1015 break;
never executed: break;
0
1016 } -
1017 case QEvent::DragLeave: -
1018 d->dragLeaveEvent();
never executed (the execution status of this line is deduced): d->dragLeaveEvent();
-
1019 break;
never executed: break;
0
1020 case QEvent::DragMove: { -
1021 QDragMoveEvent *ev = static_cast<QDragMoveEvent *>(e);
never executed (the execution status of this line is deduced): QDragMoveEvent *ev = static_cast<QDragMoveEvent *>(e);
-
1022 if (d->dragMoveEvent(e, ev->mimeData(), matrix.map(ev->pos())))
never evaluated: d->dragMoveEvent(e, ev->mimeData(), matrix.map(ev->pos()))
0
1023 ev->acceptProposedAction();
never executed: ev->acceptProposedAction();
0
1024 break;
never executed: break;
0
1025 } -
1026 case QEvent::Drop: { -
1027 QDropEvent *ev = static_cast<QDropEvent *>(e);
never executed (the execution status of this line is deduced): QDropEvent *ev = static_cast<QDropEvent *>(e);
-
1028 if (d->dropEvent(ev->mimeData(), matrix.map(ev->pos()), ev->dropAction(), ev->source()))
never evaluated: d->dropEvent(ev->mimeData(), matrix.map(ev->pos()), ev->dropAction(), ev->source())
0
1029 ev->acceptProposedAction();
never executed: ev->acceptProposedAction();
0
1030 break;
never executed: break;
0
1031 } -
1032#endif -
1033 -
1034#ifndef QT_NO_GRAPHICSVIEW -
1035 case QEvent::GraphicsSceneMousePress: { -
1036 QGraphicsSceneMouseEvent *ev = static_cast<QGraphicsSceneMouseEvent *>(e);
never executed (the execution status of this line is deduced): QGraphicsSceneMouseEvent *ev = static_cast<QGraphicsSceneMouseEvent *>(e);
-
1037 d->mousePressEvent(ev, ev->button(), matrix.map(ev->pos()), ev->modifiers(), ev->buttons(),
never executed (the execution status of this line is deduced): d->mousePressEvent(ev, ev->button(), matrix.map(ev->pos()), ev->modifiers(), ev->buttons(),
-
1038 ev->screenPos());
never executed (the execution status of this line is deduced): ev->screenPos());
-
1039 break; }
never executed: break;
0
1040 case QEvent::GraphicsSceneMouseMove: { -
1041 QGraphicsSceneMouseEvent *ev = static_cast<QGraphicsSceneMouseEvent *>(e);
never executed (the execution status of this line is deduced): QGraphicsSceneMouseEvent *ev = static_cast<QGraphicsSceneMouseEvent *>(e);
-
1042 d->mouseMoveEvent(ev, ev->button(), matrix.map(ev->pos()), ev->modifiers(), ev->buttons(),
never executed (the execution status of this line is deduced): d->mouseMoveEvent(ev, ev->button(), matrix.map(ev->pos()), ev->modifiers(), ev->buttons(),
-
1043 ev->screenPos());
never executed (the execution status of this line is deduced): ev->screenPos());
-
1044 break; }
never executed: break;
0
1045 case QEvent::GraphicsSceneMouseRelease: { -
1046 QGraphicsSceneMouseEvent *ev = static_cast<QGraphicsSceneMouseEvent *>(e);
never executed (the execution status of this line is deduced): QGraphicsSceneMouseEvent *ev = static_cast<QGraphicsSceneMouseEvent *>(e);
-
1047 d->mouseReleaseEvent(ev, ev->button(), matrix.map(ev->pos()), ev->modifiers(), ev->buttons(),
never executed (the execution status of this line is deduced): d->mouseReleaseEvent(ev, ev->button(), matrix.map(ev->pos()), ev->modifiers(), ev->buttons(),
-
1048 ev->screenPos());
never executed (the execution status of this line is deduced): ev->screenPos());
-
1049 break; }
never executed: break;
0
1050 case QEvent::GraphicsSceneMouseDoubleClick: { -
1051 QGraphicsSceneMouseEvent *ev = static_cast<QGraphicsSceneMouseEvent *>(e);
never executed (the execution status of this line is deduced): QGraphicsSceneMouseEvent *ev = static_cast<QGraphicsSceneMouseEvent *>(e);
-
1052 d->mouseDoubleClickEvent(ev, ev->button(), matrix.map(ev->pos()), ev->modifiers(), ev->buttons(),
never executed (the execution status of this line is deduced): d->mouseDoubleClickEvent(ev, ev->button(), matrix.map(ev->pos()), ev->modifiers(), ev->buttons(),
-
1053 ev->screenPos());
never executed (the execution status of this line is deduced): ev->screenPos());
-
1054 break; }
never executed: break;
0
1055 case QEvent::GraphicsSceneContextMenu: { -
1056 QGraphicsSceneContextMenuEvent *ev = static_cast<QGraphicsSceneContextMenuEvent *>(e);
never executed (the execution status of this line is deduced): QGraphicsSceneContextMenuEvent *ev = static_cast<QGraphicsSceneContextMenuEvent *>(e);
-
1057 d->contextMenuEvent(ev->screenPos(), matrix.map(ev->pos()), contextWidget);
never executed (the execution status of this line is deduced): d->contextMenuEvent(ev->screenPos(), matrix.map(ev->pos()), contextWidget);
-
1058 break; }
never executed: break;
0
1059 -
1060 case QEvent::GraphicsSceneHoverMove: { -
1061 QGraphicsSceneHoverEvent *ev = static_cast<QGraphicsSceneHoverEvent *>(e);
never executed (the execution status of this line is deduced): QGraphicsSceneHoverEvent *ev = static_cast<QGraphicsSceneHoverEvent *>(e);
-
1062 d->mouseMoveEvent(ev, Qt::NoButton, matrix.map(ev->pos()), ev->modifiers(),Qt::NoButton,
never executed (the execution status of this line is deduced): d->mouseMoveEvent(ev, Qt::NoButton, matrix.map(ev->pos()), ev->modifiers(),Qt::NoButton,
-
1063 ev->screenPos());
never executed (the execution status of this line is deduced): ev->screenPos());
-
1064 break; }
never executed: break;
0
1065 -
1066 case QEvent::GraphicsSceneDragEnter: { -
1067 QGraphicsSceneDragDropEvent *ev = static_cast<QGraphicsSceneDragDropEvent *>(e);
never executed (the execution status of this line is deduced): QGraphicsSceneDragDropEvent *ev = static_cast<QGraphicsSceneDragDropEvent *>(e);
-
1068 if (d->dragEnterEvent(e, ev->mimeData()))
never evaluated: d->dragEnterEvent(e, ev->mimeData())
0
1069 ev->acceptProposedAction();
never executed: ev->acceptProposedAction();
0
1070 break; }
never executed: break;
0
1071 case QEvent::GraphicsSceneDragLeave: -
1072 d->dragLeaveEvent();
never executed (the execution status of this line is deduced): d->dragLeaveEvent();
-
1073 break;
never executed: break;
0
1074 case QEvent::GraphicsSceneDragMove: { -
1075 QGraphicsSceneDragDropEvent *ev = static_cast<QGraphicsSceneDragDropEvent *>(e);
never executed (the execution status of this line is deduced): QGraphicsSceneDragDropEvent *ev = static_cast<QGraphicsSceneDragDropEvent *>(e);
-
1076 if (d->dragMoveEvent(e, ev->mimeData(), matrix.map(ev->pos())))
never evaluated: d->dragMoveEvent(e, ev->mimeData(), matrix.map(ev->pos()))
0
1077 ev->acceptProposedAction();
never executed: ev->acceptProposedAction();
0
1078 break; }
never executed: break;
0
1079 case QEvent::GraphicsSceneDrop: { -
1080 QGraphicsSceneDragDropEvent *ev = static_cast<QGraphicsSceneDragDropEvent *>(e);
never executed (the execution status of this line is deduced): QGraphicsSceneDragDropEvent *ev = static_cast<QGraphicsSceneDragDropEvent *>(e);
-
1081 if (d->dropEvent(ev->mimeData(), matrix.map(ev->pos()), ev->dropAction(), ev->source()))
never evaluated: d->dropEvent(ev->mimeData(), matrix.map(ev->pos()), ev->dropAction(), ev->source())
0
1082 ev->accept();
never executed: ev->accept();
0
1083 break; }
never executed: break;
0
1084#endif // QT_NO_GRAPHICSVIEW -
1085#ifdef QT_KEYPAD_NAVIGATION -
1086 case QEvent::EnterEditFocus: -
1087 case QEvent::LeaveEditFocus: -
1088 if (QApplication::keypadNavigationEnabled()) -
1089 d->editFocusEvent(e); -
1090 break; -
1091#endif -
1092 case QEvent::ShortcutOverride: -
1093 if (d->interactionFlags & Qt::TextEditable) {
evaluated: d->interactionFlags & Qt::TextEditable
TRUEFALSE
yes
Evaluation Count:159
yes
Evaluation Count:11
11-159
1094 QKeyEvent* ke = static_cast<QKeyEvent *>(e);
executed (the execution status of this line is deduced): QKeyEvent* ke = static_cast<QKeyEvent *>(e);
-
1095 if (ke->modifiers() == Qt::NoModifier
evaluated: ke->modifiers() == Qt::NoModifier
TRUEFALSE
yes
Evaluation Count:89
yes
Evaluation Count:70
70-89
1096 || ke->modifiers() == Qt::ShiftModifier
evaluated: ke->modifiers() == Qt::ShiftModifier
TRUEFALSE
yes
Evaluation Count:52
yes
Evaluation Count:18
18-52
1097 || ke->modifiers() == Qt::KeypadModifier) {
evaluated: ke->modifiers() == Qt::KeypadModifier
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:17
1-17
1098 if (ke->key() < Qt::Key_Escape) {
evaluated: ke->key() < Qt::Key_Escape
TRUEFALSE
yes
Evaluation Count:70
yes
Evaluation Count:72
70-72
1099 ke->accept();
executed (the execution status of this line is deduced): ke->accept();
-
1100 } else {
executed: }
Execution Count:70
70
1101 switch (ke->key()) { -
1102 case Qt::Key_Return: -
1103 case Qt::Key_Enter: -
1104 case Qt::Key_Delete: -
1105 case Qt::Key_Home: -
1106 case Qt::Key_End: -
1107 case Qt::Key_Backspace: -
1108 case Qt::Key_Left: -
1109 case Qt::Key_Right: -
1110 case Qt::Key_Up: -
1111 case Qt::Key_Down: -
1112 case Qt::Key_Tab: -
1113 ke->accept();
executed (the execution status of this line is deduced): ke->accept();
-
1114 default: -
1115 break;
executed: break;
Execution Count:72
72
1116 } -
1117 }
executed: }
Execution Count:72
72
1118#ifndef QT_NO_SHORTCUT -
1119 } else if (ke == QKeySequence::Copy
partially evaluated: ke == QKeySequence::Copy
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:17
0-17
1120 || ke == QKeySequence::Paste
partially evaluated: ke == QKeySequence::Paste
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:17
0-17
1121 || ke == QKeySequence::Cut
evaluated: ke == QKeySequence::Cut
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:15
2-15
1122 || ke == QKeySequence::Redo
partially evaluated: ke == QKeySequence::Redo
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:15
0-15
1123 || ke == QKeySequence::Undo
partially evaluated: ke == QKeySequence::Undo
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:15
0-15
1124 || ke == QKeySequence::MoveToNextWord
partially evaluated: ke == QKeySequence::MoveToNextWord
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:15
0-15
1125 || ke == QKeySequence::MoveToPreviousWord
partially evaluated: ke == QKeySequence::MoveToPreviousWord
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:15
0-15
1126 || ke == QKeySequence::MoveToStartOfDocument
partially evaluated: ke == QKeySequence::MoveToStartOfDocument
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:15
0-15
1127 || ke == QKeySequence::MoveToEndOfDocument
partially evaluated: ke == QKeySequence::MoveToEndOfDocument
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:15
0-15
1128 || ke == QKeySequence::SelectNextWord
partially evaluated: ke == QKeySequence::SelectNextWord
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:15
0-15
1129 || ke == QKeySequence::SelectPreviousWord
partially evaluated: ke == QKeySequence::SelectPreviousWord
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:15
0-15
1130 || ke == QKeySequence::SelectStartOfLine
partially evaluated: ke == QKeySequence::SelectStartOfLine
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:15
0-15
1131 || ke == QKeySequence::SelectEndOfLine
partially evaluated: ke == QKeySequence::SelectEndOfLine
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:15
0-15
1132 || ke == QKeySequence::SelectStartOfBlock
partially evaluated: ke == QKeySequence::SelectStartOfBlock
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:15
0-15
1133 || ke == QKeySequence::SelectEndOfBlock
partially evaluated: ke == QKeySequence::SelectEndOfBlock
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:15
0-15
1134 || ke == QKeySequence::SelectStartOfDocument
partially evaluated: ke == QKeySequence::SelectStartOfDocument
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:15
0-15
1135 || ke == QKeySequence::SelectEndOfDocument
partially evaluated: ke == QKeySequence::SelectEndOfDocument
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:15
0-15
1136 || ke == QKeySequence::SelectAll
partially evaluated: ke == QKeySequence::SelectAll
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:15
0-15
1137 ) { -
1138 ke->accept();
executed (the execution status of this line is deduced): ke->accept();
-
1139#endif -
1140 }
executed: }
Execution Count:2
2
1141 } -
1142 break;
executed: break;
Execution Count:170
170
1143 default: -
1144 break;
executed: break;
Execution Count:1
1
1145 } -
1146}
executed: }
Execution Count:494
494
1147 -
1148bool QWidgetTextControl::event(QEvent *e) -
1149{ -
1150 return QObject::event(e);
executed: return QObject::event(e);
Execution Count:476
476
1151} -
1152 -
1153void QWidgetTextControl::timerEvent(QTimerEvent *e) -
1154{ -
1155 Q_D(QWidgetTextControl);
never executed (the execution status of this line is deduced): QWidgetTextControlPrivate * const d = d_func();
-
1156 if (e->timerId() == d->cursorBlinkTimer.timerId()) {
partially evaluated: e->timerId() == d->cursorBlinkTimer.timerId()
TRUEFALSE
yes
Evaluation Count:1
no
Evaluation Count:0
0-1
1157 d->cursorOn = !d->cursorOn;
executed (the execution status of this line is deduced): d->cursorOn = !d->cursorOn;
-
1158 -
1159 if (d->cursor.hasSelection())
partially evaluated: d->cursor.hasSelection()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1
0-1
1160 d->cursorOn &= (QApplication::style()->styleHint(QStyle::SH_BlinkCursorWhenTextSelected)
never executed: d->cursorOn &= (QApplication::style()->styleHint(QStyle::SH_BlinkCursorWhenTextSelected) != 0);
0
1161 != 0);
never executed: d->cursorOn &= (QApplication::style()->styleHint(QStyle::SH_BlinkCursorWhenTextSelected) != 0);
0
1162 -
1163 d->repaintCursor();
executed (the execution status of this line is deduced): d->repaintCursor();
-
1164 } else if (e->timerId() == d->trippleClickTimer.timerId()) {
executed: }
Execution Count:1
never evaluated: e->timerId() == d->trippleClickTimer.timerId()
0-1
1165 d->trippleClickTimer.stop();
never executed (the execution status of this line is deduced): d->trippleClickTimer.stop();
-
1166 }
never executed: }
0
1167} -
1168 -
1169void QWidgetTextControl::setPlainText(const QString &text) -
1170{ -
1171 Q_D(QWidgetTextControl);
executed (the execution status of this line is deduced): QWidgetTextControlPrivate * const d = d_func();
-
1172 d->setContent(Qt::PlainText, text);
executed (the execution status of this line is deduced): d->setContent(Qt::PlainText, text);
-
1173}
executed: }
Execution Count:167
167
1174 -
1175void QWidgetTextControl::setHtml(const QString &text) -
1176{ -
1177 Q_D(QWidgetTextControl);
executed (the execution status of this line is deduced): QWidgetTextControlPrivate * const d = d_func();
-
1178 d->setContent(Qt::RichText, text);
executed (the execution status of this line is deduced): d->setContent(Qt::RichText, text);
-
1179}
executed: }
Execution Count:72
72
1180 -
1181void QWidgetTextControlPrivate::keyPressEvent(QKeyEvent *e) -
1182{ -
1183 Q_Q(QWidgetTextControl);
executed (the execution status of this line is deduced): QWidgetTextControl * const q = q_func();
-
1184#ifndef QT_NO_SHORTCUT -
1185 if (e == QKeySequence::SelectAll) {
evaluated: e == QKeySequence::SelectAll
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:164
1-164
1186 e->accept();
executed (the execution status of this line is deduced): e->accept();
-
1187 q->selectAll();
executed (the execution status of this line is deduced): q->selectAll();
-
1188 return;
executed: return;
Execution Count:1
1
1189 } -
1190#ifndef QT_NO_CLIPBOARD -
1191 else if (e == QKeySequence::Copy) {
evaluated: e == QKeySequence::Copy
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:163
1-163
1192 e->accept();
executed (the execution status of this line is deduced): e->accept();
-
1193 q->copy();
executed (the execution status of this line is deduced): q->copy();
-
1194 return;
executed: return;
Execution Count:1
1
1195 } -
1196#endif -
1197#endif // QT_NO_SHORTCUT -
1198 -
1199 if (interactionFlags & Qt::TextSelectableByKeyboard
evaluated: interactionFlags & Qt::TextSelectableByKeyboard
TRUEFALSE
yes
Evaluation Count:154
yes
Evaluation Count:9
9-154
1200 && cursorMoveKeyEvent(e))
evaluated: cursorMoveKeyEvent(e)
TRUEFALSE
yes
Evaluation Count:34
yes
Evaluation Count:120
34-120
1201 goto accept;
executed: goto accept;
Execution Count:34
34
1202 -
1203 if (interactionFlags & Qt::LinksAccessibleByKeyboard) {
evaluated: interactionFlags & Qt::LinksAccessibleByKeyboard
TRUEFALSE
yes
Evaluation Count:6
yes
Evaluation Count:123
6-123
1204 if ((e->key() == Qt::Key_Return
partially evaluated: e->key() == Qt::Key_Return
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:6
0-6
1205 || e->key() == Qt::Key_Enter
partially evaluated: e->key() == Qt::Key_Enter
TRUEFALSE
yes
Evaluation Count:6
no
Evaluation Count:0
0-6
1206#ifdef QT_KEYPAD_NAVIGATION
executed (the execution status of this line is deduced):
-
1207 || e->key() == Qt::Key_Select
executed (the execution status of this line is deduced):
-
1208#endif
executed (the execution status of this line is deduced):
-
1209 )
executed (the execution status of this line is deduced): )
-
1210 && cursor.hasSelection()) {
partially evaluated: cursor.hasSelection()
TRUEFALSE
yes
Evaluation Count:6
no
Evaluation Count:0
0-6
1211 -
1212 e->accept();
executed (the execution status of this line is deduced): e->accept();
-
1213 activateLinkUnderCursor();
executed (the execution status of this line is deduced): activateLinkUnderCursor();
-
1214 return;
executed: return;
Execution Count:6
6
1215 } -
1216 }
never executed: }
0
1217 -
1218 if (!(interactionFlags & Qt::TextEditable)) {
evaluated: !(interactionFlags & Qt::TextEditable)
TRUEFALSE
yes
Evaluation Count:3
yes
Evaluation Count:120
3-120
1219 e->ignore();
executed (the execution status of this line is deduced): e->ignore();
-
1220 return;
executed: return;
Execution Count:3
3
1221 } -
1222 -
1223 if (e->key() == Qt::Key_Direction_L || e->key() == Qt::Key_Direction_R) {
partially evaluated: e->key() == Qt::Key_Direction_L
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:120
partially evaluated: e->key() == Qt::Key_Direction_R
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:120
0-120
1224 QTextBlockFormat fmt;
never executed (the execution status of this line is deduced): QTextBlockFormat fmt;
-
1225 fmt.setLayoutDirection((e->key() == Qt::Key_Direction_L) ? Qt::LeftToRight : Qt::RightToLeft);
never executed (the execution status of this line is deduced): fmt.setLayoutDirection((e->key() == Qt::Key_Direction_L) ? Qt::LeftToRight : Qt::RightToLeft);
-
1226 cursor.mergeBlockFormat(fmt);
never executed (the execution status of this line is deduced): cursor.mergeBlockFormat(fmt);
-
1227 goto accept;
never executed: goto accept;
0
1228 } -
1229 -
1230 // schedule a repaint of the region of the cursor, as when we move it we -
1231 // want to make sure the old cursor disappears (not noticeable when moving -
1232 // only a few pixels but noticeable when jumping between cells in tables for -
1233 // example) -
1234 repaintSelection();
executed (the execution status of this line is deduced): repaintSelection();
-
1235 -
1236 if (e->key() == Qt::Key_Backspace && !(e->modifiers() & ~Qt::ShiftModifier)) {
evaluated: e->key() == Qt::Key_Backspace
TRUEFALSE
yes
Evaluation Count:6
yes
Evaluation Count:114
partially evaluated: !(e->modifiers() & ~Qt::ShiftModifier)
TRUEFALSE
yes
Evaluation Count:6
no
Evaluation Count:0
0-114
1237 QTextBlockFormat blockFmt = cursor.blockFormat();
executed (the execution status of this line is deduced): QTextBlockFormat blockFmt = cursor.blockFormat();
-
1238 QTextList *list = cursor.currentList();
executed (the execution status of this line is deduced): QTextList *list = cursor.currentList();
-
1239 if (list && cursor.atBlockStart() && !cursor.hasSelection()) {
evaluated: list
TRUEFALSE
yes
Evaluation Count:4
yes
Evaluation Count:2
evaluated: cursor.atBlockStart()
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:2
partially evaluated: !cursor.hasSelection()
TRUEFALSE
yes
Evaluation Count:2
no
Evaluation Count:0
0-4
1240 list->remove(cursor.block());
executed (the execution status of this line is deduced): list->remove(cursor.block());
-
1241 } else if (cursor.atBlockStart() && blockFmt.indent() > 0) {
executed: }
Execution Count:2
evaluated: cursor.atBlockStart()
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:2
partially evaluated: blockFmt.indent() > 0
TRUEFALSE
yes
Evaluation Count:2
no
Evaluation Count:0
0-2
1242 blockFmt.setIndent(blockFmt.indent() - 1);
executed (the execution status of this line is deduced): blockFmt.setIndent(blockFmt.indent() - 1);
-
1243 cursor.setBlockFormat(blockFmt);
executed (the execution status of this line is deduced): cursor.setBlockFormat(blockFmt);
-
1244 } else {
executed: }
Execution Count:2
2
1245 QTextCursor localCursor = cursor;
executed (the execution status of this line is deduced): QTextCursor localCursor = cursor;
-
1246 localCursor.deletePreviousChar();
executed (the execution status of this line is deduced): localCursor.deletePreviousChar();
-
1247 }
executed: }
Execution Count:2
2
1248 goto accept;
executed: goto accept;
Execution Count:6
6
1249 } -
1250#ifndef QT_NO_SHORTCUT -
1251 else if (e == QKeySequence::InsertParagraphSeparator) {
evaluated: e == QKeySequence::InsertParagraphSeparator
TRUEFALSE
yes
Evaluation Count:4
yes
Evaluation Count:110
4-110
1252 cursor.insertBlock();
executed (the execution status of this line is deduced): cursor.insertBlock();
-
1253 e->accept();
executed (the execution status of this line is deduced): e->accept();
-
1254 goto accept;
executed: goto accept;
Execution Count:4
4
1255 } else if (e == QKeySequence::InsertLineSeparator) {
evaluated: e == QKeySequence::InsertLineSeparator
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:109
1-109
1256 cursor.insertText(QString(QChar::LineSeparator));
executed (the execution status of this line is deduced): cursor.insertText(QString(QChar::LineSeparator));
-
1257 e->accept();
executed (the execution status of this line is deduced): e->accept();
-
1258 goto accept;
executed: goto accept;
Execution Count:1
1
1259 } -
1260#endif -
1261 if (false) {
partially evaluated: false
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:109
0-109
1262 }
never executed: }
0
1263#ifndef QT_NO_SHORTCUT -
1264 else if (e == QKeySequence::Undo) {
partially evaluated: e == QKeySequence::Undo
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:109
0-109
1265 q->undo();
never executed (the execution status of this line is deduced): q->undo();
-
1266 }
never executed: }
0
1267 else if (e == QKeySequence::Redo) {
partially evaluated: e == QKeySequence::Redo
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:109
0-109
1268 q->redo();
never executed (the execution status of this line is deduced): q->redo();
-
1269 }
never executed: }
0
1270#ifndef QT_NO_CLIPBOARD -
1271 else if (e == QKeySequence::Cut) {
evaluated: e == QKeySequence::Cut
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:107
2-107
1272 q->cut();
executed (the execution status of this line is deduced): q->cut();
-
1273 }
executed: }
Execution Count:2
2
1274 else if (e == QKeySequence::Paste) {
partially evaluated: e == QKeySequence::Paste
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:107
0-107
1275 QClipboard::Mode mode = QClipboard::Clipboard;
never executed (the execution status of this line is deduced): QClipboard::Mode mode = QClipboard::Clipboard;
-
1276 if (QGuiApplication::clipboard()->supportsSelection()) {
never evaluated: QGuiApplication::clipboard()->supportsSelection()
0
1277 if (e->modifiers() == (Qt::CTRL | Qt::SHIFT) && e->key() == Qt::Key_Insert)
never evaluated: e->modifiers() == (Qt::CTRL | Qt::SHIFT)
never evaluated: e->key() == Qt::Key_Insert
0
1278 mode = QClipboard::Selection;
never executed: mode = QClipboard::Selection;
0
1279 }
never executed: }
0
1280 q->paste(mode);
never executed (the execution status of this line is deduced): q->paste(mode);
-
1281 }
never executed: }
0
1282#endif -
1283 else if (e == QKeySequence::Delete) {
partially evaluated: e == QKeySequence::Delete
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:107
0-107
1284 QTextCursor localCursor = cursor;
never executed (the execution status of this line is deduced): QTextCursor localCursor = cursor;
-
1285 localCursor.deleteChar();
never executed (the execution status of this line is deduced): localCursor.deleteChar();
-
1286 }
never executed: }
0
1287 else if (e == QKeySequence::DeleteEndOfWord) {
partially evaluated: e == QKeySequence::DeleteEndOfWord
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:107
0-107
1288 if (!cursor.hasSelection())
never evaluated: !cursor.hasSelection()
0
1289 cursor.movePosition(QTextCursor::NextWord, QTextCursor::KeepAnchor);
never executed: cursor.movePosition(QTextCursor::NextWord, QTextCursor::KeepAnchor);
0
1290 cursor.removeSelectedText();
never executed (the execution status of this line is deduced): cursor.removeSelectedText();
-
1291 }
never executed: }
0
1292 else if (e == QKeySequence::DeleteStartOfWord) {
partially evaluated: e == QKeySequence::DeleteStartOfWord
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:107
0-107
1293 if (!cursor.hasSelection())
never evaluated: !cursor.hasSelection()
0
1294 cursor.movePosition(QTextCursor::PreviousWord, QTextCursor::KeepAnchor);
never executed: cursor.movePosition(QTextCursor::PreviousWord, QTextCursor::KeepAnchor);
0
1295 cursor.removeSelectedText();
never executed (the execution status of this line is deduced): cursor.removeSelectedText();
-
1296 }
never executed: }
0
1297 else if (e == QKeySequence::DeleteEndOfLine) {
partially evaluated: e == QKeySequence::DeleteEndOfLine
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:107
0-107
1298 QTextBlock block = cursor.block();
never executed (the execution status of this line is deduced): QTextBlock block = cursor.block();
-
1299 if (cursor.position() == block.position() + block.length() - 2)
never evaluated: cursor.position() == block.position() + block.length() - 2
0
1300 cursor.movePosition(QTextCursor::Right, QTextCursor::KeepAnchor);
never executed: cursor.movePosition(QTextCursor::Right, QTextCursor::KeepAnchor);
0
1301 else -
1302 cursor.movePosition(QTextCursor::EndOfBlock, QTextCursor::KeepAnchor);
never executed: cursor.movePosition(QTextCursor::EndOfBlock, QTextCursor::KeepAnchor);
0
1303 cursor.removeSelectedText();
never executed (the execution status of this line is deduced): cursor.removeSelectedText();
-
1304 }
never executed: }
0
1305#endif // QT_NO_SHORTCUT -
1306 else { -
1307 goto process;
executed: goto process;
Execution Count:107
107
1308 } -
1309 goto accept;
executed: goto accept;
Execution Count:2
2
1310 -
1311process: -
1312 { -
1313 QString text = e->text();
executed (the execution status of this line is deduced): QString text = e->text();
-
1314 if (!text.isEmpty() && (text.at(0).isPrint() || text.at(0) == QLatin1Char('\t'))) {
evaluated: !text.isEmpty()
TRUEFALSE
yes
Evaluation Count:71
yes
Evaluation Count:36
partially evaluated: text.at(0).isPrint()
TRUEFALSE
yes
Evaluation Count:71
no
Evaluation Count:0
never evaluated: text.at(0) == QLatin1Char('\t')
0-71
1315 if (overwriteMode
evaluated: overwriteMode
TRUEFALSE
yes
Evaluation Count:10
yes
Evaluation Count:61
10-61
1316 // no need to call deleteChar() if we have a selection, insertText
executed (the execution status of this line is deduced):
-
1317 // does it already
executed (the execution status of this line is deduced):
-
1318 && !cursor.hasSelection()
partially evaluated: !cursor.hasSelection()
TRUEFALSE
yes
Evaluation Count:10
no
Evaluation Count:0
0-10
1319 && !cursor.atBlockEnd())
evaluated: !cursor.atBlockEnd()
TRUEFALSE
yes
Evaluation Count:5
yes
Evaluation Count:5
5
1320 cursor.deleteChar();
executed: cursor.deleteChar();
Execution Count:5
5
1321 -
1322 cursor.insertText(text);
executed (the execution status of this line is deduced): cursor.insertText(text);
-
1323 selectionChanged();
executed (the execution status of this line is deduced): selectionChanged();
-
1324 } else {
executed: }
Execution Count:71
71
1325 e->ignore();
executed (the execution status of this line is deduced): e->ignore();
-
1326 return;
executed: return;
Execution Count:36
36
1327 } -
1328 } -
1329 -
1330 accept:
code before this statement executed: accept:
Execution Count:71
71
1331 -
1332 e->accept();
executed (the execution status of this line is deduced): e->accept();
-
1333 cursorOn = true;
executed (the execution status of this line is deduced): cursorOn = true;
-
1334 -
1335 q->ensureCursorVisible();
executed (the execution status of this line is deduced): q->ensureCursorVisible();
-
1336 -
1337 updateCurrentCharFormat();
executed (the execution status of this line is deduced): updateCurrentCharFormat();
-
1338}
executed: }
Execution Count:118
118
1339 -
1340QVariant QWidgetTextControl::loadResource(int type, const QUrl &name) -
1341{ -
1342#ifdef QT_NO_TEXTEDIT -
1343 Q_UNUSED(type); -
1344 Q_UNUSED(name); -
1345#else -
1346 if (QTextEdit *textEdit = qobject_cast<QTextEdit *>(parent())) {
partially evaluated: QTextEdit *textEdit = qobject_cast<QTextEdit *>(parent())
TRUEFALSE
yes
Evaluation Count:6
no
Evaluation Count:0
0-6
1347 QUrl resolvedName = textEdit->d_func()->resolveUrl(name);
executed (the execution status of this line is deduced): QUrl resolvedName = textEdit->d_func()->resolveUrl(name);
-
1348 return textEdit->loadResource(type, resolvedName);
executed: return textEdit->loadResource(type, resolvedName);
Execution Count:6
6
1349 } -
1350#endif -
1351 return QVariant();
never executed: return QVariant();
0
1352} -
1353 -
1354void QWidgetTextControlPrivate::_q_updateBlock(const QTextBlock &block) -
1355{ -
1356 Q_Q(QWidgetTextControl);
executed (the execution status of this line is deduced): QWidgetTextControl * const q = q_func();
-
1357 QRectF br = q->blockBoundingRect(block);
executed (the execution status of this line is deduced): QRectF br = q->blockBoundingRect(block);
-
1358 br.setRight(qreal(INT_MAX)); // the block might have shrunk
executed (the execution status of this line is deduced): br.setRight(qreal(2147483647));
-
1359 emit q->updateRequest(br);
executed (the execution status of this line is deduced): q->updateRequest(br);
-
1360}
executed: }
Execution Count:355
355
1361 -
1362QRectF QWidgetTextControlPrivate::rectForPosition(int position) const -
1363{ -
1364 Q_Q(const QWidgetTextControl);
executed (the execution status of this line is deduced): const QWidgetTextControl * const q = q_func();
-
1365 const QTextBlock block = doc->findBlock(position);
executed (the execution status of this line is deduced): const QTextBlock block = doc->findBlock(position);
-
1366 if (!block.isValid())
partially evaluated: !block.isValid()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:2107
0-2107
1367 return QRectF();
never executed: return QRectF();
0
1368 const QAbstractTextDocumentLayout *docLayout = doc->documentLayout();
executed (the execution status of this line is deduced): const QAbstractTextDocumentLayout *docLayout = doc->documentLayout();
-
1369 const QTextLayout *layout = block.layout();
executed (the execution status of this line is deduced): const QTextLayout *layout = block.layout();
-
1370 const QPointF layoutPos = q->blockBoundingRect(block).topLeft();
executed (the execution status of this line is deduced): const QPointF layoutPos = q->blockBoundingRect(block).topLeft();
-
1371 int relativePos = position - block.position();
executed (the execution status of this line is deduced): int relativePos = position - block.position();
-
1372 if (preeditCursor != 0) {
partially evaluated: preeditCursor != 0
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:2107
0-2107
1373 int preeditPos = layout->preeditAreaPosition();
never executed (the execution status of this line is deduced): int preeditPos = layout->preeditAreaPosition();
-
1374 if (relativePos == preeditPos)
never evaluated: relativePos == preeditPos
0
1375 relativePos += preeditCursor;
never executed: relativePos += preeditCursor;
0
1376 else if (relativePos > preeditPos)
never evaluated: relativePos > preeditPos
0
1377 relativePos += layout->preeditAreaText().length();
never executed: relativePos += layout->preeditAreaText().length();
0
1378 } -
1379 QTextLine line = layout->lineForTextPosition(relativePos);
executed (the execution status of this line is deduced): QTextLine line = layout->lineForTextPosition(relativePos);
-
1380 -
1381 int cursorWidth;
executed (the execution status of this line is deduced): int cursorWidth;
-
1382 { -
1383 bool ok = false;
executed (the execution status of this line is deduced): bool ok = false;
-
1384#ifndef QT_NO_PROPERTIES -
1385 cursorWidth = docLayout->property("cursorWidth").toInt(&ok);
executed (the execution status of this line is deduced): cursorWidth = docLayout->property("cursorWidth").toInt(&ok);
-
1386#endif -
1387 if (!ok)
partially evaluated: !ok
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:2107
0-2107
1388 cursorWidth = 1;
never executed: cursorWidth = 1;
0
1389 } -
1390 -
1391 QRectF r;
executed (the execution status of this line is deduced): QRectF r;
-
1392 -
1393 if (line.isValid()) {
evaluated: line.isValid()
TRUEFALSE
yes
Evaluation Count:2087
yes
Evaluation Count:20
20-2087
1394 qreal x = line.cursorToX(relativePos);
executed (the execution status of this line is deduced): qreal x = line.cursorToX(relativePos);
-
1395 qreal w = 0;
executed (the execution status of this line is deduced): qreal w = 0;
-
1396 if (overwriteMode) {
evaluated: overwriteMode
TRUEFALSE
yes
Evaluation Count:43
yes
Evaluation Count:2044
43-2044
1397 if (relativePos < line.textLength() - line.textStart())
evaluated: relativePos < line.textLength() - line.textStart()
TRUEFALSE
yes
Evaluation Count:20
yes
Evaluation Count:23
20-23
1398 w = line.cursorToX(relativePos + 1) - x;
executed: w = line.cursorToX(relativePos + 1) - x;
Execution Count:20
20
1399 else -
1400 w = QFontMetrics(block.layout()->font()).width(QLatin1Char(' ')); // in sync with QTextLine::draw()
executed: w = QFontMetrics(block.layout()->font()).width(QLatin1Char(' '));
Execution Count:23
23
1401 } -
1402 r = QRectF(layoutPos.x() + x, layoutPos.y() + line.y(),
executed (the execution status of this line is deduced): r = QRectF(layoutPos.x() + x, layoutPos.y() + line.y(),
-
1403 cursorWidth + w, line.height());
executed (the execution status of this line is deduced): cursorWidth + w, line.height());
-
1404 } else {
executed: }
Execution Count:2087
2087
1405 r = QRectF(layoutPos.x(), layoutPos.y(), cursorWidth, 10); // #### correct height
executed (the execution status of this line is deduced): r = QRectF(layoutPos.x(), layoutPos.y(), cursorWidth, 10);
-
1406 }
executed: }
Execution Count:20
20
1407 -
1408 return r;
executed: return r;
Execution Count:2107
2107
1409} -
1410 -
1411namespace { -
1412struct QTextFrameComparator { -
1413#if defined(Q_CC_MSVC) && _MSC_VER < 1600 -
1414//The STL implementation of MSVC 2008 requires the definition -
1415 bool operator()(QTextFrame *frame1, QTextFrame *frame2) { return frame1->firstPosition() < frame2->firstPosition(); } -
1416#endif -
1417 bool operator()(QTextFrame *frame, int position) { return frame->firstPosition() < position; }
never executed: return frame->firstPosition() < position;
0
1418 bool operator()(int position, QTextFrame *frame) { return position < frame->firstPosition(); }
never executed: return position < frame->firstPosition();
0
1419}; -
1420} -
1421 -
1422static QRectF boundingRectOfFloatsInSelection(const QTextCursor &cursor) -
1423{ -
1424 QRectF r;
executed (the execution status of this line is deduced): QRectF r;
-
1425 QTextFrame *frame = cursor.currentFrame();
executed (the execution status of this line is deduced): QTextFrame *frame = cursor.currentFrame();
-
1426 const QList<QTextFrame *> children = frame->childFrames();
executed (the execution status of this line is deduced): const QList<QTextFrame *> children = frame->childFrames();
-
1427 -
1428 const QList<QTextFrame *>::ConstIterator firstFrame = std::lower_bound(children.constBegin(), children.constEnd(),
executed (the execution status of this line is deduced): const QList<QTextFrame *>::ConstIterator firstFrame = std::lower_bound(children.constBegin(), children.constEnd(),
-
1429 cursor.selectionStart(), QTextFrameComparator());
executed (the execution status of this line is deduced): cursor.selectionStart(), QTextFrameComparator());
-
1430 const QList<QTextFrame *>::ConstIterator lastFrame = std::upper_bound(children.constBegin(), children.constEnd(),
executed (the execution status of this line is deduced): const QList<QTextFrame *>::ConstIterator lastFrame = std::upper_bound(children.constBegin(), children.constEnd(),
-
1431 cursor.selectionEnd(), QTextFrameComparator());
executed (the execution status of this line is deduced): cursor.selectionEnd(), QTextFrameComparator());
-
1432 for (QList<QTextFrame *>::ConstIterator it = firstFrame; it != lastFrame; ++it) {
partially evaluated: it != lastFrame
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:7
0-7
1433 if ((*it)->frameFormat().position() != QTextFrameFormat::InFlow)
never evaluated: (*it)->frameFormat().position() != QTextFrameFormat::InFlow
0
1434 r |= frame->document()->documentLayout()->frameBoundingRect(*it);
never executed: r |= frame->document()->documentLayout()->frameBoundingRect(*it);
0
1435 }
never executed: }
0
1436 return r;
executed: return r;
Execution Count:7
7
1437} -
1438 -
1439QRectF QWidgetTextControl::selectionRect(const QTextCursor &cursor) const -
1440{ -
1441 Q_D(const QWidgetTextControl);
executed (the execution status of this line is deduced): const QWidgetTextControlPrivate * const d = d_func();
-
1442 -
1443 QRectF r = d->rectForPosition(cursor.selectionStart());
executed (the execution status of this line is deduced): QRectF r = d->rectForPosition(cursor.selectionStart());
-
1444 -
1445 if (cursor.hasComplexSelection() && cursor.currentTable()) {
partially evaluated: cursor.hasComplexSelection()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:454
never evaluated: cursor.currentTable()
0-454
1446 QTextTable *table = cursor.currentTable();
never executed (the execution status of this line is deduced): QTextTable *table = cursor.currentTable();
-
1447 -
1448 r = d->doc->documentLayout()->frameBoundingRect(table);
never executed (the execution status of this line is deduced): r = d->doc->documentLayout()->frameBoundingRect(table);
-
1449 /* -
1450 int firstRow, numRows, firstColumn, numColumns; -
1451 cursor.selectedTableCells(&firstRow, &numRows, &firstColumn, &numColumns); -
1452 -
1453 const QTextTableCell firstCell = table->cellAt(firstRow, firstColumn); -
1454 const QTextTableCell lastCell = table->cellAt(firstRow + numRows - 1, firstColumn + numColumns - 1); -
1455 -
1456 const QAbstractTextDocumentLayout * const layout = doc->documentLayout(); -
1457 -
1458 QRectF tableSelRect = layout->blockBoundingRect(firstCell.firstCursorPosition().block()); -
1459 -
1460 for (int col = firstColumn; col < firstColumn + numColumns; ++col) { -
1461 const QTextTableCell cell = table->cellAt(firstRow, col); -
1462 const qreal y = layout->blockBoundingRect(cell.firstCursorPosition().block()).top(); -
1463 -
1464 tableSelRect.setTop(qMin(tableSelRect.top(), y)); -
1465 } -
1466 -
1467 for (int row = firstRow; row < firstRow + numRows; ++row) { -
1468 const QTextTableCell cell = table->cellAt(row, firstColumn); -
1469 const qreal x = layout->blockBoundingRect(cell.firstCursorPosition().block()).left(); -
1470 -
1471 tableSelRect.setLeft(qMin(tableSelRect.left(), x)); -
1472 } -
1473 -
1474 for (int col = firstColumn; col < firstColumn + numColumns; ++col) { -
1475 const QTextTableCell cell = table->cellAt(firstRow + numRows - 1, col); -
1476 const qreal y = layout->blockBoundingRect(cell.lastCursorPosition().block()).bottom(); -
1477 -
1478 tableSelRect.setBottom(qMax(tableSelRect.bottom(), y)); -
1479 } -
1480 -
1481 for (int row = firstRow; row < firstRow + numRows; ++row) { -
1482 const QTextTableCell cell = table->cellAt(row, firstColumn + numColumns - 1); -
1483 const qreal x = layout->blockBoundingRect(cell.lastCursorPosition().block()).right(); -
1484 -
1485 tableSelRect.setRight(qMax(tableSelRect.right(), x)); -
1486 } -
1487 -
1488 r = tableSelRect.toRect(); -
1489 */ -
1490 } else if (cursor.hasSelection()) {
never executed: }
evaluated: cursor.hasSelection()
TRUEFALSE
yes
Evaluation Count:76
yes
Evaluation Count:378
0-378
1491 const int position = cursor.selectionStart();
executed (the execution status of this line is deduced): const int position = cursor.selectionStart();
-
1492 const int anchor = cursor.selectionEnd();
executed (the execution status of this line is deduced): const int anchor = cursor.selectionEnd();
-
1493 const QTextBlock posBlock = d->doc->findBlock(position);
executed (the execution status of this line is deduced): const QTextBlock posBlock = d->doc->findBlock(position);
-
1494 const QTextBlock anchorBlock = d->doc->findBlock(anchor);
executed (the execution status of this line is deduced): const QTextBlock anchorBlock = d->doc->findBlock(anchor);
-
1495 if (posBlock == anchorBlock && posBlock.isValid() && posBlock.layout()->lineCount()) {
evaluated: posBlock == anchorBlock
TRUEFALSE
yes
Evaluation Count:69
yes
Evaluation Count:7
partially evaluated: posBlock.isValid()
TRUEFALSE
yes
Evaluation Count:69
no
Evaluation Count:0
partially evaluated: posBlock.layout()->lineCount()
TRUEFALSE
yes
Evaluation Count:69
no
Evaluation Count:0
0-69
1496 const QTextLine posLine = posBlock.layout()->lineForTextPosition(position - posBlock.position());
executed (the execution status of this line is deduced): const QTextLine posLine = posBlock.layout()->lineForTextPosition(position - posBlock.position());
-
1497 const QTextLine anchorLine = anchorBlock.layout()->lineForTextPosition(anchor - anchorBlock.position());
executed (the execution status of this line is deduced): const QTextLine anchorLine = anchorBlock.layout()->lineForTextPosition(anchor - anchorBlock.position());
-
1498 -
1499 const int firstLine = qMin(posLine.lineNumber(), anchorLine.lineNumber());
executed (the execution status of this line is deduced): const int firstLine = qMin(posLine.lineNumber(), anchorLine.lineNumber());
-
1500 const int lastLine = qMax(posLine.lineNumber(), anchorLine.lineNumber());
executed (the execution status of this line is deduced): const int lastLine = qMax(posLine.lineNumber(), anchorLine.lineNumber());
-
1501 const QTextLayout *layout = posBlock.layout();
executed (the execution status of this line is deduced): const QTextLayout *layout = posBlock.layout();
-
1502 r = QRectF();
executed (the execution status of this line is deduced): r = QRectF();
-
1503 for (int i = firstLine; i <= lastLine; ++i) {
evaluated: i <= lastLine
TRUEFALSE
yes
Evaluation Count:77
yes
Evaluation Count:69
69-77
1504 r |= layout->lineAt(i).rect();
executed (the execution status of this line is deduced): r |= layout->lineAt(i).rect();
-
1505 r |= layout->lineAt(i).naturalTextRect(); // might be bigger in the case of wrap not enabled
executed (the execution status of this line is deduced): r |= layout->lineAt(i).naturalTextRect();
-
1506 }
executed: }
Execution Count:77
77
1507 r.translate(blockBoundingRect(posBlock).topLeft());
executed (the execution status of this line is deduced): r.translate(blockBoundingRect(posBlock).topLeft());
-
1508 } else {
executed: }
Execution Count:69
69
1509 QRectF anchorRect = d->rectForPosition(cursor.selectionEnd());
executed (the execution status of this line is deduced): QRectF anchorRect = d->rectForPosition(cursor.selectionEnd());
-
1510 r |= anchorRect;
executed (the execution status of this line is deduced): r |= anchorRect;
-
1511 r |= boundingRectOfFloatsInSelection(cursor);
executed (the execution status of this line is deduced): r |= boundingRectOfFloatsInSelection(cursor);
-
1512 QRectF frameRect(d->doc->documentLayout()->frameBoundingRect(cursor.currentFrame()));
executed (the execution status of this line is deduced): QRectF frameRect(d->doc->documentLayout()->frameBoundingRect(cursor.currentFrame()));
-
1513 r.setLeft(frameRect.left());
executed (the execution status of this line is deduced): r.setLeft(frameRect.left());
-
1514 r.setRight(frameRect.right());
executed (the execution status of this line is deduced): r.setRight(frameRect.right());
-
1515 }
executed: }
Execution Count:7
7
1516 if (r.isValid())
partially evaluated: r.isValid()
TRUEFALSE
yes
Evaluation Count:76
no
Evaluation Count:0
0-76
1517 r.adjust(-1, -1, 1, 1);
executed: r.adjust(-1, -1, 1, 1);
Execution Count:76
76
1518 }
executed: }
Execution Count:76
76
1519 -
1520 return r;
executed: return r;
Execution Count:454
454
1521} -
1522 -
1523QRectF QWidgetTextControl::selectionRect() const -
1524{ -
1525 Q_D(const QWidgetTextControl);
executed (the execution status of this line is deduced): const QWidgetTextControlPrivate * const d = d_func();
-
1526 return selectionRect(d->cursor);
executed: return selectionRect(d->cursor);
Execution Count:367
367
1527} -
1528 -
1529void QWidgetTextControlPrivate::mousePressEvent(QEvent *e, Qt::MouseButton button, const QPointF &pos, Qt::KeyboardModifiers modifiers, -
1530 Qt::MouseButtons buttons, const QPoint &globalPos) -
1531{ -
1532 Q_Q(QWidgetTextControl);
executed (the execution status of this line is deduced): QWidgetTextControl * const q = q_func();
-
1533 -
1534 mousePressPos = pos.toPoint();
executed (the execution status of this line is deduced): mousePressPos = pos.toPoint();
-
1535 -
1536#ifndef QT_NO_DRAGANDDROP -
1537 mightStartDrag = false;
executed (the execution status of this line is deduced): mightStartDrag = false;
-
1538#endif -
1539 -
1540 if (sendMouseEventToInputContext(
partially evaluated: sendMouseEventToInputContext( e, QEvent::MouseButtonPress, button, pos, modifiers, buttons, globalPos)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:7
0-7
1541 e, QEvent::MouseButtonPress, button, pos, modifiers, buttons, globalPos)) {
partially evaluated: sendMouseEventToInputContext( e, QEvent::MouseButtonPress, button, pos, modifiers, buttons, globalPos)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:7
0-7
1542 return;
never executed: return;
0
1543 } -
1544 -
1545 if (interactionFlags & Qt::LinksAccessibleByMouse) {
evaluated: interactionFlags & Qt::LinksAccessibleByMouse
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:5
2-5
1546 anchorOnMousePress = q->anchorAt(pos);
executed (the execution status of this line is deduced): anchorOnMousePress = q->anchorAt(pos);
-
1547 -
1548 if (cursorIsFocusIndicator) {
partially evaluated: cursorIsFocusIndicator
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:2
0-2
1549 cursorIsFocusIndicator = false;
never executed (the execution status of this line is deduced): cursorIsFocusIndicator = false;
-
1550 repaintSelection();
never executed (the execution status of this line is deduced): repaintSelection();
-
1551 cursor.clearSelection();
never executed (the execution status of this line is deduced): cursor.clearSelection();
-
1552 }
never executed: }
0
1553 }
executed: }
Execution Count:2
2
1554 if (!(button & Qt::LeftButton) ||
partially evaluated: !(button & Qt::LeftButton)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:7
0-7
1555 !((interactionFlags & Qt::TextSelectableByMouse) || (interactionFlags & Qt::TextEditable))) {
evaluated: (interactionFlags & Qt::TextSelectableByMouse)
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:5
partially evaluated: (interactionFlags & Qt::TextEditable)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:5
0-5
1556 e->ignore();
executed (the execution status of this line is deduced): e->ignore();
-
1557 return;
executed: return;
Execution Count:5
5
1558 } -
1559 -
1560 cursorIsFocusIndicator = false;
executed (the execution status of this line is deduced): cursorIsFocusIndicator = false;
-
1561 const QTextCursor oldSelection = cursor;
executed (the execution status of this line is deduced): const QTextCursor oldSelection = cursor;
-
1562 const int oldCursorPos = cursor.position();
executed (the execution status of this line is deduced): const int oldCursorPos = cursor.position();
-
1563 -
1564 mousePressed = (interactionFlags & Qt::TextSelectableByMouse);
executed (the execution status of this line is deduced): mousePressed = (interactionFlags & Qt::TextSelectableByMouse);
-
1565 -
1566 commitPreedit();
executed (the execution status of this line is deduced): commitPreedit();
-
1567 -
1568 if (trippleClickTimer.isActive()
partially evaluated: trippleClickTimer.isActive()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:2
0-2
1569 && ((pos - trippleClickPoint).toPoint().manhattanLength() < QApplication::startDragDistance())) {
never evaluated: ((pos - trippleClickPoint).toPoint().manhattanLength() < QApplication::startDragDistance())
0
1570 -
1571 cursor.movePosition(QTextCursor::StartOfBlock);
never executed (the execution status of this line is deduced): cursor.movePosition(QTextCursor::StartOfBlock);
-
1572 cursor.movePosition(QTextCursor::EndOfBlock, QTextCursor::KeepAnchor);
never executed (the execution status of this line is deduced): cursor.movePosition(QTextCursor::EndOfBlock, QTextCursor::KeepAnchor);
-
1573 cursor.movePosition(QTextCursor::NextCharacter, QTextCursor::KeepAnchor);
never executed (the execution status of this line is deduced): cursor.movePosition(QTextCursor::NextCharacter, QTextCursor::KeepAnchor);
-
1574 selectedBlockOnTrippleClick = cursor;
never executed (the execution status of this line is deduced): selectedBlockOnTrippleClick = cursor;
-
1575 -
1576 anchorOnMousePress = QString();
never executed (the execution status of this line is deduced): anchorOnMousePress = QString();
-
1577 -
1578 trippleClickTimer.stop();
never executed (the execution status of this line is deduced): trippleClickTimer.stop();
-
1579 } else {
never executed: }
0
1580 int cursorPos = q->hitTest(pos, Qt::FuzzyHit);
executed (the execution status of this line is deduced): int cursorPos = q->hitTest(pos, Qt::FuzzyHit);
-
1581 if (cursorPos == -1) {
partially evaluated: cursorPos == -1
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:2
0-2
1582 e->ignore();
never executed (the execution status of this line is deduced): e->ignore();
-
1583 return;
never executed: return;
0
1584 } -
1585 -
1586 if (modifiers == Qt::ShiftModifier && (interactionFlags & Qt::TextSelectableByMouse)) {
partially evaluated: modifiers == Qt::ShiftModifier
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:2
never evaluated: (interactionFlags & Qt::TextSelectableByMouse)
0-2
1587 if (wordSelectionEnabled && !selectedWordOnDoubleClick.hasSelection()) {
never evaluated: wordSelectionEnabled
never evaluated: !selectedWordOnDoubleClick.hasSelection()
0
1588 selectedWordOnDoubleClick = cursor;
never executed (the execution status of this line is deduced): selectedWordOnDoubleClick = cursor;
-
1589 selectedWordOnDoubleClick.select(QTextCursor::WordUnderCursor);
never executed (the execution status of this line is deduced): selectedWordOnDoubleClick.select(QTextCursor::WordUnderCursor);
-
1590 }
never executed: }
0
1591 -
1592 if (selectedBlockOnTrippleClick.hasSelection())
never evaluated: selectedBlockOnTrippleClick.hasSelection()
0
1593 extendBlockwiseSelection(cursorPos);
never executed: extendBlockwiseSelection(cursorPos);
0
1594 else if (selectedWordOnDoubleClick.hasSelection())
never evaluated: selectedWordOnDoubleClick.hasSelection()
0
1595 extendWordwiseSelection(cursorPos, pos.x());
never executed: extendWordwiseSelection(cursorPos, pos.x());
0
1596 else if (!wordSelectionEnabled)
never evaluated: !wordSelectionEnabled
0
1597 setCursorPosition(cursorPos, QTextCursor::KeepAnchor);
never executed: setCursorPosition(cursorPos, QTextCursor::KeepAnchor);
0
1598 } else { -
1599 -
1600 if (dragEnabled
partially evaluated: dragEnabled
TRUEFALSE
yes
Evaluation Count:2
no
Evaluation Count:0
0-2
1601 && cursor.hasSelection()
partially evaluated: cursor.hasSelection()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:2
0-2
1602 && !cursorIsFocusIndicator
never evaluated: !cursorIsFocusIndicator
0
1603 && cursorPos >= cursor.selectionStart()
never evaluated: cursorPos >= cursor.selectionStart()
0
1604 && cursorPos <= cursor.selectionEnd()
never evaluated: cursorPos <= cursor.selectionEnd()
0
1605 && q->hitTest(pos, Qt::ExactHit) != -1) {
never evaluated: q->hitTest(pos, Qt::ExactHit) != -1
0
1606#ifndef QT_NO_DRAGANDDROP -
1607 mightStartDrag = true;
never executed (the execution status of this line is deduced): mightStartDrag = true;
-
1608#endif -
1609 return;
never executed: return;
0
1610 } -
1611 -
1612 setCursorPosition(cursorPos);
executed (the execution status of this line is deduced): setCursorPosition(cursorPos);
-
1613 }
executed: }
Execution Count:2
2
1614 } -
1615 -
1616 if (interactionFlags & Qt::TextEditable) {
partially evaluated: interactionFlags & Qt::TextEditable
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:2
0-2
1617 q->ensureCursorVisible();
never executed (the execution status of this line is deduced): q->ensureCursorVisible();
-
1618 if (cursor.position() != oldCursorPos)
never evaluated: cursor.position() != oldCursorPos
0
1619 emit q->cursorPositionChanged();
never executed: q->cursorPositionChanged();
0
1620 _q_updateCurrentCharFormatAndSelection();
never executed (the execution status of this line is deduced): _q_updateCurrentCharFormatAndSelection();
-
1621 } else {
never executed: }
0
1622 if (cursor.position() != oldCursorPos) {
partially evaluated: cursor.position() != oldCursorPos
TRUEFALSE
yes
Evaluation Count:2
no
Evaluation Count:0
0-2
1623 emit q->cursorPositionChanged();
executed (the execution status of this line is deduced): q->cursorPositionChanged();
-
1624 emit q->microFocusChanged();
executed (the execution status of this line is deduced): q->microFocusChanged();
-
1625 }
executed: }
Execution Count:2
2
1626 selectionChanged();
executed (the execution status of this line is deduced): selectionChanged();
-
1627 }
executed: }
Execution Count:2
2
1628 repaintOldAndNewSelection(oldSelection);
executed (the execution status of this line is deduced): repaintOldAndNewSelection(oldSelection);
-
1629 hadSelectionOnMousePress = cursor.hasSelection();
executed (the execution status of this line is deduced): hadSelectionOnMousePress = cursor.hasSelection();
-
1630}
executed: }
Execution Count:2
2
1631 -
1632void QWidgetTextControlPrivate::mouseMoveEvent(QEvent *e, Qt::MouseButton button, const QPointF &mousePos, Qt::KeyboardModifiers modifiers, -
1633 Qt::MouseButtons buttons, const QPoint &globalPos) -
1634{ -
1635 Q_Q(QWidgetTextControl);
executed (the execution status of this line is deduced): QWidgetTextControl * const q = q_func();
-
1636 -
1637 if (interactionFlags & Qt::LinksAccessibleByMouse) {
partially evaluated: interactionFlags & Qt::LinksAccessibleByMouse
TRUEFALSE
yes
Evaluation Count:1
no
Evaluation Count:0
0-1
1638 QString anchor = q->anchorAt(mousePos);
executed (the execution status of this line is deduced): QString anchor = q->anchorAt(mousePos);
-
1639 if (anchor != highlightedAnchor) {
partially evaluated: anchor != highlightedAnchor
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1
0-1
1640 highlightedAnchor = anchor;
never executed (the execution status of this line is deduced): highlightedAnchor = anchor;
-
1641 emit q->linkHovered(anchor);
never executed (the execution status of this line is deduced): q->linkHovered(anchor);
-
1642 }
never executed: }
0
1643 }
executed: }
Execution Count:1
1
1644 -
1645 if (buttons & Qt::LeftButton) {
partially evaluated: buttons & Qt::LeftButton
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1
0-1
1646 const bool editable = interactionFlags & Qt::TextEditable;
never executed (the execution status of this line is deduced): const bool editable = interactionFlags & Qt::TextEditable;
-
1647 -
1648 if (!(mousePressed
never evaluated: mousePressed
0
1649 || editable
never evaluated: editable
0
1650 || mightStartDrag
never evaluated: mightStartDrag
0
1651 || selectedWordOnDoubleClick.hasSelection()
never evaluated: selectedWordOnDoubleClick.hasSelection()
0
1652 || selectedBlockOnTrippleClick.hasSelection()))
never evaluated: selectedBlockOnTrippleClick.hasSelection()
0
1653 return;
never executed: return;
0
1654 -
1655 const QTextCursor oldSelection = cursor;
never executed (the execution status of this line is deduced): const QTextCursor oldSelection = cursor;
-
1656 const int oldCursorPos = cursor.position();
never executed (the execution status of this line is deduced): const int oldCursorPos = cursor.position();
-
1657 -
1658 if (mightStartDrag) {
never evaluated: mightStartDrag
0
1659 if ((mousePos.toPoint() - mousePressPos).manhattanLength() > QApplication::startDragDistance())
never evaluated: (mousePos.toPoint() - mousePressPos).manhattanLength() > QApplication::startDragDistance()
0
1660 startDrag();
never executed: startDrag();
0
1661 return;
never executed: return;
0
1662 } -
1663 -
1664 if (!mousePressed)
never evaluated: !mousePressed
0
1665 return;
never executed: return;
0
1666 -
1667 const qreal mouseX = qreal(mousePos.x());
never executed (the execution status of this line is deduced): const qreal mouseX = qreal(mousePos.x());
-
1668 -
1669 int newCursorPos = q->hitTest(mousePos, Qt::FuzzyHit);
never executed (the execution status of this line is deduced): int newCursorPos = q->hitTest(mousePos, Qt::FuzzyHit);
-
1670 -
1671 if (isPreediting()) {
never evaluated: isPreediting()
0
1672 // note: oldCursorPos not including preedit -
1673 int selectionStartPos = q->hitTest(mousePressPos, Qt::FuzzyHit);
never executed (the execution status of this line is deduced): int selectionStartPos = q->hitTest(mousePressPos, Qt::FuzzyHit);
-
1674 -
1675 if (newCursorPos != selectionStartPos) {
never evaluated: newCursorPos != selectionStartPos
0
1676 commitPreedit();
never executed (the execution status of this line is deduced): commitPreedit();
-
1677 // commit invalidates positions -
1678 newCursorPos = q->hitTest(mousePos, Qt::FuzzyHit);
never executed (the execution status of this line is deduced): newCursorPos = q->hitTest(mousePos, Qt::FuzzyHit);
-
1679 selectionStartPos = q->hitTest(mousePressPos, Qt::FuzzyHit);
never executed (the execution status of this line is deduced): selectionStartPos = q->hitTest(mousePressPos, Qt::FuzzyHit);
-
1680 setCursorPosition(selectionStartPos);
never executed (the execution status of this line is deduced): setCursorPosition(selectionStartPos);
-
1681 }
never executed: }
0
1682 }
never executed: }
0
1683 -
1684 if (newCursorPos == -1)
never evaluated: newCursorPos == -1
0
1685 return;
never executed: return;
0
1686 -
1687 if (wordSelectionEnabled && !selectedWordOnDoubleClick.hasSelection()) {
never evaluated: wordSelectionEnabled
never evaluated: !selectedWordOnDoubleClick.hasSelection()
0
1688 selectedWordOnDoubleClick = cursor;
never executed (the execution status of this line is deduced): selectedWordOnDoubleClick = cursor;
-
1689 selectedWordOnDoubleClick.select(QTextCursor::WordUnderCursor);
never executed (the execution status of this line is deduced): selectedWordOnDoubleClick.select(QTextCursor::WordUnderCursor);
-
1690 }
never executed: }
0
1691 -
1692 if (selectedBlockOnTrippleClick.hasSelection())
never evaluated: selectedBlockOnTrippleClick.hasSelection()
0
1693 extendBlockwiseSelection(newCursorPos);
never executed: extendBlockwiseSelection(newCursorPos);
0
1694 else if (selectedWordOnDoubleClick.hasSelection())
never evaluated: selectedWordOnDoubleClick.hasSelection()
0
1695 extendWordwiseSelection(newCursorPos, mouseX);
never executed: extendWordwiseSelection(newCursorPos, mouseX);
0
1696 else if (!isPreediting())
never evaluated: !isPreediting()
0
1697 setCursorPosition(newCursorPos, QTextCursor::KeepAnchor);
never executed: setCursorPosition(newCursorPos, QTextCursor::KeepAnchor);
0
1698 -
1699 if (interactionFlags & Qt::TextEditable) {
never evaluated: interactionFlags & Qt::TextEditable
0
1700 // don't call ensureVisible for the visible cursor to avoid jumping -
1701 // scrollbars. the autoscrolling ensures smooth scrolling if necessary. -
1702 //q->ensureCursorVisible(); -
1703 if (cursor.position() != oldCursorPos)
never evaluated: cursor.position() != oldCursorPos
0
1704 emit q->cursorPositionChanged();
never executed: q->cursorPositionChanged();
0
1705 _q_updateCurrentCharFormatAndSelection();
never executed (the execution status of this line is deduced): _q_updateCurrentCharFormatAndSelection();
-
1706#ifndef QT_NO_IM -
1707 if (contextWidget)
never evaluated: contextWidget
0
1708 qApp->inputMethod()->update(Qt::ImQueryInput);
never executed: (static_cast<QApplication *>(QCoreApplication::instance()))->inputMethod()->update(Qt::ImQueryInput);
0
1709#endif //QT_NO_IM -
1710 } else {
never executed: }
0
1711 //emit q->visibilityRequest(QRectF(mousePos, QSizeF(1, 1))); -
1712 if (cursor.position() != oldCursorPos) {
never evaluated: cursor.position() != oldCursorPos
0
1713 emit q->cursorPositionChanged();
never executed (the execution status of this line is deduced): q->cursorPositionChanged();
-
1714 emit q->microFocusChanged();
never executed (the execution status of this line is deduced): q->microFocusChanged();
-
1715 }
never executed: }
0
1716 }
never executed: }
0
1717 selectionChanged(true);
never executed (the execution status of this line is deduced): selectionChanged(true);
-
1718 repaintOldAndNewSelection(oldSelection);
never executed (the execution status of this line is deduced): repaintOldAndNewSelection(oldSelection);
-
1719 }
never executed: }
0
1720 -
1721 sendMouseEventToInputContext(e, QEvent::MouseMove, button, mousePos, modifiers, buttons, globalPos);
executed (the execution status of this line is deduced): sendMouseEventToInputContext(e, QEvent::MouseMove, button, mousePos, modifiers, buttons, globalPos);
-
1722}
executed: }
Execution Count:1
1
1723 -
1724void QWidgetTextControlPrivate::mouseReleaseEvent(QEvent *e, Qt::MouseButton button, const QPointF &pos, Qt::KeyboardModifiers modifiers, -
1725 Qt::MouseButtons buttons, const QPoint &globalPos) -
1726{ -
1727 Q_Q(QWidgetTextControl);
executed (the execution status of this line is deduced): QWidgetTextControl * const q = q_func();
-
1728 -
1729 if (sendMouseEventToInputContext(
partially evaluated: sendMouseEventToInputContext( e, QEvent::MouseButtonRelease, button, pos, modifiers, buttons, globalPos)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1
0-1
1730 e, QEvent::MouseButtonRelease, button, pos, modifiers, buttons, globalPos)) {
partially evaluated: sendMouseEventToInputContext( e, QEvent::MouseButtonRelease, button, pos, modifiers, buttons, globalPos)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1
0-1
1731 return;
never executed: return;
0
1732 } -
1733 -
1734 const QTextCursor oldSelection = cursor;
executed (the execution status of this line is deduced): const QTextCursor oldSelection = cursor;
-
1735 const int oldCursorPos = cursor.position();
executed (the execution status of this line is deduced): const int oldCursorPos = cursor.position();
-
1736 -
1737#ifndef QT_NO_DRAGANDDROP -
1738 if (mightStartDrag && (button & Qt::LeftButton)) {
partially evaluated: mightStartDrag
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1
never evaluated: (button & Qt::LeftButton)
0-1
1739 mousePressed = false;
never executed (the execution status of this line is deduced): mousePressed = false;
-
1740 setCursorPosition(pos);
never executed (the execution status of this line is deduced): setCursorPosition(pos);
-
1741 cursor.clearSelection();
never executed (the execution status of this line is deduced): cursor.clearSelection();
-
1742 selectionChanged();
never executed (the execution status of this line is deduced): selectionChanged();
-
1743 }
never executed: }
0
1744#endif -
1745 if (mousePressed) {
partially evaluated: mousePressed
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1
0-1
1746 mousePressed = false;
never executed (the execution status of this line is deduced): mousePressed = false;
-
1747#ifndef QT_NO_CLIPBOARD -
1748 setClipboardSelection();
never executed (the execution status of this line is deduced): setClipboardSelection();
-
1749 selectionChanged(true);
never executed (the execution status of this line is deduced): selectionChanged(true);
-
1750 } else if (button == Qt::MidButton
never executed: }
partially evaluated: button == Qt::MidButton
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1
0-1
1751 && (interactionFlags & Qt::TextEditable)
never evaluated: (interactionFlags & Qt::TextEditable)
0
1752 && QApplication::clipboard()->supportsSelection()) {
never evaluated: QApplication::clipboard()->supportsSelection()
0
1753 setCursorPosition(pos);
never executed (the execution status of this line is deduced): setCursorPosition(pos);
-
1754 const QMimeData *md = QApplication::clipboard()->mimeData(QClipboard::Selection);
never executed (the execution status of this line is deduced): const QMimeData *md = QApplication::clipboard()->mimeData(QClipboard::Selection);
-
1755 if (md)
never evaluated: md
0
1756 q->insertFromMimeData(md);
never executed: q->insertFromMimeData(md);
0
1757#endif -
1758 }
never executed: }
0
1759 -
1760 repaintOldAndNewSelection(oldSelection);
executed (the execution status of this line is deduced): repaintOldAndNewSelection(oldSelection);
-
1761 -
1762 if (cursor.position() != oldCursorPos) {
partially evaluated: cursor.position() != oldCursorPos
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1
0-1
1763 emit q->cursorPositionChanged();
never executed (the execution status of this line is deduced): q->cursorPositionChanged();
-
1764 emit q->microFocusChanged();
never executed (the execution status of this line is deduced): q->microFocusChanged();
-
1765 }
never executed: }
0
1766 -
1767 if (interactionFlags & Qt::LinksAccessibleByMouse) {
partially evaluated: interactionFlags & Qt::LinksAccessibleByMouse
TRUEFALSE
yes
Evaluation Count:1
no
Evaluation Count:0
0-1
1768 if (!(button & Qt::LeftButton))
partially evaluated: !(button & Qt::LeftButton)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1
0-1
1769 return;
never executed: return;
0
1770 -
1771 const QString anchor = q->anchorAt(pos);
executed (the execution status of this line is deduced): const QString anchor = q->anchorAt(pos);
-
1772 -
1773 if (anchor.isEmpty())
partially evaluated: anchor.isEmpty()
TRUEFALSE
yes
Evaluation Count:1
no
Evaluation Count:0
0-1
1774 return;
executed: return;
Execution Count:1
1
1775 -
1776 if (!cursor.hasSelection()
never evaluated: !cursor.hasSelection()
0
1777 || (anchor == anchorOnMousePress && hadSelectionOnMousePress)) {
never evaluated: anchor == anchorOnMousePress
never evaluated: hadSelectionOnMousePress
0
1778 -
1779 const int anchorPos = q->hitTest(pos, Qt::ExactHit);
never executed (the execution status of this line is deduced): const int anchorPos = q->hitTest(pos, Qt::ExactHit);
-
1780 if (anchorPos != -1) {
never evaluated: anchorPos != -1
0
1781 cursor.setPosition(anchorPos);
never executed (the execution status of this line is deduced): cursor.setPosition(anchorPos);
-
1782 -
1783 QString anchor = anchorOnMousePress;
never executed (the execution status of this line is deduced): QString anchor = anchorOnMousePress;
-
1784 anchorOnMousePress = QString();
never executed (the execution status of this line is deduced): anchorOnMousePress = QString();
-
1785 activateLinkUnderCursor(anchor);
never executed (the execution status of this line is deduced): activateLinkUnderCursor(anchor);
-
1786 }
never executed: }
0
1787 }
never executed: }
0
1788 }
never executed: }
0
1789}
never executed: }
0
1790 -
1791void QWidgetTextControlPrivate::mouseDoubleClickEvent(QEvent *e, Qt::MouseButton button, const QPointF &pos, -
1792 Qt::KeyboardModifiers modifiers, Qt::MouseButtons buttons, -
1793 const QPoint &globalPos) -
1794{ -
1795 Q_Q(QWidgetTextControl);
never executed (the execution status of this line is deduced): QWidgetTextControl * const q = q_func();
-
1796 -
1797 if (button == Qt::LeftButton
never evaluated: button == Qt::LeftButton
0
1798 && (interactionFlags & Qt::TextSelectableByMouse)) {
never evaluated: (interactionFlags & Qt::TextSelectableByMouse)
0
1799 -
1800#ifndef QT_NO_DRAGANDDROP -
1801 mightStartDrag = false;
never executed (the execution status of this line is deduced): mightStartDrag = false;
-
1802#endif -
1803 commitPreedit();
never executed (the execution status of this line is deduced): commitPreedit();
-
1804 -
1805 const QTextCursor oldSelection = cursor;
never executed (the execution status of this line is deduced): const QTextCursor oldSelection = cursor;
-
1806 setCursorPosition(pos);
never executed (the execution status of this line is deduced): setCursorPosition(pos);
-
1807 QTextLine line = currentTextLine(cursor);
never executed (the execution status of this line is deduced): QTextLine line = currentTextLine(cursor);
-
1808 bool doEmit = false;
never executed (the execution status of this line is deduced): bool doEmit = false;
-
1809 if (line.isValid() && line.textLength()) {
never evaluated: line.isValid()
never evaluated: line.textLength()
0
1810 cursor.select(QTextCursor::WordUnderCursor);
never executed (the execution status of this line is deduced): cursor.select(QTextCursor::WordUnderCursor);
-
1811 doEmit = true;
never executed (the execution status of this line is deduced): doEmit = true;
-
1812 }
never executed: }
0
1813 repaintOldAndNewSelection(oldSelection);
never executed (the execution status of this line is deduced): repaintOldAndNewSelection(oldSelection);
-
1814 -
1815 cursorIsFocusIndicator = false;
never executed (the execution status of this line is deduced): cursorIsFocusIndicator = false;
-
1816 selectedWordOnDoubleClick = cursor;
never executed (the execution status of this line is deduced): selectedWordOnDoubleClick = cursor;
-
1817 -
1818 trippleClickPoint = pos;
never executed (the execution status of this line is deduced): trippleClickPoint = pos;
-
1819 trippleClickTimer.start(QApplication::doubleClickInterval(), q);
never executed (the execution status of this line is deduced): trippleClickTimer.start(QApplication::doubleClickInterval(), q);
-
1820 if (doEmit) {
never evaluated: doEmit
0
1821 selectionChanged();
never executed (the execution status of this line is deduced): selectionChanged();
-
1822#ifndef QT_NO_CLIPBOARD -
1823 setClipboardSelection();
never executed (the execution status of this line is deduced): setClipboardSelection();
-
1824#endif -
1825 emit q->cursorPositionChanged();
never executed (the execution status of this line is deduced): q->cursorPositionChanged();
-
1826 }
never executed: }
0
1827 } else if (!sendMouseEventToInputContext(e, QEvent::MouseButtonDblClick, button, pos,
never executed: }
never evaluated: !sendMouseEventToInputContext(e, QEvent::MouseButtonDblClick, button, pos, modifiers, buttons, globalPos)
0
1828 modifiers, buttons, globalPos)) {
never evaluated: !sendMouseEventToInputContext(e, QEvent::MouseButtonDblClick, button, pos, modifiers, buttons, globalPos)
0
1829 e->ignore();
never executed (the execution status of this line is deduced): e->ignore();
-
1830 }
never executed: }
0
1831} -
1832 -
1833bool QWidgetTextControlPrivate::sendMouseEventToInputContext( -
1834 QEvent *e, QEvent::Type eventType, Qt::MouseButton button, const QPointF &pos, -
1835 Qt::KeyboardModifiers modifiers, Qt::MouseButtons buttons, const QPoint &globalPos) -
1836{ -
1837 Q_UNUSED(eventType);
executed (the execution status of this line is deduced): (void)eventType;;
-
1838 Q_UNUSED(button);
executed (the execution status of this line is deduced): (void)button;;
-
1839 Q_UNUSED(pos);
executed (the execution status of this line is deduced): (void)pos;;
-
1840 Q_UNUSED(modifiers);
executed (the execution status of this line is deduced): (void)modifiers;;
-
1841 Q_UNUSED(buttons);
executed (the execution status of this line is deduced): (void)buttons;;
-
1842 Q_UNUSED(globalPos);
executed (the execution status of this line is deduced): (void)globalPos;;
-
1843#if !defined(QT_NO_IM) -
1844 Q_Q(QWidgetTextControl);
executed (the execution status of this line is deduced): QWidgetTextControl * const q = q_func();
-
1845 -
1846 if (isPreediting()) {
partially evaluated: isPreediting()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:9
0-9
1847 QTextLayout *layout = cursor.block().layout();
never executed (the execution status of this line is deduced): QTextLayout *layout = cursor.block().layout();
-
1848 int cursorPos = q->hitTest(pos, Qt::FuzzyHit) - cursor.position();
never executed (the execution status of this line is deduced): int cursorPos = q->hitTest(pos, Qt::FuzzyHit) - cursor.position();
-
1849 -
1850 if (cursorPos < 0 || cursorPos > layout->preeditAreaText().length())
never evaluated: cursorPos < 0
never evaluated: cursorPos > layout->preeditAreaText().length()
0
1851 cursorPos = -1;
never executed: cursorPos = -1;
0
1852 -
1853 if (cursorPos >= 0) {
never evaluated: cursorPos >= 0
0
1854 if (eventType == QEvent::MouseButtonRelease)
never evaluated: eventType == QEvent::MouseButtonRelease
0
1855 qApp->inputMethod()->invokeAction(QInputMethod::Click, cursorPos);
never executed: (static_cast<QApplication *>(QCoreApplication::instance()))->inputMethod()->invokeAction(QInputMethod::Click, cursorPos);
0
1856 -
1857 e->setAccepted(true);
never executed (the execution status of this line is deduced): e->setAccepted(true);
-
1858 return true;
never executed: return true;
0
1859 } -
1860 }
never executed: }
0
1861#else -
1862 Q_UNUSED(e); -
1863#endif -
1864 return false;
executed: return false;
Execution Count:9
9
1865} -
1866 -
1867void QWidgetTextControlPrivate::contextMenuEvent(const QPoint &screenPos, const QPointF &docPos, QWidget *contextWidget) -
1868{ -
1869#ifdef QT_NO_CONTEXTMENU -
1870 Q_UNUSED(screenPos); -
1871 Q_UNUSED(docPos); -
1872 Q_UNUSED(contextWidget); -
1873#else -
1874 Q_Q(QWidgetTextControl);
never executed (the execution status of this line is deduced): QWidgetTextControl * const q = q_func();
-
1875 if (!hasFocus)
never evaluated: !hasFocus
0
1876 return;
never executed: return;
0
1877 QMenu *menu = q->createStandardContextMenu(docPos, contextWidget);
never executed (the execution status of this line is deduced): QMenu *menu = q->createStandardContextMenu(docPos, contextWidget);
-
1878 if (!menu)
never evaluated: !menu
0
1879 return;
never executed: return;
0
1880 menu->setAttribute(Qt::WA_DeleteOnClose);
never executed (the execution status of this line is deduced): menu->setAttribute(Qt::WA_DeleteOnClose);
-
1881 menu->popup(screenPos);
never executed (the execution status of this line is deduced): menu->popup(screenPos);
-
1882#endif -
1883}
never executed: }
0
1884 -
1885bool QWidgetTextControlPrivate::dragEnterEvent(QEvent *e, const QMimeData *mimeData) -
1886{ -
1887 Q_Q(QWidgetTextControl);
never executed (the execution status of this line is deduced): QWidgetTextControl * const q = q_func();
-
1888 if (!(interactionFlags & Qt::TextEditable) || !q->canInsertFromMimeData(mimeData)) {
never evaluated: !(interactionFlags & Qt::TextEditable)
never evaluated: !q->canInsertFromMimeData(mimeData)
0
1889 e->ignore();
never executed (the execution status of this line is deduced): e->ignore();
-
1890 return false;
never executed: return false;
0
1891 } -
1892 -
1893 dndFeedbackCursor = QTextCursor();
never executed (the execution status of this line is deduced): dndFeedbackCursor = QTextCursor();
-
1894 -
1895 return true; // accept proposed action
never executed: return true;
0
1896} -
1897 -
1898void QWidgetTextControlPrivate::dragLeaveEvent() -
1899{ -
1900 Q_Q(QWidgetTextControl);
never executed (the execution status of this line is deduced): QWidgetTextControl * const q = q_func();
-
1901 -
1902 const QRectF crect = q->cursorRect(dndFeedbackCursor);
never executed (the execution status of this line is deduced): const QRectF crect = q->cursorRect(dndFeedbackCursor);
-
1903 dndFeedbackCursor = QTextCursor();
never executed (the execution status of this line is deduced): dndFeedbackCursor = QTextCursor();
-
1904 -
1905 if (crect.isValid())
never evaluated: crect.isValid()
0
1906 emit q->updateRequest(crect);
never executed: q->updateRequest(crect);
0
1907}
never executed: }
0
1908 -
1909bool QWidgetTextControlPrivate::dragMoveEvent(QEvent *e, const QMimeData *mimeData, const QPointF &pos) -
1910{ -
1911 Q_Q(QWidgetTextControl);
never executed (the execution status of this line is deduced): QWidgetTextControl * const q = q_func();
-
1912 if (!(interactionFlags & Qt::TextEditable) || !q->canInsertFromMimeData(mimeData)) {
never evaluated: !(interactionFlags & Qt::TextEditable)
never evaluated: !q->canInsertFromMimeData(mimeData)
0
1913 e->ignore();
never executed (the execution status of this line is deduced): e->ignore();
-
1914 return false;
never executed: return false;
0
1915 } -
1916 -
1917 const int cursorPos = q->hitTest(pos, Qt::FuzzyHit);
never executed (the execution status of this line is deduced): const int cursorPos = q->hitTest(pos, Qt::FuzzyHit);
-
1918 if (cursorPos != -1) {
never evaluated: cursorPos != -1
0
1919 QRectF crect = q->cursorRect(dndFeedbackCursor);
never executed (the execution status of this line is deduced): QRectF crect = q->cursorRect(dndFeedbackCursor);
-
1920 if (crect.isValid())
never evaluated: crect.isValid()
0
1921 emit q->updateRequest(crect);
never executed: q->updateRequest(crect);
0
1922 -
1923 dndFeedbackCursor = cursor;
never executed (the execution status of this line is deduced): dndFeedbackCursor = cursor;
-
1924 dndFeedbackCursor.setPosition(cursorPos);
never executed (the execution status of this line is deduced): dndFeedbackCursor.setPosition(cursorPos);
-
1925 -
1926 crect = q->cursorRect(dndFeedbackCursor);
never executed (the execution status of this line is deduced): crect = q->cursorRect(dndFeedbackCursor);
-
1927 emit q->updateRequest(crect);
never executed (the execution status of this line is deduced): q->updateRequest(crect);
-
1928 }
never executed: }
0
1929 -
1930 return true; // accept proposed action
never executed: return true;
0
1931} -
1932 -
1933bool QWidgetTextControlPrivate::dropEvent(const QMimeData *mimeData, const QPointF &pos, Qt::DropAction dropAction, QObject *source) -
1934{ -
1935 Q_Q(QWidgetTextControl);
never executed (the execution status of this line is deduced): QWidgetTextControl * const q = q_func();
-
1936 dndFeedbackCursor = QTextCursor();
never executed (the execution status of this line is deduced): dndFeedbackCursor = QTextCursor();
-
1937 -
1938 if (!(interactionFlags & Qt::TextEditable) || !q->canInsertFromMimeData(mimeData))
never evaluated: !(interactionFlags & Qt::TextEditable)
never evaluated: !q->canInsertFromMimeData(mimeData)
0
1939 return false;
never executed: return false;
0
1940 -
1941 repaintSelection();
never executed (the execution status of this line is deduced): repaintSelection();
-
1942 -
1943 QTextCursor insertionCursor = q->cursorForPosition(pos);
never executed (the execution status of this line is deduced): QTextCursor insertionCursor = q->cursorForPosition(pos);
-
1944 insertionCursor.beginEditBlock();
never executed (the execution status of this line is deduced): insertionCursor.beginEditBlock();
-
1945 -
1946 if (dropAction == Qt::MoveAction && source == contextWidget)
never evaluated: dropAction == Qt::MoveAction
never evaluated: source == contextWidget
0
1947 cursor.removeSelectedText();
never executed: cursor.removeSelectedText();
0
1948 -
1949 cursor = insertionCursor;
never executed (the execution status of this line is deduced): cursor = insertionCursor;
-
1950 q->insertFromMimeData(mimeData);
never executed (the execution status of this line is deduced): q->insertFromMimeData(mimeData);
-
1951 insertionCursor.endEditBlock();
never executed (the execution status of this line is deduced): insertionCursor.endEditBlock();
-
1952 q->ensureCursorVisible();
never executed (the execution status of this line is deduced): q->ensureCursorVisible();
-
1953 return true; // accept proposed action
never executed: return true;
0
1954} -
1955 -
1956void QWidgetTextControlPrivate::inputMethodEvent(QInputMethodEvent *e) -
1957{ -
1958 Q_Q(QWidgetTextControl);
never executed (the execution status of this line is deduced): QWidgetTextControl * const q = q_func();
-
1959 if (!(interactionFlags & Qt::TextEditable) || cursor.isNull()) {
never evaluated: !(interactionFlags & Qt::TextEditable)
never evaluated: cursor.isNull()
0
1960 e->ignore();
never executed (the execution status of this line is deduced): e->ignore();
-
1961 return;
never executed: return;
0
1962 } -
1963 bool isGettingInput = !e->commitString().isEmpty()
never evaluated: !e->commitString().isEmpty()
0
1964 || e->preeditString() != cursor.block().layout()->preeditAreaText()
never evaluated: e->preeditString() != cursor.block().layout()->preeditAreaText()
0
1965 || e->replacementLength() > 0;
never evaluated: e->replacementLength() > 0
0
1966 -
1967 cursor.beginEditBlock();
never executed (the execution status of this line is deduced): cursor.beginEditBlock();
-
1968 if (isGettingInput) {
never evaluated: isGettingInput
0
1969 cursor.removeSelectedText();
never executed (the execution status of this line is deduced): cursor.removeSelectedText();
-
1970 }
never executed: }
0
1971 -
1972 // insert commit string -
1973 if (!e->commitString().isEmpty() || e->replacementLength()) {
never evaluated: !e->commitString().isEmpty()
never evaluated: e->replacementLength()
0
1974 QTextCursor c = cursor;
never executed (the execution status of this line is deduced): QTextCursor c = cursor;
-
1975 c.setPosition(c.position() + e->replacementStart());
never executed (the execution status of this line is deduced): c.setPosition(c.position() + e->replacementStart());
-
1976 c.setPosition(c.position() + e->replacementLength(), QTextCursor::KeepAnchor);
never executed (the execution status of this line is deduced): c.setPosition(c.position() + e->replacementLength(), QTextCursor::KeepAnchor);
-
1977 c.insertText(e->commitString());
never executed (the execution status of this line is deduced): c.insertText(e->commitString());
-
1978 }
never executed: }
0
1979 -
1980 for (int i = 0; i < e->attributes().size(); ++i) {
never evaluated: i < e->attributes().size()
0
1981 const QInputMethodEvent::Attribute &a = e->attributes().at(i);
never executed (the execution status of this line is deduced): const QInputMethodEvent::Attribute &a = e->attributes().at(i);
-
1982 if (a.type == QInputMethodEvent::Selection) {
never evaluated: a.type == QInputMethodEvent::Selection
0
1983 QTextCursor oldCursor = cursor;
never executed (the execution status of this line is deduced): QTextCursor oldCursor = cursor;
-
1984 int blockStart = a.start + cursor.block().position();
never executed (the execution status of this line is deduced): int blockStart = a.start + cursor.block().position();
-
1985 cursor.setPosition(blockStart, QTextCursor::MoveAnchor);
never executed (the execution status of this line is deduced): cursor.setPosition(blockStart, QTextCursor::MoveAnchor);
-
1986 cursor.setPosition(blockStart + a.length, QTextCursor::KeepAnchor);
never executed (the execution status of this line is deduced): cursor.setPosition(blockStart + a.length, QTextCursor::KeepAnchor);
-
1987 q->ensureCursorVisible();
never executed (the execution status of this line is deduced): q->ensureCursorVisible();
-
1988 repaintOldAndNewSelection(oldCursor);
never executed (the execution status of this line is deduced): repaintOldAndNewSelection(oldCursor);
-
1989 }
never executed: }
0
1990 }
never executed: }
0
1991 -
1992 QTextBlock block = cursor.block();
never executed (the execution status of this line is deduced): QTextBlock block = cursor.block();
-
1993 QTextLayout *layout = block.layout();
never executed (the execution status of this line is deduced): QTextLayout *layout = block.layout();
-
1994 if (isGettingInput)
never evaluated: isGettingInput
0
1995 layout->setPreeditArea(cursor.position() - block.position(), e->preeditString());
never executed: layout->setPreeditArea(cursor.position() - block.position(), e->preeditString());
0
1996 QList<QTextLayout::FormatRange> overrides;
never executed (the execution status of this line is deduced): QList<QTextLayout::FormatRange> overrides;
-
1997 const int oldPreeditCursor = preeditCursor;
never executed (the execution status of this line is deduced): const int oldPreeditCursor = preeditCursor;
-
1998 preeditCursor = e->preeditString().length();
never executed (the execution status of this line is deduced): preeditCursor = e->preeditString().length();
-
1999 hideCursor = false;
never executed (the execution status of this line is deduced): hideCursor = false;
-
2000 for (int i = 0; i < e->attributes().size(); ++i) {
never evaluated: i < e->attributes().size()
0
2001 const QInputMethodEvent::Attribute &a = e->attributes().at(i);
never executed (the execution status of this line is deduced): const QInputMethodEvent::Attribute &a = e->attributes().at(i);
-
2002 if (a.type == QInputMethodEvent::Cursor) {
never evaluated: a.type == QInputMethodEvent::Cursor
0
2003 preeditCursor = a.start;
never executed (the execution status of this line is deduced): preeditCursor = a.start;
-
2004 hideCursor = !a.length;
never executed (the execution status of this line is deduced): hideCursor = !a.length;
-
2005 } else if (a.type == QInputMethodEvent::TextFormat) {
never executed: }
never evaluated: a.type == QInputMethodEvent::TextFormat
0
2006 QTextCharFormat f = qvariant_cast<QTextFormat>(a.value).toCharFormat();
never executed (the execution status of this line is deduced): QTextCharFormat f = qvariant_cast<QTextFormat>(a.value).toCharFormat();
-
2007 if (f.isValid()) {
never evaluated: f.isValid()
0
2008 QTextLayout::FormatRange o;
never executed (the execution status of this line is deduced): QTextLayout::FormatRange o;
-
2009 o.start = a.start + cursor.position() - block.position();
never executed (the execution status of this line is deduced): o.start = a.start + cursor.position() - block.position();
-
2010 o.length = a.length;
never executed (the execution status of this line is deduced): o.length = a.length;
-
2011 o.format = f;
never executed (the execution status of this line is deduced): o.format = f;
-
2012 overrides.append(o);
never executed (the execution status of this line is deduced): overrides.append(o);
-
2013 }
never executed: }
0
2014 }
never executed: }
0
2015 } -
2016 layout->setAdditionalFormats(overrides);
never executed (the execution status of this line is deduced): layout->setAdditionalFormats(overrides);
-
2017 -
2018 cursor.endEditBlock();
never executed (the execution status of this line is deduced): cursor.endEditBlock();
-
2019 -
2020 if (cursor.d)
never evaluated: cursor.d
0
2021 cursor.d->setX();
never executed: cursor.d->setX();
0
2022 if (oldPreeditCursor != preeditCursor)
never evaluated: oldPreeditCursor != preeditCursor
0
2023 emit q->microFocusChanged();
never executed: q->microFocusChanged();
0
2024}
never executed: }
0
2025 -
2026QVariant QWidgetTextControl::inputMethodQuery(Qt::InputMethodQuery property) const -
2027{ -
2028 Q_D(const QWidgetTextControl);
executed (the execution status of this line is deduced): const QWidgetTextControlPrivate * const d = d_func();
-
2029 QTextBlock block = d->cursor.block();
executed (the execution status of this line is deduced): QTextBlock block = d->cursor.block();
-
2030 switch(property) { -
2031 case Qt::ImCursorRectangle: -
2032 return cursorRect();
never executed: return cursorRect();
0
2033 case Qt::ImFont: -
2034 return QVariant(d->cursor.charFormat().font());
never executed: return QVariant(d->cursor.charFormat().font());
0
2035 case Qt::ImCursorPosition: -
2036 return QVariant(d->cursor.position() - block.position());
never executed: return QVariant(d->cursor.position() - block.position());
0
2037 case Qt::ImSurroundingText: -
2038 return QVariant(block.text());
never executed: return QVariant(block.text());
0
2039 case Qt::ImCurrentSelection: -
2040 return QVariant(d->cursor.selectedText());
never executed: return QVariant(d->cursor.selectedText());
0
2041 case Qt::ImMaximumTextLength: -
2042 return QVariant(); // No limit.
never executed: return QVariant();
0
2043 case Qt::ImAnchorPosition: -
2044 return QVariant(d->cursor.anchor() - block.position());
never executed: return QVariant(d->cursor.anchor() - block.position());
0
2045 default: -
2046 return QVariant();
executed: return QVariant();
Execution Count:463
463
2047 } -
2048}
never executed: }
0
2049 -
2050void QWidgetTextControl::setFocus(bool focus, Qt::FocusReason reason) -
2051{ -
2052 QFocusEvent ev(focus ? QEvent::FocusIn : QEvent::FocusOut,
executed (the execution status of this line is deduced): QFocusEvent ev(focus ? QEvent::FocusIn : QEvent::FocusOut,
-
2053 reason);
executed (the execution status of this line is deduced): reason);
-
2054 processEvent(&ev);
executed (the execution status of this line is deduced): processEvent(&ev);
-
2055}
executed: }
Execution Count:23
23
2056 -
2057void QWidgetTextControlPrivate::focusEvent(QFocusEvent *e) -
2058{ -
2059 Q_Q(QWidgetTextControl);
executed (the execution status of this line is deduced): QWidgetTextControl * const q = q_func();
-
2060 emit q->updateRequest(q->selectionRect());
executed (the execution status of this line is deduced): q->updateRequest(q->selectionRect());
-
2061 if (e->gotFocus()) {
evaluated: e->gotFocus()
TRUEFALSE
yes
Evaluation Count:77
yes
Evaluation Count:72
72-77
2062#ifdef QT_KEYPAD_NAVIGATION -
2063 if (!QApplication::keypadNavigationEnabled() || (hasEditFocus && (e->reason() == Qt::PopupFocusReason))) { -
2064#endif -
2065 cursorOn = (interactionFlags & Qt::TextSelectableByKeyboard);
executed (the execution status of this line is deduced): cursorOn = (interactionFlags & Qt::TextSelectableByKeyboard);
-
2066 if (interactionFlags & Qt::TextEditable) {
evaluated: interactionFlags & Qt::TextEditable
TRUEFALSE
yes
Evaluation Count:52
yes
Evaluation Count:25
25-52
2067 setBlinkingCursorEnabled(true);
executed (the execution status of this line is deduced): setBlinkingCursorEnabled(true);
-
2068 }
executed: }
Execution Count:52
52
2069#ifdef QT_KEYPAD_NAVIGATION -
2070 } -
2071#endif -
2072 } else {
executed: }
Execution Count:77
77
2073 setBlinkingCursorEnabled(false);
executed (the execution status of this line is deduced): setBlinkingCursorEnabled(false);
-
2074 -
2075 if (cursorIsFocusIndicator
partially evaluated: cursorIsFocusIndicator
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:72
0-72
2076 && e->reason() != Qt::ActiveWindowFocusReason
never evaluated: e->reason() != Qt::ActiveWindowFocusReason
0
2077 && e->reason() != Qt::PopupFocusReason
never evaluated: e->reason() != Qt::PopupFocusReason
0
2078 && cursor.hasSelection()) {
never evaluated: cursor.hasSelection()
0
2079 cursor.clearSelection();
never executed (the execution status of this line is deduced): cursor.clearSelection();
-
2080 }
never executed: }
0
2081 }
executed: }
Execution Count:72
72
2082 hasFocus = e->gotFocus();
executed (the execution status of this line is deduced): hasFocus = e->gotFocus();
-
2083}
executed: }
Execution Count:149
149
2084 -
2085QString QWidgetTextControlPrivate::anchorForCursor(const QTextCursor &anchorCursor) const -
2086{ -
2087 if (anchorCursor.hasSelection()) {
never evaluated: anchorCursor.hasSelection()
0
2088 QTextCursor cursor = anchorCursor;
never executed (the execution status of this line is deduced): QTextCursor cursor = anchorCursor;
-
2089 if (cursor.selectionStart() != cursor.position())
never evaluated: cursor.selectionStart() != cursor.position()
0
2090 cursor.setPosition(cursor.selectionStart());
never executed: cursor.setPosition(cursor.selectionStart());
0
2091 cursor.movePosition(QTextCursor::NextCharacter);
never executed (the execution status of this line is deduced): cursor.movePosition(QTextCursor::NextCharacter);
-
2092 QTextCharFormat fmt = cursor.charFormat();
never executed (the execution status of this line is deduced): QTextCharFormat fmt = cursor.charFormat();
-
2093 if (fmt.isAnchor() && fmt.hasProperty(QTextFormat::AnchorHref))
never evaluated: fmt.isAnchor()
never evaluated: fmt.hasProperty(QTextFormat::AnchorHref)
0
2094 return fmt.stringProperty(QTextFormat::AnchorHref);
never executed: return fmt.stringProperty(QTextFormat::AnchorHref);
0
2095 }
never executed: }
0
2096 return QString();
never executed: return QString();
0
2097} -
2098 -
2099#ifdef QT_KEYPAD_NAVIGATION -
2100void QWidgetTextControlPrivate::editFocusEvent(QEvent *e) -
2101{ -
2102 Q_Q(QWidgetTextControl); -
2103 -
2104 if (QApplication::keypadNavigationEnabled()) { -
2105 if (e->type() == QEvent::EnterEditFocus && interactionFlags & Qt::TextEditable) { -
2106 const QTextCursor oldSelection = cursor; -
2107 const int oldCursorPos = cursor.position(); -
2108 const bool moved = cursor.movePosition(QTextCursor::End, QTextCursor::MoveAnchor); -
2109 q->ensureCursorVisible(); -
2110 if (moved) { -
2111 if (cursor.position() != oldCursorPos) -
2112 emit q->cursorPositionChanged(); -
2113 emit q->microFocusChanged(); -
2114 } -
2115 selectionChanged(); -
2116 repaintOldAndNewSelection(oldSelection); -
2117 -
2118 setBlinkingCursorEnabled(true); -
2119 } else -
2120 setBlinkingCursorEnabled(false); -
2121 } -
2122 -
2123 hasEditFocus = e->type() == QEvent::EnterEditFocus ? true : false; -
2124} -
2125#endif -
2126 -
2127#ifndef QT_NO_CONTEXTMENU -
2128QMenu *QWidgetTextControl::createStandardContextMenu(const QPointF &pos, QWidget *parent) -
2129{ -
2130 Q_D(QWidgetTextControl);
executed (the execution status of this line is deduced): QWidgetTextControlPrivate * const d = d_func();
-
2131 -
2132 const bool showTextSelectionActions = d->interactionFlags & (Qt::TextEditable | Qt::TextSelectableByKeyboard | Qt::TextSelectableByMouse);
executed (the execution status of this line is deduced): const bool showTextSelectionActions = d->interactionFlags & (Qt::TextEditable | Qt::TextSelectableByKeyboard | Qt::TextSelectableByMouse);
-
2133 -
2134 d->linkToCopy = QString();
executed (the execution status of this line is deduced): d->linkToCopy = QString();
-
2135 if (!pos.isNull())
partially evaluated: !pos.isNull()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1
0-1
2136 d->linkToCopy = anchorAt(pos);
never executed: d->linkToCopy = anchorAt(pos);
0
2137 -
2138 if (d->linkToCopy.isEmpty() && !showTextSelectionActions)
partially evaluated: d->linkToCopy.isEmpty()
TRUEFALSE
yes
Evaluation Count:1
no
Evaluation Count:0
partially evaluated: !showTextSelectionActions
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1
0-1
2139 return 0;
never executed: return 0;
0
2140 -
2141 QMenu *menu = new QMenu(parent);
executed (the execution status of this line is deduced): QMenu *menu = new QMenu(parent);
-
2142 QAction *a;
executed (the execution status of this line is deduced): QAction *a;
-
2143 -
2144 if (d->interactionFlags & Qt::TextEditable) {
partially evaluated: d->interactionFlags & Qt::TextEditable
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1
0-1
2145 a = menu->addAction(tr("&Undo") + ACCEL_KEY(QKeySequence::Undo), this, SLOT(undo()));
never executed (the execution status of this line is deduced): a = menu->addAction(tr("&Undo") + (!(static_cast<QApplication *>(QCoreApplication::instance()))->d_func()->shortcutMap.hasShortcutForKeySequence(QKeySequence::Undo) ? QLatin1Char('\t') + QKeySequence(QKeySequence::Undo).toString(QKeySequence::NativeText) : QString()), this, "1""undo()");
-
2146 a->setEnabled(d->doc->isUndoAvailable());
never executed (the execution status of this line is deduced): a->setEnabled(d->doc->isUndoAvailable());
-
2147 a = menu->addAction(tr("&Redo") + ACCEL_KEY(QKeySequence::Redo), this, SLOT(redo()));
never executed (the execution status of this line is deduced): a = menu->addAction(tr("&Redo") + (!(static_cast<QApplication *>(QCoreApplication::instance()))->d_func()->shortcutMap.hasShortcutForKeySequence(QKeySequence::Redo) ? QLatin1Char('\t') + QKeySequence(QKeySequence::Redo).toString(QKeySequence::NativeText) : QString()), this, "1""redo()");
-
2148 a->setEnabled(d->doc->isRedoAvailable());
never executed (the execution status of this line is deduced): a->setEnabled(d->doc->isRedoAvailable());
-
2149 menu->addSeparator();
never executed (the execution status of this line is deduced): menu->addSeparator();
-
2150 -
2151 a = menu->addAction(tr("Cu&t") + ACCEL_KEY(QKeySequence::Cut), this, SLOT(cut()));
never executed (the execution status of this line is deduced): a = menu->addAction(tr("Cu&t") + (!(static_cast<QApplication *>(QCoreApplication::instance()))->d_func()->shortcutMap.hasShortcutForKeySequence(QKeySequence::Cut) ? QLatin1Char('\t') + QKeySequence(QKeySequence::Cut).toString(QKeySequence::NativeText) : QString()), this, "1""cut()");
-
2152 a->setEnabled(d->cursor.hasSelection());
never executed (the execution status of this line is deduced): a->setEnabled(d->cursor.hasSelection());
-
2153 }
never executed: }
0
2154 -
2155 if (showTextSelectionActions) {
partially evaluated: showTextSelectionActions
TRUEFALSE
yes
Evaluation Count:1
no
Evaluation Count:0
0-1
2156 a = menu->addAction(tr("&Copy") + ACCEL_KEY(QKeySequence::Copy), this, SLOT(copy()));
executed (the execution status of this line is deduced): a = menu->addAction(tr("&Copy") + (!(static_cast<QApplication *>(QCoreApplication::instance()))->d_func()->shortcutMap.hasShortcutForKeySequence(QKeySequence::Copy) ? QLatin1Char('\t') + QKeySequence(QKeySequence::Copy).toString(QKeySequence::NativeText) : QString()), this, "1""copy()");
-
2157 a->setEnabled(d->cursor.hasSelection());
executed (the execution status of this line is deduced): a->setEnabled(d->cursor.hasSelection());
-
2158 }
executed: }
Execution Count:1
1
2159 -
2160 if ((d->interactionFlags & Qt::LinksAccessibleByKeyboard)
partially evaluated: (d->interactionFlags & Qt::LinksAccessibleByKeyboard)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1
0-1
2161 || (d->interactionFlags & Qt::LinksAccessibleByMouse)) {
partially evaluated: (d->interactionFlags & Qt::LinksAccessibleByMouse)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1
0-1
2162 -
2163 a = menu->addAction(tr("Copy &Link Location"), this, SLOT(_q_copyLink()));
never executed (the execution status of this line is deduced): a = menu->addAction(tr("Copy &Link Location"), this, "1""_q_copyLink()");
-
2164 a->setEnabled(!d->linkToCopy.isEmpty());
never executed (the execution status of this line is deduced): a->setEnabled(!d->linkToCopy.isEmpty());
-
2165 }
never executed: }
0
2166 -
2167 if (d->interactionFlags & Qt::TextEditable) {
partially evaluated: d->interactionFlags & Qt::TextEditable
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1
0-1
2168#if !defined(QT_NO_CLIPBOARD) -
2169 a = menu->addAction(tr("&Paste") + ACCEL_KEY(QKeySequence::Paste), this, SLOT(paste()));
never executed (the execution status of this line is deduced): a = menu->addAction(tr("&Paste") + (!(static_cast<QApplication *>(QCoreApplication::instance()))->d_func()->shortcutMap.hasShortcutForKeySequence(QKeySequence::Paste) ? QLatin1Char('\t') + QKeySequence(QKeySequence::Paste).toString(QKeySequence::NativeText) : QString()), this, "1""paste()");
-
2170 a->setEnabled(canPaste());
never executed (the execution status of this line is deduced): a->setEnabled(canPaste());
-
2171#endif -
2172 a = menu->addAction(tr("Delete"), this, SLOT(_q_deleteSelected()));
never executed (the execution status of this line is deduced): a = menu->addAction(tr("Delete"), this, "1""_q_deleteSelected()");
-
2173 a->setEnabled(d->cursor.hasSelection());
never executed (the execution status of this line is deduced): a->setEnabled(d->cursor.hasSelection());
-
2174 }
never executed: }
0
2175 -
2176 -
2177 if (showTextSelectionActions) {
partially evaluated: showTextSelectionActions
TRUEFALSE
yes
Evaluation Count:1
no
Evaluation Count:0
0-1
2178 menu->addSeparator();
executed (the execution status of this line is deduced): menu->addSeparator();
-
2179 a = menu->addAction(tr("Select All") + ACCEL_KEY(QKeySequence::SelectAll), this, SLOT(selectAll()));
executed (the execution status of this line is deduced): a = menu->addAction(tr("Select All") + (!(static_cast<QApplication *>(QCoreApplication::instance()))->d_func()->shortcutMap.hasShortcutForKeySequence(QKeySequence::SelectAll) ? QLatin1Char('\t') + QKeySequence(QKeySequence::SelectAll).toString(QKeySequence::NativeText) : QString()), this, "1""selectAll()");
-
2180 a->setEnabled(!d->doc->isEmpty());
executed (the execution status of this line is deduced): a->setEnabled(!d->doc->isEmpty());
-
2181 }
executed: }
Execution Count:1
1
2182 -
2183 if ((d->interactionFlags & Qt::TextEditable) && qApp->styleHints()->useRtlExtensions()) {
partially evaluated: (d->interactionFlags & Qt::TextEditable)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1
never evaluated: (static_cast<QApplication *>(QCoreApplication::instance()))->styleHints()->useRtlExtensions()
0-1
2184 menu->addSeparator();
never executed (the execution status of this line is deduced): menu->addSeparator();
-
2185 QUnicodeControlCharacterMenu *ctrlCharacterMenu = new QUnicodeControlCharacterMenu(this, menu);
never executed (the execution status of this line is deduced): QUnicodeControlCharacterMenu *ctrlCharacterMenu = new QUnicodeControlCharacterMenu(this, menu);
-
2186 menu->addMenu(ctrlCharacterMenu);
never executed (the execution status of this line is deduced): menu->addMenu(ctrlCharacterMenu);
-
2187 }
never executed: }
0
2188 -
2189 return menu;
executed: return menu;
Execution Count:1
1
2190} -
2191#endif // QT_NO_CONTEXTMENU -
2192 -
2193QTextCursor QWidgetTextControl::cursorForPosition(const QPointF &pos) const -
2194{ -
2195 Q_D(const QWidgetTextControl);
never executed (the execution status of this line is deduced): const QWidgetTextControlPrivate * const d = d_func();
-
2196 int cursorPos = hitTest(pos, Qt::FuzzyHit);
never executed (the execution status of this line is deduced): int cursorPos = hitTest(pos, Qt::FuzzyHit);
-
2197 if (cursorPos == -1)
never evaluated: cursorPos == -1
0
2198 cursorPos = 0;
never executed: cursorPos = 0;
0
2199 QTextCursor c(d->doc);
never executed (the execution status of this line is deduced): QTextCursor c(d->doc);
-
2200 c.setPosition(cursorPos);
never executed (the execution status of this line is deduced): c.setPosition(cursorPos);
-
2201 return c;
never executed: return c;
0
2202} -
2203 -
2204QRectF QWidgetTextControl::cursorRect(const QTextCursor &cursor) const -
2205{ -
2206 Q_D(const QWidgetTextControl);
executed (the execution status of this line is deduced): const QWidgetTextControlPrivate * const d = d_func();
-
2207 if (cursor.isNull())
partially evaluated: cursor.isNull()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:369
0-369
2208 return QRectF();
never executed: return QRectF();
0
2209 -
2210 return d->rectForPosition(cursor.position());
executed: return d->rectForPosition(cursor.position());
Execution Count:369
369
2211} -
2212 -
2213QRectF QWidgetTextControl::cursorRect() const -
2214{ -
2215 Q_D(const QWidgetTextControl);
never executed (the execution status of this line is deduced): const QWidgetTextControlPrivate * const d = d_func();
-
2216 return cursorRect(d->cursor);
never executed: return cursorRect(d->cursor);
0
2217} -
2218 -
2219QRectF QWidgetTextControlPrivate::cursorRectPlusUnicodeDirectionMarkers(const QTextCursor &cursor) const -
2220{ -
2221 if (cursor.isNull())
partially evaluated: cursor.isNull()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:692
0-692
2222 return QRectF();
never executed: return QRectF();
0
2223 -
2224 return rectForPosition(cursor.position()).adjusted(-4, 0, 4, 0);
executed: return rectForPosition(cursor.position()).adjusted(-4, 0, 4, 0);
Execution Count:692
692
2225} -
2226 -
2227QString QWidgetTextControl::anchorAt(const QPointF &pos) const -
2228{ -
2229 Q_D(const QWidgetTextControl);
executed (the execution status of this line is deduced): const QWidgetTextControlPrivate * const d = d_func();
-
2230 return d->doc->documentLayout()->anchorAt(pos);
executed: return d->doc->documentLayout()->anchorAt(pos);
Execution Count:4
4
2231} -
2232 -
2233QString QWidgetTextControl::anchorAtCursor() const -
2234{ -
2235 Q_D(const QWidgetTextControl);
never executed (the execution status of this line is deduced): const QWidgetTextControlPrivate * const d = d_func();
-
2236 -
2237 return d->anchorForCursor(d->cursor);
never executed: return d->anchorForCursor(d->cursor);
0
2238} -
2239 -
2240bool QWidgetTextControl::overwriteMode() const -
2241{ -
2242 Q_D(const QWidgetTextControl);
executed (the execution status of this line is deduced): const QWidgetTextControlPrivate * const d = d_func();
-
2243 return d->overwriteMode;
executed: return d->overwriteMode;
Execution Count:9
9
2244} -
2245 -
2246void QWidgetTextControl::setOverwriteMode(bool overwrite) -
2247{ -
2248 Q_D(QWidgetTextControl);
executed (the execution status of this line is deduced): QWidgetTextControlPrivate * const d = d_func();
-
2249 d->overwriteMode = overwrite;
executed (the execution status of this line is deduced): d->overwriteMode = overwrite;
-
2250}
executed: }
Execution Count:5
5
2251 -
2252int QWidgetTextControl::cursorWidth() const -
2253{ -
2254#ifndef QT_NO_PROPERTIES -
2255 Q_D(const QWidgetTextControl);
executed (the execution status of this line is deduced): const QWidgetTextControlPrivate * const d = d_func();
-
2256 return d->doc->documentLayout()->property("cursorWidth").toInt();
executed: return d->doc->documentLayout()->property("cursorWidth").toInt();
Execution Count:6
6
2257#else -
2258 return 1; -
2259#endif -
2260} -
2261 -
2262void QWidgetTextControl::setCursorWidth(int width) -
2263{ -
2264 Q_D(QWidgetTextControl);
executed (the execution status of this line is deduced): QWidgetTextControlPrivate * const d = d_func();
-
2265#ifdef QT_NO_PROPERTIES -
2266 Q_UNUSED(width); -
2267#else -
2268 if (width == -1)
partially evaluated: width == -1
TRUEFALSE
yes
Evaluation Count:291
no
Evaluation Count:0
0-291
2269 width = QApplication::style()->pixelMetric(QStyle::PM_TextCursorWidth);
executed: width = QApplication::style()->pixelMetric(QStyle::PM_TextCursorWidth);
Execution Count:291
291
2270 d->doc->documentLayout()->setProperty("cursorWidth", width);
executed (the execution status of this line is deduced): d->doc->documentLayout()->setProperty("cursorWidth", width);
-
2271#endif -
2272 d->repaintCursor();
executed (the execution status of this line is deduced): d->repaintCursor();
-
2273}
executed: }
Execution Count:291
291
2274 -
2275bool QWidgetTextControl::acceptRichText() const -
2276{ -
2277 Q_D(const QWidgetTextControl);
never executed (the execution status of this line is deduced): const QWidgetTextControlPrivate * const d = d_func();
-
2278 return d->acceptRichText;
never executed: return d->acceptRichText;
0
2279} -
2280 -
2281void QWidgetTextControl::setAcceptRichText(bool accept) -
2282{ -
2283 Q_D(QWidgetTextControl);
executed (the execution status of this line is deduced): QWidgetTextControlPrivate * const d = d_func();
-
2284 d->acceptRichText = accept;
executed (the execution status of this line is deduced): d->acceptRichText = accept;
-
2285}
executed: }
Execution Count:87
87
2286 -
2287#ifndef QT_NO_TEXTEDIT -
2288 -
2289void QWidgetTextControl::setExtraSelections(const QList<QTextEdit::ExtraSelection> &selections) -
2290{ -
2291 Q_D(QWidgetTextControl);
executed (the execution status of this line is deduced): QWidgetTextControlPrivate * const d = d_func();
-
2292 -
2293 QHash<int, int> hash;
executed (the execution status of this line is deduced): QHash<int, int> hash;
-
2294 for (int i = 0; i < d->extraSelections.count(); ++i) {
evaluated: i < d->extraSelections.count()
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:2
1-2
2295 const QAbstractTextDocumentLayout::Selection &esel = d->extraSelections.at(i);
executed (the execution status of this line is deduced): const QAbstractTextDocumentLayout::Selection &esel = d->extraSelections.at(i);
-
2296 hash.insertMulti(esel.cursor.anchor(), i);
executed (the execution status of this line is deduced): hash.insertMulti(esel.cursor.anchor(), i);
-
2297 }
executed: }
Execution Count:1
1
2298 -
2299 for (int i = 0; i < selections.count(); ++i) {
evaluated: i < selections.count()
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:2
2
2300 const QTextEdit::ExtraSelection &sel = selections.at(i);
executed (the execution status of this line is deduced): const QTextEdit::ExtraSelection &sel = selections.at(i);
-
2301 QHash<int, int>::iterator it = hash.find(sel.cursor.anchor());
executed (the execution status of this line is deduced): QHash<int, int>::iterator it = hash.find(sel.cursor.anchor());
-
2302 if (it != hash.end()) {
partially evaluated: it != hash.end()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:2
0-2
2303 const QAbstractTextDocumentLayout::Selection &esel = d->extraSelections.at(it.value());
never executed (the execution status of this line is deduced): const QAbstractTextDocumentLayout::Selection &esel = d->extraSelections.at(it.value());
-
2304 if (esel.cursor.position() == sel.cursor.position()
never evaluated: esel.cursor.position() == sel.cursor.position()
0
2305 && esel.format == sel.format) {
never evaluated: esel.format == sel.format
0
2306 hash.erase(it);
never executed (the execution status of this line is deduced): hash.erase(it);
-
2307 continue;
never executed: continue;
0
2308 } -
2309 }
never executed: }
0
2310 QRectF r = selectionRect(sel.cursor);
executed (the execution status of this line is deduced): QRectF r = selectionRect(sel.cursor);
-
2311 if (sel.format.boolProperty(QTextFormat::FullWidthSelection)) {
partially evaluated: sel.format.boolProperty(QTextFormat::FullWidthSelection)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:2
0-2
2312 r.setLeft(0);
never executed (the execution status of this line is deduced): r.setLeft(0);
-
2313 r.setWidth(qreal(INT_MAX));
never executed (the execution status of this line is deduced): r.setWidth(qreal(2147483647));
-
2314 }
never executed: }
0
2315 emit updateRequest(r);
executed (the execution status of this line is deduced): updateRequest(r);
-
2316 }
executed: }
Execution Count:2
2
2317 -
2318 for (QHash<int, int>::iterator it = hash.begin(); it != hash.end(); ++it) {
evaluated: it != hash.end()
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:2
1-2
2319 const QAbstractTextDocumentLayout::Selection &esel = d->extraSelections.at(it.value());
executed (the execution status of this line is deduced): const QAbstractTextDocumentLayout::Selection &esel = d->extraSelections.at(it.value());
-
2320 QRectF r = selectionRect(esel.cursor);
executed (the execution status of this line is deduced): QRectF r = selectionRect(esel.cursor);
-
2321 if (esel.format.boolProperty(QTextFormat::FullWidthSelection)) {
partially evaluated: esel.format.boolProperty(QTextFormat::FullWidthSelection)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1
0-1
2322 r.setLeft(0);
never executed (the execution status of this line is deduced): r.setLeft(0);
-
2323 r.setWidth(qreal(INT_MAX));
never executed (the execution status of this line is deduced): r.setWidth(qreal(2147483647));
-
2324 }
never executed: }
0
2325 emit updateRequest(r);
executed (the execution status of this line is deduced): updateRequest(r);
-
2326 }
executed: }
Execution Count:1
1
2327 -
2328 d->extraSelections.resize(selections.count());
executed (the execution status of this line is deduced): d->extraSelections.resize(selections.count());
-
2329 for (int i = 0; i < selections.count(); ++i) {
evaluated: i < selections.count()
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:2
2
2330 d->extraSelections[i].cursor = selections.at(i).cursor;
executed (the execution status of this line is deduced): d->extraSelections[i].cursor = selections.at(i).cursor;
-
2331 d->extraSelections[i].format = selections.at(i).format;
executed (the execution status of this line is deduced): d->extraSelections[i].format = selections.at(i).format;
-
2332 }
executed: }
Execution Count:2
2
2333}
executed: }
Execution Count:2
2
2334 -
2335QList<QTextEdit::ExtraSelection> QWidgetTextControl::extraSelections() const -
2336{ -
2337 Q_D(const QWidgetTextControl);
executed (the execution status of this line is deduced): const QWidgetTextControlPrivate * const d = d_func();
-
2338 QList<QTextEdit::ExtraSelection> selections;
executed (the execution status of this line is deduced): QList<QTextEdit::ExtraSelection> selections;
-
2339 for (int i = 0; i < d->extraSelections.count(); ++i) {
evaluated: i < d->extraSelections.count()
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:1
1
2340 QTextEdit::ExtraSelection sel;
executed (the execution status of this line is deduced): QTextEdit::ExtraSelection sel;
-
2341 sel.cursor = d->extraSelections.at(i).cursor;
executed (the execution status of this line is deduced): sel.cursor = d->extraSelections.at(i).cursor;
-
2342 sel.format = d->extraSelections.at(i).format;
executed (the execution status of this line is deduced): sel.format = d->extraSelections.at(i).format;
-
2343 selections.append(sel);
executed (the execution status of this line is deduced): selections.append(sel);
-
2344 }
executed: }
Execution Count:1
1
2345 return selections;
executed: return selections;
Execution Count:1
1
2346} -
2347 -
2348#endif // QT_NO_TEXTEDIT -
2349 -
2350void QWidgetTextControl::setTextWidth(qreal width) -
2351{ -
2352 Q_D(QWidgetTextControl);
executed (the execution status of this line is deduced): QWidgetTextControlPrivate * const d = d_func();
-
2353 d->doc->setTextWidth(width);
executed (the execution status of this line is deduced): d->doc->setTextWidth(width);
-
2354}
executed: }
Execution Count:197
197
2355 -
2356qreal QWidgetTextControl::textWidth() const -
2357{ -
2358 Q_D(const QWidgetTextControl);
executed (the execution status of this line is deduced): const QWidgetTextControlPrivate * const d = d_func();
-
2359 return d->doc->textWidth();
executed: return d->doc->textWidth();
Execution Count:102
102
2360} -
2361 -
2362QSizeF QWidgetTextControl::size() const -
2363{ -
2364 Q_D(const QWidgetTextControl);
executed (the execution status of this line is deduced): const QWidgetTextControlPrivate * const d = d_func();
-
2365 return d->doc->size();
executed: return d->doc->size();
Execution Count:206
206
2366} -
2367 -
2368void QWidgetTextControl::setOpenExternalLinks(bool open) -
2369{ -
2370 Q_D(QWidgetTextControl);
executed (the execution status of this line is deduced): QWidgetTextControlPrivate * const d = d_func();
-
2371 d->openExternalLinks = open;
executed (the execution status of this line is deduced): d->openExternalLinks = open;
-
2372}
executed: }
Execution Count:23
23
2373 -
2374bool QWidgetTextControl::openExternalLinks() const -
2375{ -
2376 Q_D(const QWidgetTextControl);
never executed (the execution status of this line is deduced): const QWidgetTextControlPrivate * const d = d_func();
-
2377 return d->openExternalLinks;
never executed: return d->openExternalLinks;
0
2378} -
2379 -
2380bool QWidgetTextControl::ignoreUnusedNavigationEvents() const -
2381{ -
2382 Q_D(const QWidgetTextControl);
never executed (the execution status of this line is deduced): const QWidgetTextControlPrivate * const d = d_func();
-
2383 return d->ignoreUnusedNavigationEvents;
never executed: return d->ignoreUnusedNavigationEvents;
0
2384} -
2385 -
2386void QWidgetTextControl::setIgnoreUnusedNavigationEvents(bool ignore) -
2387{ -
2388 Q_D(QWidgetTextControl);
never executed (the execution status of this line is deduced): QWidgetTextControlPrivate * const d = d_func();
-
2389 d->ignoreUnusedNavigationEvents = ignore;
never executed (the execution status of this line is deduced): d->ignoreUnusedNavigationEvents = ignore;
-
2390}
never executed: }
0
2391 -
2392void QWidgetTextControl::moveCursor(QTextCursor::MoveOperation op, QTextCursor::MoveMode mode) -
2393{ -
2394 Q_D(QWidgetTextControl);
executed (the execution status of this line is deduced): QWidgetTextControlPrivate * const d = d_func();
-
2395 const QTextCursor oldSelection = d->cursor;
executed (the execution status of this line is deduced): const QTextCursor oldSelection = d->cursor;
-
2396 const bool moved = d->cursor.movePosition(op, mode);
executed (the execution status of this line is deduced): const bool moved = d->cursor.movePosition(op, mode);
-
2397 d->_q_updateCurrentCharFormatAndSelection();
executed (the execution status of this line is deduced): d->_q_updateCurrentCharFormatAndSelection();
-
2398 ensureCursorVisible();
executed (the execution status of this line is deduced): ensureCursorVisible();
-
2399 d->repaintOldAndNewSelection(oldSelection);
executed (the execution status of this line is deduced): d->repaintOldAndNewSelection(oldSelection);
-
2400 if (moved)
evaluated: moved
TRUEFALSE
yes
Evaluation Count:8
yes
Evaluation Count:3
3-8
2401 emit cursorPositionChanged();
executed: cursorPositionChanged();
Execution Count:8
8
2402}
executed: }
Execution Count:11
11
2403 -
2404bool QWidgetTextControl::canPaste() const -
2405{ -
2406#ifndef QT_NO_CLIPBOARD -
2407 Q_D(const QWidgetTextControl);
executed (the execution status of this line is deduced): const QWidgetTextControlPrivate * const d = d_func();
-
2408 if (d->interactionFlags & Qt::TextEditable) {
evaluated: d->interactionFlags & Qt::TextEditable
TRUEFALSE
yes
Evaluation Count:9
yes
Evaluation Count:1
1-9
2409 const QMimeData *md = QApplication::clipboard()->mimeData();
executed (the execution status of this line is deduced): const QMimeData *md = QApplication::clipboard()->mimeData();
-
2410 return md && canInsertFromMimeData(md);
executed: return md && canInsertFromMimeData(md);
Execution Count:9
9
2411 } -
2412#endif -
2413 return false;
executed: return false;
Execution Count:1
1
2414} -
2415 -
2416void QWidgetTextControl::setCursorIsFocusIndicator(bool b) -
2417{ -
2418 Q_D(QWidgetTextControl);
executed (the execution status of this line is deduced): QWidgetTextControlPrivate * const d = d_func();
-
2419 d->cursorIsFocusIndicator = b;
executed (the execution status of this line is deduced): d->cursorIsFocusIndicator = b;
-
2420 d->repaintCursor();
executed (the execution status of this line is deduced): d->repaintCursor();
-
2421}
executed: }
Execution Count:10
10
2422 -
2423bool QWidgetTextControl::cursorIsFocusIndicator() const -
2424{ -
2425 Q_D(const QWidgetTextControl);
executed (the execution status of this line is deduced): const QWidgetTextControlPrivate * const d = d_func();
-
2426 return d->cursorIsFocusIndicator;
executed: return d->cursorIsFocusIndicator;
Execution Count:54
54
2427} -
2428 -
2429 -
2430void QWidgetTextControl::setDragEnabled(bool enabled) -
2431{ -
2432 Q_D(QWidgetTextControl);
never executed (the execution status of this line is deduced): QWidgetTextControlPrivate * const d = d_func();
-
2433 d->dragEnabled = enabled;
never executed (the execution status of this line is deduced): d->dragEnabled = enabled;
-
2434}
never executed: }
0
2435 -
2436bool QWidgetTextControl::isDragEnabled() const -
2437{ -
2438 Q_D(const QWidgetTextControl);
never executed (the execution status of this line is deduced): const QWidgetTextControlPrivate * const d = d_func();
-
2439 return d->dragEnabled;
never executed: return d->dragEnabled;
0
2440} -
2441 -
2442void QWidgetTextControl::setWordSelectionEnabled(bool enabled) -
2443{ -
2444 Q_D(QWidgetTextControl);
never executed (the execution status of this line is deduced): QWidgetTextControlPrivate * const d = d_func();
-
2445 d->wordSelectionEnabled = enabled;
never executed (the execution status of this line is deduced): d->wordSelectionEnabled = enabled;
-
2446}
never executed: }
0
2447 -
2448bool QWidgetTextControl::isWordSelectionEnabled() const -
2449{ -
2450 Q_D(const QWidgetTextControl);
never executed (the execution status of this line is deduced): const QWidgetTextControlPrivate * const d = d_func();
-
2451 return d->wordSelectionEnabled;
never executed: return d->wordSelectionEnabled;
0
2452} -
2453 -
2454#ifndef QT_NO_PRINTER -
2455void QWidgetTextControl::print(QPagedPaintDevice *printer) const -
2456{ -
2457 Q_D(const QWidgetTextControl);
never executed (the execution status of this line is deduced): const QWidgetTextControlPrivate * const d = d_func();
-
2458 if (!printer)
never evaluated: !printer
0
2459 return;
never executed: return;
0
2460 QTextDocument *tempDoc = 0;
never executed (the execution status of this line is deduced): QTextDocument *tempDoc = 0;
-
2461 const QTextDocument *doc = d->doc;
never executed (the execution status of this line is deduced): const QTextDocument *doc = d->doc;
-
2462 if (QPagedPaintDevicePrivate::get(printer)->printSelectionOnly) {
never evaluated: QPagedPaintDevicePrivate::get(printer)->printSelectionOnly
0
2463 if (!d->cursor.hasSelection())
never evaluated: !d->cursor.hasSelection()
0
2464 return;
never executed: return;
0
2465 tempDoc = new QTextDocument(const_cast<QTextDocument *>(doc));
never executed (the execution status of this line is deduced): tempDoc = new QTextDocument(const_cast<QTextDocument *>(doc));
-
2466 tempDoc->setMetaInformation(QTextDocument::DocumentTitle, doc->metaInformation(QTextDocument::DocumentTitle));
never executed (the execution status of this line is deduced): tempDoc->setMetaInformation(QTextDocument::DocumentTitle, doc->metaInformation(QTextDocument::DocumentTitle));
-
2467 tempDoc->setPageSize(doc->pageSize());
never executed (the execution status of this line is deduced): tempDoc->setPageSize(doc->pageSize());
-
2468 tempDoc->setDefaultFont(doc->defaultFont());
never executed (the execution status of this line is deduced): tempDoc->setDefaultFont(doc->defaultFont());
-
2469 tempDoc->setUseDesignMetrics(doc->useDesignMetrics());
never executed (the execution status of this line is deduced): tempDoc->setUseDesignMetrics(doc->useDesignMetrics());
-
2470 QTextCursor(tempDoc).insertFragment(d->cursor.selection());
never executed (the execution status of this line is deduced): QTextCursor(tempDoc).insertFragment(d->cursor.selection());
-
2471 doc = tempDoc;
never executed (the execution status of this line is deduced): doc = tempDoc;
-
2472 -
2473 // copy the custom object handlers -
2474 doc->documentLayout()->d_func()->handlers = d->doc->documentLayout()->d_func()->handlers;
never executed (the execution status of this line is deduced): doc->documentLayout()->d_func()->handlers = d->doc->documentLayout()->d_func()->handlers;
-
2475 }
never executed: }
0
2476 doc->print(printer);
never executed (the execution status of this line is deduced): doc->print(printer);
-
2477 delete tempDoc;
never executed (the execution status of this line is deduced): delete tempDoc;
-
2478}
never executed: }
0
2479#endif -
2480 -
2481QMimeData *QWidgetTextControl::createMimeDataFromSelection() const -
2482{ -
2483 Q_D(const QWidgetTextControl);
executed (the execution status of this line is deduced): const QWidgetTextControlPrivate * const d = d_func();
-
2484 const QTextDocumentFragment fragment(d->cursor);
executed (the execution status of this line is deduced): const QTextDocumentFragment fragment(d->cursor);
-
2485 return new QTextEditMimeData(fragment);
executed: return new QTextEditMimeData(fragment);
Execution Count:7
7
2486} -
2487 -
2488bool QWidgetTextControl::canInsertFromMimeData(const QMimeData *source) const -
2489{ -
2490 Q_D(const QWidgetTextControl);
executed (the execution status of this line is deduced): const QWidgetTextControlPrivate * const d = d_func();
-
2491 if (d->acceptRichText)
partially evaluated: d->acceptRichText
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:9
0-9
2492 return (source->hasText() && !source->text().isEmpty())
never executed: return (source->hasText() && !source->text().isEmpty()) || source->hasHtml() || source->hasFormat(QLatin1String("application/x-qrichtext")) || source->hasFormat(QLatin1String("application/x-qt-richtext"));
0
2493 || source->hasHtml()
never executed: return (source->hasText() && !source->text().isEmpty()) || source->hasHtml() || source->hasFormat(QLatin1String("application/x-qrichtext")) || source->hasFormat(QLatin1String("application/x-qt-richtext"));
0
2494 || source->hasFormat(QLatin1String("application/x-qrichtext"))
never executed: return (source->hasText() && !source->text().isEmpty()) || source->hasHtml() || source->hasFormat(QLatin1String("application/x-qrichtext")) || source->hasFormat(QLatin1String("application/x-qt-richtext"));
0
2495 || source->hasFormat(QLatin1String("application/x-qt-richtext"));
never executed: return (source->hasText() && !source->text().isEmpty()) || source->hasHtml() || source->hasFormat(QLatin1String("application/x-qrichtext")) || source->hasFormat(QLatin1String("application/x-qt-richtext"));
0
2496 else -
2497 return source->hasText() && !source->text().isEmpty();
executed: return source->hasText() && !source->text().isEmpty();
Execution Count:9
9
2498} -
2499 -
2500void QWidgetTextControl::insertFromMimeData(const QMimeData *source) -
2501{ -
2502 Q_D(QWidgetTextControl);
executed (the execution status of this line is deduced): QWidgetTextControlPrivate * const d = d_func();
-
2503 if (!(d->interactionFlags & Qt::TextEditable) || !source)
partially evaluated: !(d->interactionFlags & Qt::TextEditable)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:3
partially evaluated: !source
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:3
0-3
2504 return;
never executed: return;
0
2505 -
2506 bool hasData = false;
executed (the execution status of this line is deduced): bool hasData = false;
-
2507 QTextDocumentFragment fragment;
executed (the execution status of this line is deduced): QTextDocumentFragment fragment;
-
2508#ifndef QT_NO_TEXTHTMLPARSER -
2509 if (source->hasFormat(QLatin1String("application/x-qrichtext")) && d->acceptRichText) {
partially evaluated: source->hasFormat(QLatin1String("application/x-qrichtext"))
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:3
never evaluated: d->acceptRichText
0-3
2510 // x-qrichtext is always UTF-8 (taken from Qt3 since we don't use it anymore). -
2511 QString richtext = QString::fromUtf8(source->data(QLatin1String("application/x-qrichtext")));
never executed (the execution status of this line is deduced): QString richtext = QString::fromUtf8(source->data(QLatin1String("application/x-qrichtext")));
-
2512 richtext.prepend(QLatin1String("<meta name=\"qrichtext\" content=\"1\" />"));
never executed (the execution status of this line is deduced): richtext.prepend(QLatin1String("<meta name=\"qrichtext\" content=\"1\" />"));
-
2513 fragment = QTextDocumentFragment::fromHtml(richtext, d->doc);
never executed (the execution status of this line is deduced): fragment = QTextDocumentFragment::fromHtml(richtext, d->doc);
-
2514 hasData = true;
never executed (the execution status of this line is deduced): hasData = true;
-
2515 } else if (source->hasHtml() && d->acceptRichText) {
never executed: }
evaluated: source->hasHtml()
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:1
partially evaluated: d->acceptRichText
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:2
0-2
2516 fragment = QTextDocumentFragment::fromHtml(source->html(), d->doc);
never executed (the execution status of this line is deduced): fragment = QTextDocumentFragment::fromHtml(source->html(), d->doc);
-
2517 hasData = true;
never executed (the execution status of this line is deduced): hasData = true;
-
2518 } else {
never executed: }
0
2519 QString text = source->text();
executed (the execution status of this line is deduced): QString text = source->text();
-
2520 if (!text.isNull()) {
partially evaluated: !text.isNull()
TRUEFALSE
yes
Evaluation Count:3
no
Evaluation Count:0
0-3
2521 fragment = QTextDocumentFragment::fromPlainText(text);
executed (the execution status of this line is deduced): fragment = QTextDocumentFragment::fromPlainText(text);
-
2522 hasData = true;
executed (the execution status of this line is deduced): hasData = true;
-
2523 }
executed: }
Execution Count:3
3
2524 }
executed: }
Execution Count:3
3
2525#else -
2526 fragment = QTextDocumentFragment::fromPlainText(source->text()); -
2527#endif // QT_NO_TEXTHTMLPARSER -
2528 -
2529 if (hasData)
partially evaluated: hasData
TRUEFALSE
yes
Evaluation Count:3
no
Evaluation Count:0
0-3
2530 d->cursor.insertFragment(fragment);
executed: d->cursor.insertFragment(fragment);
Execution Count:3
3
2531 ensureCursorVisible();
executed (the execution status of this line is deduced): ensureCursorVisible();
-
2532}
executed: }
Execution Count:3
3
2533 -
2534bool QWidgetTextControl::findNextPrevAnchor(const QTextCursor &startCursor, bool next, QTextCursor &newAnchor) -
2535{ -
2536 Q_D(QWidgetTextControl);
executed (the execution status of this line is deduced): QWidgetTextControlPrivate * const d = d_func();
-
2537 -
2538 int anchorStart = -1;
executed (the execution status of this line is deduced): int anchorStart = -1;
-
2539 QString anchorHref;
executed (the execution status of this line is deduced): QString anchorHref;
-
2540 int anchorEnd = -1;
executed (the execution status of this line is deduced): int anchorEnd = -1;
-
2541 -
2542 if (next) {
evaluated: next
TRUEFALSE
yes
Evaluation Count:9
yes
Evaluation Count:2
2-9
2543 const int startPos = startCursor.selectionEnd();
executed (the execution status of this line is deduced): const int startPos = startCursor.selectionEnd();
-
2544 -
2545 QTextBlock block = d->doc->findBlock(startPos);
executed (the execution status of this line is deduced): QTextBlock block = d->doc->findBlock(startPos);
-
2546 QTextBlock::Iterator it = block.begin();
executed (the execution status of this line is deduced): QTextBlock::Iterator it = block.begin();
-
2547 -
2548 while (!it.atEnd() && it.fragment().position() < startPos)
evaluated: !it.atEnd()
TRUEFALSE
yes
Evaluation Count:13
yes
Evaluation Count:1
evaluated: it.fragment().position() < startPos
TRUEFALSE
yes
Evaluation Count:5
yes
Evaluation Count:8
1-13
2549 ++it;
executed: ++it;
Execution Count:5
5
2550 -
2551 while (block.isValid()) {
evaluated: block.isValid()
TRUEFALSE
yes
Evaluation Count:10
yes
Evaluation Count:1
1-10
2552 anchorStart = -1;
executed (the execution status of this line is deduced): anchorStart = -1;
-
2553 -
2554 // find next anchor -
2555 for (; !it.atEnd(); ++it) {
evaluated: !it.atEnd()
TRUEFALSE
yes
Evaluation Count:14
yes
Evaluation Count:2
2-14
2556 const QTextFragment fragment = it.fragment();
executed (the execution status of this line is deduced): const QTextFragment fragment = it.fragment();
-
2557 const QTextCharFormat fmt = fragment.charFormat();
executed (the execution status of this line is deduced): const QTextCharFormat fmt = fragment.charFormat();
-
2558 -
2559 if (fmt.isAnchor() && fmt.hasProperty(QTextFormat::AnchorHref)) {
evaluated: fmt.isAnchor()
TRUEFALSE
yes
Evaluation Count:8
yes
Evaluation Count:6
partially evaluated: fmt.hasProperty(QTextFormat::AnchorHref)
TRUEFALSE
yes
Evaluation Count:8
no
Evaluation Count:0
0-8
2560 anchorStart = fragment.position();
executed (the execution status of this line is deduced): anchorStart = fragment.position();
-
2561 anchorHref = fmt.anchorHref();
executed (the execution status of this line is deduced): anchorHref = fmt.anchorHref();
-
2562 break;
executed: break;
Execution Count:8
8
2563 } -
2564 }
executed: }
Execution Count:6
6
2565 -
2566 if (anchorStart != -1) {
evaluated: anchorStart != -1
TRUEFALSE
yes
Evaluation Count:8
yes
Evaluation Count:2
2-8
2567 anchorEnd = -1;
executed (the execution status of this line is deduced): anchorEnd = -1;
-
2568 -
2569 // find next non-anchor fragment -
2570 for (; !it.atEnd(); ++it) {
evaluated: !it.atEnd()
TRUEFALSE
yes
Evaluation Count:14
yes
Evaluation Count:2
2-14
2571 const QTextFragment fragment = it.fragment();
executed (the execution status of this line is deduced): const QTextFragment fragment = it.fragment();
-
2572 const QTextCharFormat fmt = fragment.charFormat();
executed (the execution status of this line is deduced): const QTextCharFormat fmt = fragment.charFormat();
-
2573 -
2574 if (!fmt.isAnchor() || fmt.anchorHref() != anchorHref) {
evaluated: !fmt.isAnchor()
TRUEFALSE
yes
Evaluation Count:5
yes
Evaluation Count:9
evaluated: fmt.anchorHref() != anchorHref
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:8
1-9
2575 anchorEnd = fragment.position();
executed (the execution status of this line is deduced): anchorEnd = fragment.position();
-
2576 break;
executed: break;
Execution Count:6
6
2577 } -
2578 }
executed: }
Execution Count:8
8
2579 -
2580 if (anchorEnd == -1)
evaluated: anchorEnd == -1
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:6
2-6
2581 anchorEnd = block.position() + block.length() - 1;
executed: anchorEnd = block.position() + block.length() - 1;
Execution Count:2
2
2582 -
2583 // make found selection -
2584 break;
executed: break;
Execution Count:8
8
2585 } -
2586 -
2587 block = block.next();
executed (the execution status of this line is deduced): block = block.next();
-
2588 it = block.begin();
executed (the execution status of this line is deduced): it = block.begin();
-
2589 }
executed: }
Execution Count:2
2
2590 } else {
executed: }
Execution Count:9
9
2591 int startPos = startCursor.selectionStart();
executed (the execution status of this line is deduced): int startPos = startCursor.selectionStart();
-
2592 if (startPos > 0)
partially evaluated: startPos > 0
TRUEFALSE
yes
Evaluation Count:2
no
Evaluation Count:0
0-2
2593 --startPos;
executed: --startPos;
Execution Count:2
2
2594 -
2595 QTextBlock block = d->doc->findBlock(startPos);
executed (the execution status of this line is deduced): QTextBlock block = d->doc->findBlock(startPos);
-
2596 QTextBlock::Iterator blockStart = block.begin();
executed (the execution status of this line is deduced): QTextBlock::Iterator blockStart = block.begin();
-
2597 QTextBlock::Iterator it = block.end();
executed (the execution status of this line is deduced): QTextBlock::Iterator it = block.end();
-
2598 -
2599 if (startPos == block.position()) {
partially evaluated: startPos == block.position()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:2
0-2
2600 it = block.begin();
never executed (the execution status of this line is deduced): it = block.begin();
-
2601 } else {
never executed: }
0
2602 do { -
2603 if (it == blockStart) {
partially evaluated: it == blockStart
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:3
0-3
2604 it = QTextBlock::Iterator();
never executed (the execution status of this line is deduced): it = QTextBlock::Iterator();
-
2605 block = QTextBlock();
never executed (the execution status of this line is deduced): block = QTextBlock();
-
2606 } else {
never executed: }
0
2607 --it;
executed (the execution status of this line is deduced): --it;
-
2608 }
executed: }
Execution Count:3
3
2609 } while (!it.atEnd() && it.fragment().position() + it.fragment().length() - 1 > startPos);
partially evaluated: !it.atEnd()
TRUEFALSE
yes
Evaluation Count:3
no
Evaluation Count:0
evaluated: it.fragment().position() + it.fragment().length() - 1 > startPos
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:2
0-3
2610 }
executed: }
Execution Count:2
2
2611 -
2612 while (block.isValid()) {
partially evaluated: block.isValid()
TRUEFALSE
yes
Evaluation Count:2
no
Evaluation Count:0
0-2
2613 anchorStart = -1;
executed (the execution status of this line is deduced): anchorStart = -1;
-
2614 -
2615 if (!it.atEnd()) {
partially evaluated: !it.atEnd()
TRUEFALSE
yes
Evaluation Count:2
no
Evaluation Count:0
0-2
2616 do { -
2617 const QTextFragment fragment = it.fragment();
executed (the execution status of this line is deduced): const QTextFragment fragment = it.fragment();
-
2618 const QTextCharFormat fmt = fragment.charFormat();
executed (the execution status of this line is deduced): const QTextCharFormat fmt = fragment.charFormat();
-
2619 -
2620 if (fmt.isAnchor() && fmt.hasProperty(QTextFormat::AnchorHref)) {
partially evaluated: fmt.isAnchor()
TRUEFALSE
yes
Evaluation Count:2
no
Evaluation Count:0
partially evaluated: fmt.hasProperty(QTextFormat::AnchorHref)
TRUEFALSE
yes
Evaluation Count:2
no
Evaluation Count:0
0-2
2621 anchorStart = fragment.position() + fragment.length();
executed (the execution status of this line is deduced): anchorStart = fragment.position() + fragment.length();
-
2622 anchorHref = fmt.anchorHref();
executed (the execution status of this line is deduced): anchorHref = fmt.anchorHref();
-
2623 break;
executed: break;
Execution Count:2
2
2624 } -
2625 -
2626 if (it == blockStart)
never evaluated: it == blockStart
0
2627 it = QTextBlock::Iterator();
never executed: it = QTextBlock::Iterator();
0
2628 else -
2629 --it;
never executed: --it;
0
2630 } while (!it.atEnd());
never evaluated: !it.atEnd()
0
2631 }
executed: }
Execution Count:2
2
2632 -
2633 if (anchorStart != -1 && !it.atEnd()) {
partially evaluated: anchorStart != -1
TRUEFALSE
yes
Evaluation Count:2
no
Evaluation Count:0
partially evaluated: !it.atEnd()
TRUEFALSE
yes
Evaluation Count:2
no
Evaluation Count:0
0-2
2634 anchorEnd = -1;
executed (the execution status of this line is deduced): anchorEnd = -1;
-
2635 -
2636 do { -
2637 const QTextFragment fragment = it.fragment();
executed (the execution status of this line is deduced): const QTextFragment fragment = it.fragment();
-
2638 const QTextCharFormat fmt = fragment.charFormat();
executed (the execution status of this line is deduced): const QTextCharFormat fmt = fragment.charFormat();
-
2639 -
2640 if (!fmt.isAnchor() || fmt.anchorHref() != anchorHref) {
partially evaluated: !fmt.isAnchor()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:3
evaluated: fmt.anchorHref() != anchorHref
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:2
0-3
2641 anchorEnd = fragment.position() + fragment.length();
executed (the execution status of this line is deduced): anchorEnd = fragment.position() + fragment.length();
-
2642 break;
executed: break;
Execution Count:1
1
2643 } -
2644 -
2645 if (it == blockStart)
evaluated: it == blockStart
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:1
1
2646 it = QTextBlock::Iterator();
executed: it = QTextBlock::Iterator();
Execution Count:1
1
2647 else -
2648 --it;
executed: --it;
Execution Count:1
1
2649 } while (!it.atEnd());
evaluated: !it.atEnd()
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:1
1
2650 -
2651 if (anchorEnd == -1)
evaluated: anchorEnd == -1
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:1
1
2652 anchorEnd = qMax(0, block.position());
executed: anchorEnd = qMax(0, block.position());
Execution Count:1
1
2653 -
2654 break;
executed: break;
Execution Count:2
2
2655 } -
2656 -
2657 block = block.previous();
never executed (the execution status of this line is deduced): block = block.previous();
-
2658 it = block.end();
never executed (the execution status of this line is deduced): it = block.end();
-
2659 if (it != block.begin())
never evaluated: it != block.begin()
0
2660 --it;
never executed: --it;
0
2661 blockStart = block.begin();
never executed (the execution status of this line is deduced): blockStart = block.begin();
-
2662 }
never executed: }
0
2663 -
2664 }
executed: }
Execution Count:2
2
2665 -
2666 if (anchorStart != -1 && anchorEnd != -1) {
evaluated: anchorStart != -1
TRUEFALSE
yes
Evaluation Count:10
yes
Evaluation Count:1
partially evaluated: anchorEnd != -1
TRUEFALSE
yes
Evaluation Count:10
no
Evaluation Count:0
0-10
2667 newAnchor = d->cursor;
executed (the execution status of this line is deduced): newAnchor = d->cursor;
-
2668 newAnchor.setPosition(anchorStart);
executed (the execution status of this line is deduced): newAnchor.setPosition(anchorStart);
-
2669 newAnchor.setPosition(anchorEnd, QTextCursor::KeepAnchor);
executed (the execution status of this line is deduced): newAnchor.setPosition(anchorEnd, QTextCursor::KeepAnchor);
-
2670 return true;
executed: return true;
Execution Count:10
10
2671 } -
2672 -
2673 return false;
executed: return false;
Execution Count:1
1
2674} -
2675 -
2676void QWidgetTextControlPrivate::activateLinkUnderCursor(QString href) -
2677{ -
2678 QTextCursor oldCursor = cursor;
executed (the execution status of this line is deduced): QTextCursor oldCursor = cursor;
-
2679 -
2680 if (href.isEmpty()) {
partially evaluated: href.isEmpty()
TRUEFALSE
yes
Evaluation Count:6
no
Evaluation Count:0
0-6
2681 QTextCursor tmp = cursor;
executed (the execution status of this line is deduced): QTextCursor tmp = cursor;
-
2682 if (tmp.selectionStart() != tmp.position())
partially evaluated: tmp.selectionStart() != tmp.position()
TRUEFALSE
yes
Evaluation Count:6
no
Evaluation Count:0
0-6
2683 tmp.setPosition(tmp.selectionStart());
executed: tmp.setPosition(tmp.selectionStart());
Execution Count:6
6
2684 tmp.movePosition(QTextCursor::NextCharacter);
executed (the execution status of this line is deduced): tmp.movePosition(QTextCursor::NextCharacter);
-
2685 href = tmp.charFormat().anchorHref();
executed (the execution status of this line is deduced): href = tmp.charFormat().anchorHref();
-
2686 }
executed: }
Execution Count:6
6
2687 if (href.isEmpty())
partially evaluated: href.isEmpty()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:6
0-6
2688 return;
never executed: return;
0
2689 -
2690 if (!cursor.hasSelection()) {
partially evaluated: !cursor.hasSelection()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:6
0-6
2691 QTextBlock block = cursor.block();
never executed (the execution status of this line is deduced): QTextBlock block = cursor.block();
-
2692 const int cursorPos = cursor.position();
never executed (the execution status of this line is deduced): const int cursorPos = cursor.position();
-
2693 -
2694 QTextBlock::Iterator it = block.begin();
never executed (the execution status of this line is deduced): QTextBlock::Iterator it = block.begin();
-
2695 QTextBlock::Iterator linkFragment;
never executed (the execution status of this line is deduced): QTextBlock::Iterator linkFragment;
-
2696 -
2697 for (; !it.atEnd(); ++it) {
never evaluated: !it.atEnd()
0
2698 QTextFragment fragment = it.fragment();
never executed (the execution status of this line is deduced): QTextFragment fragment = it.fragment();
-
2699 const int fragmentPos = fragment.position();
never executed (the execution status of this line is deduced): const int fragmentPos = fragment.position();
-
2700 if (fragmentPos <= cursorPos &&
never evaluated: fragmentPos <= cursorPos
0
2701 fragmentPos + fragment.length() > cursorPos) {
never evaluated: fragmentPos + fragment.length() > cursorPos
0
2702 linkFragment = it;
never executed (the execution status of this line is deduced): linkFragment = it;
-
2703 break;
never executed: break;
0
2704 } -
2705 }
never executed: }
0
2706 -
2707 if (!linkFragment.atEnd()) {
never evaluated: !linkFragment.atEnd()
0
2708 it = linkFragment;
never executed (the execution status of this line is deduced): it = linkFragment;
-
2709 cursor.setPosition(it.fragment().position());
never executed (the execution status of this line is deduced): cursor.setPosition(it.fragment().position());
-
2710 if (it != block.begin()) {
never evaluated: it != block.begin()
0
2711 do { -
2712 --it;
never executed (the execution status of this line is deduced): --it;
-
2713 QTextFragment fragment = it.fragment();
never executed (the execution status of this line is deduced): QTextFragment fragment = it.fragment();
-
2714 if (fragment.charFormat().anchorHref() != href)
never evaluated: fragment.charFormat().anchorHref() != href
0
2715 break;
never executed: break;
0
2716 cursor.setPosition(fragment.position());
never executed (the execution status of this line is deduced): cursor.setPosition(fragment.position());
-
2717 } while (it != block.begin());
never executed: }
never evaluated: it != block.begin()
0
2718 }
never executed: }
0
2719 -
2720 for (it = linkFragment; !it.atEnd(); ++it) {
never evaluated: !it.atEnd()
0
2721 QTextFragment fragment = it.fragment();
never executed (the execution status of this line is deduced): QTextFragment fragment = it.fragment();
-
2722 if (fragment.charFormat().anchorHref() != href)
never evaluated: fragment.charFormat().anchorHref() != href
0
2723 break;
never executed: break;
0
2724 cursor.setPosition(fragment.position() + fragment.length(), QTextCursor::KeepAnchor);
never executed (the execution status of this line is deduced): cursor.setPosition(fragment.position() + fragment.length(), QTextCursor::KeepAnchor);
-
2725 }
never executed: }
0
2726 }
never executed: }
0
2727 }
never executed: }
0
2728 -
2729 if (hasFocus) {
partially evaluated: hasFocus
TRUEFALSE
yes
Evaluation Count:6
no
Evaluation Count:0
0-6
2730 cursorIsFocusIndicator = true;
executed (the execution status of this line is deduced): cursorIsFocusIndicator = true;
-
2731 } else {
executed: }
Execution Count:6
6
2732 cursorIsFocusIndicator = false;
never executed (the execution status of this line is deduced): cursorIsFocusIndicator = false;
-
2733 cursor.clearSelection();
never executed (the execution status of this line is deduced): cursor.clearSelection();
-
2734 }
never executed: }
0
2735 repaintOldAndNewSelection(oldCursor);
executed (the execution status of this line is deduced): repaintOldAndNewSelection(oldCursor);
-
2736 -
2737#ifndef QT_NO_DESKTOPSERVICES -
2738 if (openExternalLinks)
partially evaluated: openExternalLinks
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:6
0-6
2739 QDesktopServices::openUrl(href);
never executed: QDesktopServices::openUrl(href);
0
2740 else -
2741#endif -
2742 emit q_func()->linkActivated(href);
executed: q_func()->linkActivated(href);
Execution Count:6
6
2743} -
2744 -
2745#ifndef QT_NO_TOOLTIP -
2746void QWidgetTextControlPrivate::showToolTip(const QPoint &globalPos, const QPointF &pos, QWidget *contextWidget) -
2747{ -
2748 const QString toolTip = q_func()->cursorForPosition(pos).charFormat().toolTip();
never executed (the execution status of this line is deduced): const QString toolTip = q_func()->cursorForPosition(pos).charFormat().toolTip();
-
2749 if (toolTip.isEmpty())
never evaluated: toolTip.isEmpty()
0
2750 return;
never executed: return;
0
2751 QToolTip::showText(globalPos, toolTip, contextWidget);
never executed (the execution status of this line is deduced): QToolTip::showText(globalPos, toolTip, contextWidget);
-
2752}
never executed: }
0
2753#endif // QT_NO_TOOLTIP -
2754 -
2755bool QWidgetTextControlPrivate::isPreediting() const -
2756{ -
2757 QTextLayout *layout = cursor.block().layout();
executed (the execution status of this line is deduced): QTextLayout *layout = cursor.block().layout();
-
2758 if (layout && !layout->preeditAreaText().isEmpty())
partially evaluated: layout
TRUEFALSE
yes
Evaluation Count:11
no
Evaluation Count:0
partially evaluated: !layout->preeditAreaText().isEmpty()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:11
0-11
2759 return true;
never executed: return true;
0
2760 -
2761 return false;
executed: return false;
Execution Count:11
11
2762} -
2763 -
2764void QWidgetTextControlPrivate::commitPreedit() -
2765{ -
2766 if (!isPreediting())
partially evaluated: !isPreediting()
TRUEFALSE
yes
Evaluation Count:2
no
Evaluation Count:0
0-2
2767 return;
executed: return;
Execution Count:2
2
2768 -
2769 qApp->inputMethod()->commit();
never executed (the execution status of this line is deduced): (static_cast<QApplication *>(QCoreApplication::instance()))->inputMethod()->commit();
-
2770 -
2771 if (!isPreediting())
never evaluated: !isPreediting()
0
2772 return;
never executed: return;
0
2773 -
2774 cursor.beginEditBlock();
never executed (the execution status of this line is deduced): cursor.beginEditBlock();
-
2775 preeditCursor = 0;
never executed (the execution status of this line is deduced): preeditCursor = 0;
-
2776 QTextBlock block = cursor.block();
never executed (the execution status of this line is deduced): QTextBlock block = cursor.block();
-
2777 QTextLayout *layout = block.layout();
never executed (the execution status of this line is deduced): QTextLayout *layout = block.layout();
-
2778 layout->setPreeditArea(-1, QString());
never executed (the execution status of this line is deduced): layout->setPreeditArea(-1, QString());
-
2779 layout->clearAdditionalFormats();
never executed (the execution status of this line is deduced): layout->clearAdditionalFormats();
-
2780 cursor.endEditBlock();
never executed (the execution status of this line is deduced): cursor.endEditBlock();
-
2781}
never executed: }
0
2782 -
2783bool QWidgetTextControl::setFocusToNextOrPreviousAnchor(bool next) -
2784{ -
2785 Q_D(QWidgetTextControl);
executed (the execution status of this line is deduced): QWidgetTextControlPrivate * const d = d_func();
-
2786 -
2787 if (!(d->interactionFlags & Qt::LinksAccessibleByKeyboard))
partially evaluated: !(d->interactionFlags & Qt::LinksAccessibleByKeyboard)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:11
0-11
2788 return false;
never executed: return false;
0
2789 -
2790 QRectF crect = selectionRect();
executed (the execution status of this line is deduced): QRectF crect = selectionRect();
-
2791 emit updateRequest(crect);
executed (the execution status of this line is deduced): updateRequest(crect);
-
2792 -
2793 // If we don't have a current anchor, we start from the start/end -
2794 if (!d->cursor.hasSelection()) {
evaluated: !d->cursor.hasSelection()
TRUEFALSE
yes
Evaluation Count:7
yes
Evaluation Count:4
4-7
2795 d->cursor = QTextCursor(d->doc);
executed (the execution status of this line is deduced): d->cursor = QTextCursor(d->doc);
-
2796 if (next)
evaluated: next
TRUEFALSE
yes
Evaluation Count:6
yes
Evaluation Count:1
1-6
2797 d->cursor.movePosition(QTextCursor::Start);
executed: d->cursor.movePosition(QTextCursor::Start);
Execution Count:6
6
2798 else -
2799 d->cursor.movePosition(QTextCursor::End);
executed: d->cursor.movePosition(QTextCursor::End);
Execution Count:1
1
2800 } -
2801 -
2802 QTextCursor newAnchor;
executed (the execution status of this line is deduced): QTextCursor newAnchor;
-
2803 if (findNextPrevAnchor(d->cursor, next, newAnchor)) {
evaluated: findNextPrevAnchor(d->cursor, next, newAnchor)
TRUEFALSE
yes
Evaluation Count:10
yes
Evaluation Count:1
1-10
2804 d->cursor = newAnchor;
executed (the execution status of this line is deduced): d->cursor = newAnchor;
-
2805 d->cursorIsFocusIndicator = true;
executed (the execution status of this line is deduced): d->cursorIsFocusIndicator = true;
-
2806 } else {
executed: }
Execution Count:10
10
2807 d->cursor.clearSelection();
executed (the execution status of this line is deduced): d->cursor.clearSelection();
-
2808 }
executed: }
Execution Count:1
1
2809 -
2810 if (d->cursor.hasSelection()) {
evaluated: d->cursor.hasSelection()
TRUEFALSE
yes
Evaluation Count:10
yes
Evaluation Count:1
1-10
2811 crect = selectionRect();
executed (the execution status of this line is deduced): crect = selectionRect();
-
2812 emit updateRequest(crect);
executed (the execution status of this line is deduced): updateRequest(crect);
-
2813 emit visibilityRequest(crect);
executed (the execution status of this line is deduced): visibilityRequest(crect);
-
2814 return true;
executed: return true;
Execution Count:10
10
2815 } else { -
2816 return false;
executed: return false;
Execution Count:1
1
2817 } -
2818} -
2819 -
2820bool QWidgetTextControl::setFocusToAnchor(const QTextCursor &newCursor) -
2821{ -
2822 Q_D(QWidgetTextControl);
never executed (the execution status of this line is deduced): QWidgetTextControlPrivate * const d = d_func();
-
2823 -
2824 if (!(d->interactionFlags & Qt::LinksAccessibleByKeyboard))
never evaluated: !(d->interactionFlags & Qt::LinksAccessibleByKeyboard)
0
2825 return false;
never executed: return false;
0
2826 -
2827 // Verify that this is an anchor. -
2828 const QString anchorHref = d->anchorForCursor(newCursor);
never executed (the execution status of this line is deduced): const QString anchorHref = d->anchorForCursor(newCursor);
-
2829 if (anchorHref.isEmpty())
never evaluated: anchorHref.isEmpty()
0
2830 return false;
never executed: return false;
0
2831 -
2832 // and process it -
2833 QRectF crect = selectionRect();
never executed (the execution status of this line is deduced): QRectF crect = selectionRect();
-
2834 emit updateRequest(crect);
never executed (the execution status of this line is deduced): updateRequest(crect);
-
2835 -
2836 d->cursor.setPosition(newCursor.selectionStart());
never executed (the execution status of this line is deduced): d->cursor.setPosition(newCursor.selectionStart());
-
2837 d->cursor.setPosition(newCursor.selectionEnd(), QTextCursor::KeepAnchor);
never executed (the execution status of this line is deduced): d->cursor.setPosition(newCursor.selectionEnd(), QTextCursor::KeepAnchor);
-
2838 d->cursorIsFocusIndicator = true;
never executed (the execution status of this line is deduced): d->cursorIsFocusIndicator = true;
-
2839 -
2840 crect = selectionRect();
never executed (the execution status of this line is deduced): crect = selectionRect();
-
2841 emit updateRequest(crect);
never executed (the execution status of this line is deduced): updateRequest(crect);
-
2842 emit visibilityRequest(crect);
never executed (the execution status of this line is deduced): visibilityRequest(crect);
-
2843 return true;
never executed: return true;
0
2844} -
2845 -
2846void QWidgetTextControl::setTextInteractionFlags(Qt::TextInteractionFlags flags) -
2847{ -
2848 Q_D(QWidgetTextControl);
executed (the execution status of this line is deduced): QWidgetTextControlPrivate * const d = d_func();
-
2849 if (flags == d->interactionFlags)
evaluated: flags == d->interactionFlags
TRUEFALSE
yes
Evaluation Count:12
yes
Evaluation Count:166
12-166
2850 return;
executed: return;
Execution Count:12
12
2851 d->interactionFlags = flags;
executed (the execution status of this line is deduced): d->interactionFlags = flags;
-
2852 -
2853 if (d->hasFocus)
evaluated: d->hasFocus
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:164
2-164
2854 d->setBlinkingCursorEnabled(flags & Qt::TextEditable);
executed: d->setBlinkingCursorEnabled(flags & Qt::TextEditable);
Execution Count:2
2
2855}
executed: }
Execution Count:166
166
2856 -
2857Qt::TextInteractionFlags QWidgetTextControl::textInteractionFlags() const -
2858{ -
2859 Q_D(const QWidgetTextControl);
executed (the execution status of this line is deduced): const QWidgetTextControlPrivate * const d = d_func();
-
2860 return d->interactionFlags;
executed: return d->interactionFlags;
Execution Count:192
192
2861} -
2862 -
2863void QWidgetTextControl::mergeCurrentCharFormat(const QTextCharFormat &modifier) -
2864{ -
2865 Q_D(QWidgetTextControl);
executed (the execution status of this line is deduced): QWidgetTextControlPrivate * const d = d_func();
-
2866 d->cursor.mergeCharFormat(modifier);
executed (the execution status of this line is deduced): d->cursor.mergeCharFormat(modifier);
-
2867 d->updateCurrentCharFormat();
executed (the execution status of this line is deduced): d->updateCurrentCharFormat();
-
2868}
executed: }
Execution Count:5
5
2869 -
2870void QWidgetTextControl::setCurrentCharFormat(const QTextCharFormat &format) -
2871{ -
2872 Q_D(QWidgetTextControl);
never executed (the execution status of this line is deduced): QWidgetTextControlPrivate * const d = d_func();
-
2873 d->cursor.setCharFormat(format);
never executed (the execution status of this line is deduced): d->cursor.setCharFormat(format);
-
2874 d->updateCurrentCharFormat();
never executed (the execution status of this line is deduced): d->updateCurrentCharFormat();
-
2875}
never executed: }
0
2876 -
2877QTextCharFormat QWidgetTextControl::currentCharFormat() const -
2878{ -
2879 Q_D(const QWidgetTextControl);
never executed (the execution status of this line is deduced): const QWidgetTextControlPrivate * const d = d_func();
-
2880 return d->cursor.charFormat();
never executed: return d->cursor.charFormat();
0
2881} -
2882 -
2883void QWidgetTextControl::insertPlainText(const QString &text) -
2884{ -
2885 Q_D(QWidgetTextControl);
executed (the execution status of this line is deduced): QWidgetTextControlPrivate * const d = d_func();
-
2886 d->cursor.insertText(text);
executed (the execution status of this line is deduced): d->cursor.insertText(text);
-
2887}
executed: }
Execution Count:3
3
2888 -
2889#ifndef QT_NO_TEXTHTMLPARSER -
2890void QWidgetTextControl::insertHtml(const QString &text) -
2891{ -
2892 Q_D(QWidgetTextControl);
never executed (the execution status of this line is deduced): QWidgetTextControlPrivate * const d = d_func();
-
2893 d->cursor.insertHtml(text);
never executed (the execution status of this line is deduced): d->cursor.insertHtml(text);
-
2894}
never executed: }
0
2895#endif // QT_NO_TEXTHTMLPARSER -
2896 -
2897QPointF QWidgetTextControl::anchorPosition(const QString &name) const -
2898{ -
2899 Q_D(const QWidgetTextControl);
executed (the execution status of this line is deduced): const QWidgetTextControlPrivate * const d = d_func();
-
2900 if (name.isEmpty())
partially evaluated: name.isEmpty()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:5
0-5
2901 return QPointF();
never executed: return QPointF();
0
2902 -
2903 QRectF r;
executed (the execution status of this line is deduced): QRectF r;
-
2904 for (QTextBlock block = d->doc->begin(); block.isValid(); block = block.next()) {
evaluated: block.isValid()
TRUEFALSE
yes
Evaluation Count:10
yes
Evaluation Count:4
4-10
2905 QTextCharFormat format = block.charFormat();
executed (the execution status of this line is deduced): QTextCharFormat format = block.charFormat();
-
2906 if (format.isAnchor() && format.anchorNames().contains(name)) {
evaluated: format.isAnchor()
TRUEFALSE
yes
Evaluation Count:3
yes
Evaluation Count:7
evaluated: format.anchorNames().contains(name)
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:2
1-7
2907 r = d->rectForPosition(block.position());
executed (the execution status of this line is deduced): r = d->rectForPosition(block.position());
-
2908 break;
executed: break;
Execution Count:1
1
2909 } -
2910 -
2911 for (QTextBlock::Iterator it = block.begin(); !it.atEnd(); ++it) {
evaluated: !it.atEnd()
TRUEFALSE
yes
Evaluation Count:14
yes
Evaluation Count:5
5-14
2912 QTextFragment fragment = it.fragment();
executed (the execution status of this line is deduced): QTextFragment fragment = it.fragment();
-
2913 format = fragment.charFormat();
executed (the execution status of this line is deduced): format = fragment.charFormat();
-
2914 if (format.isAnchor() && format.anchorNames().contains(name)) {
evaluated: format.isAnchor()
TRUEFALSE
yes
Evaluation Count:8
yes
Evaluation Count:6
evaluated: format.anchorNames().contains(name)
TRUEFALSE
yes
Evaluation Count:4
yes
Evaluation Count:4
4-8
2915 r = d->rectForPosition(fragment.position());
executed (the execution status of this line is deduced): r = d->rectForPosition(fragment.position());
-
2916 block = QTextBlock();
executed (the execution status of this line is deduced): block = QTextBlock();
-
2917 break;
executed: break;
Execution Count:4
4
2918 } -
2919 }
executed: }
Execution Count:10
10
2920 }
executed: }
Execution Count:9
9
2921 if (!r.isValid())
partially evaluated: !r.isValid()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:5
0-5
2922 return QPointF();
never executed: return QPointF();
0
2923 return QPointF(0, r.top());
executed: return QPointF(0, r.top());
Execution Count:5
5
2924} -
2925 -
2926void QWidgetTextControl::adjustSize() -
2927{ -
2928 Q_D(QWidgetTextControl);
executed (the execution status of this line is deduced): QWidgetTextControlPrivate * const d = d_func();
-
2929 d->doc->adjustSize();
executed (the execution status of this line is deduced): d->doc->adjustSize();
-
2930}
executed: }
Execution Count:7
7
2931 -
2932bool QWidgetTextControl::find(const QString &exp, QTextDocument::FindFlags options) -
2933{ -
2934 Q_D(QWidgetTextControl);
never executed (the execution status of this line is deduced): QWidgetTextControlPrivate * const d = d_func();
-
2935 QTextCursor search = d->doc->find(exp, d->cursor, options);
never executed (the execution status of this line is deduced): QTextCursor search = d->doc->find(exp, d->cursor, options);
-
2936 if (search.isNull())
never evaluated: search.isNull()
0
2937 return false;
never executed: return false;
0
2938 -
2939 setTextCursor(search);
never executed (the execution status of this line is deduced): setTextCursor(search);
-
2940 return true;
never executed: return true;
0
2941} -
2942 -
2943QString QWidgetTextControl::toPlainText() const -
2944{ -
2945 return document()->toPlainText();
executed: return document()->toPlainText();
Execution Count:33
33
2946} -
2947 -
2948#ifndef QT_NO_TEXTHTMLPARSER -
2949QString QWidgetTextControl::toHtml() const -
2950{ -
2951 return document()->toHtml();
executed: return document()->toHtml();
Execution Count:1
1
2952} -
2953#endif -
2954 -
2955void QWidgetTextControlPrivate::append(const QString &text, Qt::TextFormat format) -
2956{ -
2957 QTextCursor tmp(doc);
executed (the execution status of this line is deduced): QTextCursor tmp(doc);
-
2958 tmp.beginEditBlock();
executed (the execution status of this line is deduced): tmp.beginEditBlock();
-
2959 tmp.movePosition(QTextCursor::End);
executed (the execution status of this line is deduced): tmp.movePosition(QTextCursor::End);
-
2960 -
2961 if (!doc->isEmpty())
evaluated: !doc->isEmpty()
TRUEFALSE
yes
Evaluation Count:8
yes
Evaluation Count:5
5-8
2962 tmp.insertBlock(cursor.blockFormat(), cursor.charFormat());
executed: tmp.insertBlock(cursor.blockFormat(), cursor.charFormat());
Execution Count:8
8
2963 else -
2964 tmp.setCharFormat(cursor.charFormat());
executed: tmp.setCharFormat(cursor.charFormat());
Execution Count:5
5
2965 -
2966 // preserve the char format -
2967 QTextCharFormat oldCharFormat = cursor.charFormat();
executed (the execution status of this line is deduced): QTextCharFormat oldCharFormat = cursor.charFormat();
-
2968 -
2969#ifndef QT_NO_TEXTHTMLPARSER -
2970 if (format == Qt::RichText || (format == Qt::AutoText && Qt::mightBeRichText(text))) {
evaluated: format == Qt::RichText
TRUEFALSE
yes
Evaluation Count:4
yes
Evaluation Count:9
partially evaluated: format == Qt::AutoText
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:9
never evaluated: Qt::mightBeRichText(text)
0-9
2971 tmp.insertHtml(text);
executed (the execution status of this line is deduced): tmp.insertHtml(text);
-
2972 } else {
executed: }
Execution Count:4
4
2973 tmp.insertText(text);
executed (the execution status of this line is deduced): tmp.insertText(text);
-
2974 }
executed: }
Execution Count:9
9
2975#else -
2976 tmp.insertText(text); -
2977#endif // QT_NO_TEXTHTMLPARSER -
2978 if (!cursor.hasSelection())
evaluated: !cursor.hasSelection()
TRUEFALSE
yes
Evaluation Count:12
yes
Evaluation Count:1
1-12
2979 cursor.setCharFormat(oldCharFormat);
executed: cursor.setCharFormat(oldCharFormat);
Execution Count:12
12
2980 -
2981 tmp.endEditBlock();
executed (the execution status of this line is deduced): tmp.endEditBlock();
-
2982}
executed: }
Execution Count:13
13
2983 -
2984void QWidgetTextControl::append(const QString &text) -
2985{ -
2986 Q_D(QWidgetTextControl);
never executed (the execution status of this line is deduced): QWidgetTextControlPrivate * const d = d_func();
-
2987 d->append(text, Qt::AutoText);
never executed (the execution status of this line is deduced): d->append(text, Qt::AutoText);
-
2988}
never executed: }
0
2989 -
2990void QWidgetTextControl::appendHtml(const QString &html) -
2991{ -
2992 Q_D(QWidgetTextControl);
executed (the execution status of this line is deduced): QWidgetTextControlPrivate * const d = d_func();
-
2993 d->append(html, Qt::RichText);
executed (the execution status of this line is deduced): d->append(html, Qt::RichText);
-
2994}
executed: }
Execution Count:4
4
2995 -
2996void QWidgetTextControl::appendPlainText(const QString &text) -
2997{ -
2998 Q_D(QWidgetTextControl);
executed (the execution status of this line is deduced): QWidgetTextControlPrivate * const d = d_func();
-
2999 d->append(text, Qt::PlainText);
executed (the execution status of this line is deduced): d->append(text, Qt::PlainText);
-
3000}
executed: }
Execution Count:9
9
3001 -
3002 -
3003void QWidgetTextControl::ensureCursorVisible() -
3004{ -
3005 Q_D(QWidgetTextControl);
executed (the execution status of this line is deduced): QWidgetTextControlPrivate * const d = d_func();
-
3006 QRectF crect = d->rectForPosition(d->cursor.position()).adjusted(-5, 0, 5, 0);
executed (the execution status of this line is deduced): QRectF crect = d->rectForPosition(d->cursor.position()).adjusted(-5, 0, 5, 0);
-
3007 emit visibilityRequest(crect);
executed (the execution status of this line is deduced): visibilityRequest(crect);
-
3008 emit microFocusChanged();
executed (the execution status of this line is deduced): microFocusChanged();
-
3009}
executed: }
Execution Count:580
580
3010 -
3011QPalette QWidgetTextControl::palette() const -
3012{ -
3013 Q_D(const QWidgetTextControl);
never executed (the execution status of this line is deduced): const QWidgetTextControlPrivate * const d = d_func();
-
3014 return d->palette;
never executed: return d->palette;
0
3015} -
3016 -
3017void QWidgetTextControl::setPalette(const QPalette &pal) -
3018{ -
3019 Q_D(QWidgetTextControl);
executed (the execution status of this line is deduced): QWidgetTextControlPrivate * const d = d_func();
-
3020 d->palette = pal;
executed (the execution status of this line is deduced): d->palette = pal;
-
3021}
executed: }
Execution Count:210
210
3022 -
3023QAbstractTextDocumentLayout::PaintContext QWidgetTextControl::getPaintContext(QWidget *widget) const -
3024{ -
3025 Q_D(const QWidgetTextControl);
executed (the execution status of this line is deduced): const QWidgetTextControlPrivate * const d = d_func();
-
3026 -
3027 QAbstractTextDocumentLayout::PaintContext ctx;
executed (the execution status of this line is deduced): QAbstractTextDocumentLayout::PaintContext ctx;
-
3028 -
3029 ctx.selections = d->extraSelections;
executed (the execution status of this line is deduced): ctx.selections = d->extraSelections;
-
3030 ctx.palette = d->palette;
executed (the execution status of this line is deduced): ctx.palette = d->palette;
-
3031 if (d->cursorOn && d->isEnabled) {
evaluated: d->cursorOn
TRUEFALSE
yes
Evaluation Count:40
yes
Evaluation Count:262
partially evaluated: d->isEnabled
TRUEFALSE
yes
Evaluation Count:40
no
Evaluation Count:0
0-262
3032 if (d->hideCursor)
partially evaluated: d->hideCursor
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:40
0-40
3033 ctx.cursorPosition = -1;
never executed: ctx.cursorPosition = -1;
0
3034 else if (d->preeditCursor != 0)
partially evaluated: d->preeditCursor != 0
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:40
0-40
3035 ctx.cursorPosition = - (d->preeditCursor + 2);
never executed: ctx.cursorPosition = - (d->preeditCursor + 2);
0
3036 else -
3037 ctx.cursorPosition = d->cursor.position();
executed: ctx.cursorPosition = d->cursor.position();
Execution Count:40
40
3038 } -
3039 -
3040 if (!d->dndFeedbackCursor.isNull())
partially evaluated: !d->dndFeedbackCursor.isNull()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:302
0-302
3041 ctx.cursorPosition = d->dndFeedbackCursor.position();
never executed: ctx.cursorPosition = d->dndFeedbackCursor.position();
0
3042#ifdef QT_KEYPAD_NAVIGATION -
3043 if (!QApplication::keypadNavigationEnabled() || d->hasEditFocus) -
3044#endif -
3045 if (d->cursor.hasSelection()) {
partially evaluated: d->cursor.hasSelection()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:302
0-302
3046 QAbstractTextDocumentLayout::Selection selection;
never executed (the execution status of this line is deduced): QAbstractTextDocumentLayout::Selection selection;
-
3047 selection.cursor = d->cursor;
never executed (the execution status of this line is deduced): selection.cursor = d->cursor;
-
3048 if (d->cursorIsFocusIndicator) {
never evaluated: d->cursorIsFocusIndicator
0
3049 QStyleOption opt;
never executed (the execution status of this line is deduced): QStyleOption opt;
-
3050 opt.palette = ctx.palette;
never executed (the execution status of this line is deduced): opt.palette = ctx.palette;
-
3051 QStyleHintReturnVariant ret;
never executed (the execution status of this line is deduced): QStyleHintReturnVariant ret;
-
3052 QStyle *style = QApplication::style();
never executed (the execution status of this line is deduced): QStyle *style = QApplication::style();
-
3053 if (widget)
never evaluated: widget
0
3054 style = widget->style();
never executed: style = widget->style();
0
3055 style->styleHint(QStyle::SH_TextControl_FocusIndicatorTextCharFormat, &opt, widget, &ret);
never executed (the execution status of this line is deduced): style->styleHint(QStyle::SH_TextControl_FocusIndicatorTextCharFormat, &opt, widget, &ret);
-
3056 selection.format = qvariant_cast<QTextFormat>(ret.variant).toCharFormat();
never executed (the execution status of this line is deduced): selection.format = qvariant_cast<QTextFormat>(ret.variant).toCharFormat();
-
3057 } else {
never executed: }
0
3058 QPalette::ColorGroup cg = d->hasFocus ? QPalette::Active : QPalette::Inactive;
never evaluated: d->hasFocus
0
3059 selection.format.setBackground(ctx.palette.brush(cg, QPalette::Highlight));
never executed (the execution status of this line is deduced): selection.format.setBackground(ctx.palette.brush(cg, QPalette::Highlight));
-
3060 selection.format.setForeground(ctx.palette.brush(cg, QPalette::HighlightedText));
never executed (the execution status of this line is deduced): selection.format.setForeground(ctx.palette.brush(cg, QPalette::HighlightedText));
-
3061 QStyleOption opt;
never executed (the execution status of this line is deduced): QStyleOption opt;
-
3062 QStyle *style = QApplication::style();
never executed (the execution status of this line is deduced): QStyle *style = QApplication::style();
-
3063 if (widget) {
never evaluated: widget
0
3064 opt.initFrom(widget);
never executed (the execution status of this line is deduced): opt.initFrom(widget);
-
3065 style = widget->style();
never executed (the execution status of this line is deduced): style = widget->style();
-
3066 }
never executed: }
0
3067 if (style->styleHint(QStyle::SH_RichText_FullWidthSelection, &opt, widget))
never evaluated: style->styleHint(QStyle::SH_RichText_FullWidthSelection, &opt, widget)
0
3068 selection.format.setProperty(QTextFormat::FullWidthSelection, true);
never executed: selection.format.setProperty(QTextFormat::FullWidthSelection, true);
0
3069 }
never executed: }
0
3070 ctx.selections.append(selection);
never executed (the execution status of this line is deduced): ctx.selections.append(selection);
-
3071 }
never executed: }
0
3072 -
3073 return ctx;
executed: return ctx;
Execution Count:302
302
3074} -
3075 -
3076void QWidgetTextControl::drawContents(QPainter *p, const QRectF &rect, QWidget *widget) -
3077{ -
3078 Q_D(QWidgetTextControl);
executed (the execution status of this line is deduced): QWidgetTextControlPrivate * const d = d_func();
-
3079 p->save();
executed (the execution status of this line is deduced): p->save();
-
3080 QAbstractTextDocumentLayout::PaintContext ctx = getPaintContext(widget);
executed (the execution status of this line is deduced): QAbstractTextDocumentLayout::PaintContext ctx = getPaintContext(widget);
-
3081 if (rect.isValid())
evaluated: rect.isValid()
TRUEFALSE
yes
Evaluation Count:271
yes
Evaluation Count:24
24-271
3082 p->setClipRect(rect, Qt::IntersectClip);
executed: p->setClipRect(rect, Qt::IntersectClip);
Execution Count:271
271
3083 ctx.clip = rect;
executed (the execution status of this line is deduced): ctx.clip = rect;
-
3084 -
3085 d->doc->documentLayout()->draw(p, ctx);
executed (the execution status of this line is deduced): d->doc->documentLayout()->draw(p, ctx);
-
3086 p->restore();
executed (the execution status of this line is deduced): p->restore();
-
3087}
executed: }
Execution Count:295
295
3088 -
3089void QWidgetTextControlPrivate::_q_copyLink() -
3090{ -
3091#ifndef QT_NO_CLIPBOARD -
3092 QMimeData *md = new QMimeData;
never executed (the execution status of this line is deduced): QMimeData *md = new QMimeData;
-
3093 md->setText(linkToCopy);
never executed (the execution status of this line is deduced): md->setText(linkToCopy);
-
3094 QApplication::clipboard()->setMimeData(md);
never executed (the execution status of this line is deduced): QApplication::clipboard()->setMimeData(md);
-
3095#endif -
3096}
never executed: }
0
3097 -
3098int QWidgetTextControl::hitTest(const QPointF &point, Qt::HitTestAccuracy accuracy) const -
3099{ -
3100 Q_D(const QWidgetTextControl);
executed (the execution status of this line is deduced): const QWidgetTextControlPrivate * const d = d_func();
-
3101 return d->doc->documentLayout()->hitTest(point, accuracy);
executed: return d->doc->documentLayout()->hitTest(point, accuracy);
Execution Count:2
2
3102} -
3103 -
3104QRectF QWidgetTextControl::blockBoundingRect(const QTextBlock &block) const -
3105{ -
3106 Q_D(const QWidgetTextControl);
executed (the execution status of this line is deduced): const QWidgetTextControlPrivate * const d = d_func();
-
3107 return d->doc->documentLayout()->blockBoundingRect(block);
executed: return d->doc->documentLayout()->blockBoundingRect(block);
Execution Count:1292
1292
3108} -
3109 -
3110#ifndef QT_NO_CONTEXTMENU -
3111#define NUM_CONTROL_CHARACTERS 10 -
3112const struct QUnicodeControlCharacter { -
3113 const char *text; -
3114 ushort character; -
3115} qt_controlCharacters[NUM_CONTROL_CHARACTERS] = { -
3116 { QT_TRANSLATE_NOOP("QUnicodeControlCharacterMenu", "LRM Left-to-right mark"), 0x200e }, -
3117 { QT_TRANSLATE_NOOP("QUnicodeControlCharacterMenu", "RLM Right-to-left mark"), 0x200f }, -
3118 { QT_TRANSLATE_NOOP("QUnicodeControlCharacterMenu", "ZWJ Zero width joiner"), 0x200d }, -
3119 { QT_TRANSLATE_NOOP("QUnicodeControlCharacterMenu", "ZWNJ Zero width non-joiner"), 0x200c }, -
3120 { QT_TRANSLATE_NOOP("QUnicodeControlCharacterMenu", "ZWSP Zero width space"), 0x200b }, -
3121 { QT_TRANSLATE_NOOP("QUnicodeControlCharacterMenu", "LRE Start of left-to-right embedding"), 0x202a }, -
3122 { QT_TRANSLATE_NOOP("QUnicodeControlCharacterMenu", "RLE Start of right-to-left embedding"), 0x202b }, -
3123 { QT_TRANSLATE_NOOP("QUnicodeControlCharacterMenu", "LRO Start of left-to-right override"), 0x202d }, -
3124 { QT_TRANSLATE_NOOP("QUnicodeControlCharacterMenu", "RLO Start of right-to-left override"), 0x202e }, -
3125 { QT_TRANSLATE_NOOP("QUnicodeControlCharacterMenu", "PDF Pop directional formatting"), 0x202c }, -
3126}; -
3127 -
3128QUnicodeControlCharacterMenu::QUnicodeControlCharacterMenu(QObject *_editWidget, QWidget *parent) -
3129 : QMenu(parent), editWidget(_editWidget) -
3130{ -
3131 setTitle(tr("Insert Unicode control character"));
never executed (the execution status of this line is deduced): setTitle(tr("Insert Unicode control character"));
-
3132 for (int i = 0; i < NUM_CONTROL_CHARACTERS; ++i) {
never evaluated: i < 10
0
3133 addAction(tr(qt_controlCharacters[i].text), this, SLOT(menuActionTriggered()));
never executed (the execution status of this line is deduced): addAction(tr(qt_controlCharacters[i].text), this, "1""menuActionTriggered()");
-
3134 }
never executed: }
0
3135}
never executed: }
0
3136 -
3137void QUnicodeControlCharacterMenu::menuActionTriggered() -
3138{ -
3139 QAction *a = qobject_cast<QAction *>(sender());
never executed (the execution status of this line is deduced): QAction *a = qobject_cast<QAction *>(sender());
-
3140 int idx = actions().indexOf(a);
never executed (the execution status of this line is deduced): int idx = actions().indexOf(a);
-
3141 if (idx < 0 || idx >= NUM_CONTROL_CHARACTERS)
never evaluated: idx < 0
never evaluated: idx >= 10
0
3142 return;
never executed: return;
0
3143 QChar c(qt_controlCharacters[idx].character);
never executed (the execution status of this line is deduced): QChar c(qt_controlCharacters[idx].character);
-
3144 QString str(c);
never executed (the execution status of this line is deduced): QString str(c);
-
3145 -
3146#ifndef QT_NO_TEXTEDIT -
3147 if (QTextEdit *edit = qobject_cast<QTextEdit *>(editWidget)) {
never evaluated: QTextEdit *edit = qobject_cast<QTextEdit *>(editWidget)
0
3148 edit->insertPlainText(str);
never executed (the execution status of this line is deduced): edit->insertPlainText(str);
-
3149 return;
never executed: return;
0
3150 } -
3151#endif -
3152 if (QWidgetTextControl *control = qobject_cast<QWidgetTextControl *>(editWidget)) {
never evaluated: QWidgetTextControl *control = qobject_cast<QWidgetTextControl *>(editWidget)
0
3153 control->insertPlainText(str);
never executed (the execution status of this line is deduced): control->insertPlainText(str);
-
3154 }
never executed: }
0
3155#ifndef QT_NO_LINEEDIT -
3156 if (QLineEdit *edit = qobject_cast<QLineEdit *>(editWidget)) {
never evaluated: QLineEdit *edit = qobject_cast<QLineEdit *>(editWidget)
0
3157 edit->insert(str);
never executed (the execution status of this line is deduced): edit->insert(str);
-
3158 return;
never executed: return;
0
3159 } -
3160#endif -
3161}
never executed: }
0
3162#endif // QT_NO_CONTEXTMENU -
3163 -
3164QStringList QTextEditMimeData::formats() const -
3165{ -
3166 if (!fragment.isEmpty())
evaluated: !fragment.isEmpty()
TRUEFALSE
yes
Evaluation Count:4
yes
Evaluation Count:1
1-4
3167 return QStringList() << QString::fromLatin1("text/plain") << QString::fromLatin1("text/html")
executed: return QStringList() << QString::fromLatin1("text/plain") << QString::fromLatin1("text/html") << QString::fromLatin1("application/vnd.oasis.opendocument.text") ;
Execution Count:4
4
3168#ifndef QT_NO_TEXTODFWRITER
executed: return QStringList() << QString::fromLatin1("text/plain") << QString::fromLatin1("text/html") << QString::fromLatin1("application/vnd.oasis.opendocument.text") ;
Execution Count:4
4
3169 << QString::fromLatin1("application/vnd.oasis.opendocument.text")
executed: return QStringList() << QString::fromLatin1("text/plain") << QString::fromLatin1("text/html") << QString::fromLatin1("application/vnd.oasis.opendocument.text") ;
Execution Count:4
4
3170#endif
executed: return QStringList() << QString::fromLatin1("text/plain") << QString::fromLatin1("text/html") << QString::fromLatin1("application/vnd.oasis.opendocument.text") ;
Execution Count:4
4
3171 ;
executed: return QStringList() << QString::fromLatin1("text/plain") << QString::fromLatin1("text/html") << QString::fromLatin1("application/vnd.oasis.opendocument.text") ;
Execution Count:4
4
3172 else -
3173 return QMimeData::formats();
executed: return QMimeData::formats();
Execution Count:1
1
3174} -
3175 -
3176QVariant QTextEditMimeData::retrieveData(const QString &mimeType, QVariant::Type type) const -
3177{ -
3178 if (!fragment.isEmpty())
evaluated: !fragment.isEmpty()
TRUEFALSE
yes
Evaluation Count:3
yes
Evaluation Count:1
1-3
3179 setup();
executed: setup();
Execution Count:3
3
3180 return QMimeData::retrieveData(mimeType, type);
executed: return QMimeData::retrieveData(mimeType, type);
Execution Count:4
4
3181} -
3182 -
3183void QTextEditMimeData::setup() const -
3184{ -
3185 QTextEditMimeData *that = const_cast<QTextEditMimeData *>(this);
executed (the execution status of this line is deduced): QTextEditMimeData *that = const_cast<QTextEditMimeData *>(this);
-
3186#ifndef QT_NO_TEXTHTMLPARSER -
3187 that->setData(QLatin1String("text/html"), fragment.toHtml("utf-8").toUtf8());
executed (the execution status of this line is deduced): that->setData(QLatin1String("text/html"), fragment.toHtml("utf-8").toUtf8());
-
3188#endif -
3189#ifndef QT_NO_TEXTODFWRITER -
3190 { -
3191 QBuffer buffer;
executed (the execution status of this line is deduced): QBuffer buffer;
-
3192 QTextDocumentWriter writer(&buffer, "ODF");
executed (the execution status of this line is deduced): QTextDocumentWriter writer(&buffer, "ODF");
-
3193 writer.write(fragment);
executed (the execution status of this line is deduced): writer.write(fragment);
-
3194 buffer.close();
executed (the execution status of this line is deduced): buffer.close();
-
3195 that->setData(QLatin1String("application/vnd.oasis.opendocument.text"), buffer.data());
executed (the execution status of this line is deduced): that->setData(QLatin1String("application/vnd.oasis.opendocument.text"), buffer.data());
-
3196 } -
3197#endif -
3198 that->setText(fragment.toPlainText());
executed (the execution status of this line is deduced): that->setText(fragment.toPlainText());
-
3199 fragment = QTextDocumentFragment();
executed (the execution status of this line is deduced): fragment = QTextDocumentFragment();
-
3200}
executed: }
Execution Count:3
3
3201 -
3202QT_END_NAMESPACE -
3203 -
3204#include "moc_qwidgettextcontrol_p.cpp" -
3205 -
3206#endif // QT_NO_TEXTCONTROL -
3207 -
Source codeSwitch to Preprocessed file

Generated by Squish Coco Non-Commercial