Line | Source Code | Coverage |
---|
1 | | - |
2 | | - |
3 | | - |
4 | | - |
5 | | - |
6 | | - |
7 | | - |
8 | | - |
9 | | - |
10 | | - |
11 | | - |
12 | | - |
13 | static inline bool shouldEnableInputMethod(QTextEdit *textedit) | - |
14 | { | - |
15 | return !textedit->isReadOnly(); executed: return !textedit->isReadOnly(); Execution Count:7 | 7 |
16 | } | - |
17 | | - |
18 | class QTextEditControl : public QWidgetTextControl | - |
19 | { | - |
20 | public: | - |
21 | inline QTextEditControl(QObject *parent) : QWidgetTextControl(parent) {} executed: } Execution Count:77 | 77 |
22 | | - |
23 | virtual QMimeData *createMimeDataFromSelection() const { | - |
24 | QTextEdit *ed = qobject_cast<QTextEdit *>(parent()); | - |
25 | if (!ed) | 0 |
26 | return QWidgetTextControl::createMimeDataFromSelection(); never executed: return QWidgetTextControl::createMimeDataFromSelection(); | 0 |
27 | return ed->createMimeDataFromSelection(); never executed: return ed->createMimeDataFromSelection(); | 0 |
28 | } | - |
29 | virtual bool canInsertFromMimeData(const QMimeData *source) const { | - |
30 | QTextEdit *ed = qobject_cast<QTextEdit *>(parent()); | - |
31 | if (!ed) | 0 |
32 | return QWidgetTextControl::canInsertFromMimeData(source); never executed: return QWidgetTextControl::canInsertFromMimeData(source); | 0 |
33 | return ed->canInsertFromMimeData(source); never executed: return ed->canInsertFromMimeData(source); | 0 |
34 | } | - |
35 | virtual void insertFromMimeData(const QMimeData *source) { | - |
36 | QTextEdit *ed = qobject_cast<QTextEdit *>(parent()); | - |
37 | if (!ed) | 0 |
38 | QWidgetTextControl::insertFromMimeData(source); never executed: QWidgetTextControl::insertFromMimeData(source); | 0 |
39 | else | - |
40 | ed->insertFromMimeData(source); never executed: ed->insertFromMimeData(source); | 0 |
41 | } | - |
42 | }; | - |
43 | | - |
44 | QTextEditPrivate::QTextEditPrivate() | - |
45 | : control(0), | - |
46 | autoFormatting(QTextEdit::AutoNone), tabChangesFocus(false), | - |
47 | lineWrap(QTextEdit::WidgetWidth), lineWrapColumnOrWidth(0), | - |
48 | wordWrap(QTextOption::WrapAtWordBoundaryOrAnywhere), clickCausedFocus(0), | - |
49 | textFormat(Qt::AutoText) | - |
50 | { | - |
51 | ignoreAutomaticScrollbarAdjustment = false; | - |
52 | preferRichText = false; | - |
53 | showCursorOnInitialShow = true; | - |
54 | inDrag = false; | - |
55 | } executed: } Execution Count:77 | 77 |
56 | | - |
57 | void QTextEditPrivate::createAutoBulletList() | - |
58 | { | - |
59 | QTextCursor cursor = control->textCursor(); | - |
60 | cursor.beginEditBlock(); | - |
61 | | - |
62 | QTextBlockFormat blockFmt = cursor.blockFormat(); | - |
63 | | - |
64 | QTextListFormat listFmt; | - |
65 | listFmt.setStyle(QTextListFormat::ListDisc); | - |
66 | listFmt.setIndent(blockFmt.indent() + 1); | - |
67 | | - |
68 | blockFmt.setIndent(0); | - |
69 | cursor.setBlockFormat(blockFmt); | - |
70 | | - |
71 | cursor.createList(listFmt); | - |
72 | | - |
73 | cursor.endEditBlock(); | - |
74 | control->setTextCursor(cursor); | - |
75 | } | 0 |
76 | | - |
77 | void QTextEditPrivate::init(const QString &html) | - |
78 | { | - |
79 | QTextEdit * const q = q_func(); | - |
80 | control = new QTextEditControl(q); | - |
81 | control->setPalette(q->palette()); | - |
82 | | - |
83 | QObject::connect(control, "2""microFocusChanged()", q, "1""updateMicroFocus()"); | - |
84 | QObject::connect(control, "2""documentSizeChanged(QSizeF)", q, "1""_q_adjustScrollbars()"); | - |
85 | QObject::connect(control, "2""updateRequest(QRectF)", q, "1""_q_repaintContents(QRectF)"); | - |
86 | QObject::connect(control, "2""visibilityRequest(QRectF)", q, "1""_q_ensureVisible(QRectF)"); | - |
87 | QObject::connect(control, "2""currentCharFormatChanged(QTextCharFormat)", | - |
88 | q, "1""_q_currentCharFormatChanged(QTextCharFormat)"); | - |
89 | | - |
90 | QObject::connect(control, "2""textChanged()", q, "2""textChanged()"); | - |
91 | QObject::connect(control, "2""undoAvailable(bool)", q, "2""undoAvailable(bool)"); | - |
92 | QObject::connect(control, "2""redoAvailable(bool)", q, "2""redoAvailable(bool)"); | - |
93 | QObject::connect(control, "2""copyAvailable(bool)", q, "2""copyAvailable(bool)"); | - |
94 | QObject::connect(control, "2""selectionChanged()", q, "2""selectionChanged()"); | - |
95 | QObject::connect(control, "2""cursorPositionChanged()", q, "1""_q_cursorPositionChanged()"); | - |
96 | | - |
97 | QObject::connect(control, "2""textChanged()", q, "1""updateMicroFocus()"); | - |
98 | | - |
99 | QTextDocument *doc = control->document(); | - |
100 | | - |
101 | | - |
102 | | - |
103 | doc->setPageSize(QSize(0, 0)); | - |
104 | doc->documentLayout()->setPaintDevice(viewport); | - |
105 | doc->setDefaultFont(q->font()); | - |
106 | doc->setUndoRedoEnabled(false); | - |
107 | doc->setUndoRedoEnabled(true); | - |
108 | | - |
109 | if (!html.isEmpty()) evaluated: !html.isEmpty() yes Evaluation Count:6 | yes Evaluation Count:71 |
| 6-71 |
110 | control->setHtml(html); executed: control->setHtml(html); Execution Count:6 | 6 |
111 | | - |
112 | hbar->setSingleStep(20); | - |
113 | vbar->setSingleStep(20); | - |
114 | | - |
115 | viewport->setBackgroundRole(QPalette::Base); | - |
116 | q->setAcceptDrops(true); | - |
117 | q->setFocusPolicy(Qt::WheelFocus); | - |
118 | q->setAttribute(Qt::WA_KeyCompression); | - |
119 | q->setAttribute(Qt::WA_InputMethodEnabled); | - |
120 | | - |
121 | | - |
122 | viewport->setCursor(Qt::IBeamCursor); | - |
123 | | - |
124 | | - |
125 | | - |
126 | | - |
127 | } executed: } Execution Count:77 | 77 |
128 | | - |
129 | void QTextEditPrivate::_q_repaintContents(const QRectF &contentsRect) | - |
130 | { | - |
131 | if (!contentsRect.isValid()) { evaluated: !contentsRect.isValid() yes Evaluation Count:2 | yes Evaluation Count:590 |
| 2-590 |
132 | viewport->update(); | - |
133 | return; executed: return; Execution Count:2 | 2 |
134 | } | - |
135 | const int xOffset = horizontalOffset(); | - |
136 | const int yOffset = verticalOffset(); | - |
137 | const QRectF visibleRect(xOffset, yOffset, viewport->width(), viewport->height()); | - |
138 | | - |
139 | QRect r = contentsRect.intersected(visibleRect).toAlignedRect(); | - |
140 | if (r.isEmpty()) evaluated: r.isEmpty() yes Evaluation Count:2 | yes Evaluation Count:588 |
| 2-588 |
141 | return; executed: return; Execution Count:2 | 2 |
142 | | - |
143 | r.translate(-xOffset, -yOffset); | - |
144 | viewport->update(r); | - |
145 | } executed: } Execution Count:588 | 588 |
146 | | - |
147 | void QTextEditPrivate::_q_cursorPositionChanged() | - |
148 | { | - |
149 | QTextEdit * const q = q_func(); | - |
150 | q->cursorPositionChanged(); | - |
151 | | - |
152 | QAccessibleTextCursorEvent event(q, q->textCursor().position()); | - |
153 | QAccessible::updateAccessibility(&event); | - |
154 | | - |
155 | } executed: } Execution Count:115 | 115 |
156 | | - |
157 | void QTextEditPrivate::pageUpDown(QTextCursor::MoveOperation op, QTextCursor::MoveMode moveMode) | - |
158 | { | - |
159 | QTextCursor cursor = control->textCursor(); | - |
160 | bool moved = false; | - |
161 | qreal lastY = control->cursorRect(cursor).top(); | - |
162 | qreal distance = 0; | - |
163 | | - |
164 | do { | - |
165 | qreal y = control->cursorRect(cursor).top(); | - |
166 | distance += qAbs(y - lastY); | - |
167 | lastY = y; | - |
168 | moved = cursor.movePosition(op, moveMode); | - |
169 | } while (moved && distance < viewport->height()); never evaluated: distance < viewport->height() | 0 |
170 | | - |
171 | if (moved) { | 0 |
172 | if (op == QTextCursor::Up) { never evaluated: op == QTextCursor::Up | 0 |
173 | cursor.movePosition(QTextCursor::Down, moveMode); | - |
174 | vbar->triggerAction(QAbstractSlider::SliderPageStepSub); | - |
175 | } else { | 0 |
176 | cursor.movePosition(QTextCursor::Up, moveMode); | - |
177 | vbar->triggerAction(QAbstractSlider::SliderPageStepAdd); | - |
178 | } | 0 |
179 | } | - |
180 | control->setTextCursor(cursor); | - |
181 | } | 0 |
182 | | - |
183 | | - |
184 | static QSize documentSize(QWidgetTextControl *control) | - |
185 | { | - |
186 | QTextDocument *doc = control->document(); | - |
187 | QAbstractTextDocumentLayout *layout = doc->documentLayout(); | - |
188 | | - |
189 | QSize docSize; | - |
190 | | - |
191 | if (QTextDocumentLayout *tlayout = qobject_cast<QTextDocumentLayout *>(layout)) { partially evaluated: QTextDocumentLayout *tlayout = qobject_cast<QTextDocumentLayout *>(layout) yes Evaluation Count:429 | no Evaluation Count:0 |
| 0-429 |
192 | docSize = tlayout->dynamicDocumentSize().toSize(); | - |
193 | int percentageDone = tlayout->layoutStatus(); | - |
194 | | - |
195 | if (percentageDone > 0) partially evaluated: percentageDone > 0 yes Evaluation Count:429 | no Evaluation Count:0 |
| 0-429 |
196 | docSize.setHeight(docSize.height() * 100 / percentageDone); executed: docSize.setHeight(docSize.height() * 100 / percentageDone); Execution Count:429 | 429 |
197 | } else { executed: } Execution Count:429 | 429 |
198 | docSize = layout->documentSize().toSize(); | - |
199 | } | 0 |
200 | | - |
201 | return docSize; executed: return docSize; Execution Count:429 | 429 |
202 | } | - |
203 | | - |
204 | void QTextEditPrivate::_q_adjustScrollbars() | - |
205 | { | - |
206 | if (ignoreAutomaticScrollbarAdjustment) evaluated: ignoreAutomaticScrollbarAdjustment yes Evaluation Count:161 | yes Evaluation Count:207 |
| 161-207 |
207 | return; executed: return; Execution Count:161 | 161 |
208 | ignoreAutomaticScrollbarAdjustment = true; | - |
209 | | - |
210 | QSize viewportSize = viewport->size(); | - |
211 | QSize docSize = documentSize(control); | - |
212 | | - |
213 | | - |
214 | | - |
215 | | - |
216 | | - |
217 | | - |
218 | | - |
219 | for (int i = 0; i < 4; ++i) { partially evaluated: i < 4 yes Evaluation Count:222 | no Evaluation Count:0 |
| 0-222 |
220 | hbar->setRange(0, docSize.width() - viewportSize.width()); | - |
221 | hbar->setPageStep(viewportSize.width()); | - |
222 | | - |
223 | vbar->setRange(0, docSize.height() - viewportSize.height()); | - |
224 | vbar->setPageStep(viewportSize.height()); | - |
225 | | - |
226 | | - |
227 | | - |
228 | | - |
229 | | - |
230 | | - |
231 | | - |
232 | if (q_func()->isRightToLeft()) partially evaluated: q_func()->isRightToLeft() no Evaluation Count:0 | yes Evaluation Count:222 |
| 0-222 |
233 | viewport->update(); never executed: viewport->update(); | 0 |
234 | | - |
235 | _q_showOrHideScrollBars(); | - |
236 | | - |
237 | const QSize oldViewportSize = viewportSize; | - |
238 | const QSize oldDocSize = docSize; | - |
239 | | - |
240 | | - |
241 | viewportSize = viewport->size(); | - |
242 | if (viewportSize.width() != oldViewportSize.width()) evaluated: viewportSize.width() != oldViewportSize.width() yes Evaluation Count:15 | yes Evaluation Count:207 |
| 15-207 |
243 | relayoutDocument(); executed: relayoutDocument(); Execution Count:15 | 15 |
244 | | - |
245 | docSize = documentSize(control); | - |
246 | if (viewportSize == oldViewportSize && docSize == oldDocSize) evaluated: viewportSize == oldViewportSize yes Evaluation Count:207 | yes Evaluation Count:15 |
partially evaluated: docSize == oldDocSize yes Evaluation Count:207 | no Evaluation Count:0 |
| 0-207 |
247 | break; executed: break; Execution Count:207 | 207 |
248 | } executed: } Execution Count:15 | 15 |
249 | ignoreAutomaticScrollbarAdjustment = false; | - |
250 | } executed: } Execution Count:207 | 207 |
251 | | - |
252 | | - |
253 | | - |
254 | void QTextEditPrivate::_q_ensureVisible(const QRectF &_rect) | - |
255 | { | - |
256 | const QRect rect = _rect.toRect(); | - |
257 | if ((vbar->isVisible() && vbar->maximum() < rect.bottom()) evaluated: vbar->isVisible() yes Evaluation Count:12 | yes Evaluation Count:181 |
evaluated: vbar->maximum() < rect.bottom() yes Evaluation Count:2 | yes Evaluation Count:10 |
| 2-181 |
258 | || (hbar->isVisible() && hbar->maximum() < rect.right())) evaluated: hbar->isVisible() yes Evaluation Count:2 | yes Evaluation Count:189 |
partially evaluated: hbar->maximum() < rect.right() yes Evaluation Count:2 | no Evaluation Count:0 |
| 0-189 |
259 | _q_adjustScrollbars(); executed: _q_adjustScrollbars(); Execution Count:4 | 4 |
260 | const int visibleWidth = viewport->width(); | - |
261 | const int visibleHeight = viewport->height(); | - |
262 | const bool rtl = q_func()->isRightToLeft(); | - |
263 | | - |
264 | if (rect.x() < horizontalOffset()) { evaluated: rect.x() < horizontalOffset() yes Evaluation Count:167 | yes Evaluation Count:26 |
| 26-167 |
265 | if (rtl) partially evaluated: rtl no Evaluation Count:0 | yes Evaluation Count:167 |
| 0-167 |
266 | hbar->setValue(hbar->maximum() - rect.x()); never executed: hbar->setValue(hbar->maximum() - rect.x()); | 0 |
267 | else | - |
268 | hbar->setValue(rect.x()); executed: hbar->setValue(rect.x()); Execution Count:167 | 167 |
269 | } else if (rect.x() + rect.width() > horizontalOffset() + visibleWidth) { partially evaluated: rect.x() + rect.width() > horizontalOffset() + visibleWidth no Evaluation Count:0 | yes Evaluation Count:26 |
| 0-26 |
270 | if (rtl) | 0 |
271 | hbar->setValue(hbar->maximum() - (rect.x() + rect.width() - visibleWidth)); never executed: hbar->setValue(hbar->maximum() - (rect.x() + rect.width() - visibleWidth)); | 0 |
272 | else | - |
273 | hbar->setValue(rect.x() + rect.width() - visibleWidth); never executed: hbar->setValue(rect.x() + rect.width() - visibleWidth); | 0 |
274 | } | - |
275 | | - |
276 | if (rect.y() < verticalOffset()) partially evaluated: rect.y() < verticalOffset() no Evaluation Count:0 | yes Evaluation Count:193 |
| 0-193 |
277 | vbar->setValue(rect.y()); never executed: vbar->setValue(rect.y()); | 0 |
278 | else if (rect.y() + rect.height() > verticalOffset() + visibleHeight) evaluated: rect.y() + rect.height() > verticalOffset() + visibleHeight yes Evaluation Count:4 | yes Evaluation Count:189 |
| 4-189 |
279 | vbar->setValue(rect.y() + rect.height() - visibleHeight); executed: vbar->setValue(rect.y() + rect.height() - visibleHeight); Execution Count:4 | 4 |
280 | } | - |
281 | QTextEdit::QTextEdit(QWidget *parent) | - |
282 | : QAbstractScrollArea(*new QTextEditPrivate, parent) | - |
283 | { | - |
284 | QTextEditPrivate * const d = d_func(); | - |
285 | d->init(); | - |
286 | } executed: } Execution Count:47 | 47 |
287 | | - |
288 | | - |
289 | | - |
290 | | - |
291 | QTextEdit::QTextEdit(QTextEditPrivate &dd, QWidget *parent) | - |
292 | : QAbstractScrollArea(dd, parent) | - |
293 | { | - |
294 | QTextEditPrivate * const d = d_func(); | - |
295 | d->init(); | - |
296 | } executed: } Execution Count:24 | 24 |
297 | | - |
298 | | - |
299 | | - |
300 | | - |
301 | | - |
302 | QTextEdit::QTextEdit(const QString &text, QWidget *parent) | - |
303 | : QAbstractScrollArea(*new QTextEditPrivate, parent) | - |
304 | { | - |
305 | QTextEditPrivate * const d = d_func(); | - |
306 | d->init(text); | - |
307 | } executed: } Execution Count:6 | 6 |
308 | | - |
309 | | - |
310 | | - |
311 | | - |
312 | | - |
313 | | - |
314 | QTextEdit::~QTextEdit() | - |
315 | { | - |
316 | } | - |
317 | | - |
318 | | - |
319 | | - |
320 | | - |
321 | | - |
322 | | - |
323 | qreal QTextEdit::fontPointSize() const | - |
324 | { | - |
325 | const QTextEditPrivate * const d = d_func(); | - |
326 | return d->control->textCursor().charFormat().fontPointSize(); never executed: return d->control->textCursor().charFormat().fontPointSize(); | 0 |
327 | } | - |
328 | | - |
329 | | - |
330 | | - |
331 | | - |
332 | | - |
333 | | - |
334 | QString QTextEdit::fontFamily() const | - |
335 | { | - |
336 | const QTextEditPrivate * const d = d_func(); | - |
337 | return d->control->textCursor().charFormat().fontFamily(); never executed: return d->control->textCursor().charFormat().fontFamily(); | 0 |
338 | } | - |
339 | | - |
340 | | - |
341 | | - |
342 | | - |
343 | | - |
344 | | - |
345 | int QTextEdit::fontWeight() const | - |
346 | { | - |
347 | const QTextEditPrivate * const d = d_func(); | - |
348 | return d->control->textCursor().charFormat().fontWeight(); never executed: return d->control->textCursor().charFormat().fontWeight(); | 0 |
349 | } | - |
350 | | - |
351 | | - |
352 | | - |
353 | | - |
354 | | - |
355 | | - |
356 | | - |
357 | bool QTextEdit::fontUnderline() const | - |
358 | { | - |
359 | const QTextEditPrivate * const d = d_func(); | - |
360 | return d->control->textCursor().charFormat().fontUnderline(); never executed: return d->control->textCursor().charFormat().fontUnderline(); | 0 |
361 | } | - |
362 | | - |
363 | | - |
364 | | - |
365 | | - |
366 | | - |
367 | | - |
368 | | - |
369 | bool QTextEdit::fontItalic() const | - |
370 | { | - |
371 | const QTextEditPrivate * const d = d_func(); | - |
372 | return d->control->textCursor().charFormat().fontItalic(); never executed: return d->control->textCursor().charFormat().fontItalic(); | 0 |
373 | } | - |
374 | | - |
375 | | - |
376 | | - |
377 | | - |
378 | | - |
379 | | - |
380 | QColor QTextEdit::textColor() const | - |
381 | { | - |
382 | const QTextEditPrivate * const d = d_func(); | - |
383 | return d->control->textCursor().charFormat().foreground().color(); never executed: return d->control->textCursor().charFormat().foreground().color(); | 0 |
384 | } | - |
385 | QColor QTextEdit::textBackgroundColor() const | - |
386 | { | - |
387 | const QTextEditPrivate * const d = d_func(); | - |
388 | return d->control->textCursor().charFormat().background().color(); never executed: return d->control->textCursor().charFormat().background().color(); | 0 |
389 | } | - |
390 | | - |
391 | | - |
392 | | - |
393 | | - |
394 | | - |
395 | | - |
396 | QFont QTextEdit::currentFont() const | - |
397 | { | - |
398 | const QTextEditPrivate * const d = d_func(); | - |
399 | return d->control->textCursor().charFormat().font(); executed: return d->control->textCursor().charFormat().font(); Execution Count:10 | 10 |
400 | } | - |
401 | | - |
402 | | - |
403 | | - |
404 | | - |
405 | | - |
406 | | - |
407 | | - |
408 | void QTextEdit::setAlignment(Qt::Alignment a) | - |
409 | { | - |
410 | QTextEditPrivate * const d = d_func(); | - |
411 | QTextBlockFormat fmt; | - |
412 | fmt.setAlignment(a); | - |
413 | QTextCursor cursor = d->control->textCursor(); | - |
414 | cursor.mergeBlockFormat(fmt); | - |
415 | d->control->setTextCursor(cursor); | - |
416 | } | 0 |
417 | | - |
418 | | - |
419 | | - |
420 | | - |
421 | | - |
422 | | - |
423 | Qt::Alignment QTextEdit::alignment() const | - |
424 | { | - |
425 | const QTextEditPrivate * const d = d_func(); | - |
426 | return d->control->textCursor().blockFormat().alignment(); never executed: return d->control->textCursor().blockFormat().alignment(); | 0 |
427 | } | - |
428 | void QTextEdit::setDocument(QTextDocument *document) | - |
429 | { | - |
430 | QTextEditPrivate * const d = d_func(); | - |
431 | d->control->setDocument(document); | - |
432 | d->updateDefaultTextOption(); | - |
433 | d->relayoutDocument(); | - |
434 | } executed: } Execution Count:4 | 4 |
435 | | - |
436 | QTextDocument *QTextEdit::document() const | - |
437 | { | - |
438 | const QTextEditPrivate * const d = d_func(); | - |
439 | return d->control->document(); executed: return d->control->document(); Execution Count:232 | 232 |
440 | } | - |
441 | | - |
442 | | - |
443 | | - |
444 | | - |
445 | void QTextEdit::setTextCursor(const QTextCursor &cursor) | - |
446 | { | - |
447 | doSetTextCursor(cursor); | - |
448 | } executed: } Execution Count:2 | 2 |
449 | | - |
450 | | - |
451 | | - |
452 | | - |
453 | | - |
454 | | - |
455 | | - |
456 | void QTextEdit::doSetTextCursor(const QTextCursor &cursor) | - |
457 | { | - |
458 | QTextEditPrivate * const d = d_func(); | - |
459 | d->control->setTextCursor(cursor); | - |
460 | } executed: } Execution Count:2 | 2 |
461 | | - |
462 | | - |
463 | | - |
464 | | - |
465 | | - |
466 | | - |
467 | QTextCursor QTextEdit::textCursor() const | - |
468 | { | - |
469 | const QTextEditPrivate * const d = d_func(); | - |
470 | return d->control->textCursor(); executed: return d->control->textCursor(); Execution Count:232 | 232 |
471 | } | - |
472 | | - |
473 | | - |
474 | | - |
475 | | - |
476 | | - |
477 | | - |
478 | void QTextEdit::setFontFamily(const QString &fontFamily) | - |
479 | { | - |
480 | QTextCharFormat fmt; | - |
481 | fmt.setFontFamily(fontFamily); | - |
482 | mergeCurrentCharFormat(fmt); | - |
483 | } | 0 |
484 | void QTextEdit::setFontPointSize(qreal s) | - |
485 | { | - |
486 | QTextCharFormat fmt; | - |
487 | fmt.setFontPointSize(s); | - |
488 | mergeCurrentCharFormat(fmt); | - |
489 | } | 0 |
490 | void QTextEdit::setFontWeight(int w) | - |
491 | { | - |
492 | QTextCharFormat fmt; | - |
493 | fmt.setFontWeight(w); | - |
494 | mergeCurrentCharFormat(fmt); | - |
495 | } | 0 |
496 | | - |
497 | | - |
498 | | - |
499 | | - |
500 | | - |
501 | | - |
502 | | - |
503 | void QTextEdit::setFontUnderline(bool underline) | - |
504 | { | - |
505 | QTextCharFormat fmt; | - |
506 | fmt.setFontUnderline(underline); | - |
507 | mergeCurrentCharFormat(fmt); | - |
508 | } | 0 |
509 | | - |
510 | | - |
511 | | - |
512 | | - |
513 | | - |
514 | | - |
515 | | - |
516 | void QTextEdit::setFontItalic(bool italic) | - |
517 | { | - |
518 | QTextCharFormat fmt; | - |
519 | fmt.setFontItalic(italic); | - |
520 | mergeCurrentCharFormat(fmt); | - |
521 | } | 0 |
522 | | - |
523 | | - |
524 | | - |
525 | | - |
526 | | - |
527 | | - |
528 | void QTextEdit::setTextColor(const QColor &c) | - |
529 | { | - |
530 | QTextCharFormat fmt; | - |
531 | fmt.setForeground(QBrush(c)); | - |
532 | mergeCurrentCharFormat(fmt); | - |
533 | } | 0 |
534 | void QTextEdit::setTextBackgroundColor(const QColor &c) | - |
535 | { | - |
536 | QTextCharFormat fmt; | - |
537 | fmt.setBackground(QBrush(c)); | - |
538 | mergeCurrentCharFormat(fmt); | - |
539 | } | 0 |
540 | | - |
541 | | - |
542 | | - |
543 | | - |
544 | | - |
545 | | - |
546 | void QTextEdit::setCurrentFont(const QFont &f) | - |
547 | { | - |
548 | QTextCharFormat fmt; | - |
549 | fmt.setFont(f); | - |
550 | mergeCurrentCharFormat(fmt); | - |
551 | } executed: } Execution Count:1 | 1 |
552 | void QTextEdit::undo() | - |
553 | { | - |
554 | QTextEditPrivate * const d = d_func(); | - |
555 | d->control->undo(); | - |
556 | } | 0 |
557 | | - |
558 | void QTextEdit::redo() | - |
559 | { | - |
560 | QTextEditPrivate * const d = d_func(); | - |
561 | d->control->redo(); | - |
562 | } | 0 |
563 | void QTextEdit::cut() | - |
564 | { | - |
565 | QTextEditPrivate * const d = d_func(); | - |
566 | d->control->cut(); | - |
567 | } | 0 |
568 | | - |
569 | | - |
570 | | - |
571 | | - |
572 | | - |
573 | | - |
574 | | - |
575 | void QTextEdit::copy() | - |
576 | { | - |
577 | QTextEditPrivate * const d = d_func(); | - |
578 | d->control->copy(); | - |
579 | } | 0 |
580 | void QTextEdit::paste() | - |
581 | { | - |
582 | QTextEditPrivate * const d = d_func(); | - |
583 | d->control->paste(); | - |
584 | } | 0 |
585 | void QTextEdit::clear() | - |
586 | { | - |
587 | QTextEditPrivate * const d = d_func(); | - |
588 | | - |
589 | d->control->clear(); | - |
590 | } executed: } Execution Count:17 | 17 |
591 | | - |
592 | | - |
593 | | - |
594 | | - |
595 | | - |
596 | | - |
597 | | - |
598 | void QTextEdit::selectAll() | - |
599 | { | - |
600 | QTextEditPrivate * const d = d_func(); | - |
601 | d->control->selectAll(); | - |
602 | } executed: } Execution Count:2 | 2 |
603 | | - |
604 | | - |
605 | | - |
606 | bool QTextEdit::event(QEvent *e) | - |
607 | { | - |
608 | QTextEditPrivate * const d = d_func(); | - |
609 | | - |
610 | if (e->type() == QEvent::ContextMenu partially evaluated: e->type() == QEvent::ContextMenu no Evaluation Count:0 | yes Evaluation Count:2706 |
| 0-2706 |
611 | && static_cast<QContextMenuEvent *>(e)->reason() == QContextMenuEvent::Keyboard) { never evaluated: static_cast<QContextMenuEvent *>(e)->reason() == QContextMenuEvent::Keyboard | 0 |
612 | QTextEditPrivate * const d = d_func(); | - |
613 | ensureCursorVisible(); | - |
614 | const QPoint cursorPos = cursorRect().center(); | - |
615 | QContextMenuEvent ce(QContextMenuEvent::Keyboard, cursorPos, d->viewport->mapToGlobal(cursorPos)); | - |
616 | ce.setAccepted(e->isAccepted()); | - |
617 | const bool result = QAbstractScrollArea::event(&ce); | - |
618 | e->setAccepted(ce.isAccepted()); | - |
619 | return result; never executed: return result; | 0 |
620 | } else if (e->type() == QEvent::ShortcutOverride evaluated: e->type() == QEvent::ShortcutOverride yes Evaluation Count:20 | yes Evaluation Count:2686 |
| 20-2686 |
621 | || e->type() == QEvent::ToolTip) { partially evaluated: e->type() == QEvent::ToolTip no Evaluation Count:0 | yes Evaluation Count:2686 |
| 0-2686 |
622 | d->sendControlEvent(e); | - |
623 | } executed: } Execution Count:20 | 20 |
624 | | - |
625 | | - |
626 | | - |
627 | | - |
628 | | - |
629 | | - |
630 | | - |
631 | return QAbstractScrollArea::event(e); executed: return QAbstractScrollArea::event(e); Execution Count:2706 | 2706 |
632 | } | - |
633 | | - |
634 | | - |
635 | | - |
636 | | - |
637 | void QTextEdit::timerEvent(QTimerEvent *e) | - |
638 | { | - |
639 | QTextEditPrivate * const d = d_func(); | - |
640 | if (e->timerId() == d->autoScrollTimer.timerId()) { never evaluated: e->timerId() == d->autoScrollTimer.timerId() | 0 |
641 | QRect visible = d->viewport->rect(); | - |
642 | QPoint pos; | - |
643 | if (d->inDrag) { never evaluated: d->inDrag | 0 |
644 | pos = d->autoScrollDragPos; | - |
645 | visible.adjust(qMin(visible.width()/3,20), qMin(visible.height()/3,20), | - |
646 | -qMin(visible.width()/3,20), -qMin(visible.height()/3,20)); | - |
647 | } else { | 0 |
648 | const QPoint globalPos = QCursor::pos(); | - |
649 | pos = d->viewport->mapFromGlobal(globalPos); | - |
650 | QMouseEvent ev(QEvent::MouseMove, pos, mapTo(topLevelWidget(), pos), globalPos, Qt::LeftButton, Qt::LeftButton, Qt::NoModifier); | - |
651 | mouseMoveEvent(&ev); | - |
652 | } | 0 |
653 | int deltaY = qMax(pos.y() - visible.top(), visible.bottom() - pos.y()) - visible.height(); | - |
654 | int deltaX = qMax(pos.x() - visible.left(), visible.right() - pos.x()) - visible.width(); | - |
655 | int delta = qMax(deltaX, deltaY); | - |
656 | if (delta >= 0) { never evaluated: delta >= 0 | 0 |
657 | if (delta < 7) never evaluated: delta < 7 | 0 |
658 | delta = 7; never executed: delta = 7; | 0 |
659 | int timeout = 4900 / (delta * delta); | - |
660 | d->autoScrollTimer.start(timeout, this); | - |
661 | | - |
662 | if (deltaY > 0) never evaluated: deltaY > 0 | 0 |
663 | d->vbar->triggerAction(pos.y() < visible.center().y() ? | 0 |
664 | QAbstractSlider::SliderSingleStepSub | 0 |
665 | : QAbstractSlider::SliderSingleStepAdd); never executed: d->vbar->triggerAction(pos.y() < visible.center().y() ? QAbstractSlider::SliderSingleStepSub : QAbstractSlider::SliderSingleStepAdd); | 0 |
666 | if (deltaX > 0) never evaluated: deltaX > 0 | 0 |
667 | d->hbar->triggerAction(pos.x() < visible.center().x() ? | 0 |
668 | QAbstractSlider::SliderSingleStepSub | 0 |
669 | : QAbstractSlider::SliderSingleStepAdd); never executed: d->hbar->triggerAction(pos.x() < visible.center().x() ? QAbstractSlider::SliderSingleStepSub : QAbstractSlider::SliderSingleStepAdd); | 0 |
670 | } | 0 |
671 | } | 0 |
672 | | - |
673 | | - |
674 | | - |
675 | | - |
676 | | - |
677 | | - |
678 | } | 0 |
679 | void QTextEdit::setPlainText(const QString &text) | - |
680 | { | - |
681 | QTextEditPrivate * const d = d_func(); | - |
682 | d->control->setPlainText(text); | - |
683 | d->preferRichText = false; | - |
684 | } executed: } Execution Count:4 | 4 |
685 | QString QTextEdit::toPlainText() const | - |
686 | { | - |
687 | const QTextEditPrivate * const d = d_func(); | - |
688 | return d->control->toPlainText(); executed: return d->control->toPlainText(); Execution Count:33 | 33 |
689 | } | - |
690 | void QTextEdit::setHtml(const QString &text) | - |
691 | { | - |
692 | QTextEditPrivate * const d = d_func(); | - |
693 | d->control->setHtml(text); | - |
694 | d->preferRichText = true; | - |
695 | } executed: } Execution Count:66 | 66 |
696 | | - |
697 | QString QTextEdit::toHtml() const | - |
698 | { | - |
699 | const QTextEditPrivate * const d = d_func(); | - |
700 | return d->control->toHtml(); executed: return d->control->toHtml(); Execution Count:1 | 1 |
701 | } | - |
702 | | - |
703 | | - |
704 | | - |
705 | | - |
706 | | - |
707 | void QTextEdit::keyPressEvent(QKeyEvent *e) | - |
708 | { | - |
709 | QTextEditPrivate * const d = d_func(); | - |
710 | Qt::TextInteractionFlags tif = d->control->textInteractionFlags(); | - |
711 | | - |
712 | if (tif & Qt::TextSelectableByKeyboard){ evaluated: tif & Qt::TextSelectableByKeyboard yes Evaluation Count:10 | yes Evaluation Count:6 |
| 6-10 |
713 | if (e == QKeySequence::SelectPreviousPage) { partially evaluated: e == QKeySequence::SelectPreviousPage no Evaluation Count:0 | yes Evaluation Count:10 |
| 0-10 |
714 | e->accept(); | - |
715 | d->pageUpDown(QTextCursor::Up, QTextCursor::KeepAnchor); | - |
716 | return; | 0 |
717 | } else if (e ==QKeySequence::SelectNextPage) { partially evaluated: e ==QKeySequence::SelectNextPage no Evaluation Count:0 | yes Evaluation Count:10 |
| 0-10 |
718 | e->accept(); | - |
719 | d->pageUpDown(QTextCursor::Down, QTextCursor::KeepAnchor); | - |
720 | return; | 0 |
721 | } | - |
722 | } | - |
723 | if (tif & (Qt::TextSelectableByKeyboard | Qt::TextEditable)) { evaluated: tif & (Qt::TextSelectableByKeyboard | Qt::TextEditable) yes Evaluation Count:10 | yes Evaluation Count:6 |
| 6-10 |
724 | if (e == QKeySequence::MoveToPreviousPage) { partially evaluated: e == QKeySequence::MoveToPreviousPage no Evaluation Count:0 | yes Evaluation Count:10 |
| 0-10 |
725 | e->accept(); | - |
726 | d->pageUpDown(QTextCursor::Up, QTextCursor::MoveAnchor); | - |
727 | return; | 0 |
728 | } else if (e == QKeySequence::MoveToNextPage) { partially evaluated: e == QKeySequence::MoveToNextPage no Evaluation Count:0 | yes Evaluation Count:10 |
| 0-10 |
729 | e->accept(); | - |
730 | d->pageUpDown(QTextCursor::Down, QTextCursor::MoveAnchor); | - |
731 | return; | 0 |
732 | } | - |
733 | } | - |
734 | | - |
735 | if (!(tif & Qt::TextEditable)) { evaluated: !(tif & Qt::TextEditable) yes Evaluation Count:6 | yes Evaluation Count:10 |
| 6-10 |
736 | switch (e->key()) { | - |
737 | case Qt::Key_Space: | - |
738 | e->accept(); | - |
739 | if (e->modifiers() & Qt::ShiftModifier) never evaluated: e->modifiers() & Qt::ShiftModifier | 0 |
740 | d->vbar->triggerAction(QAbstractSlider::SliderPageStepSub); never executed: d->vbar->triggerAction(QAbstractSlider::SliderPageStepSub); | 0 |
741 | else | - |
742 | d->vbar->triggerAction(QAbstractSlider::SliderPageStepAdd); never executed: d->vbar->triggerAction(QAbstractSlider::SliderPageStepAdd); | 0 |
743 | break; | 0 |
744 | default: | - |
745 | d->sendControlEvent(e); | - |
746 | if (!e->isAccepted() && e->modifiers() == Qt::NoModifier) { partially evaluated: !e->isAccepted() no Evaluation Count:0 | yes Evaluation Count:6 |
never evaluated: e->modifiers() == Qt::NoModifier | 0-6 |
747 | if (e->key() == Qt::Key_Home) { never evaluated: e->key() == Qt::Key_Home | 0 |
748 | d->vbar->triggerAction(QAbstractSlider::SliderToMinimum); | - |
749 | e->accept(); | - |
750 | } else if (e->key() == Qt::Key_End) { never evaluated: e->key() == Qt::Key_End | 0 |
751 | d->vbar->triggerAction(QAbstractSlider::SliderToMaximum); | - |
752 | e->accept(); | - |
753 | } | 0 |
754 | } | - |
755 | if (!e->isAccepted()) { partially evaluated: !e->isAccepted() no Evaluation Count:0 | yes Evaluation Count:6 |
| 0-6 |
756 | QAbstractScrollArea::keyPressEvent(e); | - |
757 | } | 0 |
758 | } executed: } Execution Count:6 | 6 |
759 | return; executed: return; Execution Count:6 | 6 |
760 | } | - |
761 | | - |
762 | | - |
763 | { | - |
764 | QTextCursor cursor = d->control->textCursor(); | - |
765 | const QString text = e->text(); | - |
766 | if (cursor.atBlockStart() evaluated: cursor.atBlockStart() yes Evaluation Count:9 | yes Evaluation Count:1 |
| 1-9 |
767 | && (d->autoFormatting & AutoBulletList) partially evaluated: (d->autoFormatting & AutoBulletList) no Evaluation Count:0 | yes Evaluation Count:9 |
| 0-9 |
768 | && (text.length() == 1) never evaluated: (text.length() == 1) | 0 |
769 | && (text.at(0) == QLatin1Char('-') || text.at(0) == QLatin1Char('*')) never evaluated: text.at(0) == QLatin1Char('-') never evaluated: text.at(0) == QLatin1Char('*') | 0 |
770 | && (!cursor.currentList())) { never evaluated: (!cursor.currentList()) | 0 |
771 | | - |
772 | d->createAutoBulletList(); | - |
773 | e->accept(); | - |
774 | return; | 0 |
775 | } | - |
776 | } | - |
777 | | - |
778 | d->sendControlEvent(e); | - |
779 | } executed: } Execution Count:10 | 10 |
780 | | - |
781 | | - |
782 | | - |
783 | void QTextEdit::keyReleaseEvent(QKeyEvent *e) | - |
784 | { | - |
785 | e->ignore(); | - |
786 | } executed: } Execution Count:22 | 22 |
787 | QVariant QTextEdit::loadResource(int type, const QUrl &name) | - |
788 | { | - |
789 | (void)type;; | - |
790 | (void)name;; | - |
791 | return QVariant(); never executed: return QVariant(); | 0 |
792 | } | - |
793 | | - |
794 | | - |
795 | | - |
796 | void QTextEdit::resizeEvent(QResizeEvent *e) | - |
797 | { | - |
798 | QTextEditPrivate * const d = d_func(); | - |
799 | | - |
800 | if (d->lineWrap == NoWrap) { partially evaluated: d->lineWrap == NoWrap no Evaluation Count:0 | yes Evaluation Count:141 |
| 0-141 |
801 | QTextDocument *doc = d->control->document(); | - |
802 | QVariant alignmentProperty = doc->documentLayout()->property("contentHasAlignment"); | - |
803 | | - |
804 | if (!doc->pageSize().isNull() never evaluated: !doc->pageSize().isNull() | 0 |
805 | && alignmentProperty.type() == QVariant::Bool never evaluated: alignmentProperty.type() == QVariant::Bool | 0 |
806 | && !alignmentProperty.toBool()) { never evaluated: !alignmentProperty.toBool() | 0 |
807 | | - |
808 | d->_q_adjustScrollbars(); | - |
809 | return; | 0 |
810 | } | - |
811 | } | 0 |
812 | | - |
813 | if (d->lineWrap != FixedPixelWidth partially evaluated: d->lineWrap != FixedPixelWidth yes Evaluation Count:141 | no Evaluation Count:0 |
| 0-141 |
814 | && e->oldSize().width() != e->size().width()) evaluated: e->oldSize().width() != e->size().width() yes Evaluation Count:129 | yes Evaluation Count:12 |
| 12-129 |
815 | d->relayoutDocument(); executed: d->relayoutDocument(); Execution Count:129 | 129 |
816 | else | - |
817 | d->_q_adjustScrollbars(); executed: d->_q_adjustScrollbars(); Execution Count:12 | 12 |
818 | } | - |
819 | | - |
820 | void QTextEditPrivate::relayoutDocument() | - |
821 | { | - |
822 | QTextDocument *doc = control->document(); | - |
823 | QAbstractTextDocumentLayout *layout = doc->documentLayout(); | - |
824 | | - |
825 | if (QTextDocumentLayout *tlayout = qobject_cast<QTextDocumentLayout *>(layout)) { partially evaluated: QTextDocumentLayout *tlayout = qobject_cast<QTextDocumentLayout *>(layout) yes Evaluation Count:148 | no Evaluation Count:0 |
| 0-148 |
826 | if (lineWrap == QTextEdit::FixedColumnWidth) partially evaluated: lineWrap == QTextEdit::FixedColumnWidth no Evaluation Count:0 | yes Evaluation Count:148 |
| 0-148 |
827 | tlayout->setFixedColumnWidth(lineWrapColumnOrWidth); never executed: tlayout->setFixedColumnWidth(lineWrapColumnOrWidth); | 0 |
828 | else | - |
829 | tlayout->setFixedColumnWidth(-1); executed: tlayout->setFixedColumnWidth(-1); Execution Count:148 | 148 |
830 | } | - |
831 | | - |
832 | QTextDocumentLayout *tlayout = qobject_cast<QTextDocumentLayout *>(layout); | - |
833 | QSize lastUsedSize; | - |
834 | if (tlayout) partially evaluated: tlayout yes Evaluation Count:148 | no Evaluation Count:0 |
| 0-148 |
835 | lastUsedSize = tlayout->dynamicDocumentSize().toSize(); executed: lastUsedSize = tlayout->dynamicDocumentSize().toSize(); Execution Count:148 | 148 |
836 | else | - |
837 | lastUsedSize = layout->documentSize().toSize(); never executed: lastUsedSize = layout->documentSize().toSize(); | 0 |
838 | | - |
839 | | - |
840 | | - |
841 | | - |
842 | const bool oldIgnoreScrollbarAdjustment = ignoreAutomaticScrollbarAdjustment; | - |
843 | ignoreAutomaticScrollbarAdjustment = true; | - |
844 | | - |
845 | int width = viewport->width(); | - |
846 | if (lineWrap == QTextEdit::FixedPixelWidth) partially evaluated: lineWrap == QTextEdit::FixedPixelWidth no Evaluation Count:0 | yes Evaluation Count:148 |
| 0-148 |
847 | width = lineWrapColumnOrWidth; never executed: width = lineWrapColumnOrWidth; | 0 |
848 | else if (lineWrap == QTextEdit::NoWrap) { partially evaluated: lineWrap == QTextEdit::NoWrap no Evaluation Count:0 | yes Evaluation Count:148 |
| 0-148 |
849 | QVariant alignmentProperty = doc->documentLayout()->property("contentHasAlignment"); | - |
850 | if (alignmentProperty.type() == QVariant::Bool && !alignmentProperty.toBool()) { never evaluated: alignmentProperty.type() == QVariant::Bool never evaluated: !alignmentProperty.toBool() | 0 |
851 | | - |
852 | width = 0; | - |
853 | } | 0 |
854 | } | 0 |
855 | | - |
856 | doc->setPageSize(QSize(width, -1)); | - |
857 | if (tlayout) partially evaluated: tlayout yes Evaluation Count:148 | no Evaluation Count:0 |
| 0-148 |
858 | tlayout->ensureLayouted(verticalOffset() + viewport->height()); executed: tlayout->ensureLayouted(verticalOffset() + viewport->height()); Execution Count:148 | 148 |
859 | | - |
860 | ignoreAutomaticScrollbarAdjustment = oldIgnoreScrollbarAdjustment; | - |
861 | | - |
862 | QSize usedSize; | - |
863 | if (tlayout) partially evaluated: tlayout yes Evaluation Count:148 | no Evaluation Count:0 |
| 0-148 |
864 | usedSize = tlayout->dynamicDocumentSize().toSize(); executed: usedSize = tlayout->dynamicDocumentSize().toSize(); Execution Count:148 | 148 |
865 | else | - |
866 | usedSize = layout->documentSize().toSize(); never executed: usedSize = layout->documentSize().toSize(); | 0 |
867 | if (lastUsedSize.isValid() partially evaluated: lastUsedSize.isValid() yes Evaluation Count:148 | no Evaluation Count:0 |
| 0-148 |
868 | && !vbar->isHidden() partially evaluated: !vbar->isHidden() yes Evaluation Count:148 | no Evaluation Count:0 |
| 0-148 |
869 | && viewport->width() < lastUsedSize.width() evaluated: viewport->width() < lastUsedSize.width() yes Evaluation Count:35 | yes Evaluation Count:113 |
| 35-113 |
870 | && usedSize.height() < lastUsedSize.height() partially evaluated: usedSize.height() < lastUsedSize.height() no Evaluation Count:0 | yes Evaluation Count:35 |
| 0-35 |
871 | && usedSize.height() <= viewport->height()) never evaluated: usedSize.height() <= viewport->height() | 0 |
872 | return; | 0 |
873 | | - |
874 | _q_adjustScrollbars(); | - |
875 | } executed: } Execution Count:148 | 148 |
876 | | - |
877 | void QTextEditPrivate::paint(QPainter *p, QPaintEvent *e) | - |
878 | { | - |
879 | const int xOffset = horizontalOffset(); | - |
880 | const int yOffset = verticalOffset(); | - |
881 | | - |
882 | QRect r = e->rect(); | - |
883 | p->translate(-xOffset, -yOffset); | - |
884 | r.translate(xOffset, yOffset); | - |
885 | | - |
886 | QTextDocument *doc = control->document(); | - |
887 | QTextDocumentLayout *layout = qobject_cast<QTextDocumentLayout *>(doc->documentLayout()); | - |
888 | | - |
889 | | - |
890 | | - |
891 | if (layout) partially evaluated: layout yes Evaluation Count:109 | no Evaluation Count:0 |
| 0-109 |
892 | layout->setViewport(viewport->rect()); executed: layout->setViewport(viewport->rect()); Execution Count:109 | 109 |
893 | | - |
894 | control->drawContents(p, r, q_func()); | - |
895 | | - |
896 | if (layout) partially evaluated: layout yes Evaluation Count:109 | no Evaluation Count:0 |
| 0-109 |
897 | layout->setViewport(QRect()); executed: layout->setViewport(QRect()); Execution Count:109 | 109 |
898 | } executed: } Execution Count:109 | 109 |
899 | void QTextEdit::paintEvent(QPaintEvent *e) | - |
900 | { | - |
901 | QTextEditPrivate * const d = d_func(); | - |
902 | QPainter p(d->viewport); | - |
903 | d->paint(&p, e); | - |
904 | } executed: } Execution Count:83 | 83 |
905 | | - |
906 | void QTextEditPrivate::_q_currentCharFormatChanged(const QTextCharFormat &fmt) | - |
907 | { | - |
908 | QTextEdit * const q = q_func(); | - |
909 | q->currentCharFormatChanged(fmt); | - |
910 | } executed: } Execution Count:35 | 35 |
911 | | - |
912 | void QTextEditPrivate::updateDefaultTextOption() | - |
913 | { | - |
914 | QTextDocument *doc = control->document(); | - |
915 | | - |
916 | QTextOption opt = doc->defaultTextOption(); | - |
917 | QTextOption::WrapMode oldWrapMode = opt.wrapMode(); | - |
918 | | - |
919 | if (lineWrap == QTextEdit::NoWrap) partially evaluated: lineWrap == QTextEdit::NoWrap no Evaluation Count:0 | yes Evaluation Count:4 |
| 0-4 |
920 | opt.setWrapMode(QTextOption::NoWrap); never executed: opt.setWrapMode(QTextOption::NoWrap); | 0 |
921 | else | - |
922 | opt.setWrapMode(wordWrap); executed: opt.setWrapMode(wordWrap); Execution Count:4 | 4 |
923 | | - |
924 | if (opt.wrapMode() != oldWrapMode) partially evaluated: opt.wrapMode() != oldWrapMode no Evaluation Count:0 | yes Evaluation Count:4 |
| 0-4 |
925 | doc->setDefaultTextOption(opt); never executed: doc->setDefaultTextOption(opt); | 0 |
926 | } executed: } Execution Count:4 | 4 |
927 | | - |
928 | | - |
929 | | - |
930 | void QTextEdit::mousePressEvent(QMouseEvent *e) | - |
931 | { | - |
932 | QTextEditPrivate * const d = d_func(); | - |
933 | | - |
934 | | - |
935 | | - |
936 | | - |
937 | d->sendControlEvent(e); | - |
938 | } | 0 |
939 | | - |
940 | | - |
941 | | - |
942 | void QTextEdit::mouseMoveEvent(QMouseEvent *e) | - |
943 | { | - |
944 | QTextEditPrivate * const d = d_func(); | - |
945 | d->inDrag = false; | - |
946 | const QPoint pos = e->pos(); | - |
947 | d->sendControlEvent(e); | - |
948 | if (!(e->buttons() & Qt::LeftButton)) never evaluated: !(e->buttons() & Qt::LeftButton) | 0 |
949 | return; | 0 |
950 | QRect visible = d->viewport->rect(); | - |
951 | if (visible.contains(pos)) never evaluated: visible.contains(pos) | 0 |
952 | d->autoScrollTimer.stop(); never executed: d->autoScrollTimer.stop(); | 0 |
953 | else if (!d->autoScrollTimer.isActive()) never evaluated: !d->autoScrollTimer.isActive() | 0 |
954 | d->autoScrollTimer.start(100, this); never executed: d->autoScrollTimer.start(100, this); | 0 |
955 | } | - |
956 | | - |
957 | | - |
958 | | - |
959 | void QTextEdit::mouseReleaseEvent(QMouseEvent *e) | - |
960 | { | - |
961 | QTextEditPrivate * const d = d_func(); | - |
962 | d->sendControlEvent(e); | - |
963 | if (d->autoScrollTimer.isActive()) { never evaluated: d->autoScrollTimer.isActive() | 0 |
964 | d->autoScrollTimer.stop(); | - |
965 | ensureCursorVisible(); | - |
966 | } | 0 |
967 | if (!isReadOnly() && rect().contains(e->pos())) never evaluated: !isReadOnly() never evaluated: rect().contains(e->pos()) | 0 |
968 | d->handleSoftwareInputPanel(e->button(), d->clickCausedFocus); never executed: d->handleSoftwareInputPanel(e->button(), d->clickCausedFocus); | 0 |
969 | d->clickCausedFocus = 0; | - |
970 | } | 0 |
971 | | - |
972 | | - |
973 | | - |
974 | void QTextEdit::mouseDoubleClickEvent(QMouseEvent *e) | - |
975 | { | - |
976 | QTextEditPrivate * const d = d_func(); | - |
977 | d->sendControlEvent(e); | - |
978 | } | 0 |
979 | | - |
980 | | - |
981 | | - |
982 | bool QTextEdit::focusNextPrevChild(bool next) | - |
983 | { | - |
984 | const QTextEditPrivate * const d = d_func(); | - |
985 | if (!d->tabChangesFocus && d->control->textInteractionFlags() & Qt::TextEditable) partially evaluated: !d->tabChangesFocus yes Evaluation Count:1 | no Evaluation Count:0 |
partially evaluated: d->control->textInteractionFlags() & Qt::TextEditable no Evaluation Count:0 | yes Evaluation Count:1 |
| 0-1 |
986 | return false; never executed: return false; | 0 |
987 | return QAbstractScrollArea::focusNextPrevChild(next); executed: return QAbstractScrollArea::focusNextPrevChild(next); Execution Count:1 | 1 |
988 | } | - |
989 | void QTextEdit::contextMenuEvent(QContextMenuEvent *e) | - |
990 | { | - |
991 | QTextEditPrivate * const d = d_func(); | - |
992 | d->sendControlEvent(e); | - |
993 | } | 0 |
994 | | - |
995 | | - |
996 | | - |
997 | | - |
998 | | - |
999 | void QTextEdit::dragEnterEvent(QDragEnterEvent *e) | - |
1000 | { | - |
1001 | QTextEditPrivate * const d = d_func(); | - |
1002 | d->inDrag = true; | - |
1003 | d->sendControlEvent(e); | - |
1004 | } | 0 |
1005 | | - |
1006 | | - |
1007 | | - |
1008 | void QTextEdit::dragLeaveEvent(QDragLeaveEvent *e) | - |
1009 | { | - |
1010 | QTextEditPrivate * const d = d_func(); | - |
1011 | d->inDrag = false; | - |
1012 | d->autoScrollTimer.stop(); | - |
1013 | d->sendControlEvent(e); | - |
1014 | } | 0 |
1015 | | - |
1016 | | - |
1017 | | - |
1018 | void QTextEdit::dragMoveEvent(QDragMoveEvent *e) | - |
1019 | { | - |
1020 | QTextEditPrivate * const d = d_func(); | - |
1021 | d->autoScrollDragPos = e->pos(); | - |
1022 | if (!d->autoScrollTimer.isActive()) never evaluated: !d->autoScrollTimer.isActive() | 0 |
1023 | d->autoScrollTimer.start(100, this); never executed: d->autoScrollTimer.start(100, this); | 0 |
1024 | d->sendControlEvent(e); | - |
1025 | } | 0 |
1026 | | - |
1027 | | - |
1028 | | - |
1029 | void QTextEdit::dropEvent(QDropEvent *e) | - |
1030 | { | - |
1031 | QTextEditPrivate * const d = d_func(); | - |
1032 | d->inDrag = false; | - |
1033 | d->autoScrollTimer.stop(); | - |
1034 | d->sendControlEvent(e); | - |
1035 | } | 0 |
1036 | | - |
1037 | | - |
1038 | | - |
1039 | | - |
1040 | | - |
1041 | void QTextEdit::inputMethodEvent(QInputMethodEvent *e) | - |
1042 | { | - |
1043 | QTextEditPrivate * const d = d_func(); | - |
1044 | | - |
1045 | | - |
1046 | | - |
1047 | | - |
1048 | | - |
1049 | | - |
1050 | d->sendControlEvent(e); | - |
1051 | ensureCursorVisible(); | - |
1052 | } | 0 |
1053 | | - |
1054 | | - |
1055 | | - |
1056 | void QTextEdit::scrollContentsBy(int dx, int dy) | - |
1057 | { | - |
1058 | QTextEditPrivate * const d = d_func(); | - |
1059 | if (isRightToLeft()) partially evaluated: isRightToLeft() no Evaluation Count:0 | yes Evaluation Count:12 |
| 0-12 |
1060 | dx = -dx; never executed: dx = -dx; | 0 |
1061 | d->viewport->scroll(dx, dy); | - |
1062 | } executed: } Execution Count:12 | 12 |
1063 | | - |
1064 | | - |
1065 | | - |
1066 | QVariant QTextEdit::inputMethodQuery(Qt::InputMethodQuery property) const | - |
1067 | { | - |
1068 | const QTextEditPrivate * const d = d_func(); | - |
1069 | QVariant v; | - |
1070 | switch (property) { | - |
1071 | case Qt::ImHints: | - |
1072 | v = QWidget::inputMethodQuery(property); | - |
1073 | break; | 0 |
1074 | default: | - |
1075 | v = d->control->inputMethodQuery(property); | - |
1076 | const QPoint offset(-d->horizontalOffset(), -d->verticalOffset()); | - |
1077 | if (v.type() == QVariant::RectF) partially evaluated: v.type() == QVariant::RectF no Evaluation Count:0 | yes Evaluation Count:448 |
| 0-448 |
1078 | v = v.toRectF().toRect().translated(offset); never executed: v = v.toRectF().toRect().translated(offset); | 0 |
1079 | else if (v.type() == QVariant::PointF) partially evaluated: v.type() == QVariant::PointF no Evaluation Count:0 | yes Evaluation Count:448 |
| 0-448 |
1080 | v = v.toPointF().toPoint() + offset; never executed: v = v.toPointF().toPoint() + offset; | 0 |
1081 | else if (v.type() == QVariant::Rect) partially evaluated: v.type() == QVariant::Rect no Evaluation Count:0 | yes Evaluation Count:448 |
| 0-448 |
1082 | v = v.toRect().translated(offset); never executed: v = v.toRect().translated(offset); | 0 |
1083 | else if (v.type() == QVariant::Point) partially evaluated: v.type() == QVariant::Point no Evaluation Count:0 | yes Evaluation Count:448 |
| 0-448 |
1084 | v = v.toPoint() + offset; never executed: v = v.toPoint() + offset; | 0 |
1085 | } | - |
1086 | | - |
1087 | return v; executed: return v; Execution Count:448 | 448 |
1088 | } | - |
1089 | | - |
1090 | | - |
1091 | | - |
1092 | void QTextEdit::focusInEvent(QFocusEvent *e) | - |
1093 | { | - |
1094 | QTextEditPrivate * const d = d_func(); | - |
1095 | if (e->reason() == Qt::MouseFocusReason) { partially evaluated: e->reason() == Qt::MouseFocusReason no Evaluation Count:0 | yes Evaluation Count:69 |
| 0-69 |
1096 | d->clickCausedFocus = 1; | - |
1097 | } | 0 |
1098 | QAbstractScrollArea::focusInEvent(e); | - |
1099 | d->sendControlEvent(e); | - |
1100 | } executed: } Execution Count:69 | 69 |
1101 | | - |
1102 | | - |
1103 | | - |
1104 | void QTextEdit::focusOutEvent(QFocusEvent *e) | - |
1105 | { | - |
1106 | QTextEditPrivate * const d = d_func(); | - |
1107 | QAbstractScrollArea::focusOutEvent(e); | - |
1108 | d->sendControlEvent(e); | - |
1109 | } executed: } Execution Count:45 | 45 |
1110 | | - |
1111 | | - |
1112 | | - |
1113 | void QTextEdit::showEvent(QShowEvent *) | - |
1114 | { | - |
1115 | QTextEditPrivate * const d = d_func(); | - |
1116 | if (!d->anchorToScrollToWhenVisible.isEmpty()) { partially evaluated: !d->anchorToScrollToWhenVisible.isEmpty() no Evaluation Count:0 | yes Evaluation Count:131 |
| 0-131 |
1117 | scrollToAnchor(d->anchorToScrollToWhenVisible); | - |
1118 | d->anchorToScrollToWhenVisible.clear(); | - |
1119 | d->showCursorOnInitialShow = false; | - |
1120 | } else if (d->showCursorOnInitialShow) { evaluated: d->showCursorOnInitialShow yes Evaluation Count:69 | yes Evaluation Count:62 |
| 0-69 |
1121 | d->showCursorOnInitialShow = false; | - |
1122 | ensureCursorVisible(); | - |
1123 | } executed: } Execution Count:69 | 69 |
1124 | } | - |
1125 | | - |
1126 | | - |
1127 | | - |
1128 | void QTextEdit::changeEvent(QEvent *e) | - |
1129 | { | - |
1130 | QTextEditPrivate * const d = d_func(); | - |
1131 | QAbstractScrollArea::changeEvent(e); | - |
1132 | if (e->type() == QEvent::ApplicationFontChange partially evaluated: e->type() == QEvent::ApplicationFontChange no Evaluation Count:0 | yes Evaluation Count:351 |
| 0-351 |
1133 | || e->type() == QEvent::FontChange) { partially evaluated: e->type() == QEvent::FontChange no Evaluation Count:0 | yes Evaluation Count:351 |
| 0-351 |
1134 | d->control->document()->setDefaultFont(font()); | - |
1135 | } else if(e->type() == QEvent::ActivationChange) { evaluated: e->type() == QEvent::ActivationChange yes Evaluation Count:32 | yes Evaluation Count:319 |
| 0-319 |
1136 | if (!isActiveWindow()) evaluated: !isActiveWindow() yes Evaluation Count:4 | yes Evaluation Count:28 |
| 4-28 |
1137 | d->autoScrollTimer.stop(); executed: d->autoScrollTimer.stop(); Execution Count:4 | 4 |
1138 | } else if (e->type() == QEvent::EnabledChange) { executed: } Execution Count:32 partially evaluated: e->type() == QEvent::EnabledChange no Evaluation Count:0 | yes Evaluation Count:319 |
| 0-319 |
1139 | e->setAccepted(isEnabled()); | - |
1140 | d->control->setPalette(palette()); | - |
1141 | d->sendControlEvent(e); | - |
1142 | } else if (e->type() == QEvent::PaletteChange) { partially evaluated: e->type() == QEvent::PaletteChange no Evaluation Count:0 | yes Evaluation Count:319 |
| 0-319 |
1143 | d->control->setPalette(palette()); | - |
1144 | } else if (e->type() == QEvent::LayoutDirectionChange) { partially evaluated: e->type() == QEvent::LayoutDirectionChange no Evaluation Count:0 | yes Evaluation Count:319 |
| 0-319 |
1145 | d->sendControlEvent(e); | - |
1146 | } | 0 |
1147 | } | - |
1148 | | - |
1149 | | - |
1150 | | - |
1151 | | - |
1152 | void QTextEdit::wheelEvent(QWheelEvent *e) | - |
1153 | { | - |
1154 | QTextEditPrivate * const d = d_func(); | - |
1155 | if (!(d->control->textInteractionFlags() & Qt::TextEditable)) { never evaluated: !(d->control->textInteractionFlags() & Qt::TextEditable) | 0 |
1156 | if (e->modifiers() & Qt::ControlModifier) { never evaluated: e->modifiers() & Qt::ControlModifier | 0 |
1157 | const int delta = e->delta(); | - |
1158 | if (delta < 0) never evaluated: delta < 0 | 0 |
1159 | zoomOut(); never executed: zoomOut(); | 0 |
1160 | else if (delta > 0) never evaluated: delta > 0 | 0 |
1161 | zoomIn(); never executed: zoomIn(); | 0 |
1162 | return; | 0 |
1163 | } | - |
1164 | } | 0 |
1165 | QAbstractScrollArea::wheelEvent(e); | - |
1166 | updateMicroFocus(); | - |
1167 | } | 0 |
1168 | QMenu *QTextEdit::createStandardContextMenu() | - |
1169 | { | - |
1170 | QTextEditPrivate * const d = d_func(); | - |
1171 | return d->control->createStandardContextMenu(QPointF(), this); never executed: return d->control->createStandardContextMenu(QPointF(), this); | 0 |
1172 | } | - |
1173 | QMenu *QTextEdit::createStandardContextMenu(const QPoint &position) | - |
1174 | { | - |
1175 | QTextEditPrivate * const d = d_func(); | - |
1176 | return d->control->createStandardContextMenu(position, this); never executed: return d->control->createStandardContextMenu(position, this); | 0 |
1177 | } | - |
1178 | | - |
1179 | | - |
1180 | | - |
1181 | | - |
1182 | | - |
1183 | QTextCursor QTextEdit::cursorForPosition(const QPoint &pos) const | - |
1184 | { | - |
1185 | const QTextEditPrivate * const d = d_func(); | - |
1186 | return d->control->cursorForPosition(d->mapToContents(pos)); never executed: return d->control->cursorForPosition(d->mapToContents(pos)); | 0 |
1187 | } | - |
1188 | | - |
1189 | | - |
1190 | | - |
1191 | | - |
1192 | | - |
1193 | QRect QTextEdit::cursorRect(const QTextCursor &cursor) const | - |
1194 | { | - |
1195 | const QTextEditPrivate * const d = d_func(); | - |
1196 | if (cursor.isNull()) never evaluated: cursor.isNull() | 0 |
1197 | return QRect(); never executed: return QRect(); | 0 |
1198 | | - |
1199 | QRect r = d->control->cursorRect(cursor).toRect(); | - |
1200 | r.translate(-d->horizontalOffset(),-d->verticalOffset()); | - |
1201 | return r; never executed: return r; | 0 |
1202 | } | - |
1203 | | - |
1204 | | - |
1205 | | - |
1206 | | - |
1207 | | - |
1208 | QRect QTextEdit::cursorRect() const | - |
1209 | { | - |
1210 | const QTextEditPrivate * const d = d_func(); | - |
1211 | QRect r = d->control->cursorRect().toRect(); | - |
1212 | r.translate(-d->horizontalOffset(),-d->verticalOffset()); | - |
1213 | return r; never executed: return r; | 0 |
1214 | } | - |
1215 | | - |
1216 | | - |
1217 | | - |
1218 | | - |
1219 | | - |
1220 | | - |
1221 | QString QTextEdit::anchorAt(const QPoint& pos) const | - |
1222 | { | - |
1223 | const QTextEditPrivate * const d = d_func(); | - |
1224 | return d->control->anchorAt(d->mapToContents(pos)); never executed: return d->control->anchorAt(d->mapToContents(pos)); | 0 |
1225 | } | - |
1226 | bool QTextEdit::overwriteMode() const | - |
1227 | { | - |
1228 | const QTextEditPrivate * const d = d_func(); | - |
1229 | return d->control->overwriteMode(); never executed: return d->control->overwriteMode(); | 0 |
1230 | } | - |
1231 | | - |
1232 | void QTextEdit::setOverwriteMode(bool overwrite) | - |
1233 | { | - |
1234 | QTextEditPrivate * const d = d_func(); | - |
1235 | d->control->setOverwriteMode(overwrite); | - |
1236 | } | 0 |
1237 | int QTextEdit::tabStopWidth() const | - |
1238 | { | - |
1239 | const QTextEditPrivate * const d = d_func(); | - |
1240 | return qRound(d->control->document()->defaultTextOption().tabStop()); never executed: return qRound(d->control->document()->defaultTextOption().tabStop()); | 0 |
1241 | } | - |
1242 | | - |
1243 | void QTextEdit::setTabStopWidth(int width) | - |
1244 | { | - |
1245 | QTextEditPrivate * const d = d_func(); | - |
1246 | QTextOption opt = d->control->document()->defaultTextOption(); | - |
1247 | if (opt.tabStop() == width || width < 0) never evaluated: opt.tabStop() == width never evaluated: width < 0 | 0 |
1248 | return; | 0 |
1249 | opt.setTabStop(width); | - |
1250 | d->control->document()->setDefaultTextOption(opt); | - |
1251 | } | 0 |
1252 | | - |
1253 | | - |
1254 | | - |
1255 | | - |
1256 | | - |
1257 | | - |
1258 | | - |
1259 | int QTextEdit::cursorWidth() const | - |
1260 | { | - |
1261 | const QTextEditPrivate * const d = d_func(); | - |
1262 | return d->control->cursorWidth(); never executed: return d->control->cursorWidth(); | 0 |
1263 | } | - |
1264 | | - |
1265 | void QTextEdit::setCursorWidth(int width) | - |
1266 | { | - |
1267 | QTextEditPrivate * const d = d_func(); | - |
1268 | d->control->setCursorWidth(width); | - |
1269 | } | 0 |
1270 | bool QTextEdit::acceptRichText() const | - |
1271 | { | - |
1272 | const QTextEditPrivate * const d = d_func(); | - |
1273 | return d->control->acceptRichText(); never executed: return d->control->acceptRichText(); | 0 |
1274 | } | - |
1275 | | - |
1276 | void QTextEdit::setAcceptRichText(bool accept) | - |
1277 | { | - |
1278 | QTextEditPrivate * const d = d_func(); | - |
1279 | d->control->setAcceptRichText(accept); | - |
1280 | } | 0 |
1281 | void QTextEdit::setExtraSelections(const QList<ExtraSelection> &selections) | - |
1282 | { | - |
1283 | QTextEditPrivate * const d = d_func(); | - |
1284 | d->control->setExtraSelections(selections); | - |
1285 | } | 0 |
1286 | | - |
1287 | | - |
1288 | | - |
1289 | | - |
1290 | | - |
1291 | | - |
1292 | | - |
1293 | QList<QTextEdit::ExtraSelection> QTextEdit::extraSelections() const | - |
1294 | { | - |
1295 | const QTextEditPrivate * const d = d_func(); | - |
1296 | return d->control->extraSelections(); never executed: return d->control->extraSelections(); | 0 |
1297 | } | - |
1298 | QMimeData *QTextEdit::createMimeDataFromSelection() const | - |
1299 | { | - |
1300 | const QTextEditPrivate * const d = d_func(); | - |
1301 | return d->control->QWidgetTextControl::createMimeDataFromSelection(); never executed: return d->control->QWidgetTextControl::createMimeDataFromSelection(); | 0 |
1302 | } | - |
1303 | bool QTextEdit::canInsertFromMimeData(const QMimeData *source) const | - |
1304 | { | - |
1305 | const QTextEditPrivate * const d = d_func(); | - |
1306 | return d->control->QWidgetTextControl::canInsertFromMimeData(source); never executed: return d->control->QWidgetTextControl::canInsertFromMimeData(source); | 0 |
1307 | } | - |
1308 | void QTextEdit::insertFromMimeData(const QMimeData *source) | - |
1309 | { | - |
1310 | QTextEditPrivate * const d = d_func(); | - |
1311 | d->control->QWidgetTextControl::insertFromMimeData(source); | - |
1312 | } | 0 |
1313 | bool QTextEdit::isReadOnly() const | - |
1314 | { | - |
1315 | const QTextEditPrivate * const d = d_func(); | - |
1316 | return !(d->control->textInteractionFlags() & Qt::TextEditable); executed: return !(d->control->textInteractionFlags() & Qt::TextEditable); Execution Count:8 | 8 |
1317 | } | - |
1318 | | - |
1319 | void QTextEdit::setReadOnly(bool ro) | - |
1320 | { | - |
1321 | QTextEditPrivate * const d = d_func(); | - |
1322 | Qt::TextInteractionFlags flags = Qt::NoTextInteraction; | - |
1323 | if (ro) { evaluated: ro yes Evaluation Count:6 | yes Evaluation Count:1 |
| 1-6 |
1324 | flags = Qt::TextSelectableByMouse; | - |
1325 | | - |
1326 | if (qobject_cast<QTextBrowser *>(this)) evaluated: qobject_cast<QTextBrowser *>(this) yes Evaluation Count:2 | yes Evaluation Count:4 |
| 2-4 |
1327 | flags |= Qt::TextBrowserInteraction; executed: flags |= Qt::TextBrowserInteraction; Execution Count:2 | 2 |
1328 | | - |
1329 | } else { executed: } Execution Count:6 | 6 |
1330 | flags = Qt::TextEditorInteraction; | - |
1331 | } executed: } Execution Count:1 | 1 |
1332 | d->control->setTextInteractionFlags(flags); | - |
1333 | setAttribute(Qt::WA_InputMethodEnabled, shouldEnableInputMethod(this)); | - |
1334 | } executed: } Execution Count:7 | 7 |
1335 | void QTextEdit::setTextInteractionFlags(Qt::TextInteractionFlags flags) | - |
1336 | { | - |
1337 | QTextEditPrivate * const d = d_func(); | - |
1338 | d->control->setTextInteractionFlags(flags); | - |
1339 | } | 0 |
1340 | | - |
1341 | Qt::TextInteractionFlags QTextEdit::textInteractionFlags() const | - |
1342 | { | - |
1343 | const QTextEditPrivate * const d = d_func(); | - |
1344 | return d->control->textInteractionFlags(); executed: return d->control->textInteractionFlags(); Execution Count:4 | 4 |
1345 | } | - |
1346 | void QTextEdit::mergeCurrentCharFormat(const QTextCharFormat &modifier) | - |
1347 | { | - |
1348 | QTextEditPrivate * const d = d_func(); | - |
1349 | d->control->mergeCurrentCharFormat(modifier); | - |
1350 | } executed: } Execution Count:1 | 1 |
1351 | | - |
1352 | | - |
1353 | | - |
1354 | | - |
1355 | | - |
1356 | | - |
1357 | | - |
1358 | void QTextEdit::setCurrentCharFormat(const QTextCharFormat &format) | - |
1359 | { | - |
1360 | QTextEditPrivate * const d = d_func(); | - |
1361 | d->control->setCurrentCharFormat(format); | - |
1362 | } | 0 |
1363 | | - |
1364 | | - |
1365 | | - |
1366 | | - |
1367 | QTextCharFormat QTextEdit::currentCharFormat() const | - |
1368 | { | - |
1369 | const QTextEditPrivate * const d = d_func(); | - |
1370 | return d->control->currentCharFormat(); never executed: return d->control->currentCharFormat(); | 0 |
1371 | } | - |
1372 | QTextEdit::AutoFormatting QTextEdit::autoFormatting() const | - |
1373 | { | - |
1374 | const QTextEditPrivate * const d = d_func(); | - |
1375 | return d->autoFormatting; never executed: return d->autoFormatting; | 0 |
1376 | } | - |
1377 | | - |
1378 | void QTextEdit::setAutoFormatting(AutoFormatting features) | - |
1379 | { | - |
1380 | QTextEditPrivate * const d = d_func(); | - |
1381 | d->autoFormatting = features; | - |
1382 | } | 0 |
1383 | void QTextEdit::insertPlainText(const QString &text) | - |
1384 | { | - |
1385 | QTextEditPrivate * const d = d_func(); | - |
1386 | d->control->insertPlainText(text); | - |
1387 | } executed: } Execution Count:2 | 2 |
1388 | void QTextEdit::insertHtml(const QString &text) | - |
1389 | { | - |
1390 | QTextEditPrivate * const d = d_func(); | - |
1391 | d->control->insertHtml(text); | - |
1392 | } | 0 |
1393 | | - |
1394 | | - |
1395 | | - |
1396 | | - |
1397 | | - |
1398 | | - |
1399 | | - |
1400 | void QTextEdit::scrollToAnchor(const QString &name) | - |
1401 | { | - |
1402 | QTextEditPrivate * const d = d_func(); | - |
1403 | if (name.isEmpty()) partially evaluated: name.isEmpty() no Evaluation Count:0 | yes Evaluation Count:5 |
| 0-5 |
1404 | return; | 0 |
1405 | | - |
1406 | if (!isVisible()) { partially evaluated: !isVisible() no Evaluation Count:0 | yes Evaluation Count:5 |
| 0-5 |
1407 | d->anchorToScrollToWhenVisible = name; | - |
1408 | return; | 0 |
1409 | } | - |
1410 | | - |
1411 | QPointF p = d->control->anchorPosition(name); | - |
1412 | const int newPosition = qRound(p.y()); | - |
1413 | if ( d->vbar->maximum() < newPosition ) partially evaluated: d->vbar->maximum() < newPosition yes Evaluation Count:5 | no Evaluation Count:0 |
| 0-5 |
1414 | d->_q_adjustScrollbars(); executed: d->_q_adjustScrollbars(); Execution Count:5 | 5 |
1415 | d->vbar->setValue(newPosition); | - |
1416 | } executed: } Execution Count:5 | 5 |
1417 | void QTextEdit::zoomIn(int range) | - |
1418 | { | - |
1419 | QFont f = font(); | - |
1420 | const int newSize = f.pointSize() + range; | - |
1421 | if (newSize <= 0) never evaluated: newSize <= 0 | 0 |
1422 | return; | 0 |
1423 | f.setPointSize(newSize); | - |
1424 | setFont(f); | - |
1425 | } | 0 |
1426 | void QTextEdit::zoomOut(int range) | - |
1427 | { | - |
1428 | zoomIn(-range); | - |
1429 | } | 0 |
1430 | void QTextEdit::moveCursor(QTextCursor::MoveOperation operation, QTextCursor::MoveMode mode) | - |
1431 | { | - |
1432 | QTextEditPrivate * const d = d_func(); | - |
1433 | d->control->moveCursor(operation, mode); | - |
1434 | } executed: } Execution Count:1 | 1 |
1435 | | - |
1436 | | - |
1437 | | - |
1438 | | - |
1439 | | - |
1440 | bool QTextEdit::canPaste() const | - |
1441 | { | - |
1442 | const QTextEditPrivate * const d = d_func(); | - |
1443 | return d->control->canPaste(); never executed: return d->control->canPaste(); | 0 |
1444 | } | - |
1445 | void QTextEdit::print(QPagedPaintDevice *printer) const | - |
1446 | { | - |
1447 | const QTextEditPrivate * const d = d_func(); | - |
1448 | d->control->print(printer); | - |
1449 | } | 0 |
1450 | bool QTextEdit::tabChangesFocus() const | - |
1451 | { | - |
1452 | const QTextEditPrivate * const d = d_func(); | - |
1453 | return d->tabChangesFocus; never executed: return d->tabChangesFocus; | 0 |
1454 | } | - |
1455 | | - |
1456 | void QTextEdit::setTabChangesFocus(bool b) | - |
1457 | { | - |
1458 | QTextEditPrivate * const d = d_func(); | - |
1459 | d->tabChangesFocus = b; | - |
1460 | } | 0 |
1461 | QTextEdit::LineWrapMode QTextEdit::lineWrapMode() const | - |
1462 | { | - |
1463 | const QTextEditPrivate * const d = d_func(); | - |
1464 | return d->lineWrap; never executed: return d->lineWrap; | 0 |
1465 | } | - |
1466 | | - |
1467 | void QTextEdit::setLineWrapMode(LineWrapMode wrap) | - |
1468 | { | - |
1469 | QTextEditPrivate * const d = d_func(); | - |
1470 | if (d->lineWrap == wrap) never evaluated: d->lineWrap == wrap | 0 |
1471 | return; | 0 |
1472 | d->lineWrap = wrap; | - |
1473 | d->updateDefaultTextOption(); | - |
1474 | d->relayoutDocument(); | - |
1475 | } | 0 |
1476 | int QTextEdit::lineWrapColumnOrWidth() const | - |
1477 | { | - |
1478 | const QTextEditPrivate * const d = d_func(); | - |
1479 | return d->lineWrapColumnOrWidth; never executed: return d->lineWrapColumnOrWidth; | 0 |
1480 | } | - |
1481 | | - |
1482 | void QTextEdit::setLineWrapColumnOrWidth(int w) | - |
1483 | { | - |
1484 | QTextEditPrivate * const d = d_func(); | - |
1485 | d->lineWrapColumnOrWidth = w; | - |
1486 | d->relayoutDocument(); | - |
1487 | } | 0 |
1488 | QTextOption::WrapMode QTextEdit::wordWrapMode() const | - |
1489 | { | - |
1490 | const QTextEditPrivate * const d = d_func(); | - |
1491 | return d->wordWrap; never executed: return d->wordWrap; | 0 |
1492 | } | - |
1493 | | - |
1494 | void QTextEdit::setWordWrapMode(QTextOption::WrapMode mode) | - |
1495 | { | - |
1496 | QTextEditPrivate * const d = d_func(); | - |
1497 | if (mode == d->wordWrap) partially evaluated: mode == d->wordWrap yes Evaluation Count:1 | no Evaluation Count:0 |
| 0-1 |
1498 | return; executed: return; Execution Count:1 | 1 |
1499 | d->wordWrap = mode; | - |
1500 | d->updateDefaultTextOption(); | - |
1501 | } | 0 |
1502 | | - |
1503 | | - |
1504 | | - |
1505 | | - |
1506 | | - |
1507 | | - |
1508 | bool QTextEdit::find(const QString &exp, QTextDocument::FindFlags options) | - |
1509 | { | - |
1510 | QTextEditPrivate * const d = d_func(); | - |
1511 | return d->control->find(exp, options); never executed: return d->control->find(exp, options); | 0 |
1512 | } | - |
1513 | void QTextEdit::setText(const QString &text) | - |
1514 | { | - |
1515 | QTextEditPrivate * const d = d_func(); | - |
1516 | Qt::TextFormat format = d->textFormat; | - |
1517 | if (d->textFormat == Qt::AutoText) partially evaluated: d->textFormat == Qt::AutoText yes Evaluation Count:3 | no Evaluation Count:0 |
| 0-3 |
1518 | format = Qt::mightBeRichText(text) ? Qt::RichText : Qt::PlainText; executed: format = Qt::mightBeRichText(text) ? Qt::RichText : Qt::PlainText; Execution Count:3 evaluated: Qt::mightBeRichText(text) yes Evaluation Count:2 | yes Evaluation Count:1 |
| 1-3 |
1519 | | - |
1520 | if (format == Qt::RichText) evaluated: format == Qt::RichText yes Evaluation Count:2 | yes Evaluation Count:1 |
| 1-2 |
1521 | setHtml(text); executed: setHtml(text); Execution Count:2 | 2 |
1522 | else | - |
1523 | | - |
1524 | setPlainText(text); executed: setPlainText(text); Execution Count:1 | 1 |
1525 | } | - |
1526 | void QTextEdit::append(const QString &text) | - |
1527 | { | - |
1528 | QTextEditPrivate * const d = d_func(); | - |
1529 | const bool atBottom = isReadOnly() ? d->verticalOffset() >= d->vbar->maximum() : never evaluated: isReadOnly() | 0 |
1530 | d->control->textCursor().atEnd(); | - |
1531 | d->control->append(text); | - |
1532 | if (atBottom) never evaluated: atBottom | 0 |
1533 | d->vbar->setValue(d->vbar->maximum()); never executed: d->vbar->setValue(d->vbar->maximum()); | 0 |
1534 | } | 0 |
1535 | | - |
1536 | | - |
1537 | | - |
1538 | | - |
1539 | | - |
1540 | void QTextEdit::ensureCursorVisible() | - |
1541 | { | - |
1542 | QTextEditPrivate * const d = d_func(); | - |
1543 | d->control->ensureCursorVisible(); | - |
1544 | } executed: } Execution Count:69 | 69 |
1545 | | - |
1546 | | - |
1547 | | - |
| | |