qwidgettextcontrol.cpp

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

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