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