qplaintextedit.cpp

Absolute File Name:/home/qt/qt5_coco/qt5/qtbase/src/widgets/widgets/qplaintextedit.cpp
Switch to Source codePreprocessed file
LineSourceCount
1-
2-
3-
4-
5-
6-
7-
8-
9static inline bool shouldEnableInputMethod(QPlainTextEdit *plaintextedit)-
10{-
11 return
never executed: return !plaintextedit->isReadOnly();
!plaintextedit->isReadOnly();
never executed: return !plaintextedit->isReadOnly();
0
12}-
13-
14class QPlainTextDocumentLayoutPrivate : public QAbstractTextDocumentLayoutPrivate-
15{-
16 inline QPlainTextDocumentLayout* q_func() { return static_cast<QPlainTextDocumentLayout *>(q_ptr); } inline const QPlainTextDocumentLayout* q_func() const { return static_cast<const QPlainTextDocumentLayout *>(q_ptr); } friend class QPlainTextDocumentLayout;-
17public:-
18 QPlainTextDocumentLayoutPrivate() {-
19 mainViewPrivate = 0;-
20 width = 0;-
21 maximumWidth = 0;-
22 maximumWidthBlockNumber = 0;-
23 blockCount = 1;-
24 blockUpdate = blockDocumentSizeChanged = false;-
25 cursorWidth = 1;-
26 textLayoutFlags = 0;-
27 }
never executed: end of block
0
28-
29 qreal width;-
30 qreal maximumWidth;-
31 int maximumWidthBlockNumber;-
32 int blockCount;-
33 QPlainTextEditPrivate *mainViewPrivate;-
34 bool blockUpdate;-
35 bool blockDocumentSizeChanged;-
36 int cursorWidth;-
37 int textLayoutFlags;-
38-
39 void layoutBlock(const QTextBlock &block);-
40 qreal blockWidth(const QTextBlock &block);-
41-
42 void relayout();-
43};-
44QPlainTextDocumentLayout::QPlainTextDocumentLayout(QTextDocument *document)-
45 :QAbstractTextDocumentLayout(* new QPlainTextDocumentLayoutPrivate, document) {-
46}
never executed: end of block
0
47-
48-
49-
50QPlainTextDocumentLayout::~QPlainTextDocumentLayout() {}-
51-
52-
53-
54-
55-
56void QPlainTextDocumentLayout::draw(QPainter *, const PaintContext &)-
57{-
58}-
59-
60-
61-
62-
63int QPlainTextDocumentLayout::hitTest(const QPointF &, Qt::HitTestAccuracy ) const-
64{-
65-
66-
67-
68-
69-
70 return
never executed: return -1;
-1;
never executed: return -1;
0
71}-
72-
73-
74-
75-
76int QPlainTextDocumentLayout::pageCount() const-
77{ return
never executed: return 1;
1;
never executed: return 1;
}
0
78-
79-
80-
81-
82QSizeF QPlainTextDocumentLayout::documentSize() const-
83{-
84 const QPlainTextDocumentLayoutPrivate * const d = d_func();-
85 return
never executed: return QSizeF(d->maximumWidth, document()->lineCount());
QSizeF(d->maximumWidth, document()->lineCount());
never executed: return QSizeF(d->maximumWidth, document()->lineCount());
0
86}-
87-
88-
89-
90-
91QRectF QPlainTextDocumentLayout::frameBoundingRect(QTextFrame *) const-
92{-
93 const QPlainTextDocumentLayoutPrivate * const d = d_func();-
94 return
never executed: return QRectF(0, 0, qMax(d->width, d->maximumWidth), qreal(2147483647));
QRectF(0, 0, qMax(d->width, d->maximumWidth), qreal(2147483647));
never executed: return QRectF(0, 0, qMax(d->width, d->maximumWidth), qreal(2147483647));
0
95}-
96-
97-
98-
99-
100QRectF QPlainTextDocumentLayout::blockBoundingRect(const QTextBlock &block) const-
101{-
102 if (!block.isValid()
!block.isValid()Description
TRUEnever evaluated
FALSEnever evaluated
) { return
never executed: return QRectF();
QRectF();
never executed: return QRectF();
}
0
103 QTextLayout *tl = block.layout();-
104 if (!tl->lineCount()
!tl->lineCount()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
105 const_cast<
never executed: const_cast<QPlainTextDocumentLayout*>(this)->layoutBlock(block);
QPlainTextDocumentLayout*>(this)->layoutBlock(block);
never executed: const_cast<QPlainTextDocumentLayout*>(this)->layoutBlock(block);
0
106 QRectF br;-
107 if (block.isVisible()
block.isVisible()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
108 br = QRectF(QPointF(0, 0), tl->boundingRect().bottomRight());-
109 if (tl->lineCount() == 1
tl->lineCount() == 1Description
TRUEnever evaluated
FALSEnever evaluated
)
0
110 br.setWidth(qMax(br.width(), tl->lineAt(0).naturalTextWidth()));
never executed: br.setWidth(qMax(br.width(), tl->lineAt(0).naturalTextWidth()));
0
111 qreal margin = document()->documentMargin();-
112 br.adjust(0, 0, margin, 0);-
113 if (!block.next().isValid()
!block.next().isValid()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
114 br.adjust(0, 0, 0, margin);
never executed: br.adjust(0, 0, 0, margin);
0
115 }
never executed: end of block
0
116 return
never executed: return br;
br;
never executed: return br;
0
117-
118}-
119-
120-
121-
122-
123void QPlainTextDocumentLayout::ensureBlockLayout(const QTextBlock &block) const-
124{-
125 if (!block.isValid()
!block.isValid()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
126 return;
never executed: return;
0
127 QTextLayout *tl = block.layout();-
128 if (!tl->lineCount()
!tl->lineCount()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
129 const_cast<
never executed: const_cast<QPlainTextDocumentLayout*>(this)->layoutBlock(block);
QPlainTextDocumentLayout*>(this)->layoutBlock(block);
never executed: const_cast<QPlainTextDocumentLayout*>(this)->layoutBlock(block);
0
130}
never executed: end of block
0
131-
132-
133-
134-
135-
136-
137void QPlainTextDocumentLayout::setCursorWidth(int width)-
138{-
139 QPlainTextDocumentLayoutPrivate * const d = d_func();-
140 d->cursorWidth = width;-
141}
never executed: end of block
0
142-
143int QPlainTextDocumentLayout::cursorWidth() const-
144{-
145 const QPlainTextDocumentLayoutPrivate * const d = d_func();-
146 return
never executed: return d->cursorWidth;
d->cursorWidth;
never executed: return d->cursorWidth;
0
147}-
148-
149QPlainTextDocumentLayoutPrivate *QPlainTextDocumentLayout::priv() const-
150{-
151 const QPlainTextDocumentLayoutPrivate * const d = d_func();-
152 return
never executed: return const_cast<QPlainTextDocumentLayoutPrivate*>(d);
const_cast<QPlainTextDocumentLayoutPrivate*>(d);
never executed: return const_cast<QPlainTextDocumentLayoutPrivate*>(d);
0
153}-
154-
155-
156-
157-
158-
159-
160void QPlainTextDocumentLayout::requestUpdate()-
161{-
162 update(QRectF(0., -document()->documentMargin(), 1000000000., 1000000000.));-
163}
never executed: end of block
0
164-
165-
166void QPlainTextDocumentLayout::setTextWidth(qreal newWidth)-
167{-
168 QPlainTextDocumentLayoutPrivate * const d = d_func();-
169 d->width = d->maximumWidth = newWidth;-
170 d->relayout();-
171}
never executed: end of block
0
172-
173qreal QPlainTextDocumentLayout::textWidth() const-
174{-
175 const QPlainTextDocumentLayoutPrivate * const d = d_func();-
176 return
never executed: return d->width;
d->width;
never executed: return d->width;
0
177}-
178-
179void QPlainTextDocumentLayoutPrivate::relayout()-
180{-
181 QPlainTextDocumentLayout * const q = q_func();-
182 QTextBlock block = q->document()->firstBlock();-
183 while (block.isValid()
block.isValid()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
184 block.layout()->clearLayout();-
185 block.setLineCount(block.isVisible() ? 1 : 0);-
186 block = block.next();-
187 }
never executed: end of block
0
188 q->update();-
189}
never executed: end of block
0
190-
191-
192-
193-
194void QPlainTextDocumentLayout::documentChanged(int from, int charsRemoved, int charsAdded)-
195{-
196 QPlainTextDocumentLayoutPrivate * const d = d_func();-
197 QTextDocument *doc = document();-
198 int newBlockCount = doc->blockCount();-
199 int charsChanged = charsRemoved + charsAdded;-
200-
201 QTextBlock changeStartBlock = doc->findBlock(from);-
202 QTextBlock changeEndBlock = doc->findBlock(qMax(0, from + charsChanged - 1));-
203-
204 if (changeStartBlock == changeEndBlock
changeStartBlo...changeEndBlockDescription
TRUEnever evaluated
FALSEnever evaluated
&& newBlockCount == d->blockCount
newBlockCount == d->blockCountDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
205 QTextBlock block = changeStartBlock;-
206 if (block.isValid()
block.isValid()Description
TRUEnever evaluated
FALSEnever evaluated
&& block.length()
block.length()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
207 QRectF oldBr = blockBoundingRect(block);-
208 layoutBlock(block);-
209 QRectF newBr = blockBoundingRect(block);-
210 if (newBr.height() == oldBr.height()
newBr.height()...oldBr.height()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
211 if (!d->blockUpdate
!d->blockUpdateDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
212 updateBlock(block);
never executed: updateBlock(block);
0
213 return;
never executed: return;
0
214 }-
215 }
never executed: end of block
0
216 }
never executed: end of block
else {
0
217 QTextBlock block = changeStartBlock;-
218 do {-
219 block.clearLayout();-
220 if (block == changeEndBlock
block == changeEndBlockDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
221 break;
never executed: break;
0
222 block = block.next();-
223 }
never executed: end of block
while(block.isValid()
block.isValid()Description
TRUEnever evaluated
FALSEnever evaluated
);
0
224 }
never executed: end of block
0
225-
226 if (newBlockCount != d->blockCount
newBlockCount != d->blockCountDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
227-
228 int changeEnd = changeEndBlock.blockNumber();-
229 int blockDiff = newBlockCount - d->blockCount;-
230 int oldChangeEnd = changeEnd - blockDiff;-
231-
232 if (d->maximumWidthBlockNumber > oldChangeEnd
d->maximumWidt...> oldChangeEndDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
233 d->maximumWidthBlockNumber += blockDiff;
never executed: d->maximumWidthBlockNumber += blockDiff;
0
234-
235 d->blockCount = newBlockCount;-
236 if (d->blockCount == 1
d->blockCount == 1Description
TRUEnever evaluated
FALSEnever evaluated
)
0
237 d->maximumWidth = blockWidth(doc->firstBlock());
never executed: d->maximumWidth = blockWidth(doc->firstBlock());
0
238-
239 if (!d->blockDocumentSizeChanged
!d->blockDocumentSizeChangedDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
240 documentSizeChanged(documentSize());
never executed: documentSizeChanged(documentSize());
0
241-
242 if (blockDiff == 1
blockDiff == 1Description
TRUEnever evaluated
FALSEnever evaluated
&& changeEnd == newBlockCount -1
changeEnd == newBlockCount -1Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
243 if (!d->blockUpdate
!d->blockUpdateDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
244 QTextBlock b = changeStartBlock;-
245 for(;;) {-
246 updateBlock(b);-
247 if (b == changeEndBlock
b == changeEndBlockDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
248 break;
never executed: break;
0
249 b = b.next();-
250 }
never executed: end of block
0
251 }
never executed: end of block
0
252 return;
never executed: return;
0
253 }-
254 }
never executed: end of block
0
255-
256 if (!d->blockUpdate
!d->blockUpdateDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
257 update(QRectF(0., -doc->documentMargin(), 1000000000., 1000000000.));
never executed: update(QRectF(0., -doc->documentMargin(), 1000000000., 1000000000.));
0
258}
never executed: end of block
0
259-
260-
261void QPlainTextDocumentLayout::layoutBlock(const QTextBlock &block)-
262{-
263 QPlainTextDocumentLayoutPrivate * const d = d_func();-
264 QTextDocument *doc = document();-
265 qreal margin = doc->documentMargin();-
266 qreal blockMaximumWidth = 0;-
267-
268 qreal height = 0;-
269 QTextLayout *tl = block.layout();-
270 QTextOption option = doc->defaultTextOption();-
271 tl->setTextOption(option);-
272-
273 int extraMargin = 0;-
274 if (option.flags() & QTextOption::AddSpaceForLineAndParagraphSeparators
option.flags()...raphSeparatorsDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
275 QFontMetrics fm(block.charFormat().font());-
276 extraMargin += fm.width(QChar(0x21B5));-
277 }
never executed: end of block
0
278 tl->beginLayout();-
279 qreal availableWidth = d->width;-
280 if (availableWidth <= 0
availableWidth <= 0Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
281 availableWidth = qreal(2147483647);-
282 }
never executed: end of block
0
283 availableWidth -= 2*margin + extraMargin;-
284 while (1) {-
285 QTextLine line = tl->createLine();-
286 if (!line.isValid()
!line.isValid()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
287 break;
never executed: break;
0
288 line.setLeadingIncluded(true);-
289 line.setLineWidth(availableWidth);-
290 line.setPosition(QPointF(margin, height));-
291 height += line.height();-
292 blockMaximumWidth = qMax(blockMaximumWidth, line.naturalTextWidth() + 2*margin);-
293 }
never executed: end of block
0
294 tl->endLayout();-
295-
296 int previousLineCount = doc->lineCount();-
297 const_cast<QTextBlock&>(block).setLineCount(block.isVisible() ? tl->lineCount() : 0);-
298 int lineCount = doc->lineCount();-
299-
300 bool emitDocumentSizeChanged = previousLineCount != lineCount;-
301 if (blockMaximumWidth > d->maximumWidth
blockMaximumWi...->maximumWidthDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
302-
303 d->maximumWidth = blockMaximumWidth;-
304 d->maximumWidthBlockNumber = block.blockNumber();-
305 emitDocumentSizeChanged = true;-
306 }
never executed: end of block
else if (block.blockNumber() == d->maximumWidthBlockNumber
block.blockNum...dthBlockNumberDescription
TRUEnever evaluated
FALSEnever evaluated
&& blockMaximumWidth < d->maximumWidth
blockMaximumWi...->maximumWidthDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
307-
308 QTextBlock b = doc->firstBlock();-
309 d->maximumWidth = 0;-
310 QTextBlock maximumBlock;-
311 while (b.isValid()
b.isValid()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
312 qreal blockMaximumWidth = blockWidth(b);-
313 if (blockMaximumWidth > d->maximumWidth
blockMaximumWi...->maximumWidthDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
314 d->maximumWidth = blockMaximumWidth;-
315 maximumBlock = b;-
316 }
never executed: end of block
0
317 b = b.next();-
318 }
never executed: end of block
0
319 if (maximumBlock.isValid()
maximumBlock.isValid()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
320 d->maximumWidthBlockNumber = maximumBlock.blockNumber();-
321 emitDocumentSizeChanged = true;-
322 }
never executed: end of block
0
323 }
never executed: end of block
0
324 if (emitDocumentSizeChanged
emitDocumentSizeChangedDescription
TRUEnever evaluated
FALSEnever evaluated
&& !d->blockDocumentSizeChanged
!d->blockDocumentSizeChangedDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
325 documentSizeChanged(documentSize());
never executed: documentSizeChanged(documentSize());
0
326}
never executed: end of block
0
327-
328qreal QPlainTextDocumentLayout::blockWidth(const QTextBlock &block)-
329{-
330 QTextLayout *layout = block.layout();-
331 if (!layout->lineCount()
!layout->lineCount()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
332 return
never executed: return 0;
0;
never executed: return 0;
0
333 qreal blockWidth = 0;-
334 for (int i = 0; i < layout->lineCount()
i < layout->lineCount()Description
TRUEnever evaluated
FALSEnever evaluated
; ++i) {
0
335 QTextLine line = layout->lineAt(i);-
336 blockWidth = qMax(line.naturalTextWidth() + 8, blockWidth);-
337 }
never executed: end of block
0
338 return
never executed: return blockWidth;
blockWidth;
never executed: return blockWidth;
0
339}-
340-
341-
342QPlainTextEditControl::QPlainTextEditControl(QPlainTextEdit *parent)-
343 : QWidgetTextControl(parent), textEdit(parent),-
344 topBlock(0)-
345{-
346 setAcceptRichText(false);-
347}
never executed: end of block
0
348-
349void QPlainTextEditPrivate::_q_cursorPositionChanged()-
350{-
351 pageUpDownLastCursorYIsValid = false;-
352 QPlainTextEdit * const q = q_func();-
353-
354 QAccessibleTextCursorEvent ev(q, q->textCursor().position());-
355 QAccessible::updateAccessibility(&ev);-
356-
357 q->cursorPositionChanged();-
358}
never executed: end of block
0
359-
360void QPlainTextEditPrivate::_q_verticalScrollbarActionTriggered(int action) {-
361 if (action == QAbstractSlider::SliderPageStepAdd
action == QAbs...derPageStepAddDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
362 pageUpDown(QTextCursor::Down, QTextCursor::MoveAnchor, false);-
363 }
never executed: end of block
else if (action == QAbstractSlider::SliderPageStepSub
action == QAbs...derPageStepSubDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
364 pageUpDown(QTextCursor::Up, QTextCursor::MoveAnchor, false);-
365 }
never executed: end of block
0
366}
never executed: end of block
0
367-
368QMimeData *QPlainTextEditControl::createMimeDataFromSelection() const {-
369 QPlainTextEdit *ed = qobject_cast<QPlainTextEdit *>(parent());-
370 if (!ed
!edDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
371 return
never executed: return QWidgetTextControl::createMimeDataFromSelection();
QWidgetTextControl::createMimeDataFromSelection();
never executed: return QWidgetTextControl::createMimeDataFromSelection();
0
372 return
never executed: return ed->createMimeDataFromSelection();
ed->createMimeDataFromSelection();
never executed: return ed->createMimeDataFromSelection();
0
373 }-
374bool QPlainTextEditControl::canInsertFromMimeData(const QMimeData *source) const {-
375 QPlainTextEdit *ed = qobject_cast<QPlainTextEdit *>(parent());-
376 if (!ed
!edDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
377 return
never executed: return QWidgetTextControl::canInsertFromMimeData(source);
QWidgetTextControl::canInsertFromMimeData(source);
never executed: return QWidgetTextControl::canInsertFromMimeData(source);
0
378 return
never executed: return ed->canInsertFromMimeData(source);
ed->canInsertFromMimeData(source);
never executed: return ed->canInsertFromMimeData(source);
0
379}-
380void QPlainTextEditControl::insertFromMimeData(const QMimeData *source) {-
381 QPlainTextEdit *ed = qobject_cast<QPlainTextEdit *>(parent());-
382 if (!ed
!edDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
383 QWidgetTextControl::insertFromMimeData(source);
never executed: QWidgetTextControl::insertFromMimeData(source);
0
384 else-
385 ed->insertFromMimeData(source);
never executed: ed->insertFromMimeData(source);
0
386}-
387-
388qreal QPlainTextEditPrivate::verticalOffset(int topBlock, int topLine) const-
389{-
390 qreal offset = 0;-
391 QTextDocument *doc = control->document();-
392-
393 if (topLine
topLineDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
394 QTextBlock currentBlock = doc->findBlockByNumber(topBlock);-
395 QPlainTextDocumentLayout *documentLayout = qobject_cast<QPlainTextDocumentLayout*>(doc->documentLayout());-
396 ((!(documentLayout)) ? qt_assert("documentLayout",__FILE__,487) : qt_noop());-
397 QRectF r = documentLayout->blockBoundingRect(currentBlock);-
398 (void)r;;-
399 QTextLayout *layout = currentBlock.layout();-
400 if (layout
layoutDescription
TRUEnever evaluated
FALSEnever evaluated
&& topLine <= layout->lineCount()
topLine <= layout->lineCount()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
401 QTextLine line = layout->lineAt(topLine - 1);-
402 const QRectF lr = line.naturalTextRect();-
403 offset = lr.bottom();-
404 }
never executed: end of block
0
405 }
never executed: end of block
0
406 if (topBlock == 0
topBlock == 0Description
TRUEnever evaluated
FALSEnever evaluated
&& topLine == 0
topLine == 0Description
TRUEnever evaluated
FALSEnever evaluated
)
0
407 offset -= doc->documentMargin();
never executed: offset -= doc->documentMargin();
0
408 return
never executed: return offset;
offset;
never executed: return offset;
0
409}-
410-
411-
412qreal QPlainTextEditPrivate::verticalOffset() const {-
413 return
never executed: return verticalOffset(control->topBlock, topLine) + topLineFracture;
verticalOffset(control->topBlock, topLine) + topLineFracture;
never executed: return verticalOffset(control->topBlock, topLine) + topLineFracture;
0
414}-
415-
416-
417QTextBlock QPlainTextEditControl::firstVisibleBlock() const-
418{-
419 return
never executed: return document()->findBlockByNumber(topBlock);
document()->findBlockByNumber(topBlock);
never executed: return document()->findBlockByNumber(topBlock);
0
420}-
421-
422-
423-
424int QPlainTextEditControl::hitTest(const QPointF &point, Qt::HitTestAccuracy ) const {-
425 int currentBlockNumber = topBlock;-
426 QTextBlock currentBlock = document()->findBlockByNumber(currentBlockNumber);-
427 if (!currentBlock.isValid()
!currentBlock.isValid()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
428 return
never executed: return -1;
-1;
never executed: return -1;
0
429-
430 QPlainTextDocumentLayout *documentLayout = qobject_cast<QPlainTextDocumentLayout*>(document()->documentLayout());-
431 ((!(documentLayout)) ? qt_assert("documentLayout",__FILE__,522) : qt_noop());-
432-
433 QPointF offset;-
434 QRectF r = documentLayout->blockBoundingRect(currentBlock);-
435 while (currentBlock.next().isValid()
currentBlock.next().isValid()Description
TRUEnever evaluated
FALSEnever evaluated
&& r.bottom() + offset.y() <= point.y()
r.bottom() + o...) <= point.y()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
436 offset.ry() += r.height();-
437 currentBlock = currentBlock.next();-
438 ++currentBlockNumber;-
439 r = documentLayout->blockBoundingRect(currentBlock);-
440 }
never executed: end of block
0
441 while (currentBlock.previous().isValid()
currentBlock.p...us().isValid()Description
TRUEnever evaluated
FALSEnever evaluated
&& r.top() + offset.y() > point.y()
r.top() + offs...() > point.y()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
442 offset.ry() -= r.height();-
443 currentBlock = currentBlock.previous();-
444 --currentBlockNumber;-
445 r = documentLayout->blockBoundingRect(currentBlock);-
446 }
never executed: end of block
0
447-
448-
449 if (!currentBlock.isValid()
!currentBlock.isValid()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
450 return
never executed: return -1;
-1;
never executed: return -1;
0
451 QTextLayout *layout = currentBlock.layout();-
452 int off = 0;-
453 QPointF pos = point - offset;-
454 for (int i = 0; i < layout->lineCount()
i < layout->lineCount()Description
TRUEnever evaluated
FALSEnever evaluated
; ++i) {
0
455 QTextLine line = layout->lineAt(i);-
456 const QRectF lr = line.naturalTextRect();-
457 if (lr.top() > pos.y()
lr.top() > pos.y()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
458 off = qMin(off, line.textStart());-
459 }
never executed: end of block
else if (lr.bottom() <= pos.y()
lr.bottom() <= pos.y()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
460 off = qMax(off, line.textStart() + line.textLength());-
461 }
never executed: end of block
else {
0
462 off = line.xToCursor(pos.x(), overwriteMode() ?-
463 QTextLine::CursorOnCharacter : QTextLine::CursorBetweenCharacters);-
464 break;
never executed: break;
0
465 }-
466 }-
467-
468 return
never executed: return currentBlock.position() + off;
currentBlock.position() + off;
never executed: return currentBlock.position() + off;
0
469}-
470-
471QRectF QPlainTextEditControl::blockBoundingRect(const QTextBlock &block) const {-
472 int currentBlockNumber = topBlock;-
473 int blockNumber = block.blockNumber();-
474 QTextBlock currentBlock = document()->findBlockByNumber(currentBlockNumber);-
475 if (!currentBlock.isValid()
!currentBlock.isValid()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
476 return
never executed: return QRectF();
QRectF();
never executed: return QRectF();
0
477 ((!(currentBlock.blockNumber() == currentBlockNumber)) ? qt_assert("currentBlock.blockNumber() == currentBlockNumber",__FILE__,568) : qt_noop());-
478 QTextDocument *doc = document();-
479 QPlainTextDocumentLayout *documentLayout = qobject_cast<QPlainTextDocumentLayout*>(doc->documentLayout());-
480 ((!(documentLayout)) ? qt_assert("documentLayout",__FILE__,571) : qt_noop());-
481-
482 QPointF offset;-
483 if (!block.isValid()
!block.isValid()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
484 return
never executed: return QRectF();
QRectF();
never executed: return QRectF();
0
485 QRectF r = documentLayout->blockBoundingRect(currentBlock);-
486 int maxVerticalOffset = r.height();-
487 while (currentBlockNumber < blockNumber
currentBlockNu... < blockNumberDescription
TRUEnever evaluated
FALSEnever evaluated
&& offset.y() - maxVerticalOffset <= 2* textEdit->viewport()->height()
offset.y() - m...rt()->height()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
488 offset.ry() += r.height();-
489 currentBlock = currentBlock.next();-
490 ++currentBlockNumber;-
491 if (!currentBlock.isVisible()
!currentBlock.isVisible()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
492 currentBlock = doc->findBlockByLineNumber(currentBlock.firstLineNumber());-
493 currentBlockNumber = currentBlock.blockNumber();-
494 }
never executed: end of block
0
495 r = documentLayout->blockBoundingRect(currentBlock);-
496 }
never executed: end of block
0
497 while (currentBlockNumber > blockNumber
currentBlockNu... > blockNumberDescription
TRUEnever evaluated
FALSEnever evaluated
&& offset.y() + maxVerticalOffset >= -textEdit->viewport()->height()
offset.y() + m...rt()->height()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
498 currentBlock = currentBlock.previous();-
499 --currentBlockNumber;-
500 while (!currentBlock.isVisible()
!currentBlock.isVisible()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
501 currentBlock = currentBlock.previous();-
502 --currentBlockNumber;-
503 }
never executed: end of block
0
504 if (!currentBlock.isValid()
!currentBlock.isValid()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
505 break;
never executed: break;
0
506-
507 r = documentLayout->blockBoundingRect(currentBlock);-
508 offset.ry() -= r.height();-
509 }
never executed: end of block
0
510-
511 if (currentBlockNumber != blockNumber
currentBlockNu...!= blockNumberDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
512-
513-
514 r = documentLayout->blockBoundingRect(block);-
515 if (currentBlockNumber > blockNumber
currentBlockNu... > blockNumberDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
516 offset.ry() -= r.height();
never executed: offset.ry() -= r.height();
0
517 }
never executed: end of block
0
518 r.translate(offset);-
519 return
never executed: return r;
r;
never executed: return r;
0
520}-
521-
522QString QPlainTextEditControl::anchorAt(const QPointF &pos) const-
523{-
524 return
never executed: return textEdit->anchorAt(pos.toPoint());
textEdit->anchorAt(pos.toPoint());
never executed: return textEdit->anchorAt(pos.toPoint());
0
525}-
526-
527void QPlainTextEditPrivate::setTopLine(int visualTopLine, int dx)-
528{-
529 QTextDocument *doc = control->document();-
530 QTextBlock block = doc->findBlockByLineNumber(visualTopLine);-
531 int blockNumber = block.blockNumber();-
532 int lineNumber = visualTopLine - block.firstLineNumber();-
533 setTopBlock(blockNumber, lineNumber, dx);-
534}
never executed: end of block
0
535-
536void QPlainTextEditPrivate::setTopBlock(int blockNumber, int lineNumber, int dx)-
537{-
538 QPlainTextEdit * const q = q_func();-
539 blockNumber = qMax(0, blockNumber);-
540 lineNumber = qMax(0, lineNumber);-
541 QTextDocument *doc = control->document();-
542 QTextBlock block = doc->findBlockByNumber(blockNumber);-
543-
544 int newTopLine = block.firstLineNumber() + lineNumber;-
545 int maxTopLine = vbar->maximum();-
546-
547 if (newTopLine > maxTopLine
newTopLine > maxTopLineDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
548 block = doc->findBlockByLineNumber(maxTopLine);-
549 blockNumber = block.blockNumber();-
550 lineNumber = maxTopLine - block.firstLineNumber();-
551 }
never executed: end of block
0
552-
553 {-
554 const QSignalBlocker blocker(vbar);-
555 vbar->setValue(newTopLine);-
556 }-
557-
558 if (!dx
!dxDescription
TRUEnever evaluated
FALSEnever evaluated
&& blockNumber == control->topBlock
blockNumber ==...trol->topBlockDescription
TRUEnever evaluated
FALSEnever evaluated
&& lineNumber == topLine
lineNumber == topLineDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
559 return;
never executed: return;
0
560-
561 if (viewport->updatesEnabled()
viewport->updatesEnabled()Description
TRUEnever evaluated
FALSEnever evaluated
&& viewport->isVisible()
viewport->isVisible()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
562 int dy = 0;-
563 if (doc->findBlockByNumber(control->topBlock).isValid()
doc->findBlock...ock).isValid()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
564 qreal realdy = -q->blockBoundingGeometry(block).y()-
565 + verticalOffset() - verticalOffset(blockNumber, lineNumber);-
566 dy = (int)realdy;-
567 topLineFracture = realdy - dy;-
568 }
never executed: end of block
0
569 control->topBlock = blockNumber;-
570 topLine = lineNumber;-
571-
572 {-
573 const QSignalBlocker blocker(vbar);-
574 vbar->setValue(block.firstLineNumber() + lineNumber);-
575 }-
576-
577 if (dx
dxDescription
TRUEnever evaluated
FALSEnever evaluated
|| dy
dyDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
578 viewport->scroll(q->isRightToLeft() ? -dx : dx, dy);-
579 QGuiApplication::inputMethod()->update(Qt::ImCursorRectangle | Qt::ImAnchorRectangle);-
580 }
never executed: end of block
else {
0
581 viewport->update();-
582 topLineFracture = 0;-
583 }
never executed: end of block
0
584 q->updateRequest(viewport->rect(), dy);-
585 }
never executed: end of block
else {
0
586 control->topBlock = blockNumber;-
587 topLine = lineNumber;-
588 topLineFracture = 0;-
589 }
never executed: end of block
0
590-
591}-
592-
593-
594-
595void QPlainTextEditPrivate::ensureVisible(int position, bool center, bool forceCenter) {-
596 QPlainTextEdit * const q = q_func();-
597 QRectF visible = QRectF(viewport->rect()).translated(-q->contentOffset());-
598 QTextBlock block = control->document()->findBlock(position);-
599 if (!block.isValid()
!block.isValid()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
600 return;
never executed: return;
0
601 QRectF br = control->blockBoundingRect(block);-
602 if (!br.isValid()
!br.isValid()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
603 return;
never executed: return;
0
604 QTextLine line = block.layout()->lineForTextPosition(position - block.position());-
605 ((!(line.isValid())) ? qt_assert("line.isValid()",__FILE__,696) : qt_noop());-
606 QRectF lr = line.naturalTextRect().translated(br.topLeft());-
607-
608 if (lr.bottom() >= visible.bottom()
lr.bottom() >=...sible.bottom()Description
TRUEnever evaluated
FALSEnever evaluated
|| (center
centerDescription
TRUEnever evaluated
FALSEnever evaluated
&& lr.top() < visible.top()
lr.top() < visible.top()Description
TRUEnever evaluated
FALSEnever evaluated
) || forceCenter
forceCenterDescription
TRUEnever evaluated
FALSEnever evaluated
){
0
609-
610 qreal height = visible.height();-
611 if (center
centerDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
612 height /= 2;
never executed: height /= 2;
0
613-
614 qreal h = center
centerDescription
TRUEnever evaluated
FALSEnever evaluated
? line.naturalTextRect().center().y() : line.naturalTextRect().bottom();
0
615-
616 QTextBlock previousVisibleBlock = block;-
617 while (h < height
h < heightDescription
TRUEnever evaluated
FALSEnever evaluated
&& block.previous().isValid()
block.previous().isValid()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
618 previousVisibleBlock = block;-
619 do {-
620 block = block.previous();-
621 }
never executed: end of block
while (!block.isVisible()
!block.isVisible()Description
TRUEnever evaluated
FALSEnever evaluated
&& block.previous().isValid()
block.previous().isValid()Description
TRUEnever evaluated
FALSEnever evaluated
);
0
622 h += q->blockBoundingRect(block).height();-
623 }
never executed: end of block
0
624-
625 int l = 0;-
626 int lineCount = block.layout()->lineCount();-
627 qreal voffset = verticalOffset(block.blockNumber(), 0);-
628 while (l < lineCount
l < lineCountDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
629 QRectF lineRect = block.layout()->lineAt(l).naturalTextRect();-
630 if (h - voffset - lineRect.top() <= height
h - voffset - ...op() <= heightDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
631 break;
never executed: break;
0
632 ++l;-
633 }
never executed: end of block
0
634-
635 if (l >= lineCount
l >= lineCountDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
636 block = previousVisibleBlock;-
637 l = 0;-
638 }
never executed: end of block
0
639 setTopBlock(block.blockNumber(), l);-
640 }
never executed: end of block
else if (lr.top() < visible.top()
lr.top() < visible.top()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
641 setTopBlock(block.blockNumber(), line.lineNumber());-
642 }
never executed: end of block
0
643-
644}
never executed: end of block
0
645-
646-
647void QPlainTextEditPrivate::updateViewport()-
648{-
649 QPlainTextEdit * const q = q_func();-
650 viewport->update();-
651 q->updateRequest(viewport->rect(), 0);-
652}
never executed: end of block
0
653-
654QPlainTextEditPrivate::QPlainTextEditPrivate()-
655 : control(0),-
656 tabChangesFocus(false),-
657 lineWrap(QPlainTextEdit::WidgetWidth),-
658 wordWrap(QTextOption::WrapAtWordBoundaryOrAnywhere),-
659 clickCausedFocus(0),topLine(0),topLineFracture(0),-
660 pageUpDownLastCursorYIsValid(false)-
661{-
662 showCursorOnInitialShow = true;-
663 backgroundVisible = false;-
664 centerOnScroll = false;-
665 inDrag = false;-
666}
never executed: end of block
0
667-
668-
669void QPlainTextEditPrivate::init(const QString &txt)-
670{-
671 QPlainTextEdit * const q = q_func();-
672 control = new QPlainTextEditControl(q);-
673-
674 QTextDocument *doc = new QTextDocument(control);-
675 QAbstractTextDocumentLayout *layout = new QPlainTextDocumentLayout(doc);-
676 doc->setDocumentLayout(layout);-
677 control->setDocument(doc);-
678-
679 control->setPalette(q->palette());-
680-
681 QObject::connect(vbar, qFlagLocation("2""actionTriggered(int)" "\0" __FILE__ ":" "772"), q, qFlagLocation("1""_q_verticalScrollbarActionTriggered(int)" "\0" __FILE__ ":" "772"));-
682-
683 QObject::connect(control, qFlagLocation("2""microFocusChanged()" "\0" __FILE__ ":" "774"), q, qFlagLocation("1""updateMicroFocus()" "\0" __FILE__ ":" "774"));-
684 QObject::connect(control, qFlagLocation("2""documentSizeChanged(QSizeF)" "\0" __FILE__ ":" "775"), q, qFlagLocation("1""_q_adjustScrollbars()" "\0" __FILE__ ":" "775"));-
685 QObject::connect(control, qFlagLocation("2""blockCountChanged(int)" "\0" __FILE__ ":" "776"), q, qFlagLocation("2""blockCountChanged(int)" "\0" __FILE__ ":" "776"));-
686 QObject::connect(control, qFlagLocation("2""updateRequest(QRectF)" "\0" __FILE__ ":" "777"), q, qFlagLocation("1""_q_repaintContents(QRectF)" "\0" __FILE__ ":" "777"));-
687 QObject::connect(control, qFlagLocation("2""modificationChanged(bool)" "\0" __FILE__ ":" "778"), q, qFlagLocation("2""modificationChanged(bool)" "\0" __FILE__ ":" "778"));-
688-
689 QObject::connect(control, qFlagLocation("2""textChanged()" "\0" __FILE__ ":" "780"), q, qFlagLocation("2""textChanged()" "\0" __FILE__ ":" "780"));-
690 QObject::connect(control, qFlagLocation("2""undoAvailable(bool)" "\0" __FILE__ ":" "781"), q, qFlagLocation("2""undoAvailable(bool)" "\0" __FILE__ ":" "781"));-
691 QObject::connect(control, qFlagLocation("2""redoAvailable(bool)" "\0" __FILE__ ":" "782"), q, qFlagLocation("2""redoAvailable(bool)" "\0" __FILE__ ":" "782"));-
692 QObject::connect(control, qFlagLocation("2""copyAvailable(bool)" "\0" __FILE__ ":" "783"), q, qFlagLocation("2""copyAvailable(bool)" "\0" __FILE__ ":" "783"));-
693 QObject::connect(control, qFlagLocation("2""selectionChanged()" "\0" __FILE__ ":" "784"), q, qFlagLocation("2""selectionChanged()" "\0" __FILE__ ":" "784"));-
694 QObject::connect(control, qFlagLocation("2""cursorPositionChanged()" "\0" __FILE__ ":" "785"), q, qFlagLocation("1""_q_cursorPositionChanged()" "\0" __FILE__ ":" "785"));-
695-
696 QObject::connect(control, qFlagLocation("2""textChanged()" "\0" __FILE__ ":" "787"), q, qFlagLocation("1""updateMicroFocus()" "\0" __FILE__ ":" "787"));-
697-
698-
699-
700-
701 doc->setTextWidth(-1);-
702 doc->documentLayout()->setPaintDevice(viewport);-
703 doc->setDefaultFont(q->font());-
704-
705-
706 if (!txt.isEmpty()
!txt.isEmpty()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
707 control->setPlainText(txt);
never executed: control->setPlainText(txt);
0
708-
709 hbar->setSingleStep(20);-
710 vbar->setSingleStep(1);-
711-
712 viewport->setBackgroundRole(QPalette::Base);-
713 q->setAcceptDrops(true);-
714 q->setFocusPolicy(Qt::StrongFocus);-
715 q->setAttribute(Qt::WA_KeyCompression);-
716 q->setAttribute(Qt::WA_InputMethodEnabled);-
717 q->setInputMethodHints(Qt::ImhMultiLine);-
718-
719-
720 viewport->setCursor(Qt::IBeamCursor);-
721-
722 originalOffsetY = 0;-
723-
724-
725-
726}
never executed: end of block
0
727-
728void QPlainTextEditPrivate::_q_repaintContents(const QRectF &contentsRect)-
729{-
730 QPlainTextEdit * const q = q_func();-
731 if (!contentsRect.isValid()
!contentsRect.isValid()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
732 updateViewport();-
733 return;
never executed: return;
0
734 }-
735 const int xOffset = horizontalOffset();-
736 const int yOffset = (int)verticalOffset();-
737 const QRect visibleRect(xOffset, yOffset, viewport->width(), viewport->height());-
738-
739 QRect r = contentsRect.adjusted(-1, -1, 1, 1).intersected(visibleRect).toAlignedRect();-
740 if (r.isEmpty()
r.isEmpty()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
741 return;
never executed: return;
0
742-
743 r.translate(-xOffset, -yOffset);-
744 viewport->update(r);-
745 q->updateRequest(r, 0);-
746}
never executed: end of block
0
747-
748void QPlainTextEditPrivate::pageUpDown(QTextCursor::MoveOperation op, QTextCursor::MoveMode moveMode, bool moveCursor)-
749{-
750-
751 QPlainTextEdit * const q = q_func();-
752-
753 QTextCursor cursor = control->textCursor();-
754 if (moveCursor
moveCursorDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
755 ensureCursorVisible();-
756 if (!pageUpDownLastCursorYIsValid
!pageUpDownLastCursorYIsValidDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
757 pageUpDownLastCursorY = control->cursorRect(cursor).top() - verticalOffset();
never executed: pageUpDownLastCursorY = control->cursorRect(cursor).top() - verticalOffset();
0
758 }
never executed: end of block
0
759-
760 qreal lastY = pageUpDownLastCursorY;-
761-
762-
763 if (op == QTextCursor::Down
op == QTextCursor::DownDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
764 QRectF visible = QRectF(viewport->rect()).translated(-q->contentOffset());-
765 QTextBlock firstVisibleBlock = q->firstVisibleBlock();-
766 QTextBlock block = firstVisibleBlock;-
767 QRectF br = q->blockBoundingRect(block);-
768 qreal h = 0;-
769 int atEnd = false;-
770 while (h + br.height() <= visible.bottom()
h + br.height(...sible.bottom()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
771 if (!block.next().isValid()
!block.next().isValid()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
772 atEnd = true;-
773 lastY = visible.bottom();-
774 break;
never executed: break;
0
775 }-
776 h += br.height();-
777 block = block.next();-
778 br = q->blockBoundingRect(block);-
779 }
never executed: end of block
0
780-
781 if (!atEnd
!atEndDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
782 int line = 0;-
783 qreal diff = visible.bottom() - h;-
784 int lineCount = block.layout()->lineCount();-
785 while (line < lineCount - 1
line < lineCount - 1Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
786 if (block.layout()->lineAt(line).naturalTextRect().bottom() > diff
block.layout()...ottom() > diffDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
787-
788 break;
never executed: break;
0
789 }-
790 ++line;-
791 }
never executed: end of block
0
792 setTopBlock(block.blockNumber(), line);-
793 }
never executed: end of block
0
794-
795 if (moveCursor
moveCursorDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
796-
797 lastY += verticalOffset();-
798 bool moved = false;-
799 do {-
800 moved = cursor.movePosition(op, moveMode);-
801 }
never executed: end of block
while (moved
movedDescription
TRUEnever evaluated
FALSEnever evaluated
&& control->cursorRect(cursor).top() < lastY
control->curso....top() < lastYDescription
TRUEnever evaluated
FALSEnever evaluated
);
0
802 }
never executed: end of block
0
803-
804 }
never executed: end of block
else if (op == QTextCursor::Up
op == QTextCursor::UpDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
805-
806 QRectF visible = QRectF(viewport->rect()).translated(-q->contentOffset());-
807 visible.translate(0, -visible.height());-
808 QTextBlock block = q->firstVisibleBlock();-
809 qreal h = 0;-
810 while (h >= visible.top()
h >= visible.top()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
811 if (!block.previous().isValid()
!block.previous().isValid()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
812 if (control->topBlock == 0
control->topBlock == 0Description
TRUEnever evaluated
FALSEnever evaluated
&& topLine == 0
topLine == 0Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
813 lastY = 0;-
814 }
never executed: end of block
0
815 break;
never executed: break;
0
816 }-
817 block = block.previous();-
818 QRectF br = q->blockBoundingRect(block);-
819 h -= br.height();-
820 }
never executed: end of block
0
821-
822 int line = 0;-
823 if (block.isValid()
block.isValid()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
824 qreal diff = visible.top() - h;-
825 int lineCount = block.layout()->lineCount();-
826 while (line < lineCount
line < lineCountDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
827 if (block.layout()->lineAt(line).naturalTextRect().top() >= diff
block.layout()....top() >= diffDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
828 break;
never executed: break;
0
829 ++line;-
830 }
never executed: end of block
0
831 if (line == lineCount
line == lineCountDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
832 if (block.next().isValid()
block.next().isValid()Description
TRUEnever evaluated
FALSEnever evaluated
&& block.next() != q->firstVisibleBlock()
block.next() !...VisibleBlock()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
833 block = block.next();-
834 line = 0;-
835 }
never executed: end of block
else {
0
836 --line;-
837 }
never executed: end of block
0
838 }-
839 }
never executed: end of block
0
840 setTopBlock(block.blockNumber(), line);-
841-
842 if (moveCursor
moveCursorDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
843 cursor.setVisualNavigation(true);-
844-
845 lastY += verticalOffset();-
846 bool moved = false;-
847 do {-
848 moved = cursor.movePosition(op, moveMode);-
849 }
never executed: end of block
while (moved
movedDescription
TRUEnever evaluated
FALSEnever evaluated
&& control->cursorRect(cursor).top() > lastY
control->curso....top() > lastYDescription
TRUEnever evaluated
FALSEnever evaluated
);
0
850 }
never executed: end of block
0
851 }
never executed: end of block
0
852-
853 if (moveCursor
moveCursorDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
854 control->setTextCursor(cursor);-
855 pageUpDownLastCursorYIsValid = true;-
856 }
never executed: end of block
0
857}
never executed: end of block
0
858-
859-
860-
861void QPlainTextEditPrivate::_q_adjustScrollbars()-
862{-
863 QPlainTextEdit * const q = q_func();-
864 QTextDocument *doc = control->document();-
865 QPlainTextDocumentLayout *documentLayout = qobject_cast<QPlainTextDocumentLayout*>(doc->documentLayout());-
866 ((!(documentLayout)) ? qt_assert("documentLayout",__FILE__,957) : qt_noop());-
867 bool documentSizeChangedBlocked = documentLayout->priv()->blockDocumentSizeChanged;-
868 documentLayout->priv()->blockDocumentSizeChanged = true;-
869 qreal margin = doc->documentMargin();-
870-
871 int vmax = 0;-
872-
873 int vSliderLength = 0;-
874 if (!centerOnScroll
!centerOnScrollDescription
TRUEnever evaluated
FALSEnever evaluated
&& q->isVisible()
q->isVisible()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
875 QTextBlock block = doc->lastBlock();-
876 const qreal visible = viewport->rect().height() - margin - 1;-
877 qreal y = 0;-
878 int visibleFromBottom = 0;-
879-
880 while (block.isValid()
block.isValid()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
881 if (!block.isVisible()
!block.isVisible()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
882 block = block.previous();-
883 continue;
never executed: continue;
0
884 }-
885 y += documentLayout->blockBoundingRect(block).height();-
886-
887 QTextLayout *layout = block.layout();-
888 int layoutLineCount = layout->lineCount();-
889 if (y > visible
y > visibleDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
890 int lineNumber = 0;-
891 while (lineNumber < layoutLineCount
lineNumber < layoutLineCountDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
892 QTextLine line = layout->lineAt(lineNumber);-
893 const QRectF lr = line.naturalTextRect();-
894 if (lr.top() >= y - visible
lr.top() >= y - visibleDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
895 break;
never executed: break;
0
896 ++lineNumber;-
897 }
never executed: end of block
0
898 if (lineNumber < layoutLineCount
lineNumber < layoutLineCountDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
899 visibleFromBottom += (layoutLineCount - lineNumber);
never executed: visibleFromBottom += (layoutLineCount - lineNumber);
0
900 break;
never executed: break;
0
901-
902 }-
903 visibleFromBottom += layoutLineCount;-
904 block = block.previous();-
905 }
never executed: end of block
0
906 vmax = qMax(0, doc->lineCount() - visibleFromBottom);-
907 vSliderLength = visibleFromBottom;-
908-
909 }
never executed: end of block
else {
0
910 vmax = qMax(0, doc->lineCount() - 1);-
911 int lineSpacing = q->fontMetrics().lineSpacing();-
912 vSliderLength = lineSpacing != 0
lineSpacing != 0Description
TRUEnever evaluated
FALSEnever evaluated
? viewport->height() / lineSpacing : 0;
0
913 }
never executed: end of block
0
914-
915-
916-
917 QSizeF documentSize = documentLayout->documentSize();-
918 vbar->setRange(0, qMax(0, vmax));-
919 vbar->setPageStep(vSliderLength);-
920 int visualTopLine = vmax;-
921 QTextBlock firstVisibleBlock = q->firstVisibleBlock();-
922 if (firstVisibleBlock.isValid()
firstVisibleBlock.isValid()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
923 visualTopLine = firstVisibleBlock.firstLineNumber() + topLine;
never executed: visualTopLine = firstVisibleBlock.firstLineNumber() + topLine;
0
924-
925 {-
926 const QSignalBlocker blocker(vbar);-
927 vbar->setValue(visualTopLine);-
928 }-
929-
930 hbar->setRange(0, (int)documentSize.width() - viewport->width());-
931 hbar->setPageStep(viewport->width());-
932 documentLayout->priv()->blockDocumentSizeChanged = documentSizeChangedBlocked;-
933 setTopLine(vbar->value());-
934}
never executed: end of block
0
935-
936-
937-
938-
939void QPlainTextEditPrivate::ensureViewportLayouted()-
940{-
941}-
942QPlainTextEdit::QPlainTextEdit(QWidget *parent)-
943 : QAbstractScrollArea(*new QPlainTextEditPrivate, parent)-
944{-
945 QPlainTextEditPrivate * const d = d_func();-
946 d->init();-
947}
never executed: end of block
0
948-
949-
950-
951-
952QPlainTextEdit::QPlainTextEdit(QPlainTextEditPrivate &dd, QWidget *parent)-
953 : QAbstractScrollArea(dd, parent)-
954{-
955 QPlainTextEditPrivate * const d = d_func();-
956 d->init();-
957}
never executed: end of block
0
958-
959-
960-
961-
962-
963QPlainTextEdit::QPlainTextEdit(const QString &text, QWidget *parent)-
964 : QAbstractScrollArea(*new QPlainTextEditPrivate, parent)-
965{-
966 QPlainTextEditPrivate * const d = d_func();-
967 d->init(text);-
968}
never executed: end of block
0
969-
970-
971-
972-
973-
974QPlainTextEdit::~QPlainTextEdit()-
975{-
976 QPlainTextEditPrivate * const d = d_func();-
977 if (d->documentLayoutPtr
d->documentLayoutPtrDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
978 if (d->documentLayoutPtr->priv()->mainViewPrivate == d
d->documentLay...ewPrivate == dDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
979 d->documentLayoutPtr->priv()->mainViewPrivate = 0;
never executed: d->documentLayoutPtr->priv()->mainViewPrivate = 0;
0
980 }
never executed: end of block
0
981}
never executed: end of block
0
982void QPlainTextEdit::setDocument(QTextDocument *document)-
983{-
984 QPlainTextEditPrivate * const d = d_func();-
985 QPlainTextDocumentLayout *documentLayout = 0;-
986-
987 if (!document
!documentDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
988 document = new QTextDocument(d->control);-
989 documentLayout = new QPlainTextDocumentLayout(document);-
990 document->setDocumentLayout(documentLayout);-
991 }
never executed: end of block
else {
0
992 documentLayout = qobject_cast<QPlainTextDocumentLayout*>(document->documentLayout());-
993 if (__builtin_expect(!!(!documentLayout), false)
__builtin_expe...ayout), false)Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
994 QMessageLogger(__FILE__, 1302, __PRETTY_FUNCTION__).warning("QPlainTextEdit::setDocument: Document set does not support QPlainTextDocumentLayout");-
995 return;
never executed: return;
0
996 }-
997 }
never executed: end of block
0
998 d->control->setDocument(document);-
999 if (!documentLayout->priv()->mainViewPrivate
!documentLayou...ainViewPrivateDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
1000 documentLayout->priv()->mainViewPrivate = d;
never executed: documentLayout->priv()->mainViewPrivate = d;
0
1001 d->documentLayoutPtr = documentLayout;-
1002 d->updateDefaultTextOption();-
1003 d->relayoutDocument();-
1004 d->_q_adjustScrollbars();-
1005}
never executed: end of block
0
1006-
1007-
1008-
1009-
1010-
1011-
1012QTextDocument *QPlainTextEdit::document() const-
1013{-
1014 const QPlainTextEditPrivate * const d = d_func();-
1015 return
never executed: return d->control->document();
d->control->document();
never executed: return d->control->document();
0
1016}-
1017void QPlainTextEdit::setPlaceholderText(const QString &placeholderText)-
1018{-
1019 QPlainTextEditPrivate * const d = d_func();-
1020 if (d->placeholderText != placeholderText
d->placeholder...laceholderTextDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
1021 d->placeholderText = placeholderText;-
1022 if (d->control->document()->isEmpty()
d->control->do...t()->isEmpty()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
1023 d->viewport->update();
never executed: d->viewport->update();
0
1024 }
never executed: end of block
0
1025}
never executed: end of block
0
1026-
1027QString QPlainTextEdit::placeholderText() const-
1028{-
1029 const QPlainTextEditPrivate * const d = d_func();-
1030 return
never executed: return d->placeholderText;
d->placeholderText;
never executed: return d->placeholderText;
0
1031}-
1032-
1033-
1034-
1035-
1036void QPlainTextEdit::setTextCursor(const QTextCursor &cursor)-
1037{-
1038 doSetTextCursor(cursor);-
1039}
never executed: end of block
0
1040-
1041-
1042-
1043-
1044-
1045-
1046-
1047void QPlainTextEdit::doSetTextCursor(const QTextCursor &cursor)-
1048{-
1049 QPlainTextEditPrivate * const d = d_func();-
1050 d->control->setTextCursor(cursor);-
1051}
never executed: end of block
0
1052-
1053-
1054-
1055-
1056-
1057-
1058QTextCursor QPlainTextEdit::textCursor() const-
1059{-
1060 const QPlainTextEditPrivate * const d = d_func();-
1061 return
never executed: return d->control->textCursor();
d->control->textCursor();
never executed: return d->control->textCursor();
0
1062}-
1063-
1064-
1065-
1066-
1067-
1068-
1069-
1070QString QPlainTextEdit::anchorAt(const QPoint &pos) const-
1071{-
1072 const QPlainTextEditPrivate * const d = d_func();-
1073 int cursorPos = d->control->hitTest(pos + QPointF(d->horizontalOffset(),-
1074 d->verticalOffset()),-
1075 Qt::ExactHit);-
1076 if (cursorPos < 0
cursorPos < 0Description
TRUEnever evaluated
FALSEnever evaluated
)
0
1077 return
never executed: return QString();
QString();
never executed: return QString();
0
1078-
1079 QTextDocumentPrivate *pieceTable = document()->docHandle();-
1080 QTextDocumentPrivate::FragmentIterator it = pieceTable->find(cursorPos);-
1081 QTextCharFormat fmt = pieceTable->formatCollection()->charFormat(it->format);-
1082 return
never executed: return fmt.anchorHref();
fmt.anchorHref();
never executed: return fmt.anchorHref();
0
1083}-
1084void QPlainTextEdit::undo()-
1085{-
1086 QPlainTextEditPrivate * const d = d_func();-
1087 d->control->undo();-
1088}
never executed: end of block
0
1089-
1090void QPlainTextEdit::redo()-
1091{-
1092 QPlainTextEditPrivate * const d = d_func();-
1093 d->control->redo();-
1094}
never executed: end of block
0
1095void QPlainTextEdit::cut()-
1096{-
1097 QPlainTextEditPrivate * const d = d_func();-
1098 d->control->cut();-
1099}
never executed: end of block
0
1100-
1101-
1102-
1103-
1104-
1105-
1106-
1107void QPlainTextEdit::copy()-
1108{-
1109 QPlainTextEditPrivate * const d = d_func();-
1110 d->control->copy();-
1111}
never executed: end of block
0
1112void QPlainTextEdit::paste()-
1113{-
1114 QPlainTextEditPrivate * const d = d_func();-
1115 d->control->paste();-
1116}
never executed: end of block
0
1117void QPlainTextEdit::clear()-
1118{-
1119 QPlainTextEditPrivate * const d = d_func();-
1120-
1121 d->control->topBlock = d->topLine = d->topLineFracture = 0;-
1122 d->control->clear();-
1123}
never executed: end of block
0
1124-
1125-
1126-
1127-
1128-
1129-
1130-
1131void QPlainTextEdit::selectAll()-
1132{-
1133 QPlainTextEditPrivate * const d = d_func();-
1134 d->control->selectAll();-
1135}
never executed: end of block
0
1136-
1137-
1138-
1139bool QPlainTextEdit::event(QEvent *e)-
1140{-
1141 QPlainTextEditPrivate * const d = d_func();-
1142-
1143-
1144 if (e->type() == QEvent::ContextMenu
e->type() == Q...t::ContextMenuDescription
TRUEnever evaluated
FALSEnever evaluated
0
1145 && static_cast<
static_cast<QC...vent::KeyboardDescription
TRUEnever evaluated
FALSEnever evaluated
QContextMenuEvent *>(e)->reason() == QContextMenuEvent::Keyboard
static_cast<QC...vent::KeyboardDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
1146 ensureCursorVisible();-
1147 const QPoint cursorPos = cursorRect().center();-
1148 QContextMenuEvent ce(QContextMenuEvent::Keyboard, cursorPos, d->viewport->mapToGlobal(cursorPos));-
1149 ce.setAccepted(e->isAccepted());-
1150 const bool result = QAbstractScrollArea::event(&ce);-
1151 e->setAccepted(ce.isAccepted());-
1152 return
never executed: return result;
result;
never executed: return result;
0
1153 }-
1154-
1155 if (e->type() == QEvent::ShortcutOverride
e->type() == Q...ortcutOverrideDescription
TRUEnever evaluated
FALSEnever evaluated
0
1156 || e->type() == QEvent::ToolTip
e->type() == QEvent::ToolTipDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
1157 d->sendControlEvent(e);-
1158 }
never executed: end of block
0
1159-
1160-
1161-
1162-
1163-
1164-
1165-
1166 else if (e->type() == QEvent::Gesture
e->type() == QEvent::GestureDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
1167 QGestureEvent *ge = static_cast<QGestureEvent *>(e);-
1168 QPanGesture *g = static_cast<QPanGesture *>(ge->gesture(Qt::PanGesture));-
1169 if (g
gDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
1170 QScrollBar *hBar = horizontalScrollBar();-
1171 QScrollBar *vBar = verticalScrollBar();-
1172 if (g->state() == Qt::GestureStarted
g->state() == ...GestureStartedDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
1173 d->originalOffsetY = vBar->value();
never executed: d->originalOffsetY = vBar->value();
0
1174 QPointF offset = g->offset();-
1175 if (!offset.isNull()
!offset.isNull()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
1176 if (QApplication::isRightToLeft()
QApplication::isRightToLeft()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
1177 offset.rx() *= -1;
never executed: offset.rx() *= -1;
0
1178-
1179 QFontMetrics fm(document()->defaultFont());-
1180 int lineHeight = fm.height();-
1181 int newX = hBar->value() - g->delta().x();-
1182 int newY = d->originalOffsetY - offset.y()/lineHeight;-
1183 hBar->setValue(newX);-
1184 vBar->setValue(newY);-
1185 }
never executed: end of block
0
1186 }
never executed: end of block
0
1187 return
never executed: return true;
true;
never executed: return true;
0
1188 }-
1189-
1190 return
never executed: return QAbstractScrollArea::event(e);
QAbstractScrollArea::event(e);
never executed: return QAbstractScrollArea::event(e);
0
1191}-
1192-
1193-
1194-
1195-
1196void QPlainTextEdit::timerEvent(QTimerEvent *e)-
1197{-
1198 QPlainTextEditPrivate * const d = d_func();-
1199 if (e->timerId() == d->autoScrollTimer.timerId()
e->timerId() =...imer.timerId()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
1200 QRect visible = d->viewport->rect();-
1201 QPoint pos;-
1202 if (d->inDrag
d->inDragDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
1203 pos = d->autoScrollDragPos;-
1204 visible.adjust(qMin(visible.width()/3,20), qMin(visible.height()/3,20),-
1205 -qMin(visible.width()/3,20), -qMin(visible.height()/3,20));-
1206 }
never executed: end of block
else {
0
1207 const QPoint globalPos = QCursor::pos();-
1208 pos = d->viewport->mapFromGlobal(globalPos);-
1209 QMouseEvent ev(QEvent::MouseMove, pos, d->viewport->mapTo(d->viewport->topLevelWidget(), pos), globalPos,-
1210 Qt::LeftButton, Qt::LeftButton, Qt::NoModifier);-
1211 mouseMoveEvent(&ev);-
1212 }
never executed: end of block
0
1213 int deltaY = qMax(pos.y() - visible.top(), visible.bottom() - pos.y()) - visible.height();-
1214 int deltaX = qMax(pos.x() - visible.left(), visible.right() - pos.x()) - visible.width();-
1215 int delta = qMax(deltaX, deltaY);-
1216 if (delta >= 0
delta >= 0Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
1217 if (delta < 7
delta < 7Description
TRUEnever evaluated
FALSEnever evaluated
)
0
1218 delta = 7;
never executed: delta = 7;
0
1219 int timeout = 4900 / (delta * delta);-
1220 d->autoScrollTimer.start(timeout, this);-
1221-
1222 if (deltaY > 0
deltaY > 0Description
TRUEnever evaluated
FALSEnever evaluated
)
0
1223 d->vbar->triggerAction(pos.y() < visible.center().y() ?
never executed: d->vbar->triggerAction(pos.y() < visible.center().y() ? QAbstractSlider::SliderSingleStepSub : QAbstractSlider::SliderSingleStepAdd);
0
1224 QAbstractSlider::SliderSingleStepSub
never executed: d->vbar->triggerAction(pos.y() < visible.center().y() ? QAbstractSlider::SliderSingleStepSub : QAbstractSlider::SliderSingleStepAdd);
0
1225 : QAbstractSlider::SliderSingleStepAdd);
never executed: d->vbar->triggerAction(pos.y() < visible.center().y() ? QAbstractSlider::SliderSingleStepSub : QAbstractSlider::SliderSingleStepAdd);
0
1226 if (deltaX > 0
deltaX > 0Description
TRUEnever evaluated
FALSEnever evaluated
)
0
1227 d->hbar->triggerAction(pos.x() < visible.center().x() ?
never executed: d->hbar->triggerAction(pos.x() < visible.center().x() ? QAbstractSlider::SliderSingleStepSub : QAbstractSlider::SliderSingleStepAdd);
0
1228 QAbstractSlider::SliderSingleStepSub
never executed: d->hbar->triggerAction(pos.x() < visible.center().x() ? QAbstractSlider::SliderSingleStepSub : QAbstractSlider::SliderSingleStepAdd);
0
1229 : QAbstractSlider::SliderSingleStepAdd);
never executed: d->hbar->triggerAction(pos.x() < visible.center().x() ? QAbstractSlider::SliderSingleStepSub : QAbstractSlider::SliderSingleStepAdd);
0
1230 }
never executed: end of block
0
1231 }
never executed: end of block
0
1232-
1233-
1234-
1235-
1236-
1237-
1238}
never executed: end of block
0
1239void QPlainTextEdit::setPlainText(const QString &text)-
1240{-
1241 QPlainTextEditPrivate * const d = d_func();-
1242 d->control->setPlainText(text);-
1243}
never executed: end of block
0
1244void QPlainTextEdit::keyPressEvent(QKeyEvent *e)-
1245{-
1246 QPlainTextEditPrivate * const d = d_func();-
1247 Qt::TextInteractionFlags tif = d->control->textInteractionFlags();-
1248-
1249 if (tif & Qt::TextSelectableByKeyboard
tif & Qt::Text...ableByKeyboardDescription
TRUEnever evaluated
FALSEnever evaluated
){
0
1250 if (e == QKeySequence::SelectPreviousPage
e == QKeySeque...ctPreviousPageDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
1251 e->accept();-
1252 d->pageUpDown(QTextCursor::Up, QTextCursor::KeepAnchor);-
1253 return;
never executed: return;
0
1254 } else if (e ==QKeySequence::SelectNextPage
e ==QKeySequen...SelectNextPageDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
1255 e->accept();-
1256 d->pageUpDown(QTextCursor::Down, QTextCursor::KeepAnchor);-
1257 return;
never executed: return;
0
1258 }-
1259 }
never executed: end of block
0
1260 if (tif & (Qt::TextSelectableByKeyboard | Qt::TextEditable)
tif & (Qt::Tex...:TextEditable)Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
1261 if (e == QKeySequence::MoveToPreviousPage
e == QKeySeque...ToPreviousPageDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
1262 e->accept();-
1263 d->pageUpDown(QTextCursor::Up, QTextCursor::MoveAnchor);-
1264 return;
never executed: return;
0
1265 } else if (e == QKeySequence::MoveToNextPage
e == QKeySeque...MoveToNextPageDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
1266 e->accept();-
1267 d->pageUpDown(QTextCursor::Down, QTextCursor::MoveAnchor);-
1268 return;
never executed: return;
0
1269 }-
1270 }
never executed: end of block
0
1271-
1272 if (!(tif & Qt::TextEditable)
!(tif & Qt::TextEditable)Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
1273 switch (e->key()) {-
1274 case
never executed: case Qt::Key_Space:
Qt::Key_Space:
never executed: case Qt::Key_Space:
0
1275 e->accept();-
1276 if (e->modifiers() & Qt::ShiftModifier
e->modifiers()...:ShiftModifierDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
1277 d->vbar->triggerAction(QAbstractSlider::SliderPageStepSub);
never executed: d->vbar->triggerAction(QAbstractSlider::SliderPageStepSub);
0
1278 else-
1279 d->vbar->triggerAction(QAbstractSlider::SliderPageStepAdd);
never executed: d->vbar->triggerAction(QAbstractSlider::SliderPageStepAdd);
0
1280 break;
never executed: break;
0
1281 default
never executed: default:
:
never executed: default:
0
1282 d->sendControlEvent(e);-
1283 if (!e->isAccepted()
!e->isAccepted()Description
TRUEnever evaluated
FALSEnever evaluated
&& e->modifiers() == Qt::NoModifier
e->modifiers()...Qt::NoModifierDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
1284 if (e->key() == Qt::Key_Home
e->key() == Qt::Key_HomeDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
1285 d->vbar->triggerAction(QAbstractSlider::SliderToMinimum);-
1286 e->accept();-
1287 }
never executed: end of block
else if (e->key() == Qt::Key_End
e->key() == Qt::Key_EndDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
1288 d->vbar->triggerAction(QAbstractSlider::SliderToMaximum);-
1289 e->accept();-
1290 }
never executed: end of block
0
1291 }
never executed: end of block
0
1292 if (!e->isAccepted()
!e->isAccepted()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
1293 QAbstractScrollArea::keyPressEvent(e);-
1294 }
never executed: end of block
0
1295 }
never executed: end of block
0
1296 return;
never executed: return;
0
1297 }-
1298-
1299-
1300 d->sendControlEvent(e);-
1301}
never executed: end of block
0
1302-
1303-
1304-
1305void QPlainTextEdit::keyReleaseEvent(QKeyEvent *e)-
1306{-
1307 QWidget::keyReleaseEvent(e);-
1308-
1309}
never executed: end of block
0
1310QVariant QPlainTextEdit::loadResource(int type, const QUrl &name)-
1311{-
1312 (void)type;;-
1313 (void)name;;-
1314 return
never executed: return QVariant();
QVariant();
never executed: return QVariant();
0
1315}-
1316-
1317-
1318-
1319void QPlainTextEdit::resizeEvent(QResizeEvent *e)-
1320{-
1321 QPlainTextEditPrivate * const d = d_func();-
1322 if (e->oldSize().width() != e->size().width()
e->oldSize().w...size().width()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
1323 d->relayoutDocument();
never executed: d->relayoutDocument();
0
1324 d->_q_adjustScrollbars();-
1325}
never executed: end of block
0
1326-
1327void QPlainTextEditPrivate::relayoutDocument()-
1328{-
1329 QTextDocument *doc = control->document();-
1330 QPlainTextDocumentLayout *documentLayout = qobject_cast<QPlainTextDocumentLayout*>(doc->documentLayout());-
1331 ((!(documentLayout)) ? qt_assert("documentLayout",__FILE__,1848) : qt_noop());-
1332 documentLayoutPtr = documentLayout;-
1333-
1334 int width = viewport->width();-
1335-
1336 if (documentLayout->priv()->mainViewPrivate == 0
documentLayout...ewPrivate == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
1337 || documentLayout->priv()->mainViewPrivate == this
documentLayout...rivate == thisDescription
TRUEnever evaluated
FALSEnever evaluated
0
1338 || width > documentLayout->textWidth()
width > docume...t->textWidth()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
1339 documentLayout->priv()->mainViewPrivate = this;-
1340 documentLayout->setTextWidth(width);-
1341 }
never executed: end of block
0
1342}
never executed: end of block
0
1343-
1344static void fillBackground(QPainter *p, const QRectF &rect, QBrush brush, const QRectF &gradientRect = QRectF())-
1345{-
1346 p->save();-
1347 if (brush.style() >= Qt::LinearGradientPattern
brush.style() ...radientPatternDescription
TRUEnever evaluated
FALSEnever evaluated
&& brush.style() <= Qt::ConicalGradientPattern
brush.style() ...radientPatternDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
1348 if (!gradientRect.isNull()
!gradientRect.isNull()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
1349 QTransform m = QTransform::fromTranslate(gradientRect.left(), gradientRect.top());-
1350 m.scale(gradientRect.width(), gradientRect.height());-
1351 brush.setTransform(m);-
1352 const_cast<QGradient *>(brush.gradient())->setCoordinateMode(QGradient::LogicalMode);-
1353 }
never executed: end of block
0
1354 }
never executed: end of block
else {
0
1355 p->setBrushOrigin(rect.topLeft());-
1356 }
never executed: end of block
0
1357 p->fillRect(rect, brush);-
1358 p->restore();-
1359}
never executed: end of block
0
1360-
1361-
1362-
1363-
1364-
1365void QPlainTextEdit::paintEvent(QPaintEvent *e)-
1366{-
1367 QPainter painter(viewport());-
1368 ((!(qobject_cast<QPlainTextDocumentLayout*>(document()->documentLayout()))) ? qt_assert("qobject_cast<QPlainTextDocumentLayout*>(document()->documentLayout())",__FILE__,1885) : qt_noop());-
1369-
1370 QPointF offset(contentOffset());-
1371-
1372 QRect er = e->rect();-
1373 QRect viewportRect = viewport()->rect();-
1374-
1375 bool editable = !isReadOnly();-
1376-
1377 QTextBlock block = firstVisibleBlock();-
1378 qreal maximumWidth = document()->documentLayout()->documentSize().width();-
1379-
1380-
1381 painter.setBrushOrigin(offset);-
1382-
1383-
1384 int maxX = offset.x() + qMax((qreal)viewportRect.width(), maximumWidth)-
1385 - document()->documentMargin();-
1386 er.setRight(qMin(er.right(), maxX));-
1387 painter.setClipRect(er);-
1388-
1389-
1390 QAbstractTextDocumentLayout::PaintContext context = getPaintContext();-
1391-
1392 while (block.isValid()
block.isValid()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
1393-
1394 QRectF r = blockBoundingRect(block).translated(offset);-
1395 QTextLayout *layout = block.layout();-
1396-
1397 if (!block.isVisible()
!block.isVisible()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
1398 offset.ry() += r.height();-
1399 block = block.next();-
1400 continue;
never executed: continue;
0
1401 }-
1402-
1403 if (r.bottom() >= er.top()
r.bottom() >= er.top()Description
TRUEnever evaluated
FALSEnever evaluated
&& r.top() <= er.bottom()
r.top() <= er.bottom()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
1404-
1405 QTextBlockFormat blockFormat = block.blockFormat();-
1406-
1407 QBrush bg = blockFormat.background();-
1408 if (bg != Qt::NoBrush
bg != Qt::NoBrushDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
1409 QRectF contentsRect = r;-
1410 contentsRect.setWidth(qMax(r.width(), maximumWidth));-
1411 fillBackground(&painter, contentsRect, bg);-
1412 }
never executed: end of block
0
1413-
1414-
1415 QVector<QTextLayout::FormatRange> selections;-
1416 int blpos = block.position();-
1417 int bllen = block.length();-
1418 for (int i = 0; i < context.selections.size()
i < context.selections.size()Description
TRUEnever evaluated
FALSEnever evaluated
; ++i) {
0
1419 const QAbstractTextDocumentLayout::Selection &range = context.selections.at(i);-
1420 const int selStart = range.cursor.selectionStart() - blpos;-
1421 const int selEnd = range.cursor.selectionEnd() - blpos;-
1422 if (selStart < bllen
selStart < bllenDescription
TRUEnever evaluated
FALSEnever evaluated
&& selEnd > 0
selEnd > 0Description
TRUEnever evaluated
FALSEnever evaluated
0
1423 && selEnd > selStart
selEnd > selStartDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
1424 QTextLayout::FormatRange o;-
1425 o.start = selStart;-
1426 o.length = selEnd - selStart;-
1427 o.format = range.format;-
1428 selections.append(o);-
1429 }
never executed: end of block
else if (!range.cursor.hasSelection()
!range.cursor.hasSelection()Description
TRUEnever evaluated
FALSEnever evaluated
&& range.format.hasProperty(QTextFormat::FullWidthSelection)
range.format.h...idthSelection)Description
TRUEnever evaluated
FALSEnever evaluated
0
1430 && block.contains(range.cursor.position())
block.contains...or.position())Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
1431-
1432-
1433 QTextLayout::FormatRange o;-
1434 QTextLine l = layout->lineForTextPosition(range.cursor.position() - blpos);-
1435 o.start = l.textStart();-
1436 o.length = l.textLength();-
1437 if (o.start + o.length == bllen - 1
o.start + o.le...h == bllen - 1Description
TRUEnever evaluated
FALSEnever evaluated
)
0
1438 ++
never executed: ++o.length;
o.length;
never executed: ++o.length;
0
1439 o.format = range.format;-
1440 selections.append(o);-
1441 }
never executed: end of block
0
1442 }
never executed: end of block
0
1443-
1444 bool drawCursor = ((editable
editableDescription
TRUEnever evaluated
FALSEnever evaluated
|| (
(textInteracti...bleByKeyboard)Description
TRUEnever evaluated
FALSEnever evaluated
textInteractionFlags() & Qt::TextSelectableByKeyboard)
(textInteracti...bleByKeyboard)Description
TRUEnever evaluated
FALSEnever evaluated
)
0
1445 && context.cursorPosition >= blpos
context.cursor...ition >= blposDescription
TRUEnever evaluated
FALSEnever evaluated
0
1446 && context.cursorPosition < blpos + bllen
context.cursor... blpos + bllenDescription
TRUEnever evaluated
FALSEnever evaluated
);
0
1447-
1448 bool drawCursorAsBlock = drawCursor
drawCursorDescription
TRUEnever evaluated
FALSEnever evaluated
&& overwriteMode()
overwriteMode()Description
TRUEnever evaluated
FALSEnever evaluated
;
0
1449-
1450 if (drawCursorAsBlock
drawCursorAsBlockDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
1451 if (context.cursorPosition == blpos + bllen - 1
context.cursor...os + bllen - 1Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
1452 drawCursorAsBlock = false;-
1453 }
never executed: end of block
else {
0
1454 QTextLayout::FormatRange o;-
1455 o.start = context.cursorPosition - blpos;-
1456 o.length = 1;-
1457 o.format.setForeground(palette().base());-
1458 o.format.setBackground(palette().text());-
1459 selections.append(o);-
1460 }
never executed: end of block
0
1461 }-
1462-
1463-
1464 if (!placeholderText().isEmpty()
!placeholderText().isEmpty()Description
TRUEnever evaluated
FALSEnever evaluated
&& document()->isEmpty()
document()->isEmpty()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
1465 QPlainTextEditPrivate * const d = d_func();-
1466 QColor col = d->control->palette().text().color();-
1467 col.setAlpha(128);-
1468 painter.setPen(col);-
1469 const int margin = int(document()->documentMargin());-
1470 painter.drawText(r.adjusted(margin, 0, 0, 0), Qt::AlignTop | Qt::TextWordWrap, placeholderText());-
1471 }
never executed: end of block
else {
0
1472 layout->draw(&painter, offset, selections, er);-
1473 }
never executed: end of block
0
1474 if ((drawCursor
drawCursorDescription
TRUEnever evaluated
FALSEnever evaluated
&& !drawCursorAsBlock
!drawCursorAsBlockDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
1475 || (editable
editableDescription
TRUEnever evaluated
FALSEnever evaluated
&& context.cursorPosition < -1
context.cursorPosition < -1Description
TRUEnever evaluated
FALSEnever evaluated
0
1476 && !layout->preeditAreaText().isEmpty()
!layout->preed...xt().isEmpty()Description
TRUEnever evaluated
FALSEnever evaluated
)) {
0
1477 int cpos = context.cursorPosition;-
1478 if (cpos < -1
cpos < -1Description
TRUEnever evaluated
FALSEnever evaluated
)
0
1479 cpos = layout->preeditAreaPosition() - (cpos + 2);
never executed: cpos = layout->preeditAreaPosition() - (cpos + 2);
0
1480 else-
1481 cpos -= blpos;
never executed: cpos -= blpos;
0
1482 layout->drawCursor(&painter, offset, cpos, cursorWidth());-
1483 }
never executed: end of block
0
1484 }
never executed: end of block
0
1485-
1486 offset.ry() += r.height();-
1487 if (offset.y() > viewportRect.height()
offset.y() > v...tRect.height()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
1488 break;
never executed: break;
0
1489 block = block.next();-
1490 }
never executed: end of block
0
1491-
1492 if (backgroundVisible()
backgroundVisible()Description
TRUEnever evaluated
FALSEnever evaluated
&& !block.isValid()
!block.isValid()Description
TRUEnever evaluated
FALSEnever evaluated
&& offset.y() <= er.bottom()
offset.y() <= er.bottom()Description
TRUEnever evaluated
FALSEnever evaluated
0
1493 && (centerOnScroll()
centerOnScroll()Description
TRUEnever evaluated
FALSEnever evaluated
|| verticalScrollBar()->maximum() == verticalScrollBar()->minimum()
verticalScroll...r()->minimum()Description
TRUEnever evaluated
FALSEnever evaluated
)) {
0
1494 painter.fillRect(QRect(QPoint((int)er.left(), (int)offset.y()), er.bottomRight()), palette().background());-
1495 }
never executed: end of block
0
1496}
never executed: end of block
0
1497-
1498-
1499void QPlainTextEditPrivate::updateDefaultTextOption()-
1500{-
1501 QTextDocument *doc = control->document();-
1502-
1503 QTextOption opt = doc->defaultTextOption();-
1504 QTextOption::WrapMode oldWrapMode = opt.wrapMode();-
1505-
1506 if (lineWrap == QPlainTextEdit::NoWrap
lineWrap == QP...xtEdit::NoWrapDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
1507 opt.setWrapMode(QTextOption::NoWrap);
never executed: opt.setWrapMode(QTextOption::NoWrap);
0
1508 else-
1509 opt.setWrapMode(wordWrap);
never executed: opt.setWrapMode(wordWrap);
0
1510-
1511 if (opt.wrapMode() != oldWrapMode
opt.wrapMode() != oldWrapModeDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
1512 doc->setDefaultTextOption(opt);
never executed: doc->setDefaultTextOption(opt);
0
1513}
never executed: end of block
0
1514-
1515-
1516-
1517-
1518void QPlainTextEdit::mousePressEvent(QMouseEvent *e)-
1519{-
1520 QPlainTextEditPrivate * const d = d_func();-
1521-
1522-
1523-
1524-
1525 d->sendControlEvent(e);-
1526}
never executed: end of block
0
1527-
1528-
1529-
1530void QPlainTextEdit::mouseMoveEvent(QMouseEvent *e)-
1531{-
1532 QPlainTextEditPrivate * const d = d_func();-
1533 d->inDrag = false;-
1534 const QPoint pos = e->pos();-
1535 d->sendControlEvent(e);-
1536 if (!(e->buttons() & Qt::LeftButton)
!(e->buttons()...t::LeftButton)Description
TRUEnever evaluated
FALSEnever evaluated
)
0
1537 return;
never executed: return;
0
1538 if (e->source() == Qt::MouseEventNotSynthesized
e->source() ==...NotSynthesizedDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
1539 const QRect visible = d->viewport->rect();-
1540 if (visible.contains(pos)
visible.contains(pos)Description
TRUEnever evaluated
FALSEnever evaluated
)
0
1541 d->autoScrollTimer.stop();
never executed: d->autoScrollTimer.stop();
0
1542 else if (!d->autoScrollTimer.isActive()
!d->autoScrollTimer.isActive()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
1543 d->autoScrollTimer.start(100, this);
never executed: d->autoScrollTimer.start(100, this);
0
1544 }
never executed: end of block
0
1545}
never executed: end of block
0
1546-
1547-
1548-
1549void QPlainTextEdit::mouseReleaseEvent(QMouseEvent *e)-
1550{-
1551 QPlainTextEditPrivate * const d = d_func();-
1552 d->sendControlEvent(e);-
1553 if (e->source() == Qt::MouseEventNotSynthesized
e->source() ==...NotSynthesizedDescription
TRUEnever evaluated
FALSEnever evaluated
&& d->autoScrollTimer.isActive()
d->autoScrollTimer.isActive()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
1554 d->autoScrollTimer.stop();-
1555 d->ensureCursorVisible();-
1556 }
never executed: end of block
0
1557-
1558 if (!isReadOnly()
!isReadOnly()Description
TRUEnever evaluated
FALSEnever evaluated
&& rect().contains(e->pos())
rect().contains(e->pos())Description
TRUEnever evaluated
FALSEnever evaluated
)
0
1559 d->handleSoftwareInputPanel(e->button(), d->clickCausedFocus);
never executed: d->handleSoftwareInputPanel(e->button(), d->clickCausedFocus);
0
1560 d->clickCausedFocus = 0;-
1561}
never executed: end of block
0
1562-
1563-
1564-
1565void QPlainTextEdit::mouseDoubleClickEvent(QMouseEvent *e)-
1566{-
1567 QPlainTextEditPrivate * const d = d_func();-
1568 d->sendControlEvent(e);-
1569}
never executed: end of block
0
1570-
1571-
1572-
1573bool QPlainTextEdit::focusNextPrevChild(bool next)-
1574{-
1575 const QPlainTextEditPrivate * const d = d_func();-
1576 if (!d->tabChangesFocus
!d->tabChangesFocusDescription
TRUEnever evaluated
FALSEnever evaluated
&& d->control->textInteractionFlags() & Qt::TextEditable
d->control->te...::TextEditableDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
1577 return
never executed: return false;
false;
never executed: return false;
0
1578 return
never executed: return QAbstractScrollArea::focusNextPrevChild(next);
QAbstractScrollArea::focusNextPrevChild(next);
never executed: return QAbstractScrollArea::focusNextPrevChild(next);
0
1579}-
1580void QPlainTextEdit::contextMenuEvent(QContextMenuEvent *e)-
1581{-
1582 QPlainTextEditPrivate * const d = d_func();-
1583 d->sendControlEvent(e);-
1584}
never executed: end of block
0
1585-
1586-
1587-
1588-
1589-
1590void QPlainTextEdit::dragEnterEvent(QDragEnterEvent *e)-
1591{-
1592 QPlainTextEditPrivate * const d = d_func();-
1593 d->inDrag = true;-
1594 d->sendControlEvent(e);-
1595}
never executed: end of block
0
1596-
1597-
1598-
1599void QPlainTextEdit::dragLeaveEvent(QDragLeaveEvent *e)-
1600{-
1601 QPlainTextEditPrivate * const d = d_func();-
1602 d->inDrag = false;-
1603 d->autoScrollTimer.stop();-
1604 d->sendControlEvent(e);-
1605}
never executed: end of block
0
1606-
1607-
1608-
1609void QPlainTextEdit::dragMoveEvent(QDragMoveEvent *e)-
1610{-
1611 QPlainTextEditPrivate * const d = d_func();-
1612 d->autoScrollDragPos = e->pos();-
1613 if (!d->autoScrollTimer.isActive()
!d->autoScrollTimer.isActive()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
1614 d->autoScrollTimer.start(100, this);
never executed: d->autoScrollTimer.start(100, this);
0
1615 d->sendControlEvent(e);-
1616}
never executed: end of block
0
1617-
1618-
1619-
1620void QPlainTextEdit::dropEvent(QDropEvent *e)-
1621{-
1622 QPlainTextEditPrivate * const d = d_func();-
1623 d->inDrag = false;-
1624 d->autoScrollTimer.stop();-
1625 d->sendControlEvent(e);-
1626}
never executed: end of block
0
1627-
1628-
1629-
1630-
1631-
1632void QPlainTextEdit::inputMethodEvent(QInputMethodEvent *e)-
1633{-
1634 QPlainTextEditPrivate * const d = d_func();-
1635 d->sendControlEvent(e);-
1636 ensureCursorVisible();-
1637}
never executed: end of block
0
1638-
1639-
1640-
1641void QPlainTextEdit::scrollContentsBy(int dx, int )-
1642{-
1643 QPlainTextEditPrivate * const d = d_func();-
1644 d->setTopLine(d->vbar->value(), dx);-
1645}
never executed: end of block
0
1646-
1647-
1648-
1649QVariant QPlainTextEdit::inputMethodQuery(Qt::InputMethodQuery property) const-
1650{-
1651 return
never executed: return inputMethodQuery(property, QVariant());
inputMethodQuery(property, QVariant());
never executed: return inputMethodQuery(property, QVariant());
0
1652}-
1653-
1654-
1655-
1656QVariant QPlainTextEdit::inputMethodQuery(Qt::InputMethodQuery query, QVariant argument) const-
1657{-
1658 const QPlainTextEditPrivate * const d = d_func();-
1659 switch (query) {-
1660 case
never executed: case Qt::ImHints:
Qt::ImHints:
never executed: case Qt::ImHints:
0
1661 case
never executed: case Qt::ImInputItemClipRectangle:
Qt::ImInputItemClipRectangle:
never executed: case Qt::ImInputItemClipRectangle:
0
1662 return
never executed: return QWidget::inputMethodQuery(query);
QWidget::inputMethodQuery(query);
never executed: return QWidget::inputMethodQuery(query);
0
1663 default
never executed: default:
:
never executed: default:
0
1664 break;
never executed: break;
0
1665 }-
1666-
1667 const QPointF offset = contentOffset();-
1668 switch (argument.type()) {-
1669 case
never executed: case QVariant::RectF:
QVariant::RectF:
never executed: case QVariant::RectF:
0
1670 argument = argument.toRectF().translated(-offset);-
1671 break;
never executed: break;
0
1672 case
never executed: case QVariant::PointF:
QVariant::PointF:
never executed: case QVariant::PointF:
0
1673 argument = argument.toPointF() - offset;-
1674 break;
never executed: break;
0
1675 case
never executed: case QVariant::Rect:
QVariant::Rect:
never executed: case QVariant::Rect:
0
1676 argument = argument.toRect().translated(-offset.toPoint());-
1677 break;
never executed: break;
0
1678 case
never executed: case QVariant::Point:
QVariant::Point:
never executed: case QVariant::Point:
0
1679 argument = argument.toPoint() - offset;-
1680 break;
never executed: break;
0
1681 default
never executed: default:
:
never executed: default:
0
1682 break;
never executed: break;
0
1683 }-
1684-
1685 const QVariant v = d->control->inputMethodQuery(query, argument);-
1686 switch (v.type()) {-
1687 case
never executed: case QVariant::RectF:
QVariant::RectF:
never executed: case QVariant::RectF:
0
1688 return
never executed: return v.toRectF().translated(offset);
v.toRectF().translated(offset);
never executed: return v.toRectF().translated(offset);
0
1689 case
never executed: case QVariant::PointF:
QVariant::PointF:
never executed: case QVariant::PointF:
0
1690 return
never executed: return v.toPointF() + offset;
v.toPointF() + offset;
never executed: return v.toPointF() + offset;
0
1691 case
never executed: case QVariant::Rect:
QVariant::Rect:
never executed: case QVariant::Rect:
0
1692 return
never executed: return v.toRect().translated(offset.toPoint());
v.toRect().translated(offset.toPoint());
never executed: return v.toRect().translated(offset.toPoint());
0
1693 case
never executed: case QVariant::Point:
QVariant::Point:
never executed: case QVariant::Point:
0
1694 return
never executed: return v.toPoint() + offset.toPoint();
v.toPoint() + offset.toPoint();
never executed: return v.toPoint() + offset.toPoint();
0
1695 default
never executed: default:
:
never executed: default:
0
1696 break;
never executed: break;
0
1697 }-
1698 return
never executed: return v;
v;
never executed: return v;
0
1699}-
1700-
1701-
1702-
1703void QPlainTextEdit::focusInEvent(QFocusEvent *e)-
1704{-
1705 QPlainTextEditPrivate * const d = d_func();-
1706 if (e->reason() == Qt::MouseFocusReason
e->reason() ==...useFocusReasonDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
1707 d->clickCausedFocus = 1;-
1708 }
never executed: end of block
0
1709 QAbstractScrollArea::focusInEvent(e);-
1710 d->sendControlEvent(e);-
1711}
never executed: end of block
0
1712-
1713-
1714-
1715void QPlainTextEdit::focusOutEvent(QFocusEvent *e)-
1716{-
1717 QPlainTextEditPrivate * const d = d_func();-
1718 QAbstractScrollArea::focusOutEvent(e);-
1719 d->sendControlEvent(e);-
1720}
never executed: end of block
0
1721-
1722-
1723-
1724void QPlainTextEdit::showEvent(QShowEvent *)-
1725{-
1726 QPlainTextEditPrivate * const d = d_func();-
1727 if (d->showCursorOnInitialShow
d->showCursorOnInitialShowDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
1728 d->showCursorOnInitialShow = false;-
1729 ensureCursorVisible();-
1730 }
never executed: end of block
0
1731}
never executed: end of block
0
1732-
1733-
1734-
1735void QPlainTextEdit::changeEvent(QEvent *e)-
1736{-
1737 QPlainTextEditPrivate * const d = d_func();-
1738 QAbstractScrollArea::changeEvent(e);-
1739 if (e->type() == QEvent::ApplicationFontChange
e->type() == Q...tionFontChangeDescription
TRUEnever evaluated
FALSEnever evaluated
0
1740 || e->type() == QEvent::FontChange
e->type() == Q...nt::FontChangeDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
1741 d->control->document()->setDefaultFont(font());-
1742 }
never executed: end of block
else if(e->type() == QEvent::ActivationChange
e->type() == Q...tivationChangeDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
1743 if (!isActiveWindow()
!isActiveWindow()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
1744 d->autoScrollTimer.stop();
never executed: d->autoScrollTimer.stop();
0
1745 }
never executed: end of block
else if (e->type() == QEvent::EnabledChange
e->type() == Q...:EnabledChangeDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
1746 e->setAccepted(isEnabled());-
1747 d->sendControlEvent(e);-
1748 }
never executed: end of block
else if (e->type() == QEvent::PaletteChange
e->type() == Q...:PaletteChangeDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
1749 d->control->setPalette(palette());-
1750 }
never executed: end of block
else if (e->type() == QEvent::LayoutDirectionChange
e->type() == Q...irectionChangeDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
1751 d->sendControlEvent(e);-
1752 }
never executed: end of block
0
1753}
never executed: end of block
0
1754-
1755-
1756-
1757-
1758void QPlainTextEdit::wheelEvent(QWheelEvent *e)-
1759{-
1760 QPlainTextEditPrivate * const d = d_func();-
1761 if (!(d->control->textInteractionFlags() & Qt::TextEditable)
!(d->control->...:TextEditable)Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
1762 if (e->modifiers() & Qt::ControlModifier
e->modifiers()...ontrolModifierDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
1763 float delta = e->angleDelta().y() / 120.f;-
1764 zoomInF(delta);-
1765 return;
never executed: return;
0
1766 }-
1767 }
never executed: end of block
0
1768 QAbstractScrollArea::wheelEvent(e);-
1769 updateMicroFocus();-
1770}
never executed: end of block
0
1771void QPlainTextEdit::zoomIn(int range)-
1772{-
1773 zoomInF(range);-
1774}
never executed: end of block
0
1775void QPlainTextEdit::zoomOut(int range)-
1776{-
1777 zoomInF(-range);-
1778}
never executed: end of block
0
1779-
1780-
1781-
1782-
1783void QPlainTextEdit::zoomInF(float range)-
1784{-
1785 if (range == 0.f
range == 0.fDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
1786 return;
never executed: return;
0
1787 QFont f = font();-
1788 const float newSize = f.pointSizeF() + range;-
1789 if (newSize <= 0
newSize <= 0Description
TRUEnever evaluated
FALSEnever evaluated
)
0
1790 return;
never executed: return;
0
1791 f.setPointSizeF(newSize);-
1792 setFont(f);-
1793}
never executed: end of block
0
1794QMenu *QPlainTextEdit::createStandardContextMenu()-
1795{-
1796 QPlainTextEditPrivate * const d = d_func();-
1797 return
never executed: return d->control->createStandardContextMenu(QPointF(), this);
d->control->createStandardContextMenu(QPointF(), this);
never executed: return d->control->createStandardContextMenu(QPointF(), this);
0
1798}-
1799QMenu *QPlainTextEdit::createStandardContextMenu(const QPoint &position)-
1800{-
1801 QPlainTextEditPrivate * const d = d_func();-
1802 return
never executed: return d->control->createStandardContextMenu(position, this);
d->control->createStandardContextMenu(position, this);
never executed: return d->control->createStandardContextMenu(position, this);
0
1803}-
1804-
1805-
1806-
1807-
1808-
1809QTextCursor QPlainTextEdit::cursorForPosition(const QPoint &pos) const-
1810{-
1811 const QPlainTextEditPrivate * const d = d_func();-
1812 return
never executed: return d->control->cursorForPosition(d->mapToContents(pos));
d->control->cursorForPosition(d->mapToContents(pos));
never executed: return d->control->cursorForPosition(d->mapToContents(pos));
0
1813}-
1814-
1815-
1816-
1817-
1818-
1819QRect QPlainTextEdit::cursorRect(const QTextCursor &cursor) const-
1820{-
1821 const QPlainTextEditPrivate * const d = d_func();-
1822 if (cursor.isNull()
cursor.isNull()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
1823 return
never executed: return QRect();
QRect();
never executed: return QRect();
0
1824-
1825 QRect r = d->control->cursorRect(cursor).toRect();-
1826 r.translate(-d->horizontalOffset(),-(int)d->verticalOffset());-
1827 return
never executed: return r;
r;
never executed: return r;
0
1828}-
1829-
1830-
1831-
1832-
1833-
1834QRect QPlainTextEdit::cursorRect() const-
1835{-
1836 const QPlainTextEditPrivate * const d = d_func();-
1837 QRect r = d->control->cursorRect().toRect();-
1838 r.translate(-d->horizontalOffset(),-(int)d->verticalOffset());-
1839 return
never executed: return r;
r;
never executed: return r;
0
1840}-
1841bool QPlainTextEdit::overwriteMode() const-
1842{-
1843 const QPlainTextEditPrivate * const d = d_func();-
1844 return
never executed: return d->control->overwriteMode();
d->control->overwriteMode();
never executed: return d->control->overwriteMode();
0
1845}-
1846-
1847void QPlainTextEdit::setOverwriteMode(bool overwrite)-
1848{-
1849 QPlainTextEditPrivate * const d = d_func();-
1850 d->control->setOverwriteMode(overwrite);-
1851}
never executed: end of block
0
1852int QPlainTextEdit::tabStopWidth() const-
1853{-
1854 const QPlainTextEditPrivate * const d = d_func();-
1855 return
never executed: return qRound(d->control->document()->defaultTextOption().tabStop());
qRound(d->control->document()->defaultTextOption().tabStop());
never executed: return qRound(d->control->document()->defaultTextOption().tabStop());
0
1856}-
1857-
1858void QPlainTextEdit::setTabStopWidth(int width)-
1859{-
1860 QPlainTextEditPrivate * const d = d_func();-
1861 QTextOption opt = d->control->document()->defaultTextOption();-
1862 if (opt.tabStop() == width
opt.tabStop() == widthDescription
TRUEnever evaluated
FALSEnever evaluated
|| width < 0
width < 0Description
TRUEnever evaluated
FALSEnever evaluated
)
0
1863 return;
never executed: return;
0
1864 opt.setTabStop(width);-
1865 d->control->document()->setDefaultTextOption(opt);-
1866}
never executed: end of block
0
1867-
1868-
1869-
1870-
1871-
1872-
1873int QPlainTextEdit::cursorWidth() const-
1874{-
1875 const QPlainTextEditPrivate * const d = d_func();-
1876 return
never executed: return d->control->cursorWidth();
d->control->cursorWidth();
never executed: return d->control->cursorWidth();
0
1877}-
1878-
1879void QPlainTextEdit::setCursorWidth(int width)-
1880{-
1881 QPlainTextEditPrivate * const d = d_func();-
1882 d->control->setCursorWidth(width);-
1883}
never executed: end of block
0
1884void QPlainTextEdit::setExtraSelections(const QList<QTextEdit::ExtraSelection> &selections)-
1885{-
1886 QPlainTextEditPrivate * const d = d_func();-
1887 d->control->setExtraSelections(selections);-
1888}
never executed: end of block
0
1889-
1890-
1891-
1892-
1893-
1894-
1895QList<QTextEdit::ExtraSelection> QPlainTextEdit::extraSelections() const-
1896{-
1897 const QPlainTextEditPrivate * const d = d_func();-
1898 return
never executed: return d->control->extraSelections();
d->control->extraSelections();
never executed: return d->control->extraSelections();
0
1899}-
1900QMimeData *QPlainTextEdit::createMimeDataFromSelection() const-
1901{-
1902 const QPlainTextEditPrivate * const d = d_func();-
1903 return
never executed: return d->control->QWidgetTextControl::createMimeDataFromSelection();
d->control->QWidgetTextControl::createMimeDataFromSelection();
never executed: return d->control->QWidgetTextControl::createMimeDataFromSelection();
0
1904}-
1905-
1906-
1907-
1908-
1909-
1910-
1911-
1912bool QPlainTextEdit::canInsertFromMimeData(const QMimeData *source) const-
1913{-
1914 const QPlainTextEditPrivate * const d = d_func();-
1915 return
never executed: return d->control->QWidgetTextControl::canInsertFromMimeData(source);
d->control->QWidgetTextControl::canInsertFromMimeData(source);
never executed: return d->control->QWidgetTextControl::canInsertFromMimeData(source);
0
1916}-
1917void QPlainTextEdit::insertFromMimeData(const QMimeData *source)-
1918{-
1919 QPlainTextEditPrivate * const d = d_func();-
1920 d->control->QWidgetTextControl::insertFromMimeData(source);-
1921}
never executed: end of block
0
1922bool QPlainTextEdit::isReadOnly() const-
1923{-
1924 const QPlainTextEditPrivate * const d = d_func();-
1925 return
never executed: return !(d->control->textInteractionFlags() & Qt::TextEditable);
!(d->control->textInteractionFlags() & Qt::TextEditable);
never executed: return !(d->control->textInteractionFlags() & Qt::TextEditable);
0
1926}-
1927-
1928void QPlainTextEdit::setReadOnly(bool ro)-
1929{-
1930 QPlainTextEditPrivate * const d = d_func();-
1931 Qt::TextInteractionFlags flags = Qt::NoTextInteraction;-
1932 if (ro
roDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
1933 flags = Qt::TextSelectableByMouse;-
1934 }
never executed: end of block
else {
0
1935 flags = Qt::TextEditorInteraction;-
1936 }
never executed: end of block
0
1937 setAttribute(Qt::WA_InputMethodEnabled, shouldEnableInputMethod(this));-
1938 d->control->setTextInteractionFlags(flags);-
1939 QEvent event(QEvent::ReadOnlyChange);-
1940 QApplication::sendEvent(this, &event);-
1941}
never executed: end of block
0
1942void QPlainTextEdit::setTextInteractionFlags(Qt::TextInteractionFlags flags)-
1943{-
1944 QPlainTextEditPrivate * const d = d_func();-
1945 d->control->setTextInteractionFlags(flags);-
1946}
never executed: end of block
0
1947-
1948Qt::TextInteractionFlags QPlainTextEdit::textInteractionFlags() const-
1949{-
1950 const QPlainTextEditPrivate * const d = d_func();-
1951 return
never executed: return d->control->textInteractionFlags();
d->control->textInteractionFlags();
never executed: return d->control->textInteractionFlags();
0
1952}-
1953void QPlainTextEdit::mergeCurrentCharFormat(const QTextCharFormat &modifier)-
1954{-
1955 QPlainTextEditPrivate * const d = d_func();-
1956 d->control->mergeCurrentCharFormat(modifier);-
1957}
never executed: end of block
0
1958-
1959-
1960-
1961-
1962-
1963-
1964-
1965void QPlainTextEdit::setCurrentCharFormat(const QTextCharFormat &format)-
1966{-
1967 QPlainTextEditPrivate * const d = d_func();-
1968 d->control->setCurrentCharFormat(format);-
1969}
never executed: end of block
0
1970-
1971-
1972-
1973-
1974QTextCharFormat QPlainTextEdit::currentCharFormat() const-
1975{-
1976 const QPlainTextEditPrivate * const d = d_func();-
1977 return
never executed: return d->control->currentCharFormat();
d->control->currentCharFormat();
never executed: return d->control->currentCharFormat();
0
1978}-
1979void QPlainTextEdit::insertPlainText(const QString &text)-
1980{-
1981 QPlainTextEditPrivate * const d = d_func();-
1982 d->control->insertPlainText(text);-
1983}
never executed: end of block
0
1984void QPlainTextEdit::moveCursor(QTextCursor::MoveOperation operation, QTextCursor::MoveMode mode)-
1985{-
1986 QPlainTextEditPrivate * const d = d_func();-
1987 d->control->moveCursor(operation, mode);-
1988}
never executed: end of block
0
1989-
1990-
1991-
1992-
1993bool QPlainTextEdit::canPaste() const-
1994{-
1995 const QPlainTextEditPrivate * const d = d_func();-
1996 return
never executed: return d->control->canPaste();
d->control->canPaste();
never executed: return d->control->canPaste();
0
1997}-
1998void QPlainTextEdit::print(QPagedPaintDevice *printer) const-
1999{-
2000 const QPlainTextEditPrivate * const d = d_func();-
2001 d->control->print(printer);-
2002}
never executed: end of block
0
2003bool QPlainTextEdit::tabChangesFocus() const-
2004{-
2005 const QPlainTextEditPrivate * const d = d_func();-
2006 return
never executed: return d->tabChangesFocus;
d->tabChangesFocus;
never executed: return d->tabChangesFocus;
0
2007}-
2008-
2009void QPlainTextEdit::setTabChangesFocus(bool b)-
2010{-
2011 QPlainTextEditPrivate * const d = d_func();-
2012 d->tabChangesFocus = b;-
2013}
never executed: end of block
0
2014QPlainTextEdit::LineWrapMode QPlainTextEdit::lineWrapMode() const-
2015{-
2016 const QPlainTextEditPrivate * const d = d_func();-
2017 return
never executed: return d->lineWrap;
d->lineWrap;
never executed: return d->lineWrap;
0
2018}-
2019-
2020void QPlainTextEdit::setLineWrapMode(LineWrapMode wrap)-
2021{-
2022 QPlainTextEditPrivate * const d = d_func();-
2023 if (d->lineWrap == wrap
d->lineWrap == wrapDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
2024 return;
never executed: return;
0
2025 d->lineWrap = wrap;-
2026 d->updateDefaultTextOption();-
2027 d->relayoutDocument();-
2028 d->_q_adjustScrollbars();-
2029 ensureCursorVisible();-
2030}
never executed: end of block
0
2031QTextOption::WrapMode QPlainTextEdit::wordWrapMode() const-
2032{-
2033 const QPlainTextEditPrivate * const d = d_func();-
2034 return
never executed: return d->wordWrap;
d->wordWrap;
never executed: return d->wordWrap;
0
2035}-
2036-
2037void QPlainTextEdit::setWordWrapMode(QTextOption::WrapMode mode)-
2038{-
2039 QPlainTextEditPrivate * const d = d_func();-
2040 if (mode == d->wordWrap
mode == d->wordWrapDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
2041 return;
never executed: return;
0
2042 d->wordWrap = mode;-
2043 d->updateDefaultTextOption();-
2044}
never executed: end of block
0
2045bool QPlainTextEdit::backgroundVisible() const-
2046{-
2047 const QPlainTextEditPrivate * const d = d_func();-
2048 return
never executed: return d->backgroundVisible;
d->backgroundVisible;
never executed: return d->backgroundVisible;
0
2049}-
2050-
2051void QPlainTextEdit::setBackgroundVisible(bool visible)-
2052{-
2053 QPlainTextEditPrivate * const d = d_func();-
2054 if (visible == d->backgroundVisible
visible == d->...kgroundVisibleDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
2055 return;
never executed: return;
0
2056 d->backgroundVisible = visible;-
2057 d->updateViewport();-
2058}
never executed: end of block
0
2059bool QPlainTextEdit::centerOnScroll() const-
2060{-
2061 const QPlainTextEditPrivate * const d = d_func();-
2062 return
never executed: return d->centerOnScroll;
d->centerOnScroll;
never executed: return d->centerOnScroll;
0
2063}-
2064-
2065void QPlainTextEdit::setCenterOnScroll(bool enabled)-
2066{-
2067 QPlainTextEditPrivate * const d = d_func();-
2068 if (enabled == d->centerOnScroll
enabled == d->centerOnScrollDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
2069 return;
never executed: return;
0
2070 d->centerOnScroll = enabled;-
2071}
never executed: end of block
0
2072bool QPlainTextEdit::find(const QString &exp, QTextDocument::FindFlags options)-
2073{-
2074 QPlainTextEditPrivate * const d = d_func();-
2075 return
never executed: return d->control->find(exp, options);
d->control->find(exp, options);
never executed: return d->control->find(exp, options);
0
2076}-
2077bool QPlainTextEdit::find(const QRegExp &exp, QTextDocument::FindFlags options)-
2078{-
2079 QPlainTextEditPrivate * const d = d_func();-
2080 return
never executed: return d->control->find(exp, options);
d->control->find(exp, options);
never executed: return d->control->find(exp, options);
0
2081}-
2082void QPlainTextEditPrivate::append(const QString &text, Qt::TextFormat format)-
2083{-
2084 QPlainTextEdit * const q = q_func();-
2085-
2086 QTextDocument *document = control->document();-
2087 QPlainTextDocumentLayout *documentLayout = qobject_cast<QPlainTextDocumentLayout*>(document->documentLayout());-
2088 ((!(documentLayout)) ? qt_assert("documentLayout",__FILE__,2959) : qt_noop());-
2089-
2090 int maximumBlockCount = document->maximumBlockCount();-
2091 if (maximumBlockCount
maximumBlockCountDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
2092 document->setMaximumBlockCount(0);
never executed: document->setMaximumBlockCount(0);
0
2093-
2094 const bool atBottom = q->isVisible()
q->isVisible()Description
TRUEnever evaluated
FALSEnever evaluated
0
2095 && (
(control->bloc...ct().bottom())Description
TRUEnever evaluated
FALSEnever evaluated
control->blockBoundingRect(document->lastBlock()).bottom() - verticalOffset()
(control->bloc...ct().bottom())Description
TRUEnever evaluated
FALSEnever evaluated
0
2096 <= viewport->rect().bottom())
(control->bloc...ct().bottom())Description
TRUEnever evaluated
FALSEnever evaluated
;
0
2097-
2098 if (!q->isVisible()
!q->isVisible()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
2099 showCursorOnInitialShow = true;
never executed: showCursorOnInitialShow = true;
0
2100-
2101 bool documentSizeChangedBlocked = documentLayout->priv()->blockDocumentSizeChanged;-
2102 documentLayout->priv()->blockDocumentSizeChanged = true;-
2103-
2104 if (format == Qt::RichText
format == Qt::RichTextDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
2105 control->appendHtml(text);
never executed: control->appendHtml(text);
0
2106 else if (format == Qt::PlainText
format == Qt::PlainTextDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
2107 control->appendPlainText(text);
never executed: control->appendPlainText(text);
0
2108 else-
2109 control->append(text);
never executed: control->append(text);
0
2110-
2111 if (maximumBlockCount > 0
maximumBlockCount > 0Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
2112 if (document->blockCount() > maximumBlockCount
document->bloc...imumBlockCountDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
2113 bool blockUpdate = false;-
2114 if (control->topBlock
control->topBlockDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
2115 control->topBlock--;-
2116 blockUpdate = true;-
2117 q->updateRequest(viewport->rect(), 0);-
2118 }
never executed: end of block
0
2119-
2120 bool updatesBlocked = documentLayout->priv()->blockUpdate;-
2121 documentLayout->priv()->blockUpdate = blockUpdate;-
2122 QTextCursor cursor(document);-
2123 cursor.movePosition(QTextCursor::NextBlock, QTextCursor::KeepAnchor);-
2124 cursor.removeSelectedText();-
2125 documentLayout->priv()->blockUpdate = updatesBlocked;-
2126 }
never executed: end of block
0
2127 document->setMaximumBlockCount(maximumBlockCount);-
2128 }
never executed: end of block
0
2129-
2130 documentLayout->priv()->blockDocumentSizeChanged = documentSizeChangedBlocked;-
2131 _q_adjustScrollbars();-
2132-
2133-
2134 if (atBottom
atBottomDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
2135 const bool needScroll = !centerOnScroll
!centerOnScrollDescription
TRUEnever evaluated
FALSEnever evaluated
0
2136 || control->blockBoundingRect(document->lastBlock()).bottom() - verticalOffset()
control->block...ect().bottom()Description
TRUEnever evaluated
FALSEnever evaluated
0
2137 > viewport->rect().bottom()
control->block...ect().bottom()Description
TRUEnever evaluated
FALSEnever evaluated
;
0
2138 if (needScroll
needScrollDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
2139 vbar->setValue(vbar->maximum());
never executed: vbar->setValue(vbar->maximum());
0
2140 }
never executed: end of block
0
2141}
never executed: end of block
0
2142void QPlainTextEdit::appendPlainText(const QString &text)-
2143{-
2144 QPlainTextEditPrivate * const d = d_func();-
2145 d->append(text, Qt::PlainText);-
2146}
never executed: end of block
0
2147-
2148-
2149-
2150-
2151-
2152-
2153-
2154void QPlainTextEdit::appendHtml(const QString &html)-
2155{-
2156 QPlainTextEditPrivate * const d = d_func();-
2157 d->append(html, Qt::RichText);-
2158}
never executed: end of block
0
2159-
2160void QPlainTextEditPrivate::ensureCursorVisible(bool center)-
2161{-
2162 QPlainTextEdit * const q = q_func();-
2163 QRect visible = viewport->rect();-
2164 QRect cr = q->cursorRect();-
2165 if (cr.top() < visible.top()
cr.top() < visible.top()Description
TRUEnever evaluated
FALSEnever evaluated
|| cr.bottom() > visible.bottom()
cr.bottom() > visible.bottom()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
2166 ensureVisible(control->textCursor().position(), center);-
2167 }
never executed: end of block
0
2168-
2169 const bool rtl = q->isRightToLeft();-
2170 if (cr.left() < visible.left()
cr.left() < visible.left()Description
TRUEnever evaluated
FALSEnever evaluated
|| cr.right() > visible.right()
cr.right() > visible.right()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
2171 int x = cr.center().x() + horizontalOffset() - visible.width()/2;-
2172 hbar->setValue(rtl ? hbar->maximum() - x : x);-
2173 }
never executed: end of block
0
2174}
never executed: end of block
0
2175-
2176-
2177-
2178-
2179-
2180-
2181-
2182void QPlainTextEdit::ensureCursorVisible()-
2183{-
2184 QPlainTextEditPrivate * const d = d_func();-
2185 d->ensureCursorVisible(d->centerOnScroll);-
2186}
never executed: end of block
0
2187-
2188-
2189-
2190-
2191-
2192-
2193void QPlainTextEdit::centerCursor()-
2194{-
2195 QPlainTextEditPrivate * const d = d_func();-
2196 d->ensureVisible(textCursor().position(), true, true);-
2197}
never executed: end of block
0
2198-
2199-
2200-
2201-
2202-
2203-
2204QTextBlock QPlainTextEdit::firstVisibleBlock() const-
2205{-
2206 const QPlainTextEditPrivate * const d = d_func();-
2207 return
never executed: return d->control->firstVisibleBlock();
d->control->firstVisibleBlock();
never executed: return d->control->firstVisibleBlock();
0
2208}-
2209QPointF QPlainTextEdit::contentOffset() const-
2210{-
2211 const QPlainTextEditPrivate * const d = d_func();-
2212 return
never executed: return QPointF(-d->horizontalOffset(), -d->verticalOffset());
QPointF(-d->horizontalOffset(), -d->verticalOffset());
never executed: return QPointF(-d->horizontalOffset(), -d->verticalOffset());
0
2213}-
2214QRectF QPlainTextEdit::blockBoundingGeometry(const QTextBlock &block) const-
2215{-
2216 const QPlainTextEditPrivate * const d = d_func();-
2217 return
never executed: return d->control->blockBoundingRect(block);
d->control->blockBoundingRect(block);
never executed: return d->control->blockBoundingRect(block);
0
2218}-
2219-
2220-
2221-
2222-
2223-
2224-
2225QRectF QPlainTextEdit::blockBoundingRect(const QTextBlock &block) const-
2226{-
2227 QPlainTextDocumentLayout *documentLayout = qobject_cast<QPlainTextDocumentLayout*>(document()->documentLayout());-
2228 ((!(documentLayout)) ? qt_assert("documentLayout",__FILE__,3129) : qt_noop());-
2229 return
never executed: return documentLayout->blockBoundingRect(block);
documentLayout->blockBoundingRect(block);
never executed: return documentLayout->blockBoundingRect(block);
0
2230}-
2231-
2232-
2233-
2234-
2235-
2236-
2237-
2238int QPlainTextEdit::blockCount() const-
2239{-
2240 return
never executed: return document()->blockCount();
document()->blockCount();
never executed: return document()->blockCount();
0
2241}-
2242-
2243-
2244-
2245-
2246QAbstractTextDocumentLayout::PaintContext QPlainTextEdit::getPaintContext() const-
2247{-
2248 const QPlainTextEditPrivate * const d = d_func();-
2249 return
never executed: return d->control->getPaintContext(d->viewport);
d->control->getPaintContext(d->viewport);
never executed: return d->control->getPaintContext(d->viewport);
0
2250}-
2251-
2252-
Switch to Source codePreprocessed file

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