| 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__ ":" "146"), q, qFlagLocation("1""updateMicroFocus()" "\0" __FILE__ ":" "146")); | - | ||||||||||||||||||
| 84 | QObject::connect(control, qFlagLocation("2""documentSizeChanged(QSizeF)" "\0" __FILE__ ":" "147"), q, qFlagLocation("1""_q_adjustScrollbars()" "\0" __FILE__ ":" "147")); | - | ||||||||||||||||||
| 85 | QObject::connect(control, qFlagLocation("2""updateRequest(QRectF)" "\0" __FILE__ ":" "148"), q, qFlagLocation("1""_q_repaintContents(QRectF)" "\0" __FILE__ ":" "148")); | - | ||||||||||||||||||
| 86 | QObject::connect(control, qFlagLocation("2""visibilityRequest(QRectF)" "\0" __FILE__ ":" "149"), q, qFlagLocation("1""_q_ensureVisible(QRectF)" "\0" __FILE__ ":" "149")); | - | ||||||||||||||||||
| 87 | QObject::connect(control, qFlagLocation("2""currentCharFormatChanged(QTextCharFormat)" "\0" __FILE__ ":" "150"), | - | ||||||||||||||||||
| 88 | q, qFlagLocation("1""_q_currentCharFormatChanged(QTextCharFormat)" "\0" __FILE__ ":" "151")); | - | ||||||||||||||||||
| 89 | - | |||||||||||||||||||
| 90 | QObject::connect(control, qFlagLocation("2""textChanged()" "\0" __FILE__ ":" "153"), q, qFlagLocation("2""textChanged()" "\0" __FILE__ ":" "153")); | - | ||||||||||||||||||
| 91 | QObject::connect(control, qFlagLocation("2""undoAvailable(bool)" "\0" __FILE__ ":" "154"), q, qFlagLocation("2""undoAvailable(bool)" "\0" __FILE__ ":" "154")); | - | ||||||||||||||||||
| 92 | QObject::connect(control, qFlagLocation("2""redoAvailable(bool)" "\0" __FILE__ ":" "155"), q, qFlagLocation("2""redoAvailable(bool)" "\0" __FILE__ ":" "155")); | - | ||||||||||||||||||
| 93 | QObject::connect(control, qFlagLocation("2""copyAvailable(bool)" "\0" __FILE__ ":" "156"), q, qFlagLocation("2""copyAvailable(bool)" "\0" __FILE__ ":" "156")); | - | ||||||||||||||||||
| 94 | QObject::connect(control, qFlagLocation("2""selectionChanged()" "\0" __FILE__ ":" "157"), q, qFlagLocation("2""selectionChanged()" "\0" __FILE__ ":" "157")); | - | ||||||||||||||||||
| 95 | QObject::connect(control, qFlagLocation("2""cursorPositionChanged()" "\0" __FILE__ ":" "158"), q, qFlagLocation("1""_q_cursorPositionChanged()" "\0" __FILE__ ":" "158")); | - | ||||||||||||||||||
| 96 | - | |||||||||||||||||||
| 97 | QObject::connect(control, qFlagLocation("2""textChanged()" "\0" __FILE__ ":" "160"), q, qFlagLocation("1""updateMicroFocus()" "\0" __FILE__ ":" "160")); | - | ||||||||||||||||||
| 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 | return never executed: QAbstractScrollArea::event(e);return QAbstractScrollArea::event(e);never executed: return QAbstractScrollArea::event(e); | 0 | ||||||||||||||||||
| 640 | } | - | ||||||||||||||||||
| 641 | - | |||||||||||||||||||
| 642 | - | |||||||||||||||||||
| 643 | - | |||||||||||||||||||
| 644 | - | |||||||||||||||||||
| 645 | void QTextEdit::timerEvent(QTimerEvent *e) | - | ||||||||||||||||||
| 646 | { | - | ||||||||||||||||||
| 647 | QTextEditPrivate * const d = d_func(); | - | ||||||||||||||||||
| 648 | if (e->timerId() == d->autoScrollTimer.timerId()
| 0 | ||||||||||||||||||
| 649 | QRect visible = d->viewport->rect(); | - | ||||||||||||||||||
| 650 | QPoint pos; | - | ||||||||||||||||||
| 651 | if (d->inDrag
| 0 | ||||||||||||||||||
| 652 | pos = d->autoScrollDragPos; | - | ||||||||||||||||||
| 653 | visible.adjust(qMin(visible.width()/3,20), qMin(visible.height()/3,20), | - | ||||||||||||||||||
| 654 | -qMin(visible.width()/3,20), -qMin(visible.height()/3,20)); | - | ||||||||||||||||||
| 655 | } never executed: else {end of block | 0 | ||||||||||||||||||
| 656 | const QPoint globalPos = QCursor::pos(); | - | ||||||||||||||||||
| 657 | pos = d->viewport->mapFromGlobal(globalPos); | - | ||||||||||||||||||
| 658 | QMouseEvent ev(QEvent::MouseMove, pos, mapTo(topLevelWidget(), pos), globalPos, Qt::LeftButton, Qt::LeftButton, Qt::NoModifier); | - | ||||||||||||||||||
| 659 | mouseMoveEvent(&ev); | - | ||||||||||||||||||
| 660 | } never executed: end of block | 0 | ||||||||||||||||||
| 661 | int deltaY = qMax(pos.y() - visible.top(), visible.bottom() - pos.y()) - visible.height(); | - | ||||||||||||||||||
| 662 | int deltaX = qMax(pos.x() - visible.left(), visible.right() - pos.x()) - visible.width(); | - | ||||||||||||||||||
| 663 | int delta = qMax(deltaX, deltaY); | - | ||||||||||||||||||
| 664 | if (delta >= 0
| 0 | ||||||||||||||||||
| 665 | if (delta < 7
| 0 | ||||||||||||||||||
| 666 | delta = 7; never executed: delta = 7; | 0 | ||||||||||||||||||
| 667 | int timeout = 4900 / (delta * delta); | - | ||||||||||||||||||
| 668 | d->autoScrollTimer.start(timeout, this); | - | ||||||||||||||||||
| 669 | - | |||||||||||||||||||
| 670 | if (deltaY > 0
| 0 | ||||||||||||||||||
| 671 | d->vbar->triggerAction(pos.y() < visible.center().y() ? never executed: d->vbar->triggerAction(pos.y() < visible.center().y() ? QAbstractSlider::SliderSingleStepSub : QAbstractSlider::SliderSingleStepAdd); | 0 | ||||||||||||||||||
| 672 | QAbstractSlider::SliderSingleStepSub never executed: d->vbar->triggerAction(pos.y() < visible.center().y() ? QAbstractSlider::SliderSingleStepSub : QAbstractSlider::SliderSingleStepAdd); | 0 | ||||||||||||||||||
| 673 | : QAbstractSlider::SliderSingleStepAdd); never executed: d->vbar->triggerAction(pos.y() < visible.center().y() ? QAbstractSlider::SliderSingleStepSub : QAbstractSlider::SliderSingleStepAdd); | 0 | ||||||||||||||||||
| 674 | if (deltaX > 0
| 0 | ||||||||||||||||||
| 675 | d->hbar->triggerAction(pos.x() < visible.center().x() ? never executed: d->hbar->triggerAction(pos.x() < visible.center().x() ? QAbstractSlider::SliderSingleStepSub : QAbstractSlider::SliderSingleStepAdd); | 0 | ||||||||||||||||||
| 676 | QAbstractSlider::SliderSingleStepSub never executed: d->hbar->triggerAction(pos.x() < visible.center().x() ? QAbstractSlider::SliderSingleStepSub : QAbstractSlider::SliderSingleStepAdd); | 0 | ||||||||||||||||||
| 677 | : QAbstractSlider::SliderSingleStepAdd); never executed: d->hbar->triggerAction(pos.x() < visible.center().x() ? QAbstractSlider::SliderSingleStepSub : QAbstractSlider::SliderSingleStepAdd); | 0 | ||||||||||||||||||
| 678 | } never executed: end of block | 0 | ||||||||||||||||||
| 679 | } never executed: end of block | 0 | ||||||||||||||||||
| 680 | - | |||||||||||||||||||
| 681 | - | |||||||||||||||||||
| 682 | - | |||||||||||||||||||
| 683 | - | |||||||||||||||||||
| 684 | - | |||||||||||||||||||
| 685 | - | |||||||||||||||||||
| 686 | } never executed: end of block | 0 | ||||||||||||||||||
| 687 | void QTextEdit::setPlainText(const QString &text) | - | ||||||||||||||||||
| 688 | { | - | ||||||||||||||||||
| 689 | QTextEditPrivate * const d = d_func(); | - | ||||||||||||||||||
| 690 | d->control->setPlainText(text); | - | ||||||||||||||||||
| 691 | d->preferRichText = false; | - | ||||||||||||||||||
| 692 | } never executed: end of block | 0 | ||||||||||||||||||
| 693 | QString QTextEdit::toPlainText() const | - | ||||||||||||||||||
| 694 | { | - | ||||||||||||||||||
| 695 | const QTextEditPrivate * const d = d_func(); | - | ||||||||||||||||||
| 696 | return never executed: d->control->toPlainText();return d->control->toPlainText();never executed: return d->control->toPlainText(); | 0 | ||||||||||||||||||
| 697 | } | - | ||||||||||||||||||
| 698 | void QTextEdit::setHtml(const QString &text) | - | ||||||||||||||||||
| 699 | { | - | ||||||||||||||||||
| 700 | QTextEditPrivate * const d = d_func(); | - | ||||||||||||||||||
| 701 | d->control->setHtml(text); | - | ||||||||||||||||||
| 702 | d->preferRichText = true; | - | ||||||||||||||||||
| 703 | } never executed: end of block | 0 | ||||||||||||||||||
| 704 | - | |||||||||||||||||||
| 705 | QString QTextEdit::toHtml() const | - | ||||||||||||||||||
| 706 | { | - | ||||||||||||||||||
| 707 | const QTextEditPrivate * const d = d_func(); | - | ||||||||||||||||||
| 708 | return never executed: d->control->toHtml();return d->control->toHtml();never executed: return d->control->toHtml(); | 0 | ||||||||||||||||||
| 709 | } | - | ||||||||||||||||||
| 710 | - | |||||||||||||||||||
| 711 | - | |||||||||||||||||||
| 712 | - | |||||||||||||||||||
| 713 | - | |||||||||||||||||||
| 714 | - | |||||||||||||||||||
| 715 | void QTextEdit::keyPressEvent(QKeyEvent *e) | - | ||||||||||||||||||
| 716 | { | - | ||||||||||||||||||
| 717 | QTextEditPrivate * const d = d_func(); | - | ||||||||||||||||||
| 718 | Qt::TextInteractionFlags tif = d->control->textInteractionFlags(); | - | ||||||||||||||||||
| 719 | - | |||||||||||||||||||
| 720 | if (tif & Qt::TextSelectableByKeyboard
| 0 | ||||||||||||||||||
| 721 | if (e == QKeySequence::SelectPreviousPage
| 0 | ||||||||||||||||||
| 722 | e->accept(); | - | ||||||||||||||||||
| 723 | d->pageUpDown(QTextCursor::Up, QTextCursor::KeepAnchor); | - | ||||||||||||||||||
| 724 | return; never executed: return; | 0 | ||||||||||||||||||
| 725 | } else if (e ==QKeySequence::SelectNextPage
| 0 | ||||||||||||||||||
| 726 | e->accept(); | - | ||||||||||||||||||
| 727 | d->pageUpDown(QTextCursor::Down, QTextCursor::KeepAnchor); | - | ||||||||||||||||||
| 728 | return; never executed: return; | 0 | ||||||||||||||||||
| 729 | } | - | ||||||||||||||||||
| 730 | } never executed: end of block | 0 | ||||||||||||||||||
| 731 | if (tif & (Qt::TextSelectableByKeyboard | Qt::TextEditable)
| 0 | ||||||||||||||||||
| 732 | if (e == QKeySequence::MoveToPreviousPage
| 0 | ||||||||||||||||||
| 733 | e->accept(); | - | ||||||||||||||||||
| 734 | d->pageUpDown(QTextCursor::Up, QTextCursor::MoveAnchor); | - | ||||||||||||||||||
| 735 | return; never executed: return; | 0 | ||||||||||||||||||
| 736 | } else if (e == QKeySequence::MoveToNextPage
| 0 | ||||||||||||||||||
| 737 | e->accept(); | - | ||||||||||||||||||
| 738 | d->pageUpDown(QTextCursor::Down, QTextCursor::MoveAnchor); | - | ||||||||||||||||||
| 739 | return; never executed: return; | 0 | ||||||||||||||||||
| 740 | } | - | ||||||||||||||||||
| 741 | } never executed: end of block | 0 | ||||||||||||||||||
| 742 | - | |||||||||||||||||||
| 743 | if (!(tif & Qt::TextEditable)
| 0 | ||||||||||||||||||
| 744 | switch (e->key()) { | - | ||||||||||||||||||
| 745 | case never executed: Qt::Key_Space:case Qt::Key_Space:never executed: case Qt::Key_Space: | 0 | ||||||||||||||||||
| 746 | e->accept(); | - | ||||||||||||||||||
| 747 | if (e->modifiers() & Qt::ShiftModifier
| 0 | ||||||||||||||||||
| 748 | d->vbar->triggerAction(QAbstractSlider::SliderPageStepSub); never executed: d->vbar->triggerAction(QAbstractSlider::SliderPageStepSub); | 0 | ||||||||||||||||||
| 749 | else | - | ||||||||||||||||||
| 750 | d->vbar->triggerAction(QAbstractSlider::SliderPageStepAdd); never executed: d->vbar->triggerAction(QAbstractSlider::SliderPageStepAdd); | 0 | ||||||||||||||||||
| 751 | break; never executed: break; | 0 | ||||||||||||||||||
| 752 | default never executed: :default:never executed: default: | 0 | ||||||||||||||||||
| 753 | d->sendControlEvent(e); | - | ||||||||||||||||||
| 754 | if (!e->isAccepted()
| 0 | ||||||||||||||||||
| 755 | if (e->key() == Qt::Key_Home
| 0 | ||||||||||||||||||
| 756 | d->vbar->triggerAction(QAbstractSlider::SliderToMinimum); | - | ||||||||||||||||||
| 757 | e->accept(); | - | ||||||||||||||||||
| 758 | } never executed: else if (e->key() == Qt::Key_Endend of block
| 0 | ||||||||||||||||||
| 759 | d->vbar->triggerAction(QAbstractSlider::SliderToMaximum); | - | ||||||||||||||||||
| 760 | e->accept(); | - | ||||||||||||||||||
| 761 | } never executed: end of block | 0 | ||||||||||||||||||
| 762 | } never executed: end of block | 0 | ||||||||||||||||||
| 763 | if (!e->isAccepted()
| 0 | ||||||||||||||||||
| 764 | QAbstractScrollArea::keyPressEvent(e); | - | ||||||||||||||||||
| 765 | } never executed: end of block | 0 | ||||||||||||||||||
| 766 | } never executed: end of block | 0 | ||||||||||||||||||
| 767 | return; never executed: return; | 0 | ||||||||||||||||||
| 768 | } | - | ||||||||||||||||||
| 769 | - | |||||||||||||||||||
| 770 | - | |||||||||||||||||||
| 771 | { | - | ||||||||||||||||||
| 772 | QTextCursor cursor = d->control->textCursor(); | - | ||||||||||||||||||
| 773 | const QString text = e->text(); | - | ||||||||||||||||||
| 774 | if (cursor.atBlockStart()
| 0 | ||||||||||||||||||
| 775 | && (
| 0 | ||||||||||||||||||
| 776 | && (
| 0 | ||||||||||||||||||
| 777 | && (text.at(0) == QLatin1Char('-')
| 0 | ||||||||||||||||||
| 778 | && (
| 0 | ||||||||||||||||||
| 779 | - | |||||||||||||||||||
| 780 | d->createAutoBulletList(); | - | ||||||||||||||||||
| 781 | e->accept(); | - | ||||||||||||||||||
| 782 | return; never executed: return; | 0 | ||||||||||||||||||
| 783 | } | - | ||||||||||||||||||
| 784 | } | - | ||||||||||||||||||
| 785 | - | |||||||||||||||||||
| 786 | d->sendControlEvent(e); | - | ||||||||||||||||||
| 787 | } never executed: end of block | 0 | ||||||||||||||||||
| 788 | - | |||||||||||||||||||
| 789 | - | |||||||||||||||||||
| 790 | - | |||||||||||||||||||
| 791 | void QTextEdit::keyReleaseEvent(QKeyEvent *e) | - | ||||||||||||||||||
| 792 | { | - | ||||||||||||||||||
| 793 | e->ignore(); | - | ||||||||||||||||||
| 794 | } never executed: end of block | 0 | ||||||||||||||||||
| 795 | QVariant QTextEdit::loadResource(int type, const QUrl &name) | - | ||||||||||||||||||
| 796 | { | - | ||||||||||||||||||
| 797 | (void)type;; | - | ||||||||||||||||||
| 798 | (void)name;; | - | ||||||||||||||||||
| 799 | return never executed: QVariant();return QVariant();never executed: return QVariant(); | 0 | ||||||||||||||||||
| 800 | } | - | ||||||||||||||||||
| 801 | - | |||||||||||||||||||
| 802 | - | |||||||||||||||||||
| 803 | - | |||||||||||||||||||
| 804 | void QTextEdit::resizeEvent(QResizeEvent *e) | - | ||||||||||||||||||
| 805 | { | - | ||||||||||||||||||
| 806 | QTextEditPrivate * const d = d_func(); | - | ||||||||||||||||||
| 807 | - | |||||||||||||||||||
| 808 | if (d->lineWrap == NoWrap
| 0 | ||||||||||||||||||
| 809 | QTextDocument *doc = d->control->document(); | - | ||||||||||||||||||
| 810 | QVariant alignmentProperty = doc->documentLayout()->property("contentHasAlignment"); | - | ||||||||||||||||||
| 811 | - | |||||||||||||||||||
| 812 | if (!doc->pageSize().isNull()
| 0 | ||||||||||||||||||
| 813 | && alignmentProperty.type() == QVariant::Bool
| 0 | ||||||||||||||||||
| 814 | && !alignmentProperty.toBool()
| 0 | ||||||||||||||||||
| 815 | - | |||||||||||||||||||
| 816 | d->_q_adjustScrollbars(); | - | ||||||||||||||||||
| 817 | return; never executed: return; | 0 | ||||||||||||||||||
| 818 | } | - | ||||||||||||||||||
| 819 | } never executed: end of block | 0 | ||||||||||||||||||
| 820 | - | |||||||||||||||||||
| 821 | if (d->lineWrap != FixedPixelWidth
| 0 | ||||||||||||||||||
| 822 | && e->oldSize().width() != e->size().width()
| 0 | ||||||||||||||||||
| 823 | d->relayoutDocument(); never executed: d->relayoutDocument(); | 0 | ||||||||||||||||||
| 824 | else | - | ||||||||||||||||||
| 825 | d->_q_adjustScrollbars(); never executed: d->_q_adjustScrollbars(); | 0 | ||||||||||||||||||
| 826 | } | - | ||||||||||||||||||
| 827 | - | |||||||||||||||||||
| 828 | void QTextEditPrivate::relayoutDocument() | - | ||||||||||||||||||
| 829 | { | - | ||||||||||||||||||
| 830 | QTextDocument *doc = control->document(); | - | ||||||||||||||||||
| 831 | QAbstractTextDocumentLayout *layout = doc->documentLayout(); | - | ||||||||||||||||||
| 832 | - | |||||||||||||||||||
| 833 | if (QTextDocumentLayout *tlayout = qobject_cast<QTextDocumentLayout *>(layout)
| 0 | ||||||||||||||||||
| 834 | if (lineWrap == QTextEdit::FixedColumnWidth
| 0 | ||||||||||||||||||
| 835 | tlayout->setFixedColumnWidth(lineWrapColumnOrWidth); never executed: tlayout->setFixedColumnWidth(lineWrapColumnOrWidth); | 0 | ||||||||||||||||||
| 836 | else | - | ||||||||||||||||||
| 837 | tlayout->setFixedColumnWidth(-1); never executed: tlayout->setFixedColumnWidth(-1); | 0 | ||||||||||||||||||
| 838 | } | - | ||||||||||||||||||
| 839 | - | |||||||||||||||||||
| 840 | QTextDocumentLayout *tlayout = qobject_cast<QTextDocumentLayout *>(layout); | - | ||||||||||||||||||
| 841 | QSize lastUsedSize; | - | ||||||||||||||||||
| 842 | if (tlayout
| 0 | ||||||||||||||||||
| 843 | lastUsedSize = tlayout->dynamicDocumentSize().toSize(); never executed: lastUsedSize = tlayout->dynamicDocumentSize().toSize(); | 0 | ||||||||||||||||||
| 844 | else | - | ||||||||||||||||||
| 845 | lastUsedSize = layout->documentSize().toSize(); never executed: lastUsedSize = layout->documentSize().toSize(); | 0 | ||||||||||||||||||
| 846 | - | |||||||||||||||||||
| 847 | - | |||||||||||||||||||
| 848 | - | |||||||||||||||||||
| 849 | - | |||||||||||||||||||
| 850 | const bool oldIgnoreScrollbarAdjustment = ignoreAutomaticScrollbarAdjustment; | - | ||||||||||||||||||
| 851 | ignoreAutomaticScrollbarAdjustment = true; | - | ||||||||||||||||||
| 852 | - | |||||||||||||||||||
| 853 | int width = viewport->width(); | - | ||||||||||||||||||
| 854 | if (lineWrap == QTextEdit::FixedPixelWidth
| 0 | ||||||||||||||||||
| 855 | width = lineWrapColumnOrWidth; never executed: width = lineWrapColumnOrWidth; | 0 | ||||||||||||||||||
| 856 | else if (lineWrap == QTextEdit::NoWrap
| 0 | ||||||||||||||||||
| 857 | QVariant alignmentProperty = doc->documentLayout()->property("contentHasAlignment"); | - | ||||||||||||||||||
| 858 | if (alignmentProperty.type() == QVariant::Bool
| 0 | ||||||||||||||||||
| 859 | - | |||||||||||||||||||
| 860 | width = 0; | - | ||||||||||||||||||
| 861 | } never executed: end of block | 0 | ||||||||||||||||||
| 862 | } never executed: end of block | 0 | ||||||||||||||||||
| 863 | - | |||||||||||||||||||
| 864 | doc->setPageSize(QSize(width, -1)); | - | ||||||||||||||||||
| 865 | if (tlayout
| 0 | ||||||||||||||||||
| 866 | tlayout->ensureLayouted(verticalOffset() + viewport->height()); never executed: tlayout->ensureLayouted(verticalOffset() + viewport->height()); | 0 | ||||||||||||||||||
| 867 | - | |||||||||||||||||||
| 868 | ignoreAutomaticScrollbarAdjustment = oldIgnoreScrollbarAdjustment; | - | ||||||||||||||||||
| 869 | - | |||||||||||||||||||
| 870 | QSize usedSize; | - | ||||||||||||||||||
| 871 | if (tlayout
| 0 | ||||||||||||||||||
| 872 | usedSize = tlayout->dynamicDocumentSize().toSize(); never executed: usedSize = tlayout->dynamicDocumentSize().toSize(); | 0 | ||||||||||||||||||
| 873 | else | - | ||||||||||||||||||
| 874 | usedSize = layout->documentSize().toSize(); never executed: usedSize = layout->documentSize().toSize(); | 0 | ||||||||||||||||||
| 875 | if (lastUsedSize.isValid()
| 0 | ||||||||||||||||||
| 876 | && !vbar->isHidden()
| 0 | ||||||||||||||||||
| 877 | && viewport->width() < lastUsedSize.width()
| 0 | ||||||||||||||||||
| 878 | && usedSize.height() < lastUsedSize.height()
| 0 | ||||||||||||||||||
| 879 | && usedSize.height() <= viewport->height()
| 0 | ||||||||||||||||||
| 880 | return; never executed: return; | 0 | ||||||||||||||||||
| 881 | - | |||||||||||||||||||
| 882 | _q_adjustScrollbars(); | - | ||||||||||||||||||
| 883 | } never executed: end of block | 0 | ||||||||||||||||||
| 884 | - | |||||||||||||||||||
| 885 | void QTextEditPrivate::paint(QPainter *p, QPaintEvent *e) | - | ||||||||||||||||||
| 886 | { | - | ||||||||||||||||||
| 887 | const int xOffset = horizontalOffset(); | - | ||||||||||||||||||
| 888 | const int yOffset = verticalOffset(); | - | ||||||||||||||||||
| 889 | - | |||||||||||||||||||
| 890 | QRect r = e->rect(); | - | ||||||||||||||||||
| 891 | p->translate(-xOffset, -yOffset); | - | ||||||||||||||||||
| 892 | r.translate(xOffset, yOffset); | - | ||||||||||||||||||
| 893 | - | |||||||||||||||||||
| 894 | QTextDocument *doc = control->document(); | - | ||||||||||||||||||
| 895 | QTextDocumentLayout *layout = qobject_cast<QTextDocumentLayout *>(doc->documentLayout()); | - | ||||||||||||||||||
| 896 | - | |||||||||||||||||||
| 897 | - | |||||||||||||||||||
| 898 | - | |||||||||||||||||||
| 899 | if (layout
| 0 | ||||||||||||||||||
| 900 | layout->setViewport(viewport->rect()); never executed: layout->setViewport(viewport->rect()); | 0 | ||||||||||||||||||
| 901 | - | |||||||||||||||||||
| 902 | control->drawContents(p, r, q_func()); | - | ||||||||||||||||||
| 903 | - | |||||||||||||||||||
| 904 | if (layout
| 0 | ||||||||||||||||||
| 905 | layout->setViewport(QRect()); never executed: layout->setViewport(QRect()); | 0 | ||||||||||||||||||
| 906 | - | |||||||||||||||||||
| 907 | if (!placeholderText.isEmpty()
| 0 | ||||||||||||||||||
| 908 | QColor col = control->palette().text().color(); | - | ||||||||||||||||||
| 909 | col.setAlpha(128); | - | ||||||||||||||||||
| 910 | p->setPen(col); | - | ||||||||||||||||||
| 911 | const int margin = int(doc->documentMargin()); | - | ||||||||||||||||||
| 912 | p->drawText(viewport->rect().adjusted(margin, margin, -margin, -margin), Qt::AlignTop | Qt::TextWordWrap, placeholderText); | - | ||||||||||||||||||
| 913 | } never executed: end of block | 0 | ||||||||||||||||||
| 914 | } never executed: end of block | 0 | ||||||||||||||||||
| 915 | void QTextEdit::paintEvent(QPaintEvent *e) | - | ||||||||||||||||||
| 916 | { | - | ||||||||||||||||||
| 917 | QTextEditPrivate * const d = d_func(); | - | ||||||||||||||||||
| 918 | QPainter p(d->viewport); | - | ||||||||||||||||||
| 919 | d->paint(&p, e); | - | ||||||||||||||||||
| 920 | } never executed: end of block | 0 | ||||||||||||||||||
| 921 | - | |||||||||||||||||||
| 922 | void QTextEditPrivate::_q_currentCharFormatChanged(const QTextCharFormat &fmt) | - | ||||||||||||||||||
| 923 | { | - | ||||||||||||||||||
| 924 | QTextEdit * const q = q_func(); | - | ||||||||||||||||||
| 925 | q->currentCharFormatChanged(fmt); | - | ||||||||||||||||||
| 926 | } never executed: end of block | 0 | ||||||||||||||||||
| 927 | - | |||||||||||||||||||
| 928 | void QTextEditPrivate::updateDefaultTextOption() | - | ||||||||||||||||||
| 929 | { | - | ||||||||||||||||||
| 930 | QTextDocument *doc = control->document(); | - | ||||||||||||||||||
| 931 | - | |||||||||||||||||||
| 932 | QTextOption opt = doc->defaultTextOption(); | - | ||||||||||||||||||
| 933 | QTextOption::WrapMode oldWrapMode = opt.wrapMode(); | - | ||||||||||||||||||
| 934 | - | |||||||||||||||||||
| 935 | if (lineWrap == QTextEdit::NoWrap
| 0 | ||||||||||||||||||
| 936 | opt.setWrapMode(QTextOption::NoWrap); never executed: opt.setWrapMode(QTextOption::NoWrap); | 0 | ||||||||||||||||||
| 937 | else | - | ||||||||||||||||||
| 938 | opt.setWrapMode(wordWrap); never executed: opt.setWrapMode(wordWrap); | 0 | ||||||||||||||||||
| 939 | - | |||||||||||||||||||
| 940 | if (opt.wrapMode() != oldWrapMode
| 0 | ||||||||||||||||||
| 941 | doc->setDefaultTextOption(opt); never executed: doc->setDefaultTextOption(opt); | 0 | ||||||||||||||||||
| 942 | } never executed: end of block | 0 | ||||||||||||||||||
| 943 | - | |||||||||||||||||||
| 944 | - | |||||||||||||||||||
| 945 | - | |||||||||||||||||||
| 946 | void QTextEdit::mousePressEvent(QMouseEvent *e) | - | ||||||||||||||||||
| 947 | { | - | ||||||||||||||||||
| 948 | QTextEditPrivate * const d = d_func(); | - | ||||||||||||||||||
| 949 | - | |||||||||||||||||||
| 950 | - | |||||||||||||||||||
| 951 | - | |||||||||||||||||||
| 952 | - | |||||||||||||||||||
| 953 | d->sendControlEvent(e); | - | ||||||||||||||||||
| 954 | } never executed: end of block | 0 | ||||||||||||||||||
| 955 | - | |||||||||||||||||||
| 956 | - | |||||||||||||||||||
| 957 | - | |||||||||||||||||||
| 958 | void QTextEdit::mouseMoveEvent(QMouseEvent *e) | - | ||||||||||||||||||
| 959 | { | - | ||||||||||||||||||
| 960 | QTextEditPrivate * const d = d_func(); | - | ||||||||||||||||||
| 961 | d->inDrag = false; | - | ||||||||||||||||||
| 962 | const QPoint pos = e->pos(); | - | ||||||||||||||||||
| 963 | d->sendControlEvent(e); | - | ||||||||||||||||||
| 964 | if (!(e->buttons() & Qt::LeftButton)
| 0 | ||||||||||||||||||
| 965 | return; never executed: return; | 0 | ||||||||||||||||||
| 966 | if (e->source() == Qt::MouseEventNotSynthesized
| 0 | ||||||||||||||||||
| 967 | const QRect visible = d->viewport->rect(); | - | ||||||||||||||||||
| 968 | if (visible.contains(pos)
| 0 | ||||||||||||||||||
| 969 | d->autoScrollTimer.stop(); never executed: d->autoScrollTimer.stop(); | 0 | ||||||||||||||||||
| 970 | else if (!d->autoScrollTimer.isActive()
| 0 | ||||||||||||||||||
| 971 | d->autoScrollTimer.start(100, this); never executed: d->autoScrollTimer.start(100, this); | 0 | ||||||||||||||||||
| 972 | } never executed: end of block | 0 | ||||||||||||||||||
| 973 | } never executed: end of block | 0 | ||||||||||||||||||
| 974 | - | |||||||||||||||||||
| 975 | - | |||||||||||||||||||
| 976 | - | |||||||||||||||||||
| 977 | void QTextEdit::mouseReleaseEvent(QMouseEvent *e) | - | ||||||||||||||||||
| 978 | { | - | ||||||||||||||||||
| 979 | QTextEditPrivate * const d = d_func(); | - | ||||||||||||||||||
| 980 | d->sendControlEvent(e); | - | ||||||||||||||||||
| 981 | if (e->source() == Qt::MouseEventNotSynthesized
| 0 | ||||||||||||||||||
| 982 | d->autoScrollTimer.stop(); | - | ||||||||||||||||||
| 983 | ensureCursorVisible(); | - | ||||||||||||||||||
| 984 | } never executed: end of block | 0 | ||||||||||||||||||
| 985 | if (!isReadOnly()
| 0 | ||||||||||||||||||
| 986 | d->handleSoftwareInputPanel(e->button(), d->clickCausedFocus); never executed: d->handleSoftwareInputPanel(e->button(), d->clickCausedFocus); | 0 | ||||||||||||||||||
| 987 | d->clickCausedFocus = 0; | - | ||||||||||||||||||
| 988 | } never executed: end of block | 0 | ||||||||||||||||||
| 989 | - | |||||||||||||||||||
| 990 | - | |||||||||||||||||||
| 991 | - | |||||||||||||||||||
| 992 | void QTextEdit::mouseDoubleClickEvent(QMouseEvent *e) | - | ||||||||||||||||||
| 993 | { | - | ||||||||||||||||||
| 994 | QTextEditPrivate * const d = d_func(); | - | ||||||||||||||||||
| 995 | d->sendControlEvent(e); | - | ||||||||||||||||||
| 996 | } never executed: end of block | 0 | ||||||||||||||||||
| 997 | - | |||||||||||||||||||
| 998 | - | |||||||||||||||||||
| 999 | - | |||||||||||||||||||
| 1000 | bool QTextEdit::focusNextPrevChild(bool next) | - | ||||||||||||||||||
| 1001 | { | - | ||||||||||||||||||
| 1002 | const QTextEditPrivate * const d = d_func(); | - | ||||||||||||||||||
| 1003 | if (!d->tabChangesFocus
| 0 | ||||||||||||||||||
| 1004 | return never executed: false;return false;never executed: return false; | 0 | ||||||||||||||||||
| 1005 | return never executed: QAbstractScrollArea::focusNextPrevChild(next);return QAbstractScrollArea::focusNextPrevChild(next);never executed: return QAbstractScrollArea::focusNextPrevChild(next); | 0 | ||||||||||||||||||
| 1006 | } | - | ||||||||||||||||||
| 1007 | void QTextEdit::contextMenuEvent(QContextMenuEvent *e) | - | ||||||||||||||||||
| 1008 | { | - | ||||||||||||||||||
| 1009 | QTextEditPrivate * const d = d_func(); | - | ||||||||||||||||||
| 1010 | d->sendControlEvent(e); | - | ||||||||||||||||||
| 1011 | } never executed: end of block | 0 | ||||||||||||||||||
| 1012 | - | |||||||||||||||||||
| 1013 | - | |||||||||||||||||||
| 1014 | - | |||||||||||||||||||
| 1015 | - | |||||||||||||||||||
| 1016 | - | |||||||||||||||||||
| 1017 | void QTextEdit::dragEnterEvent(QDragEnterEvent *e) | - | ||||||||||||||||||
| 1018 | { | - | ||||||||||||||||||
| 1019 | QTextEditPrivate * const d = d_func(); | - | ||||||||||||||||||
| 1020 | d->inDrag = true; | - | ||||||||||||||||||
| 1021 | d->sendControlEvent(e); | - | ||||||||||||||||||
| 1022 | } never executed: end of block | 0 | ||||||||||||||||||
| 1023 | - | |||||||||||||||||||
| 1024 | - | |||||||||||||||||||
| 1025 | - | |||||||||||||||||||
| 1026 | void QTextEdit::dragLeaveEvent(QDragLeaveEvent *e) | - | ||||||||||||||||||
| 1027 | { | - | ||||||||||||||||||
| 1028 | QTextEditPrivate * const d = d_func(); | - | ||||||||||||||||||
| 1029 | d->inDrag = false; | - | ||||||||||||||||||
| 1030 | d->autoScrollTimer.stop(); | - | ||||||||||||||||||
| 1031 | d->sendControlEvent(e); | - | ||||||||||||||||||
| 1032 | } never executed: end of block | 0 | ||||||||||||||||||
| 1033 | - | |||||||||||||||||||
| 1034 | - | |||||||||||||||||||
| 1035 | - | |||||||||||||||||||
| 1036 | void QTextEdit::dragMoveEvent(QDragMoveEvent *e) | - | ||||||||||||||||||
| 1037 | { | - | ||||||||||||||||||
| 1038 | QTextEditPrivate * const d = d_func(); | - | ||||||||||||||||||
| 1039 | d->autoScrollDragPos = e->pos(); | - | ||||||||||||||||||
| 1040 | if (!d->autoScrollTimer.isActive()
| 0 | ||||||||||||||||||
| 1041 | d->autoScrollTimer.start(100, this); never executed: d->autoScrollTimer.start(100, this); | 0 | ||||||||||||||||||
| 1042 | d->sendControlEvent(e); | - | ||||||||||||||||||
| 1043 | } never executed: end of block | 0 | ||||||||||||||||||
| 1044 | - | |||||||||||||||||||
| 1045 | - | |||||||||||||||||||
| 1046 | - | |||||||||||||||||||
| 1047 | void QTextEdit::dropEvent(QDropEvent *e) | - | ||||||||||||||||||
| 1048 | { | - | ||||||||||||||||||
| 1049 | QTextEditPrivate * const d = d_func(); | - | ||||||||||||||||||
| 1050 | d->inDrag = false; | - | ||||||||||||||||||
| 1051 | d->autoScrollTimer.stop(); | - | ||||||||||||||||||
| 1052 | d->sendControlEvent(e); | - | ||||||||||||||||||
| 1053 | } never executed: end of block | 0 | ||||||||||||||||||
| 1054 | - | |||||||||||||||||||
| 1055 | - | |||||||||||||||||||
| 1056 | - | |||||||||||||||||||
| 1057 | - | |||||||||||||||||||
| 1058 | - | |||||||||||||||||||
| 1059 | void QTextEdit::inputMethodEvent(QInputMethodEvent *e) | - | ||||||||||||||||||
| 1060 | { | - | ||||||||||||||||||
| 1061 | QTextEditPrivate * const d = d_func(); | - | ||||||||||||||||||
| 1062 | - | |||||||||||||||||||
| 1063 | - | |||||||||||||||||||
| 1064 | - | |||||||||||||||||||
| 1065 | - | |||||||||||||||||||
| 1066 | - | |||||||||||||||||||
| 1067 | - | |||||||||||||||||||
| 1068 | d->sendControlEvent(e); | - | ||||||||||||||||||
| 1069 | ensureCursorVisible(); | - | ||||||||||||||||||
| 1070 | } never executed: end of block | 0 | ||||||||||||||||||
| 1071 | - | |||||||||||||||||||
| 1072 | - | |||||||||||||||||||
| 1073 | - | |||||||||||||||||||
| 1074 | void QTextEdit::scrollContentsBy(int dx, int dy) | - | ||||||||||||||||||
| 1075 | { | - | ||||||||||||||||||
| 1076 | QTextEditPrivate * const d = d_func(); | - | ||||||||||||||||||
| 1077 | if (isRightToLeft()
| 0 | ||||||||||||||||||
| 1078 | dx = -dx; never executed: dx = -dx; | 0 | ||||||||||||||||||
| 1079 | d->viewport->scroll(dx, dy); | - | ||||||||||||||||||
| 1080 | QGuiApplication::inputMethod()->update(Qt::ImCursorRectangle | Qt::ImAnchorRectangle); | - | ||||||||||||||||||
| 1081 | } never executed: end of block | 0 | ||||||||||||||||||
| 1082 | - | |||||||||||||||||||
| 1083 | - | |||||||||||||||||||
| 1084 | - | |||||||||||||||||||
| 1085 | QVariant QTextEdit::inputMethodQuery(Qt::InputMethodQuery property) const | - | ||||||||||||||||||
| 1086 | { | - | ||||||||||||||||||
| 1087 | return never executed: inputMethodQuery(property, QVariant());return inputMethodQuery(property, QVariant());never executed: return inputMethodQuery(property, QVariant()); | 0 | ||||||||||||||||||
| 1088 | } | - | ||||||||||||||||||
| 1089 | - | |||||||||||||||||||
| 1090 | - | |||||||||||||||||||
| 1091 | - | |||||||||||||||||||
| 1092 | QVariant QTextEdit::inputMethodQuery(Qt::InputMethodQuery query, QVariant argument) const | - | ||||||||||||||||||
| 1093 | { | - | ||||||||||||||||||
| 1094 | const QTextEditPrivate * const d = d_func(); | - | ||||||||||||||||||
| 1095 | switch (query) { | - | ||||||||||||||||||
| 1096 | case never executed: Qt::ImHints:case Qt::ImHints:never executed: case Qt::ImHints: | 0 | ||||||||||||||||||
| 1097 | case never executed: Qt::ImInputItemClipRectangle:case Qt::ImInputItemClipRectangle:never executed: case Qt::ImInputItemClipRectangle: | 0 | ||||||||||||||||||
| 1098 | return never executed: QWidget::inputMethodQuery(query);return QWidget::inputMethodQuery(query);never executed: return QWidget::inputMethodQuery(query); | 0 | ||||||||||||||||||
| 1099 | default never executed: :default:never executed: default: | 0 | ||||||||||||||||||
| 1100 | break; never executed: break; | 0 | ||||||||||||||||||
| 1101 | } | - | ||||||||||||||||||
| 1102 | - | |||||||||||||||||||
| 1103 | const QPointF offset(-d->horizontalOffset(), -d->verticalOffset()); | - | ||||||||||||||||||
| 1104 | switch (argument.type()) { | - | ||||||||||||||||||
| 1105 | case never executed: QVariant::RectF:case QVariant::RectF:never executed: case QVariant::RectF: | 0 | ||||||||||||||||||
| 1106 | argument = argument.toRectF().translated(-offset); | - | ||||||||||||||||||
| 1107 | break; never executed: break; | 0 | ||||||||||||||||||
| 1108 | case never executed: QVariant::PointF:case QVariant::PointF:never executed: case QVariant::PointF: | 0 | ||||||||||||||||||
| 1109 | argument = argument.toPointF() - offset; | - | ||||||||||||||||||
| 1110 | break; never executed: break; | 0 | ||||||||||||||||||
| 1111 | case never executed: QVariant::Rect:case QVariant::Rect:never executed: case QVariant::Rect: | 0 | ||||||||||||||||||
| 1112 | argument = argument.toRect().translated(-offset.toPoint()); | - | ||||||||||||||||||
| 1113 | break; never executed: break; | 0 | ||||||||||||||||||
| 1114 | case never executed: QVariant::Point:case QVariant::Point:never executed: case QVariant::Point: | 0 | ||||||||||||||||||
| 1115 | argument = argument.toPoint() - offset; | - | ||||||||||||||||||
| 1116 | break; never executed: break; | 0 | ||||||||||||||||||
| 1117 | default never executed: :default:never executed: default: | 0 | ||||||||||||||||||
| 1118 | break; never executed: break; | 0 | ||||||||||||||||||
| 1119 | } | - | ||||||||||||||||||
| 1120 | - | |||||||||||||||||||
| 1121 | const QVariant v = d->control->inputMethodQuery(query, argument); | - | ||||||||||||||||||
| 1122 | switch (v.type()) { | - | ||||||||||||||||||
| 1123 | case never executed: QVariant::RectF:case QVariant::RectF:never executed: case QVariant::RectF: | 0 | ||||||||||||||||||
| 1124 | return never executed: v.toRectF().translated(offset);return v.toRectF().translated(offset);never executed: return v.toRectF().translated(offset); | 0 | ||||||||||||||||||
| 1125 | case never executed: QVariant::PointF:case QVariant::PointF:never executed: case QVariant::PointF: | 0 | ||||||||||||||||||
| 1126 | return never executed: v.toPointF() + offset;return v.toPointF() + offset;never executed: return v.toPointF() + offset; | 0 | ||||||||||||||||||
| 1127 | case never executed: QVariant::Rect:case QVariant::Rect:never executed: case QVariant::Rect: | 0 | ||||||||||||||||||
| 1128 | return never executed: v.toRect().translated(offset.toPoint());return v.toRect().translated(offset.toPoint());never executed: return v.toRect().translated(offset.toPoint()); | 0 | ||||||||||||||||||
| 1129 | case never executed: QVariant::Point:case QVariant::Point:never executed: case QVariant::Point: | 0 | ||||||||||||||||||
| 1130 | return never executed: v.toPoint() + offset.toPoint();return v.toPoint() + offset.toPoint();never executed: return v.toPoint() + offset.toPoint(); | 0 | ||||||||||||||||||
| 1131 | default never executed: :default:never executed: default: | 0 | ||||||||||||||||||
| 1132 | break; never executed: break; | 0 | ||||||||||||||||||
| 1133 | } | - | ||||||||||||||||||
| 1134 | return never executed: v;return v;never executed: return v; | 0 | ||||||||||||||||||
| 1135 | } | - | ||||||||||||||||||
| 1136 | - | |||||||||||||||||||
| 1137 | - | |||||||||||||||||||
| 1138 | - | |||||||||||||||||||
| 1139 | void QTextEdit::focusInEvent(QFocusEvent *e) | - | ||||||||||||||||||
| 1140 | { | - | ||||||||||||||||||
| 1141 | QTextEditPrivate * const d = d_func(); | - | ||||||||||||||||||
| 1142 | if (e->reason() == Qt::MouseFocusReason
| 0 | ||||||||||||||||||
| 1143 | d->clickCausedFocus = 1; | - | ||||||||||||||||||
| 1144 | } never executed: end of block | 0 | ||||||||||||||||||
| 1145 | QAbstractScrollArea::focusInEvent(e); | - | ||||||||||||||||||
| 1146 | d->sendControlEvent(e); | - | ||||||||||||||||||
| 1147 | } never executed: end of block | 0 | ||||||||||||||||||
| 1148 | - | |||||||||||||||||||
| 1149 | - | |||||||||||||||||||
| 1150 | - | |||||||||||||||||||
| 1151 | void QTextEdit::focusOutEvent(QFocusEvent *e) | - | ||||||||||||||||||
| 1152 | { | - | ||||||||||||||||||
| 1153 | QTextEditPrivate * const d = d_func(); | - | ||||||||||||||||||
| 1154 | QAbstractScrollArea::focusOutEvent(e); | - | ||||||||||||||||||
| 1155 | d->sendControlEvent(e); | - | ||||||||||||||||||
| 1156 | } never executed: end of block | 0 | ||||||||||||||||||
| 1157 | - | |||||||||||||||||||
| 1158 | - | |||||||||||||||||||
| 1159 | - | |||||||||||||||||||
| 1160 | void QTextEdit::showEvent(QShowEvent *) | - | ||||||||||||||||||
| 1161 | { | - | ||||||||||||||||||
| 1162 | QTextEditPrivate * const d = d_func(); | - | ||||||||||||||||||
| 1163 | if (!d->anchorToScrollToWhenVisible.isEmpty()
| 0 | ||||||||||||||||||
| 1164 | scrollToAnchor(d->anchorToScrollToWhenVisible); | - | ||||||||||||||||||
| 1165 | d->anchorToScrollToWhenVisible.clear(); | - | ||||||||||||||||||
| 1166 | d->showCursorOnInitialShow = false; | - | ||||||||||||||||||
| 1167 | } never executed: else if (d->showCursorOnInitialShowend of block
| 0 | ||||||||||||||||||
| 1168 | d->showCursorOnInitialShow = false; | - | ||||||||||||||||||
| 1169 | ensureCursorVisible(); | - | ||||||||||||||||||
| 1170 | } never executed: end of block | 0 | ||||||||||||||||||
| 1171 | } never executed: end of block | 0 | ||||||||||||||||||
| 1172 | - | |||||||||||||||||||
| 1173 | - | |||||||||||||||||||
| 1174 | - | |||||||||||||||||||
| 1175 | void QTextEdit::changeEvent(QEvent *e) | - | ||||||||||||||||||
| 1176 | { | - | ||||||||||||||||||
| 1177 | QTextEditPrivate * const d = d_func(); | - | ||||||||||||||||||
| 1178 | QAbstractScrollArea::changeEvent(e); | - | ||||||||||||||||||
| 1179 | if (e->type() == QEvent::ApplicationFontChange
| 0 | ||||||||||||||||||
| 1180 | || e->type() == QEvent::FontChange
| 0 | ||||||||||||||||||
| 1181 | d->control->document()->setDefaultFont(font()); | - | ||||||||||||||||||
| 1182 | } never executed: else if(e->type() == QEvent::ActivationChangeend of block
| 0 | ||||||||||||||||||
| 1183 | if (!isActiveWindow()
| 0 | ||||||||||||||||||
| 1184 | d->autoScrollTimer.stop(); never executed: d->autoScrollTimer.stop(); | 0 | ||||||||||||||||||
| 1185 | } never executed: else if (e->type() == QEvent::EnabledChangeend of block
| 0 | ||||||||||||||||||
| 1186 | e->setAccepted(isEnabled()); | - | ||||||||||||||||||
| 1187 | d->control->setPalette(palette()); | - | ||||||||||||||||||
| 1188 | d->sendControlEvent(e); | - | ||||||||||||||||||
| 1189 | } never executed: else if (e->type() == QEvent::PaletteChangeend of block
| 0 | ||||||||||||||||||
| 1190 | d->control->setPalette(palette()); | - | ||||||||||||||||||
| 1191 | } never executed: else if (e->type() == QEvent::LayoutDirectionChangeend of block
| 0 | ||||||||||||||||||
| 1192 | d->sendControlEvent(e); | - | ||||||||||||||||||
| 1193 | } never executed: end of block | 0 | ||||||||||||||||||
| 1194 | } never executed: end of block | 0 | ||||||||||||||||||
| 1195 | - | |||||||||||||||||||
| 1196 | - | |||||||||||||||||||
| 1197 | - | |||||||||||||||||||
| 1198 | - | |||||||||||||||||||
| 1199 | void QTextEdit::wheelEvent(QWheelEvent *e) | - | ||||||||||||||||||
| 1200 | { | - | ||||||||||||||||||
| 1201 | QTextEditPrivate * const d = d_func(); | - | ||||||||||||||||||
| 1202 | if (!(d->control->textInteractionFlags() & Qt::TextEditable)
| 0 | ||||||||||||||||||
| 1203 | if (e->modifiers() & Qt::ControlModifier
| 0 | ||||||||||||||||||
| 1204 | float delta = e->angleDelta().y() / 120.f; | - | ||||||||||||||||||
| 1205 | zoomInF(delta); | - | ||||||||||||||||||
| 1206 | return; never executed: return; | 0 | ||||||||||||||||||
| 1207 | } | - | ||||||||||||||||||
| 1208 | } never executed: end of block | 0 | ||||||||||||||||||
| 1209 | QAbstractScrollArea::wheelEvent(e); | - | ||||||||||||||||||
| 1210 | updateMicroFocus(); | - | ||||||||||||||||||
| 1211 | } never executed: end of block | 0 | ||||||||||||||||||
| 1212 | QMenu *QTextEdit::createStandardContextMenu() | - | ||||||||||||||||||
| 1213 | { | - | ||||||||||||||||||
| 1214 | QTextEditPrivate * const d = d_func(); | - | ||||||||||||||||||
| 1215 | return never executed: d->control->createStandardContextMenu(QPointF(), this);return d->control->createStandardContextMenu(QPointF(), this);never executed: return d->control->createStandardContextMenu(QPointF(), this); | 0 | ||||||||||||||||||
| 1216 | } | - | ||||||||||||||||||
| 1217 | QMenu *QTextEdit::createStandardContextMenu(const QPoint &position) | - | ||||||||||||||||||
| 1218 | { | - | ||||||||||||||||||
| 1219 | QTextEditPrivate * const d = d_func(); | - | ||||||||||||||||||
| 1220 | return never executed: d->control->createStandardContextMenu(position, this);return d->control->createStandardContextMenu(position, this);never executed: return d->control->createStandardContextMenu(position, this); | 0 | ||||||||||||||||||
| 1221 | } | - | ||||||||||||||||||
| 1222 | - | |||||||||||||||||||
| 1223 | - | |||||||||||||||||||
| 1224 | - | |||||||||||||||||||
| 1225 | - | |||||||||||||||||||
| 1226 | - | |||||||||||||||||||
| 1227 | QTextCursor QTextEdit::cursorForPosition(const QPoint &pos) const | - | ||||||||||||||||||
| 1228 | { | - | ||||||||||||||||||
| 1229 | const QTextEditPrivate * const d = d_func(); | - | ||||||||||||||||||
| 1230 | 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 | ||||||||||||||||||
| 1231 | } | - | ||||||||||||||||||
| 1232 | - | |||||||||||||||||||
| 1233 | - | |||||||||||||||||||
| 1234 | - | |||||||||||||||||||
| 1235 | - | |||||||||||||||||||
| 1236 | - | |||||||||||||||||||
| 1237 | QRect QTextEdit::cursorRect(const QTextCursor &cursor) const | - | ||||||||||||||||||
| 1238 | { | - | ||||||||||||||||||
| 1239 | const QTextEditPrivate * const d = d_func(); | - | ||||||||||||||||||
| 1240 | if (cursor.isNull()
| 0 | ||||||||||||||||||
| 1241 | return never executed: QRect();return QRect();never executed: return QRect(); | 0 | ||||||||||||||||||
| 1242 | - | |||||||||||||||||||
| 1243 | QRect r = d->control->cursorRect(cursor).toRect(); | - | ||||||||||||||||||
| 1244 | r.translate(-d->horizontalOffset(),-d->verticalOffset()); | - | ||||||||||||||||||
| 1245 | return never executed: r;return r;never executed: return r; | 0 | ||||||||||||||||||
| 1246 | } | - | ||||||||||||||||||
| 1247 | - | |||||||||||||||||||
| 1248 | - | |||||||||||||||||||
| 1249 | - | |||||||||||||||||||
| 1250 | - | |||||||||||||||||||
| 1251 | - | |||||||||||||||||||
| 1252 | QRect QTextEdit::cursorRect() const | - | ||||||||||||||||||
| 1253 | { | - | ||||||||||||||||||
| 1254 | const QTextEditPrivate * const d = d_func(); | - | ||||||||||||||||||
| 1255 | QRect r = d->control->cursorRect().toRect(); | - | ||||||||||||||||||
| 1256 | r.translate(-d->horizontalOffset(),-d->verticalOffset()); | - | ||||||||||||||||||
| 1257 | return never executed: r;return r;never executed: return r; | 0 | ||||||||||||||||||
| 1258 | } | - | ||||||||||||||||||
| 1259 | - | |||||||||||||||||||
| 1260 | - | |||||||||||||||||||
| 1261 | - | |||||||||||||||||||
| 1262 | - | |||||||||||||||||||
| 1263 | - | |||||||||||||||||||
| 1264 | - | |||||||||||||||||||
| 1265 | QString QTextEdit::anchorAt(const QPoint& pos) const | - | ||||||||||||||||||
| 1266 | { | - | ||||||||||||||||||
| 1267 | const QTextEditPrivate * const d = d_func(); | - | ||||||||||||||||||
| 1268 | 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 | ||||||||||||||||||
| 1269 | } | - | ||||||||||||||||||
| 1270 | bool QTextEdit::overwriteMode() const | - | ||||||||||||||||||
| 1271 | { | - | ||||||||||||||||||
| 1272 | const QTextEditPrivate * const d = d_func(); | - | ||||||||||||||||||
| 1273 | return never executed: d->control->overwriteMode();return d->control->overwriteMode();never executed: return d->control->overwriteMode(); | 0 | ||||||||||||||||||
| 1274 | } | - | ||||||||||||||||||
| 1275 | - | |||||||||||||||||||
| 1276 | void QTextEdit::setOverwriteMode(bool overwrite) | - | ||||||||||||||||||
| 1277 | { | - | ||||||||||||||||||
| 1278 | QTextEditPrivate * const d = d_func(); | - | ||||||||||||||||||
| 1279 | d->control->setOverwriteMode(overwrite); | - | ||||||||||||||||||
| 1280 | } never executed: end of block | 0 | ||||||||||||||||||
| 1281 | int QTextEdit::tabStopWidth() const | - | ||||||||||||||||||
| 1282 | { | - | ||||||||||||||||||
| 1283 | const QTextEditPrivate * const d = d_func(); | - | ||||||||||||||||||
| 1284 | 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 | ||||||||||||||||||
| 1285 | } | - | ||||||||||||||||||
| 1286 | - | |||||||||||||||||||
| 1287 | void QTextEdit::setTabStopWidth(int width) | - | ||||||||||||||||||
| 1288 | { | - | ||||||||||||||||||
| 1289 | QTextEditPrivate * const d = d_func(); | - | ||||||||||||||||||
| 1290 | QTextOption opt = d->control->document()->defaultTextOption(); | - | ||||||||||||||||||
| 1291 | if (opt.tabStop() == width
| 0 | ||||||||||||||||||
| 1292 | return; never executed: return; | 0 | ||||||||||||||||||
| 1293 | opt.setTabStop(width); | - | ||||||||||||||||||
| 1294 | d->control->document()->setDefaultTextOption(opt); | - | ||||||||||||||||||
| 1295 | } never executed: end of block | 0 | ||||||||||||||||||
| 1296 | - | |||||||||||||||||||
| 1297 | - | |||||||||||||||||||
| 1298 | - | |||||||||||||||||||
| 1299 | - | |||||||||||||||||||
| 1300 | - | |||||||||||||||||||
| 1301 | - | |||||||||||||||||||
| 1302 | - | |||||||||||||||||||
| 1303 | int QTextEdit::cursorWidth() const | - | ||||||||||||||||||
| 1304 | { | - | ||||||||||||||||||
| 1305 | const QTextEditPrivate * const d = d_func(); | - | ||||||||||||||||||
| 1306 | return never executed: d->control->cursorWidth();return d->control->cursorWidth();never executed: return d->control->cursorWidth(); | 0 | ||||||||||||||||||
| 1307 | } | - | ||||||||||||||||||
| 1308 | - | |||||||||||||||||||
| 1309 | void QTextEdit::setCursorWidth(int width) | - | ||||||||||||||||||
| 1310 | { | - | ||||||||||||||||||
| 1311 | QTextEditPrivate * const d = d_func(); | - | ||||||||||||||||||
| 1312 | d->control->setCursorWidth(width); | - | ||||||||||||||||||
| 1313 | } never executed: end of block | 0 | ||||||||||||||||||
| 1314 | bool QTextEdit::acceptRichText() const | - | ||||||||||||||||||
| 1315 | { | - | ||||||||||||||||||
| 1316 | const QTextEditPrivate * const d = d_func(); | - | ||||||||||||||||||
| 1317 | return never executed: d->control->acceptRichText();return d->control->acceptRichText();never executed: return d->control->acceptRichText(); | 0 | ||||||||||||||||||
| 1318 | } | - | ||||||||||||||||||
| 1319 | - | |||||||||||||||||||
| 1320 | void QTextEdit::setAcceptRichText(bool accept) | - | ||||||||||||||||||
| 1321 | { | - | ||||||||||||||||||
| 1322 | QTextEditPrivate * const d = d_func(); | - | ||||||||||||||||||
| 1323 | d->control->setAcceptRichText(accept); | - | ||||||||||||||||||
| 1324 | } never executed: end of block | 0 | ||||||||||||||||||
| 1325 | void QTextEdit::setExtraSelections(const QList<ExtraSelection> &selections) | - | ||||||||||||||||||
| 1326 | { | - | ||||||||||||||||||
| 1327 | QTextEditPrivate * const d = d_func(); | - | ||||||||||||||||||
| 1328 | d->control->setExtraSelections(selections); | - | ||||||||||||||||||
| 1329 | } never executed: end of block | 0 | ||||||||||||||||||
| 1330 | - | |||||||||||||||||||
| 1331 | - | |||||||||||||||||||
| 1332 | - | |||||||||||||||||||
| 1333 | - | |||||||||||||||||||
| 1334 | - | |||||||||||||||||||
| 1335 | - | |||||||||||||||||||
| 1336 | - | |||||||||||||||||||
| 1337 | QList<QTextEdit::ExtraSelection> QTextEdit::extraSelections() const | - | ||||||||||||||||||
| 1338 | { | - | ||||||||||||||||||
| 1339 | const QTextEditPrivate * const d = d_func(); | - | ||||||||||||||||||
| 1340 | return never executed: d->control->extraSelections();return d->control->extraSelections();never executed: return d->control->extraSelections(); | 0 | ||||||||||||||||||
| 1341 | } | - | ||||||||||||||||||
| 1342 | QMimeData *QTextEdit::createMimeDataFromSelection() const | - | ||||||||||||||||||
| 1343 | { | - | ||||||||||||||||||
| 1344 | const QTextEditPrivate * const d = d_func(); | - | ||||||||||||||||||
| 1345 | return never executed: d->control->QWidgetTextControl::createMimeDataFromSelection();return d->control->QWidgetTextControl::createMimeDataFromSelection();never executed: return d->control->QWidgetTextControl::createMimeDataFromSelection(); | 0 | ||||||||||||||||||
| 1346 | } | - | ||||||||||||||||||
| 1347 | bool QTextEdit::canInsertFromMimeData(const QMimeData *source) const | - | ||||||||||||||||||
| 1348 | { | - | ||||||||||||||||||
| 1349 | const QTextEditPrivate * const d = d_func(); | - | ||||||||||||||||||
| 1350 | return never executed: d->control->QWidgetTextControl::canInsertFromMimeData(source);return d->control->QWidgetTextControl::canInsertFromMimeData(source);never executed: return d->control->QWidgetTextControl::canInsertFromMimeData(source); | 0 | ||||||||||||||||||
| 1351 | } | - | ||||||||||||||||||
| 1352 | void QTextEdit::insertFromMimeData(const QMimeData *source) | - | ||||||||||||||||||
| 1353 | { | - | ||||||||||||||||||
| 1354 | QTextEditPrivate * const d = d_func(); | - | ||||||||||||||||||
| 1355 | d->control->QWidgetTextControl::insertFromMimeData(source); | - | ||||||||||||||||||
| 1356 | } never executed: end of block | 0 | ||||||||||||||||||
| 1357 | bool QTextEdit::isReadOnly() const | - | ||||||||||||||||||
| 1358 | { | - | ||||||||||||||||||
| 1359 | const QTextEditPrivate * const d = d_func(); | - | ||||||||||||||||||
| 1360 | return never executed: !(d->control->textInteractionFlags() & Qt::TextEditable);return !(d->control->textInteractionFlags() & Qt::TextEditable);never executed: return !(d->control->textInteractionFlags() & Qt::TextEditable); | 0 | ||||||||||||||||||
| 1361 | } | - | ||||||||||||||||||
| 1362 | - | |||||||||||||||||||
| 1363 | void QTextEdit::setReadOnly(bool ro) | - | ||||||||||||||||||
| 1364 | { | - | ||||||||||||||||||
| 1365 | QTextEditPrivate * const d = d_func(); | - | ||||||||||||||||||
| 1366 | Qt::TextInteractionFlags flags = Qt::NoTextInteraction; | - | ||||||||||||||||||
| 1367 | if (ro
| 0 | ||||||||||||||||||
| 1368 | flags = Qt::TextSelectableByMouse; | - | ||||||||||||||||||
| 1369 | - | |||||||||||||||||||
| 1370 | if (qobject_cast<QTextBrowser *>(this)
| 0 | ||||||||||||||||||
| 1371 | flags |= Qt::TextBrowserInteraction; never executed: flags |= Qt::TextBrowserInteraction; | 0 | ||||||||||||||||||
| 1372 | - | |||||||||||||||||||
| 1373 | } never executed: else {end of block | 0 | ||||||||||||||||||
| 1374 | flags = Qt::TextEditorInteraction; | - | ||||||||||||||||||
| 1375 | } never executed: end of block | 0 | ||||||||||||||||||
| 1376 | d->control->setTextInteractionFlags(flags); | - | ||||||||||||||||||
| 1377 | setAttribute(Qt::WA_InputMethodEnabled, shouldEnableInputMethod(this)); | - | ||||||||||||||||||
| 1378 | QEvent event(QEvent::ReadOnlyChange); | - | ||||||||||||||||||
| 1379 | QApplication::sendEvent(this, &event); | - | ||||||||||||||||||
| 1380 | } never executed: end of block | 0 | ||||||||||||||||||
| 1381 | void QTextEdit::setTextInteractionFlags(Qt::TextInteractionFlags flags) | - | ||||||||||||||||||
| 1382 | { | - | ||||||||||||||||||
| 1383 | QTextEditPrivate * const d = d_func(); | - | ||||||||||||||||||
| 1384 | d->control->setTextInteractionFlags(flags); | - | ||||||||||||||||||
| 1385 | } never executed: end of block | 0 | ||||||||||||||||||
| 1386 | - | |||||||||||||||||||
| 1387 | Qt::TextInteractionFlags QTextEdit::textInteractionFlags() const | - | ||||||||||||||||||
| 1388 | { | - | ||||||||||||||||||
| 1389 | const QTextEditPrivate * const d = d_func(); | - | ||||||||||||||||||
| 1390 | return never executed: d->control->textInteractionFlags();return d->control->textInteractionFlags();never executed: return d->control->textInteractionFlags(); | 0 | ||||||||||||||||||
| 1391 | } | - | ||||||||||||||||||
| 1392 | void QTextEdit::mergeCurrentCharFormat(const QTextCharFormat &modifier) | - | ||||||||||||||||||
| 1393 | { | - | ||||||||||||||||||
| 1394 | QTextEditPrivate * const d = d_func(); | - | ||||||||||||||||||
| 1395 | d->control->mergeCurrentCharFormat(modifier); | - | ||||||||||||||||||
| 1396 | } never executed: end of block | 0 | ||||||||||||||||||
| 1397 | - | |||||||||||||||||||
| 1398 | - | |||||||||||||||||||
| 1399 | - | |||||||||||||||||||
| 1400 | - | |||||||||||||||||||
| 1401 | - | |||||||||||||||||||
| 1402 | - | |||||||||||||||||||
| 1403 | - | |||||||||||||||||||
| 1404 | void QTextEdit::setCurrentCharFormat(const QTextCharFormat &format) | - | ||||||||||||||||||
| 1405 | { | - | ||||||||||||||||||
| 1406 | QTextEditPrivate * const d = d_func(); | - | ||||||||||||||||||
| 1407 | d->control->setCurrentCharFormat(format); | - | ||||||||||||||||||
| 1408 | } never executed: end of block | 0 | ||||||||||||||||||
| 1409 | - | |||||||||||||||||||
| 1410 | - | |||||||||||||||||||
| 1411 | - | |||||||||||||||||||
| 1412 | - | |||||||||||||||||||
| 1413 | QTextCharFormat QTextEdit::currentCharFormat() const | - | ||||||||||||||||||
| 1414 | { | - | ||||||||||||||||||
| 1415 | const QTextEditPrivate * const d = d_func(); | - | ||||||||||||||||||
| 1416 | return never executed: d->control->currentCharFormat();return d->control->currentCharFormat();never executed: return d->control->currentCharFormat(); | 0 | ||||||||||||||||||
| 1417 | } | - | ||||||||||||||||||
| 1418 | QTextEdit::AutoFormatting QTextEdit::autoFormatting() const | - | ||||||||||||||||||
| 1419 | { | - | ||||||||||||||||||
| 1420 | const QTextEditPrivate * const d = d_func(); | - | ||||||||||||||||||
| 1421 | return never executed: d->autoFormatting;return d->autoFormatting;never executed: return d->autoFormatting; | 0 | ||||||||||||||||||
| 1422 | } | - | ||||||||||||||||||
| 1423 | - | |||||||||||||||||||
| 1424 | void QTextEdit::setAutoFormatting(AutoFormatting features) | - | ||||||||||||||||||
| 1425 | { | - | ||||||||||||||||||
| 1426 | QTextEditPrivate * const d = d_func(); | - | ||||||||||||||||||
| 1427 | d->autoFormatting = features; | - | ||||||||||||||||||
| 1428 | } never executed: end of block | 0 | ||||||||||||||||||
| 1429 | void QTextEdit::insertPlainText(const QString &text) | - | ||||||||||||||||||
| 1430 | { | - | ||||||||||||||||||
| 1431 | QTextEditPrivate * const d = d_func(); | - | ||||||||||||||||||
| 1432 | d->control->insertPlainText(text); | - | ||||||||||||||||||
| 1433 | } never executed: end of block | 0 | ||||||||||||||||||
| 1434 | void QTextEdit::insertHtml(const QString &text) | - | ||||||||||||||||||
| 1435 | { | - | ||||||||||||||||||
| 1436 | QTextEditPrivate * const d = d_func(); | - | ||||||||||||||||||
| 1437 | d->control->insertHtml(text); | - | ||||||||||||||||||
| 1438 | } never executed: end of block | 0 | ||||||||||||||||||
| 1439 | - | |||||||||||||||||||
| 1440 | - | |||||||||||||||||||
| 1441 | - | |||||||||||||||||||
| 1442 | - | |||||||||||||||||||
| 1443 | - | |||||||||||||||||||
| 1444 | - | |||||||||||||||||||
| 1445 | - | |||||||||||||||||||
| 1446 | void QTextEdit::scrollToAnchor(const QString &name) | - | ||||||||||||||||||
| 1447 | { | - | ||||||||||||||||||
| 1448 | QTextEditPrivate * const d = d_func(); | - | ||||||||||||||||||
| 1449 | if (name.isEmpty()
| 0 | ||||||||||||||||||
| 1450 | return; never executed: return; | 0 | ||||||||||||||||||
| 1451 | - | |||||||||||||||||||
| 1452 | if (!isVisible()
| 0 | ||||||||||||||||||
| 1453 | d->anchorToScrollToWhenVisible = name; | - | ||||||||||||||||||
| 1454 | return; never executed: return; | 0 | ||||||||||||||||||
| 1455 | } | - | ||||||||||||||||||
| 1456 | - | |||||||||||||||||||
| 1457 | QPointF p = d->control->anchorPosition(name); | - | ||||||||||||||||||
| 1458 | const int newPosition = qRound(p.y()); | - | ||||||||||||||||||
| 1459 | if ( d->vbar->maximum() < newPosition
| 0 | ||||||||||||||||||
| 1460 | d->_q_adjustScrollbars(); never executed: d->_q_adjustScrollbars(); | 0 | ||||||||||||||||||
| 1461 | d->vbar->setValue(newPosition); | - | ||||||||||||||||||
| 1462 | } never executed: end of block | 0 | ||||||||||||||||||
| 1463 | void QTextEdit::zoomIn(int range) | - | ||||||||||||||||||
| 1464 | { | - | ||||||||||||||||||
| 1465 | zoomInF(range); | - | ||||||||||||||||||
| 1466 | } never executed: end of block | 0 | ||||||||||||||||||
| 1467 | void QTextEdit::zoomOut(int range) | - | ||||||||||||||||||
| 1468 | { | - | ||||||||||||||||||
| 1469 | zoomInF(-range); | - | ||||||||||||||||||
| 1470 | } never executed: end of block | 0 | ||||||||||||||||||
| 1471 | - | |||||||||||||||||||
| 1472 | - | |||||||||||||||||||
| 1473 | - | |||||||||||||||||||
| 1474 | - | |||||||||||||||||||
| 1475 | void QTextEdit::zoomInF(float range) | - | ||||||||||||||||||
| 1476 | { | - | ||||||||||||||||||
| 1477 | if (range == 0.f
| 0 | ||||||||||||||||||
| 1478 | return; never executed: return; | 0 | ||||||||||||||||||
| 1479 | QFont f = font(); | - | ||||||||||||||||||
| 1480 | const float newSize = f.pointSizeF() + range; | - | ||||||||||||||||||
| 1481 | if (newSize <= 0
| 0 | ||||||||||||||||||
| 1482 | return; never executed: return; | 0 | ||||||||||||||||||
| 1483 | f.setPointSizeF(newSize); | - | ||||||||||||||||||
| 1484 | setFont(f); | - | ||||||||||||||||||
| 1485 | } never executed: end of block | 0 | ||||||||||||||||||
| 1486 | void QTextEdit::moveCursor(QTextCursor::MoveOperation operation, QTextCursor::MoveMode mode) | - | ||||||||||||||||||
| 1487 | { | - | ||||||||||||||||||
| 1488 | QTextEditPrivate * const d = d_func(); | - | ||||||||||||||||||
| 1489 | d->control->moveCursor(operation, mode); | - | ||||||||||||||||||
| 1490 | } never executed: end of block | 0 | ||||||||||||||||||
| 1491 | - | |||||||||||||||||||
| 1492 | - | |||||||||||||||||||
| 1493 | - | |||||||||||||||||||
| 1494 | - | |||||||||||||||||||
| 1495 | - | |||||||||||||||||||
| 1496 | bool QTextEdit::canPaste() const | - | ||||||||||||||||||
| 1497 | { | - | ||||||||||||||||||
| 1498 | const QTextEditPrivate * const d = d_func(); | - | ||||||||||||||||||
| 1499 | return never executed: d->control->canPaste();return d->control->canPaste();never executed: return d->control->canPaste(); | 0 | ||||||||||||||||||
| 1500 | } | - | ||||||||||||||||||
| 1501 | void QTextEdit::print(QPagedPaintDevice *printer) const | - | ||||||||||||||||||
| 1502 | { | - | ||||||||||||||||||
| 1503 | const QTextEditPrivate * const d = d_func(); | - | ||||||||||||||||||
| 1504 | d->control->print(printer); | - | ||||||||||||||||||
| 1505 | } never executed: end of block | 0 | ||||||||||||||||||
| 1506 | bool QTextEdit::tabChangesFocus() const | - | ||||||||||||||||||
| 1507 | { | - | ||||||||||||||||||
| 1508 | const QTextEditPrivate * const d = d_func(); | - | ||||||||||||||||||
| 1509 | return never executed: d->tabChangesFocus;return d->tabChangesFocus;never executed: return d->tabChangesFocus; | 0 | ||||||||||||||||||
| 1510 | } | - | ||||||||||||||||||
| 1511 | - | |||||||||||||||||||
| 1512 | void QTextEdit::setTabChangesFocus(bool b) | - | ||||||||||||||||||
| 1513 | { | - | ||||||||||||||||||
| 1514 | QTextEditPrivate * const d = d_func(); | - | ||||||||||||||||||
| 1515 | d->tabChangesFocus = b; | - | ||||||||||||||||||
| 1516 | } never executed: end of block | 0 | ||||||||||||||||||
| 1517 | QTextEdit::LineWrapMode QTextEdit::lineWrapMode() const | - | ||||||||||||||||||
| 1518 | { | - | ||||||||||||||||||
| 1519 | const QTextEditPrivate * const d = d_func(); | - | ||||||||||||||||||
| 1520 | return never executed: d->lineWrap;return d->lineWrap;never executed: return d->lineWrap; | 0 | ||||||||||||||||||
| 1521 | } | - | ||||||||||||||||||
| 1522 | - | |||||||||||||||||||
| 1523 | void QTextEdit::setLineWrapMode(LineWrapMode wrap) | - | ||||||||||||||||||
| 1524 | { | - | ||||||||||||||||||
| 1525 | QTextEditPrivate * const d = d_func(); | - | ||||||||||||||||||
| 1526 | if (d->lineWrap == wrap
| 0 | ||||||||||||||||||
| 1527 | return; never executed: return; | 0 | ||||||||||||||||||
| 1528 | d->lineWrap = wrap; | - | ||||||||||||||||||
| 1529 | d->updateDefaultTextOption(); | - | ||||||||||||||||||
| 1530 | d->relayoutDocument(); | - | ||||||||||||||||||
| 1531 | } never executed: end of block | 0 | ||||||||||||||||||
| 1532 | int QTextEdit::lineWrapColumnOrWidth() const | - | ||||||||||||||||||
| 1533 | { | - | ||||||||||||||||||
| 1534 | const QTextEditPrivate * const d = d_func(); | - | ||||||||||||||||||
| 1535 | return never executed: d->lineWrapColumnOrWidth;return d->lineWrapColumnOrWidth;never executed: return d->lineWrapColumnOrWidth; | 0 | ||||||||||||||||||
| 1536 | } | - | ||||||||||||||||||
| 1537 | - | |||||||||||||||||||
| 1538 | void QTextEdit::setLineWrapColumnOrWidth(int w) | - | ||||||||||||||||||
| 1539 | { | - | ||||||||||||||||||
| 1540 | QTextEditPrivate * const d = d_func(); | - | ||||||||||||||||||
| 1541 | d->lineWrapColumnOrWidth = w; | - | ||||||||||||||||||
| 1542 | d->relayoutDocument(); | - | ||||||||||||||||||
| 1543 | } never executed: end of block | 0 | ||||||||||||||||||
| 1544 | QTextOption::WrapMode QTextEdit::wordWrapMode() const | - | ||||||||||||||||||
| 1545 | { | - | ||||||||||||||||||
| 1546 | const QTextEditPrivate * const d = d_func(); | - | ||||||||||||||||||
| 1547 | return never executed: d->wordWrap;return d->wordWrap;never executed: return d->wordWrap; | 0 | ||||||||||||||||||
| 1548 | } | - | ||||||||||||||||||
| 1549 | - | |||||||||||||||||||
| 1550 | void QTextEdit::setWordWrapMode(QTextOption::WrapMode mode) | - | ||||||||||||||||||
| 1551 | { | - | ||||||||||||||||||
| 1552 | QTextEditPrivate * const d = d_func(); | - | ||||||||||||||||||
| 1553 | if (mode == d->wordWrap
| 0 | ||||||||||||||||||
| 1554 | return; never executed: return; | 0 | ||||||||||||||||||
| 1555 | d->wordWrap = mode; | - | ||||||||||||||||||
| 1556 | d->updateDefaultTextOption(); | - | ||||||||||||||||||
| 1557 | } never executed: end of block | 0 | ||||||||||||||||||
| 1558 | - | |||||||||||||||||||
| 1559 | - | |||||||||||||||||||
| 1560 | - | |||||||||||||||||||
| 1561 | - | |||||||||||||||||||
| 1562 | - | |||||||||||||||||||
| 1563 | - | |||||||||||||||||||
| 1564 | bool QTextEdit::find(const QString &exp, QTextDocument::FindFlags options) | - | ||||||||||||||||||
| 1565 | { | - | ||||||||||||||||||
| 1566 | QTextEditPrivate * const d = d_func(); | - | ||||||||||||||||||
| 1567 | return never executed: d->control->find(exp, options);return d->control->find(exp, options);never executed: return d->control->find(exp, options); | 0 | ||||||||||||||||||
| 1568 | } | - | ||||||||||||||||||
| 1569 | bool QTextEdit::find(const QRegExp &exp, QTextDocument::FindFlags options) | - | ||||||||||||||||||
| 1570 | { | - | ||||||||||||||||||
| 1571 | QTextEditPrivate * const d = d_func(); | - | ||||||||||||||||||
| 1572 | return never executed: d->control->find(exp, options);return d->control->find(exp, options);never executed: return d->control->find(exp, options); | 0 | ||||||||||||||||||
| 1573 | } | - | ||||||||||||||||||
| 1574 | void QTextEdit::setText(const QString &text) | - | ||||||||||||||||||
| 1575 | { | - | ||||||||||||||||||
| 1576 | QTextEditPrivate * const d = d_func(); | - | ||||||||||||||||||
| 1577 | Qt::TextFormat format = d->textFormat; | - | ||||||||||||||||||
| 1578 | if (d->textFormat == Qt::AutoText
| 0 | ||||||||||||||||||
| 1579 | format = Qt::mightBeRichText(text)
never executed: format = Qt::mightBeRichText(text) ? Qt::RichText : Qt::PlainText; | 0 | ||||||||||||||||||
| 1580 | - | |||||||||||||||||||
| 1581 | if (format == Qt::RichText
| 0 | ||||||||||||||||||
| 1582 | setHtml(text); never executed: setHtml(text); | 0 | ||||||||||||||||||
| 1583 | else | - | ||||||||||||||||||
| 1584 | - | |||||||||||||||||||
| 1585 | setPlainText(text); never executed: setPlainText(text); | 0 | ||||||||||||||||||
| 1586 | } | - | ||||||||||||||||||
| 1587 | void QTextEdit::append(const QString &text) | - | ||||||||||||||||||
| 1588 | { | - | ||||||||||||||||||
| 1589 | QTextEditPrivate * const d = d_func(); | - | ||||||||||||||||||
| 1590 | const bool atBottom = isReadOnly()
| 0 | ||||||||||||||||||
| 1591 | d->control->textCursor().atEnd(); | - | ||||||||||||||||||
| 1592 | d->control->append(text); | - | ||||||||||||||||||
| 1593 | if (atBottom
| 0 | ||||||||||||||||||
| 1594 | d->vbar->setValue(d->vbar->maximum()); never executed: d->vbar->setValue(d->vbar->maximum()); | 0 | ||||||||||||||||||
| 1595 | } never executed: end of block | 0 | ||||||||||||||||||
| 1596 | - | |||||||||||||||||||
| 1597 | - | |||||||||||||||||||
| 1598 | - | |||||||||||||||||||
| 1599 | - | |||||||||||||||||||
| 1600 | - | |||||||||||||||||||
| 1601 | void QTextEdit::ensureCursorVisible() | - | ||||||||||||||||||
| 1602 | { | - | ||||||||||||||||||
| 1603 | QTextEditPrivate * const d = d_func(); | - | ||||||||||||||||||
| 1604 | d->control->ensureCursorVisible(); | - | ||||||||||||||||||
| 1605 | } never executed: end of block | 0 | ||||||||||||||||||
| 1606 | - | |||||||||||||||||||
| 1607 | - | |||||||||||||||||||
| Switch to Source code | Preprocessed file |