| Absolute File Name: | /home/opencoverage/opencoverage/guest-scripts/qtdeclarative/src/qtdeclarative/src/quick/items/qquicktextedit.cpp |
| Switch to Source code | Preprocessed file |
| Line | Source | Count | ||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 1 | - | |||||||||||||||||||||||||
| 2 | - | |||||||||||||||||||||||||
| 3 | - | |||||||||||||||||||||||||
| 4 | - | |||||||||||||||||||||||||
| 5 | - | |||||||||||||||||||||||||
| 6 | - | |||||||||||||||||||||||||
| 7 | - | |||||||||||||||||||||||||
| 8 | - | |||||||||||||||||||||||||
| 9 | - | |||||||||||||||||||||||||
| 10 | static const int nodeBreakingSize = 300; | - | ||||||||||||||||||||||||
| 11 | - | |||||||||||||||||||||||||
| 12 | namespace { | - | ||||||||||||||||||||||||
| 13 | class ProtectedLayoutAccessor: public QAbstractTextDocumentLayout | - | ||||||||||||||||||||||||
| 14 | { | - | ||||||||||||||||||||||||
| 15 | public: | - | ||||||||||||||||||||||||
| 16 | inline QTextCharFormat formatAccessor(int pos) | - | ||||||||||||||||||||||||
| 17 | { | - | ||||||||||||||||||||||||
| 18 | return never executed: format(pos);return format(pos);never executed: return format(pos); | 0 | ||||||||||||||||||||||||
| 19 | } | - | ||||||||||||||||||||||||
| 20 | }; | - | ||||||||||||||||||||||||
| 21 | - | |||||||||||||||||||||||||
| 22 | class RootNode : public QSGTransformNode | - | ||||||||||||||||||||||||
| 23 | { | - | ||||||||||||||||||||||||
| 24 | public: | - | ||||||||||||||||||||||||
| 25 | RootNode() : cursorNode(nullptr), frameDecorationsNode(nullptr) | - | ||||||||||||||||||||||||
| 26 | { } executed 234 times by 4 tests: end of blockExecuted by:
| 234 | ||||||||||||||||||||||||
| 27 | - | |||||||||||||||||||||||||
| 28 | void resetFrameDecorations(QQuickTextNode* newNode) | - | ||||||||||||||||||||||||
| 29 | { | - | ||||||||||||||||||||||||
| 30 | if (frameDecorationsNode
| 58-234 | ||||||||||||||||||||||||
| 31 | removeChildNode(frameDecorationsNode); | - | ||||||||||||||||||||||||
| 32 | delete frameDecorationsNode; | - | ||||||||||||||||||||||||
| 33 | } executed 58 times by 1 test: end of blockExecuted by:
| 58 | ||||||||||||||||||||||||
| 34 | frameDecorationsNode = newNode; | - | ||||||||||||||||||||||||
| 35 | newNode->setFlag(QSGNode::OwnedByParent); | - | ||||||||||||||||||||||||
| 36 | } executed 292 times by 4 tests: end of blockExecuted by:
| 292 | ||||||||||||||||||||||||
| 37 | - | |||||||||||||||||||||||||
| 38 | void resetCursorNode(QSGInternalRectangleNode* newNode) | - | ||||||||||||||||||||||||
| 39 | { | - | ||||||||||||||||||||||||
| 40 | if (cursorNode
| 12-324 | ||||||||||||||||||||||||
| 41 | removeChildNode(cursorNode); executed 12 times by 1 test: removeChildNode(cursorNode);Executed by:
| 12 | ||||||||||||||||||||||||
| 42 | delete cursorNode; | - | ||||||||||||||||||||||||
| 43 | cursorNode = newNode; | - | ||||||||||||||||||||||||
| 44 | if (cursorNode
| 140-196 | ||||||||||||||||||||||||
| 45 | appendChildNode(cursorNode); | - | ||||||||||||||||||||||||
| 46 | cursorNode->setFlag(QSGNode::OwnedByParent); | - | ||||||||||||||||||||||||
| 47 | } executed 140 times by 3 tests: end of blockExecuted by:
| 140 | ||||||||||||||||||||||||
| 48 | } executed 336 times by 4 tests: end of blockExecuted by:
| 336 | ||||||||||||||||||||||||
| 49 | - | |||||||||||||||||||||||||
| 50 | QSGInternalRectangleNode *cursorNode; | - | ||||||||||||||||||||||||
| 51 | QQuickTextNode* frameDecorationsNode; | - | ||||||||||||||||||||||||
| 52 | - | |||||||||||||||||||||||||
| 53 | }; | - | ||||||||||||||||||||||||
| 54 | } | - | ||||||||||||||||||||||||
| 55 | - | |||||||||||||||||||||||||
| 56 | QQuickTextEdit::QQuickTextEdit(QQuickItem *parent) | - | ||||||||||||||||||||||||
| 57 | : QQuickImplicitSizeItem(*(new QQuickTextEditPrivate), parent) | - | ||||||||||||||||||||||||
| 58 | { | - | ||||||||||||||||||||||||
| 59 | QQuickTextEditPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 60 | d->init(); | - | ||||||||||||||||||||||||
| 61 | } executed 1076 times by 6 tests: end of blockExecuted by:
| 1076 | ||||||||||||||||||||||||
| 62 | - | |||||||||||||||||||||||||
| 63 | QQuickTextEdit::QQuickTextEdit(QQuickTextEditPrivate &dd, QQuickItem *parent) | - | ||||||||||||||||||||||||
| 64 | : QQuickImplicitSizeItem(dd, parent) | - | ||||||||||||||||||||||||
| 65 | { | - | ||||||||||||||||||||||||
| 66 | QQuickTextEditPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 67 | d->init(); | - | ||||||||||||||||||||||||
| 68 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 69 | - | |||||||||||||||||||||||||
| 70 | QString QQuickTextEdit::text() const | - | ||||||||||||||||||||||||
| 71 | { | - | ||||||||||||||||||||||||
| 72 | const QQuickTextEditPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 73 | if (!d->textCached
| 168-1496 | ||||||||||||||||||||||||
| 74 | QQuickTextEditPrivate *d = const_cast<QQuickTextEditPrivate *>(d_func()); | - | ||||||||||||||||||||||||
| 75 | - | |||||||||||||||||||||||||
| 76 | if (d->richText
| 22-510 | ||||||||||||||||||||||||
| 77 | d->text = d->control->toHtml(); executed 22 times by 1 test: d->text = d->control->toHtml();Executed by:
| 22 | ||||||||||||||||||||||||
| 78 | else | - | ||||||||||||||||||||||||
| 79 | - | |||||||||||||||||||||||||
| 80 | d->text = d->control->toPlainText(); executed 510 times by 2 tests: d->text = d->control->toPlainText();Executed by:
| 510 | ||||||||||||||||||||||||
| 81 | d->textCached = true; | - | ||||||||||||||||||||||||
| 82 | } executed 532 times by 2 tests: end of blockExecuted by:
| 532 | ||||||||||||||||||||||||
| 83 | return executed 1664 times by 5 tests: d->text;return d->text;Executed by:
executed 1664 times by 5 tests: return d->text;Executed by:
| 1664 | ||||||||||||||||||||||||
| 84 | } | - | ||||||||||||||||||||||||
| 85 | void QQuickTextEdit::setText(const QString &text) | - | ||||||||||||||||||||||||
| 86 | { | - | ||||||||||||||||||||||||
| 87 | QQuickTextEditPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 88 | if (QQuickTextEdit::text() == text
| 16-1052 | ||||||||||||||||||||||||
| 89 | return; executed 16 times by 3 tests: return;Executed by:
| 16 | ||||||||||||||||||||||||
| 90 | - | |||||||||||||||||||||||||
| 91 | d->document->clearResources(); | - | ||||||||||||||||||||||||
| 92 | d->richText = d->format == RichText
| 6-1010 | ||||||||||||||||||||||||
| 93 | if (!isComponentComplete()
| 152-900 | ||||||||||||||||||||||||
| 94 | d->text = text; | - | ||||||||||||||||||||||||
| 95 | } executed 900 times by 4 tests: else if (d->richTextend of blockExecuted by:
| 10-900 | ||||||||||||||||||||||||
| 96 | - | |||||||||||||||||||||||||
| 97 | d->control->setHtml(text); | - | ||||||||||||||||||||||||
| 98 | - | |||||||||||||||||||||||||
| 99 | - | |||||||||||||||||||||||||
| 100 | - | |||||||||||||||||||||||||
| 101 | } executed 10 times by 1 test: else {end of blockExecuted by:
| 10 | ||||||||||||||||||||||||
| 102 | d->control->setPlainText(text); | - | ||||||||||||||||||||||||
| 103 | } executed 142 times by 2 tests: end of blockExecuted by:
| 142 | ||||||||||||||||||||||||
| 104 | } | - | ||||||||||||||||||||||||
| 105 | QString QQuickTextEdit::preeditText() const | - | ||||||||||||||||||||||||
| 106 | { | - | ||||||||||||||||||||||||
| 107 | const QQuickTextEditPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 108 | return executed 8 times by 1 test: d->control->preeditText();return d->control->preeditText();Executed by:
executed 8 times by 1 test: return d->control->preeditText();Executed by:
| 8 | ||||||||||||||||||||||||
| 109 | } | - | ||||||||||||||||||||||||
| 110 | QQuickTextEdit::TextFormat QQuickTextEdit::textFormat() const | - | ||||||||||||||||||||||||
| 111 | { | - | ||||||||||||||||||||||||
| 112 | const QQuickTextEditPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 113 | return executed 26 times by 1 test: d->format;return d->format;Executed by:
executed 26 times by 1 test: return d->format;Executed by:
| 26 | ||||||||||||||||||||||||
| 114 | } | - | ||||||||||||||||||||||||
| 115 | - | |||||||||||||||||||||||||
| 116 | void QQuickTextEdit::setTextFormat(TextFormat format) | - | ||||||||||||||||||||||||
| 117 | { | - | ||||||||||||||||||||||||
| 118 | QQuickTextEditPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 119 | if (format == d->format
| 116-136 | ||||||||||||||||||||||||
| 120 | return; executed 116 times by 1 test: return;Executed by:
| 116 | ||||||||||||||||||||||||
| 121 | - | |||||||||||||||||||||||||
| 122 | bool wasRich = d->richText; | - | ||||||||||||||||||||||||
| 123 | d->richText = format == RichText
| 0-78 | ||||||||||||||||||||||||
| 124 | - | |||||||||||||||||||||||||
| 125 | - | |||||||||||||||||||||||||
| 126 | if (isComponentComplete()
| 24-112 | ||||||||||||||||||||||||
| 127 | if (wasRich
| 0-22 | ||||||||||||||||||||||||
| 128 | d->control->setPlainText(!d->textCached ? d->control->toHtml() : d->text); | - | ||||||||||||||||||||||||
| 129 | updateSize(); | - | ||||||||||||||||||||||||
| 130 | } executed 2 times by 1 test: else if (!wasRichend of blockExecuted by:
| 0-22 | ||||||||||||||||||||||||
| 131 | d->control->setHtml(!d->textCached ? d->control->toPlainText() : d->text); | - | ||||||||||||||||||||||||
| 132 | updateSize(); | - | ||||||||||||||||||||||||
| 133 | } executed 14 times by 1 test: end of blockExecuted by:
| 14 | ||||||||||||||||||||||||
| 134 | } executed 24 times by 1 test: end of blockExecuted by:
| 24 | ||||||||||||||||||||||||
| 135 | - | |||||||||||||||||||||||||
| 136 | - | |||||||||||||||||||||||||
| 137 | d->format = format; | - | ||||||||||||||||||||||||
| 138 | d->control->setAcceptRichText(d->format != PlainText); | - | ||||||||||||||||||||||||
| 139 | textFormatChanged(d->format); | - | ||||||||||||||||||||||||
| 140 | } executed 136 times by 3 tests: end of blockExecuted by:
| 136 | ||||||||||||||||||||||||
| 141 | QQuickTextEdit::RenderType QQuickTextEdit::renderType() const | - | ||||||||||||||||||||||||
| 142 | { | - | ||||||||||||||||||||||||
| 143 | const QQuickTextEditPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 144 | return executed 6 times by 1 test: d->renderType;return d->renderType;Executed by:
executed 6 times by 1 test: return d->renderType;Executed by:
| 6 | ||||||||||||||||||||||||
| 145 | } | - | ||||||||||||||||||||||||
| 146 | - | |||||||||||||||||||||||||
| 147 | void QQuickTextEdit::setRenderType(QQuickTextEdit::RenderType renderType) | - | ||||||||||||||||||||||||
| 148 | { | - | ||||||||||||||||||||||||
| 149 | QQuickTextEditPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 150 | if (d->renderType == renderType
| 2-4 | ||||||||||||||||||||||||
| 151 | return; executed 2 times by 1 test: return;Executed by:
| 2 | ||||||||||||||||||||||||
| 152 | - | |||||||||||||||||||||||||
| 153 | d->renderType = renderType; | - | ||||||||||||||||||||||||
| 154 | renderTypeChanged(); | - | ||||||||||||||||||||||||
| 155 | d->updateDefaultTextOption(); | - | ||||||||||||||||||||||||
| 156 | - | |||||||||||||||||||||||||
| 157 | if (isComponentComplete()
| 0-4 | ||||||||||||||||||||||||
| 158 | updateSize(); executed 4 times by 1 test: updateSize();Executed by:
| 4 | ||||||||||||||||||||||||
| 159 | } executed 4 times by 1 test: end of blockExecuted by:
| 4 | ||||||||||||||||||||||||
| 160 | - | |||||||||||||||||||||||||
| 161 | QFont QQuickTextEdit::font() const | - | ||||||||||||||||||||||||
| 162 | { | - | ||||||||||||||||||||||||
| 163 | const QQuickTextEditPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 164 | return executed 148 times by 3 tests: d->sourceFont;return d->sourceFont;Executed by:
executed 148 times by 3 tests: return d->sourceFont;Executed by:
| 148 | ||||||||||||||||||||||||
| 165 | } | - | ||||||||||||||||||||||||
| 166 | - | |||||||||||||||||||||||||
| 167 | void QQuickTextEdit::setFont(const QFont &font) | - | ||||||||||||||||||||||||
| 168 | { | - | ||||||||||||||||||||||||
| 169 | QQuickTextEditPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 170 | if (d->sourceFont == font
| 28-76 | ||||||||||||||||||||||||
| 171 | return; executed 28 times by 1 test: return;Executed by:
| 28 | ||||||||||||||||||||||||
| 172 | - | |||||||||||||||||||||||||
| 173 | d->sourceFont = font; | - | ||||||||||||||||||||||||
| 174 | QFont oldFont = d->font; | - | ||||||||||||||||||||||||
| 175 | d->font = font; | - | ||||||||||||||||||||||||
| 176 | if (d->font.pointSizeF() != -1
| 14-62 | ||||||||||||||||||||||||
| 177 | - | |||||||||||||||||||||||||
| 178 | qreal size = qRound(d->font.pointSizeF()*2.0); | - | ||||||||||||||||||||||||
| 179 | d->font.setPointSizeF(size/2.0); | - | ||||||||||||||||||||||||
| 180 | } executed 14 times by 1 test: end of blockExecuted by:
| 14 | ||||||||||||||||||||||||
| 181 | - | |||||||||||||||||||||||||
| 182 | if (oldFont != d->font
| 0-76 | ||||||||||||||||||||||||
| 183 | d->document->setDefaultFont(d->font); | - | ||||||||||||||||||||||||
| 184 | if (d->cursorItem
| 2-74 | ||||||||||||||||||||||||
| 185 | d->cursorItem->setHeight(QFontMetrics(d->font).height()); | - | ||||||||||||||||||||||||
| 186 | moveCursorDelegate(); | - | ||||||||||||||||||||||||
| 187 | } executed 2 times by 1 test: end of blockExecuted by:
| 2 | ||||||||||||||||||||||||
| 188 | updateSize(); | - | ||||||||||||||||||||||||
| 189 | updateWholeDocument(); | - | ||||||||||||||||||||||||
| 190 | - | |||||||||||||||||||||||||
| 191 | updateInputMethod(Qt::ImCursorRectangle | Qt::ImAnchorRectangle | Qt::ImFont); | - | ||||||||||||||||||||||||
| 192 | - | |||||||||||||||||||||||||
| 193 | } executed 76 times by 3 tests: end of blockExecuted by:
| 76 | ||||||||||||||||||||||||
| 194 | fontChanged(d->sourceFont); | - | ||||||||||||||||||||||||
| 195 | } executed 76 times by 3 tests: end of blockExecuted by:
| 76 | ||||||||||||||||||||||||
| 196 | QColor QQuickTextEdit::color() const | - | ||||||||||||||||||||||||
| 197 | { | - | ||||||||||||||||||||||||
| 198 | const QQuickTextEditPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 199 | return executed 32 times by 1 test: d->color;return d->color;Executed by:
executed 32 times by 1 test: return d->color;Executed by:
| 32 | ||||||||||||||||||||||||
| 200 | } | - | ||||||||||||||||||||||||
| 201 | - | |||||||||||||||||||||||||
| 202 | void QQuickTextEdit::setColor(const QColor &color) | - | ||||||||||||||||||||||||
| 203 | { | - | ||||||||||||||||||||||||
| 204 | QQuickTextEditPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 205 | if (d->color == color
| 4-32 | ||||||||||||||||||||||||
| 206 | return; executed 4 times by 1 test: return;Executed by:
| 4 | ||||||||||||||||||||||||
| 207 | - | |||||||||||||||||||||||||
| 208 | d->color = color; | - | ||||||||||||||||||||||||
| 209 | updateWholeDocument(); | - | ||||||||||||||||||||||||
| 210 | colorChanged(d->color); | - | ||||||||||||||||||||||||
| 211 | } executed 32 times by 2 tests: end of blockExecuted by:
| 32 | ||||||||||||||||||||||||
| 212 | - | |||||||||||||||||||||||||
| 213 | - | |||||||||||||||||||||||||
| 214 | - | |||||||||||||||||||||||||
| 215 | - | |||||||||||||||||||||||||
| 216 | - | |||||||||||||||||||||||||
| 217 | - | |||||||||||||||||||||||||
| 218 | QColor QQuickTextEdit::selectionColor() const | - | ||||||||||||||||||||||||
| 219 | { | - | ||||||||||||||||||||||||
| 220 | const QQuickTextEditPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 221 | return executed 30 times by 1 test: d->selectionColor;return d->selectionColor;Executed by:
executed 30 times by 1 test: return d->selectionColor;Executed by:
| 30 | ||||||||||||||||||||||||
| 222 | } | - | ||||||||||||||||||||||||
| 223 | - | |||||||||||||||||||||||||
| 224 | void QQuickTextEdit::setSelectionColor(const QColor &color) | - | ||||||||||||||||||||||||
| 225 | { | - | ||||||||||||||||||||||||
| 226 | QQuickTextEditPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 227 | if (d->selectionColor == color
| 2-28 | ||||||||||||||||||||||||
| 228 | return; executed 2 times by 1 test: return;Executed by:
| 2 | ||||||||||||||||||||||||
| 229 | - | |||||||||||||||||||||||||
| 230 | d->selectionColor = color; | - | ||||||||||||||||||||||||
| 231 | updateWholeDocument(); | - | ||||||||||||||||||||||||
| 232 | selectionColorChanged(d->selectionColor); | - | ||||||||||||||||||||||||
| 233 | } executed 28 times by 1 test: end of blockExecuted by:
| 28 | ||||||||||||||||||||||||
| 234 | - | |||||||||||||||||||||||||
| 235 | - | |||||||||||||||||||||||||
| 236 | - | |||||||||||||||||||||||||
| 237 | - | |||||||||||||||||||||||||
| 238 | - | |||||||||||||||||||||||||
| 239 | - | |||||||||||||||||||||||||
| 240 | QColor QQuickTextEdit::selectedTextColor() const | - | ||||||||||||||||||||||||
| 241 | { | - | ||||||||||||||||||||||||
| 242 | const QQuickTextEditPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 243 | return executed 30 times by 1 test: d->selectedTextColor;return d->selectedTextColor;Executed by:
executed 30 times by 1 test: return d->selectedTextColor;Executed by:
| 30 | ||||||||||||||||||||||||
| 244 | } | - | ||||||||||||||||||||||||
| 245 | - | |||||||||||||||||||||||||
| 246 | void QQuickTextEdit::setSelectedTextColor(const QColor &color) | - | ||||||||||||||||||||||||
| 247 | { | - | ||||||||||||||||||||||||
| 248 | QQuickTextEditPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 249 | if (d->selectedTextColor == color
| 4-26 | ||||||||||||||||||||||||
| 250 | return; executed 4 times by 1 test: return;Executed by:
| 4 | ||||||||||||||||||||||||
| 251 | - | |||||||||||||||||||||||||
| 252 | d->selectedTextColor = color; | - | ||||||||||||||||||||||||
| 253 | updateWholeDocument(); | - | ||||||||||||||||||||||||
| 254 | selectedTextColorChanged(d->selectedTextColor); | - | ||||||||||||||||||||||||
| 255 | } executed 26 times by 1 test: end of blockExecuted by:
| 26 | ||||||||||||||||||||||||
| 256 | QQuickTextEdit::HAlignment QQuickTextEdit::hAlign() const | - | ||||||||||||||||||||||||
| 257 | { | - | ||||||||||||||||||||||||
| 258 | const QQuickTextEditPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 259 | return executed 122 times by 2 tests: d->hAlign;return d->hAlign;Executed by:
executed 122 times by 2 tests: return d->hAlign;Executed by:
| 122 | ||||||||||||||||||||||||
| 260 | } | - | ||||||||||||||||||||||||
| 261 | - | |||||||||||||||||||||||||
| 262 | void QQuickTextEdit::setHAlign(HAlignment align) | - | ||||||||||||||||||||||||
| 263 | { | - | ||||||||||||||||||||||||
| 264 | QQuickTextEditPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 265 | bool forceAlign = d->hAlignImplicit
| 2-66 | ||||||||||||||||||||||||
| 266 | d->hAlignImplicit = false; | - | ||||||||||||||||||||||||
| 267 | if (d->setHAlign(align, forceAlign)
| 22-52 | ||||||||||||||||||||||||
| 268 | d->updateDefaultTextOption(); | - | ||||||||||||||||||||||||
| 269 | updateSize(); | - | ||||||||||||||||||||||||
| 270 | } executed 24 times by 1 test: end of blockExecuted by:
| 24 | ||||||||||||||||||||||||
| 271 | } executed 74 times by 1 test: end of blockExecuted by:
| 74 | ||||||||||||||||||||||||
| 272 | - | |||||||||||||||||||||||||
| 273 | void QQuickTextEdit::resetHAlign() | - | ||||||||||||||||||||||||
| 274 | { | - | ||||||||||||||||||||||||
| 275 | QQuickTextEditPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 276 | d->hAlignImplicit = true; | - | ||||||||||||||||||||||||
| 277 | if (d->determineHorizontalAlignment()
| 0-32 | ||||||||||||||||||||||||
| 278 | d->updateDefaultTextOption(); | - | ||||||||||||||||||||||||
| 279 | updateSize(); | - | ||||||||||||||||||||||||
| 280 | } executed 4 times by 1 test: end of blockExecuted by:
| 4 | ||||||||||||||||||||||||
| 281 | } executed 36 times by 2 tests: end of blockExecuted by:
| 36 | ||||||||||||||||||||||||
| 282 | - | |||||||||||||||||||||||||
| 283 | QQuickTextEdit::HAlignment QQuickTextEdit::effectiveHAlign() const | - | ||||||||||||||||||||||||
| 284 | { | - | ||||||||||||||||||||||||
| 285 | const QQuickTextEditPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 286 | QQuickTextEdit::HAlignment effectiveAlignment = d->hAlign; | - | ||||||||||||||||||||||||
| 287 | if (!d->hAlignImplicit
| 20-10458 | ||||||||||||||||||||||||
| 288 | switch (d->hAlign) { | - | ||||||||||||||||||||||||
| 289 | case executed 8 times by 1 test: QQuickTextEdit::AlignLeft:case QQuickTextEdit::AlignLeft:Executed by:
executed 8 times by 1 test: case QQuickTextEdit::AlignLeft:Executed by:
| 8 | ||||||||||||||||||||||||
| 290 | effectiveAlignment = QQuickTextEdit::AlignRight; | - | ||||||||||||||||||||||||
| 291 | break; executed 8 times by 1 test: break;Executed by:
| 8 | ||||||||||||||||||||||||
| 292 | case executed 12 times by 1 test: QQuickTextEdit::AlignRight:case QQuickTextEdit::AlignRight:Executed by:
executed 12 times by 1 test: case QQuickTextEdit::AlignRight:Executed by:
| 12 | ||||||||||||||||||||||||
| 293 | effectiveAlignment = QQuickTextEdit::AlignLeft; | - | ||||||||||||||||||||||||
| 294 | break; executed 12 times by 1 test: break;Executed by:
| 12 | ||||||||||||||||||||||||
| 295 | default never executed: :default:never executed: default: | 0 | ||||||||||||||||||||||||
| 296 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 297 | } | - | ||||||||||||||||||||||||
| 298 | } | - | ||||||||||||||||||||||||
| 299 | return executed 10826 times by 6 tests: effectiveAlignment;return effectiveAlignment;Executed by:
executed 10826 times by 6 tests: return effectiveAlignment;Executed by:
| 10826 | ||||||||||||||||||||||||
| 300 | } | - | ||||||||||||||||||||||||
| 301 | - | |||||||||||||||||||||||||
| 302 | bool QQuickTextEditPrivate::setHAlign(QQuickTextEdit::HAlignment alignment, bool forceAlign) | - | ||||||||||||||||||||||||
| 303 | { | - | ||||||||||||||||||||||||
| 304 | QQuickTextEdit * const q = q_func(); | - | ||||||||||||||||||||||||
| 305 | if (hAlign != alignment
| 2-4226 | ||||||||||||||||||||||||
| 306 | QQuickTextEdit::HAlignment oldEffectiveHAlign = q->effectiveHAlign(); | - | ||||||||||||||||||||||||
| 307 | hAlign = alignment; | - | ||||||||||||||||||||||||
| 308 | q->horizontalAlignmentChanged(alignment); | - | ||||||||||||||||||||||||
| 309 | if (oldEffectiveHAlign != q->effectiveHAlign()
| 2-94 | ||||||||||||||||||||||||
| 310 | q->effectiveHorizontalAlignmentChanged(); executed 94 times by 2 tests: q->effectiveHorizontalAlignmentChanged();Executed by:
| 94 | ||||||||||||||||||||||||
| 311 | return executed 96 times by 2 tests: true;return true;Executed by:
executed 96 times by 2 tests: return true;Executed by:
| 96 | ||||||||||||||||||||||||
| 312 | } | - | ||||||||||||||||||||||||
| 313 | return executed 4224 times by 6 tests: false;return false;Executed by:
executed 4224 times by 6 tests: return false;Executed by:
| 4224 | ||||||||||||||||||||||||
| 314 | } | - | ||||||||||||||||||||||||
| 315 | - | |||||||||||||||||||||||||
| 316 | - | |||||||||||||||||||||||||
| 317 | Qt::LayoutDirection QQuickTextEditPrivate::textDirection(const QString &text) const | - | ||||||||||||||||||||||||
| 318 | { | - | ||||||||||||||||||||||||
| 319 | const QChar *character = text.constData(); | - | ||||||||||||||||||||||||
| 320 | while (!character->isNull()
| 2692-3978 | ||||||||||||||||||||||||
| 321 | switch (character->direction()) { | - | ||||||||||||||||||||||||
| 322 | case executed 2448 times by 5 tests: QChar::DirL:case QChar::DirL:Executed by:
executed 2448 times by 5 tests: case QChar::DirL:Executed by:
| 2448 | ||||||||||||||||||||||||
| 323 | return executed 2448 times by 5 tests: Qt::LeftToRight;return Qt::LeftToRight;Executed by:
executed 2448 times by 5 tests: return Qt::LeftToRight;Executed by:
| 2448 | ||||||||||||||||||||||||
| 324 | case never executed: QChar::DirR:case QChar::DirR:never executed: case QChar::DirR: | 0 | ||||||||||||||||||||||||
| 325 | case executed 24 times by 2 tests: QChar::DirAL:case QChar::DirAL:Executed by:
executed 24 times by 2 tests: case QChar::DirAL:Executed by:
| 24 | ||||||||||||||||||||||||
| 326 | case never executed: QChar::DirAN:case QChar::DirAN:never executed: case QChar::DirAN: | 0 | ||||||||||||||||||||||||
| 327 | return executed 24 times by 2 tests: Qt::RightToLeft;return Qt::RightToLeft;Executed by:
executed 24 times by 2 tests: return Qt::RightToLeft;Executed by:
| 24 | ||||||||||||||||||||||||
| 328 | default executed 1506 times by 2 tests: :default:Executed by:
executed 1506 times by 2 tests: default:Executed by:
| 1506 | ||||||||||||||||||||||||
| 329 | break; executed 1506 times by 2 tests: break;Executed by:
| 1506 | ||||||||||||||||||||||||
| 330 | } | - | ||||||||||||||||||||||||
| 331 | character++; | - | ||||||||||||||||||||||||
| 332 | } executed 1506 times by 2 tests: end of blockExecuted by:
| 1506 | ||||||||||||||||||||||||
| 333 | return executed 2692 times by 6 tests: Qt::LayoutDirectionAuto;return Qt::LayoutDirectionAuto;Executed by:
executed 2692 times by 6 tests: return Qt::LayoutDirectionAuto;Executed by:
| 2692 | ||||||||||||||||||||||||
| 334 | } | - | ||||||||||||||||||||||||
| 335 | - | |||||||||||||||||||||||||
| 336 | bool QQuickTextEditPrivate::determineHorizontalAlignment() | - | ||||||||||||||||||||||||
| 337 | { | - | ||||||||||||||||||||||||
| 338 | QQuickTextEdit * const q = q_func(); | - | ||||||||||||||||||||||||
| 339 | if (hAlignImplicit
| 84-4342 | ||||||||||||||||||||||||
| 340 | Qt::LayoutDirection direction = contentDirection; | - | ||||||||||||||||||||||||
| 341 | - | |||||||||||||||||||||||||
| 342 | if (direction == Qt::LayoutDirectionAuto
| 1374-2872 | ||||||||||||||||||||||||
| 343 | const QString preeditText = control->textCursor().block().layout()->preeditAreaText(); | - | ||||||||||||||||||||||||
| 344 | direction = textDirection(preeditText); | - | ||||||||||||||||||||||||
| 345 | } executed 1374 times by 6 tests: end of blockExecuted by:
| 1374 | ||||||||||||||||||||||||
| 346 | if (direction == Qt::LayoutDirectionAuto
| 1352-2894 | ||||||||||||||||||||||||
| 347 | direction = (static_cast<QGuiApplication *>(QCoreApplication::instance()))->inputMethod()->inputDirection(); executed 1352 times by 6 tests: direction = (static_cast<QGuiApplication *>(QCoreApplication::instance()))->inputMethod()->inputDirection();Executed by:
| 1352 | ||||||||||||||||||||||||
| 348 | - | |||||||||||||||||||||||||
| 349 | - | |||||||||||||||||||||||||
| 350 | return executed 4246 times by 6 tests: setHAlign(direction == Qt::RightToLeft ? QQuickTextEdit::AlignRight : QQuickTextEdit::AlignLeft);return setHAlign(direction == Qt::RightToLeft ? QQuickTextEdit::AlignRight : QQuickTextEdit::AlignLeft);Executed by:
executed 4246 times by 6 tests: return setHAlign(direction == Qt::RightToLeft ? QQuickTextEdit::AlignRight : QQuickTextEdit::AlignLeft);Executed by:
| 4246 | ||||||||||||||||||||||||
| 351 | } | - | ||||||||||||||||||||||||
| 352 | return executed 180 times by 2 tests: false;return false;Executed by:
executed 180 times by 2 tests: return false;Executed by:
| 180 | ||||||||||||||||||||||||
| 353 | } | - | ||||||||||||||||||||||||
| 354 | - | |||||||||||||||||||||||||
| 355 | void QQuickTextEditPrivate::mirrorChange() | - | ||||||||||||||||||||||||
| 356 | { | - | ||||||||||||||||||||||||
| 357 | QQuickTextEdit * const q = q_func(); | - | ||||||||||||||||||||||||
| 358 | if (q->isComponentComplete()
| 0-4 | ||||||||||||||||||||||||
| 359 | if (!hAlignImplicit
| 0-2 | ||||||||||||||||||||||||
| 360 | updateDefaultTextOption(); | - | ||||||||||||||||||||||||
| 361 | q->updateSize(); | - | ||||||||||||||||||||||||
| 362 | q->effectiveHorizontalAlignmentChanged(); | - | ||||||||||||||||||||||||
| 363 | } executed 2 times by 1 test: end of blockExecuted by:
| 2 | ||||||||||||||||||||||||
| 364 | } executed 4 times by 1 test: end of blockExecuted by:
| 4 | ||||||||||||||||||||||||
| 365 | } executed 4 times by 1 test: end of blockExecuted by:
| 4 | ||||||||||||||||||||||||
| 366 | - | |||||||||||||||||||||||||
| 367 | - | |||||||||||||||||||||||||
| 368 | Qt::InputMethodHints QQuickTextEditPrivate::effectiveInputMethodHints() const | - | ||||||||||||||||||||||||
| 369 | { | - | ||||||||||||||||||||||||
| 370 | return executed 338 times by 3 tests: inputMethodHints | Qt::ImhMultiLine;return inputMethodHints | Qt::ImhMultiLine;Executed by:
executed 338 times by 3 tests: return inputMethodHints | Qt::ImhMultiLine;Executed by:
| 338 | ||||||||||||||||||||||||
| 371 | } | - | ||||||||||||||||||||||||
| 372 | - | |||||||||||||||||||||||||
| 373 | - | |||||||||||||||||||||||||
| 374 | void QQuickTextEditPrivate::setTopPadding(qreal value, bool reset) | - | ||||||||||||||||||||||||
| 375 | { | - | ||||||||||||||||||||||||
| 376 | QQuickTextEdit * const q = q_func(); | - | ||||||||||||||||||||||||
| 377 | qreal oldPadding = q->topPadding(); | - | ||||||||||||||||||||||||
| 378 | if (!reset
| 0-4 | ||||||||||||||||||||||||
| 379 | extra.value().topPadding = value; | - | ||||||||||||||||||||||||
| 380 | extra.value().explicitTopPadding = !reset; | - | ||||||||||||||||||||||||
| 381 | } executed 6 times by 1 test: end of blockExecuted by:
| 6 | ||||||||||||||||||||||||
| 382 | if ((!reset
| 0-4 | ||||||||||||||||||||||||
| 383 | q->updateSize(); | - | ||||||||||||||||||||||||
| 384 | q->topPaddingChanged(); | - | ||||||||||||||||||||||||
| 385 | } executed 6 times by 1 test: end of blockExecuted by:
| 6 | ||||||||||||||||||||||||
| 386 | } executed 6 times by 1 test: end of blockExecuted by:
| 6 | ||||||||||||||||||||||||
| 387 | - | |||||||||||||||||||||||||
| 388 | void QQuickTextEditPrivate::setLeftPadding(qreal value, bool reset) | - | ||||||||||||||||||||||||
| 389 | { | - | ||||||||||||||||||||||||
| 390 | QQuickTextEdit * const q = q_func(); | - | ||||||||||||||||||||||||
| 391 | qreal oldPadding = q->leftPadding(); | - | ||||||||||||||||||||||||
| 392 | if (!reset
| 0-4 | ||||||||||||||||||||||||
| 393 | extra.value().leftPadding = value; | - | ||||||||||||||||||||||||
| 394 | extra.value().explicitLeftPadding = !reset; | - | ||||||||||||||||||||||||
| 395 | } executed 6 times by 1 test: end of blockExecuted by:
| 6 | ||||||||||||||||||||||||
| 396 | if ((!reset
| 0-4 | ||||||||||||||||||||||||
| 397 | q->updateSize(); | - | ||||||||||||||||||||||||
| 398 | q->leftPaddingChanged(); | - | ||||||||||||||||||||||||
| 399 | } executed 6 times by 1 test: end of blockExecuted by:
| 6 | ||||||||||||||||||||||||
| 400 | } executed 6 times by 1 test: end of blockExecuted by:
| 6 | ||||||||||||||||||||||||
| 401 | - | |||||||||||||||||||||||||
| 402 | void QQuickTextEditPrivate::setRightPadding(qreal value, bool reset) | - | ||||||||||||||||||||||||
| 403 | { | - | ||||||||||||||||||||||||
| 404 | QQuickTextEdit * const q = q_func(); | - | ||||||||||||||||||||||||
| 405 | qreal oldPadding = q->rightPadding(); | - | ||||||||||||||||||||||||
| 406 | if (!reset
| 0-4 | ||||||||||||||||||||||||
| 407 | extra.value().rightPadding = value; | - | ||||||||||||||||||||||||
| 408 | extra.value().explicitRightPadding = !reset; | - | ||||||||||||||||||||||||
| 409 | } executed 6 times by 1 test: end of blockExecuted by:
| 6 | ||||||||||||||||||||||||
| 410 | if ((!reset
| 0-4 | ||||||||||||||||||||||||
| 411 | q->updateSize(); | - | ||||||||||||||||||||||||
| 412 | q->rightPaddingChanged(); | - | ||||||||||||||||||||||||
| 413 | } executed 6 times by 1 test: end of blockExecuted by:
| 6 | ||||||||||||||||||||||||
| 414 | } executed 6 times by 1 test: end of blockExecuted by:
| 6 | ||||||||||||||||||||||||
| 415 | - | |||||||||||||||||||||||||
| 416 | void QQuickTextEditPrivate::setBottomPadding(qreal value, bool reset) | - | ||||||||||||||||||||||||
| 417 | { | - | ||||||||||||||||||||||||
| 418 | QQuickTextEdit * const q = q_func(); | - | ||||||||||||||||||||||||
| 419 | qreal oldPadding = q->bottomPadding(); | - | ||||||||||||||||||||||||
| 420 | if (!reset
| 0-4 | ||||||||||||||||||||||||
| 421 | extra.value().bottomPadding = value; | - | ||||||||||||||||||||||||
| 422 | extra.value().explicitBottomPadding = !reset; | - | ||||||||||||||||||||||||
| 423 | } executed 6 times by 1 test: end of blockExecuted by:
| 6 | ||||||||||||||||||||||||
| 424 | if ((!reset
| 0-4 | ||||||||||||||||||||||||
| 425 | q->updateSize(); | - | ||||||||||||||||||||||||
| 426 | q->bottomPaddingChanged(); | - | ||||||||||||||||||||||||
| 427 | } executed 6 times by 1 test: end of blockExecuted by:
| 6 | ||||||||||||||||||||||||
| 428 | } executed 6 times by 1 test: end of blockExecuted by:
| 6 | ||||||||||||||||||||||||
| 429 | - | |||||||||||||||||||||||||
| 430 | bool QQuickTextEditPrivate::isImplicitResizeEnabled() const | - | ||||||||||||||||||||||||
| 431 | { | - | ||||||||||||||||||||||||
| 432 | return executed 5290 times by 6 tests: !extra.isAllocated() || extra->implicitResize;return !extra.isAllocated() || extra->implicitResize;Executed by:
executed 5290 times by 6 tests: return !extra.isAllocated() || extra->implicitResize;Executed by:
| 5290 | ||||||||||||||||||||||||
| 433 | } | - | ||||||||||||||||||||||||
| 434 | - | |||||||||||||||||||||||||
| 435 | void QQuickTextEditPrivate::setImplicitResizeEnabled(bool enabled) | - | ||||||||||||||||||||||||
| 436 | { | - | ||||||||||||||||||||||||
| 437 | if (!enabled
| 0 | ||||||||||||||||||||||||
| 438 | extra.value().implicitResize = false; never executed: extra.value().implicitResize = false; | 0 | ||||||||||||||||||||||||
| 439 | else if (extra.isAllocated()
| 0 | ||||||||||||||||||||||||
| 440 | extra->implicitResize = true; never executed: extra->implicitResize = true; | 0 | ||||||||||||||||||||||||
| 441 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 442 | - | |||||||||||||||||||||||||
| 443 | QQuickTextEdit::VAlignment QQuickTextEdit::vAlign() const | - | ||||||||||||||||||||||||
| 444 | { | - | ||||||||||||||||||||||||
| 445 | const QQuickTextEditPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 446 | return executed 42 times by 1 test: d->vAlign;return d->vAlign;Executed by:
executed 42 times by 1 test: return d->vAlign;Executed by:
| 42 | ||||||||||||||||||||||||
| 447 | } | - | ||||||||||||||||||||||||
| 448 | - | |||||||||||||||||||||||||
| 449 | void QQuickTextEdit::setVAlign(QQuickTextEdit::VAlignment alignment) | - | ||||||||||||||||||||||||
| 450 | { | - | ||||||||||||||||||||||||
| 451 | QQuickTextEditPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 452 | if (alignment == d->vAlign
| 20-42 | ||||||||||||||||||||||||
| 453 | return; executed 20 times by 1 test: return;Executed by:
| 20 | ||||||||||||||||||||||||
| 454 | d->vAlign = alignment; | - | ||||||||||||||||||||||||
| 455 | d->updateDefaultTextOption(); | - | ||||||||||||||||||||||||
| 456 | updateSize(); | - | ||||||||||||||||||||||||
| 457 | moveCursorDelegate(); | - | ||||||||||||||||||||||||
| 458 | verticalAlignmentChanged(d->vAlign); | - | ||||||||||||||||||||||||
| 459 | } executed 42 times by 1 test: end of blockExecuted by:
| 42 | ||||||||||||||||||||||||
| 460 | QQuickTextEdit::WrapMode QQuickTextEdit::wrapMode() const | - | ||||||||||||||||||||||||
| 461 | { | - | ||||||||||||||||||||||||
| 462 | const QQuickTextEditPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 463 | return executed 6 times by 1 test: d->wrapMode;return d->wrapMode;Executed by:
executed 6 times by 1 test: return d->wrapMode;Executed by:
| 6 | ||||||||||||||||||||||||
| 464 | } | - | ||||||||||||||||||||||||
| 465 | - | |||||||||||||||||||||||||
| 466 | void QQuickTextEdit::setWrapMode(WrapMode mode) | - | ||||||||||||||||||||||||
| 467 | { | - | ||||||||||||||||||||||||
| 468 | QQuickTextEditPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 469 | if (mode == d->wrapMode
| 10-108 | ||||||||||||||||||||||||
| 470 | return; executed 10 times by 1 test: return;Executed by:
| 10 | ||||||||||||||||||||||||
| 471 | d->wrapMode = mode; | - | ||||||||||||||||||||||||
| 472 | d->updateDefaultTextOption(); | - | ||||||||||||||||||||||||
| 473 | updateSize(); | - | ||||||||||||||||||||||||
| 474 | wrapModeChanged(); | - | ||||||||||||||||||||||||
| 475 | } executed 108 times by 4 tests: end of blockExecuted by:
| 108 | ||||||||||||||||||||||||
| 476 | - | |||||||||||||||||||||||||
| 477 | - | |||||||||||||||||||||||||
| 478 | - | |||||||||||||||||||||||||
| 479 | - | |||||||||||||||||||||||||
| 480 | - | |||||||||||||||||||||||||
| 481 | - | |||||||||||||||||||||||||
| 482 | int QQuickTextEdit::lineCount() const | - | ||||||||||||||||||||||||
| 483 | { | - | ||||||||||||||||||||||||
| 484 | const QQuickTextEditPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 485 | return executed 52 times by 1 test: d->lineCount;return d->lineCount;Executed by:
executed 52 times by 1 test: return d->lineCount;Executed by:
| 52 | ||||||||||||||||||||||||
| 486 | } | - | ||||||||||||||||||||||||
| 487 | int QQuickTextEdit::length() const | - | ||||||||||||||||||||||||
| 488 | { | - | ||||||||||||||||||||||||
| 489 | const QQuickTextEditPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 490 | - | |||||||||||||||||||||||||
| 491 | return executed 160 times by 1 test: qMax(0, d->document->characterCount() - 1);return qMax(0, d->document->characterCount() - 1);Executed by:
executed 160 times by 1 test: return qMax(0, d->document->characterCount() - 1);Executed by:
| 160 | ||||||||||||||||||||||||
| 492 | } | - | ||||||||||||||||||||||||
| 493 | - | |||||||||||||||||||||||||
| 494 | - | |||||||||||||||||||||||||
| 495 | - | |||||||||||||||||||||||||
| 496 | - | |||||||||||||||||||||||||
| 497 | - | |||||||||||||||||||||||||
| 498 | - | |||||||||||||||||||||||||
| 499 | - | |||||||||||||||||||||||||
| 500 | qreal QQuickTextEdit::contentWidth() const | - | ||||||||||||||||||||||||
| 501 | { | - | ||||||||||||||||||||||||
| 502 | const QQuickTextEditPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 503 | return executed 24 times by 2 tests: d->contentSize.width();return d->contentSize.width();Executed by:
executed 24 times by 2 tests: return d->contentSize.width();Executed by:
| 24 | ||||||||||||||||||||||||
| 504 | } | - | ||||||||||||||||||||||||
| 505 | - | |||||||||||||||||||||||||
| 506 | - | |||||||||||||||||||||||||
| 507 | - | |||||||||||||||||||||||||
| 508 | - | |||||||||||||||||||||||||
| 509 | - | |||||||||||||||||||||||||
| 510 | - | |||||||||||||||||||||||||
| 511 | - | |||||||||||||||||||||||||
| 512 | qreal QQuickTextEdit::contentHeight() const | - | ||||||||||||||||||||||||
| 513 | { | - | ||||||||||||||||||||||||
| 514 | const QQuickTextEditPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 515 | return executed 22 times by 2 tests: d->contentSize.height();return d->contentSize.height();Executed by:
executed 22 times by 2 tests: return d->contentSize.height();Executed by:
| 22 | ||||||||||||||||||||||||
| 516 | } | - | ||||||||||||||||||||||||
| 517 | QUrl QQuickTextEdit::baseUrl() const | - | ||||||||||||||||||||||||
| 518 | { | - | ||||||||||||||||||||||||
| 519 | const QQuickTextEditPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 520 | if (d->baseUrl.isEmpty()
| 18-1060 | ||||||||||||||||||||||||
| 521 | if (QQmlContext *context = qmlContext(this)
| 2-1058 | ||||||||||||||||||||||||
| 522 | const_cast< executed 1058 times by 6 tests: QQuickTextEditPrivate *>(d)->baseUrl = context->baseUrl();const_cast<QQuickTextEditPrivate *>(d)->baseUrl = context->baseUrl();Executed by:
executed 1058 times by 6 tests: const_cast<QQuickTextEditPrivate *>(d)->baseUrl = context->baseUrl();Executed by:
| 1058 | ||||||||||||||||||||||||
| 523 | } executed 1060 times by 6 tests: end of blockExecuted by:
| 1060 | ||||||||||||||||||||||||
| 524 | return executed 1078 times by 6 tests: d->baseUrl;return d->baseUrl;Executed by:
executed 1078 times by 6 tests: return d->baseUrl;Executed by:
| 1078 | ||||||||||||||||||||||||
| 525 | } | - | ||||||||||||||||||||||||
| 526 | - | |||||||||||||||||||||||||
| 527 | void QQuickTextEdit::setBaseUrl(const QUrl &url) | - | ||||||||||||||||||||||||
| 528 | { | - | ||||||||||||||||||||||||
| 529 | QQuickTextEditPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 530 | if (baseUrl() != url
| 2-8 | ||||||||||||||||||||||||
| 531 | d->baseUrl = url; | - | ||||||||||||||||||||||||
| 532 | - | |||||||||||||||||||||||||
| 533 | d->document->setBaseUrl(url); | - | ||||||||||||||||||||||||
| 534 | baseUrlChanged(); | - | ||||||||||||||||||||||||
| 535 | } executed 8 times by 1 test: end of blockExecuted by:
| 8 | ||||||||||||||||||||||||
| 536 | } executed 10 times by 1 test: end of blockExecuted by:
| 10 | ||||||||||||||||||||||||
| 537 | - | |||||||||||||||||||||||||
| 538 | void QQuickTextEdit::resetBaseUrl() | - | ||||||||||||||||||||||||
| 539 | { | - | ||||||||||||||||||||||||
| 540 | if (QQmlContext *context = qmlContext(this)
| 0-2 | ||||||||||||||||||||||||
| 541 | setBaseUrl(context->baseUrl()); executed 2 times by 1 test: setBaseUrl(context->baseUrl());Executed by:
| 2 | ||||||||||||||||||||||||
| 542 | else | - | ||||||||||||||||||||||||
| 543 | setBaseUrl(QUrl()); never executed: setBaseUrl(QUrl()); | 0 | ||||||||||||||||||||||||
| 544 | } | - | ||||||||||||||||||||||||
| 545 | QRectF QQuickTextEdit::positionToRectangle(int pos) const | - | ||||||||||||||||||||||||
| 546 | { | - | ||||||||||||||||||||||||
| 547 | const QQuickTextEditPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 548 | QTextCursor c(d->document); | - | ||||||||||||||||||||||||
| 549 | c.setPosition(pos); | - | ||||||||||||||||||||||||
| 550 | return executed 340 times by 2 tests: d->control->cursorRect(c).translated(d->xoff, d->yoff);return d->control->cursorRect(c).translated(d->xoff, d->yoff);Executed by:
executed 340 times by 2 tests: return d->control->cursorRect(c).translated(d->xoff, d->yoff);Executed by:
| 340 | ||||||||||||||||||||||||
| 551 | - | |||||||||||||||||||||||||
| 552 | } | - | ||||||||||||||||||||||||
| 553 | int QQuickTextEdit::positionAt(qreal x, qreal y) const | - | ||||||||||||||||||||||||
| 554 | { | - | ||||||||||||||||||||||||
| 555 | const QQuickTextEditPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 556 | x -= d->xoff; | - | ||||||||||||||||||||||||
| 557 | y -= d->yoff; | - | ||||||||||||||||||||||||
| 558 | - | |||||||||||||||||||||||||
| 559 | int r = d->document->documentLayout()->hitTest(QPointF(x, y), Qt::FuzzyHit); | - | ||||||||||||||||||||||||
| 560 | - | |||||||||||||||||||||||||
| 561 | QTextCursor cursor = d->control->textCursor(); | - | ||||||||||||||||||||||||
| 562 | if (r > cursor.position()
| 14-58 | ||||||||||||||||||||||||
| 563 | - | |||||||||||||||||||||||||
| 564 | - | |||||||||||||||||||||||||
| 565 | - | |||||||||||||||||||||||||
| 566 | QTextLayout *layout = cursor.block().layout(); | - | ||||||||||||||||||||||||
| 567 | const int preeditLength = layout
| 0-58 | ||||||||||||||||||||||||
| 568 | ? layout->preeditAreaText().length() | - | ||||||||||||||||||||||||
| 569 | : 0; | - | ||||||||||||||||||||||||
| 570 | if (preeditLength > 0
| 12-46 | ||||||||||||||||||||||||
| 571 | && d->document->documentLayout()->blockBoundingRect(cursor.block()).contains(x, y)
| 12-34 | ||||||||||||||||||||||||
| 572 | r = r > cursor.position() + preeditLength
| 12-22 | ||||||||||||||||||||||||
| 573 | ? r - preeditLength | - | ||||||||||||||||||||||||
| 574 | : cursor.position(); | - | ||||||||||||||||||||||||
| 575 | } executed 34 times by 1 test: end of blockExecuted by:
| 34 | ||||||||||||||||||||||||
| 576 | } executed 58 times by 1 test: end of blockExecuted by:
| 58 | ||||||||||||||||||||||||
| 577 | - | |||||||||||||||||||||||||
| 578 | return executed 72 times by 1 test: r;return r;Executed by:
executed 72 times by 1 test: return r;Executed by:
| 72 | ||||||||||||||||||||||||
| 579 | } | - | ||||||||||||||||||||||||
| 580 | void QQuickTextEdit::moveCursorSelection(int pos) | - | ||||||||||||||||||||||||
| 581 | { | - | ||||||||||||||||||||||||
| 582 | - | |||||||||||||||||||||||||
| 583 | QQuickTextEditPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 584 | QTextCursor cursor = d->control->textCursor(); | - | ||||||||||||||||||||||||
| 585 | if (cursor.position() == pos
| 0-2 | ||||||||||||||||||||||||
| 586 | return; never executed: return; | 0 | ||||||||||||||||||||||||
| 587 | cursor.setPosition(pos, QTextCursor::KeepAnchor); | - | ||||||||||||||||||||||||
| 588 | d->control->setTextCursor(cursor); | - | ||||||||||||||||||||||||
| 589 | } executed 2 times by 1 test: end of blockExecuted by:
| 2 | ||||||||||||||||||||||||
| 590 | - | |||||||||||||||||||||||||
| 591 | void QQuickTextEdit::moveCursorSelection(int pos, SelectionMode mode) | - | ||||||||||||||||||||||||
| 592 | { | - | ||||||||||||||||||||||||
| 593 | QQuickTextEditPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 594 | QTextCursor cursor = d->control->textCursor(); | - | ||||||||||||||||||||||||
| 595 | if (cursor.position() == pos
| 60-236 | ||||||||||||||||||||||||
| 596 | return; executed 60 times by 1 test: return;Executed by:
| 60 | ||||||||||||||||||||||||
| 597 | if (mode == SelectCharacters
| 40-196 | ||||||||||||||||||||||||
| 598 | cursor.setPosition(pos, QTextCursor::KeepAnchor); | - | ||||||||||||||||||||||||
| 599 | } executed 40 times by 1 test: else if (cursor.anchor() < posend of blockExecuted by:
| 2-100 | ||||||||||||||||||||||||
| 600 | if (cursor.anchor() > cursor.position()
| 8-90 | ||||||||||||||||||||||||
| 601 | cursor.setPosition(cursor.anchor(), QTextCursor::MoveAnchor); | - | ||||||||||||||||||||||||
| 602 | cursor.movePosition(QTextCursor::StartOfWord, QTextCursor::KeepAnchor); | - | ||||||||||||||||||||||||
| 603 | if (cursor.position() == cursor.anchor()
| 2-6 | ||||||||||||||||||||||||
| 604 | cursor.movePosition(QTextCursor::PreviousWord, QTextCursor::MoveAnchor); executed 2 times by 1 test: cursor.movePosition(QTextCursor::PreviousWord, QTextCursor::MoveAnchor);Executed by:
| 2 | ||||||||||||||||||||||||
| 605 | else | - | ||||||||||||||||||||||||
| 606 | cursor.setPosition(cursor.position(), QTextCursor::MoveAnchor); executed 6 times by 1 test: cursor.setPosition(cursor.position(), QTextCursor::MoveAnchor);Executed by:
| 6 | ||||||||||||||||||||||||
| 607 | } else { | - | ||||||||||||||||||||||||
| 608 | cursor.setPosition(cursor.anchor(), QTextCursor::MoveAnchor); | - | ||||||||||||||||||||||||
| 609 | cursor.movePosition(QTextCursor::StartOfWord, QTextCursor::MoveAnchor); | - | ||||||||||||||||||||||||
| 610 | } executed 90 times by 1 test: end of blockExecuted by:
| 90 | ||||||||||||||||||||||||
| 611 | - | |||||||||||||||||||||||||
| 612 | cursor.setPosition(pos, QTextCursor::KeepAnchor); | - | ||||||||||||||||||||||||
| 613 | cursor.movePosition(QTextCursor::StartOfWord, QTextCursor::KeepAnchor); | - | ||||||||||||||||||||||||
| 614 | if (cursor.position() != pos
| 42-56 | ||||||||||||||||||||||||
| 615 | cursor.movePosition(QTextCursor::EndOfWord, QTextCursor::KeepAnchor); executed 56 times by 1 test: cursor.movePosition(QTextCursor::EndOfWord, QTextCursor::KeepAnchor);Executed by:
| 56 | ||||||||||||||||||||||||
| 616 | } executed 98 times by 1 test: else if (cursor.anchor() > posend of blockExecuted by:
| 0-98 | ||||||||||||||||||||||||
| 617 | if (cursor.anchor() < cursor.position()
| 8-90 | ||||||||||||||||||||||||
| 618 | cursor.setPosition(cursor.anchor(), QTextCursor::MoveAnchor); | - | ||||||||||||||||||||||||
| 619 | cursor.movePosition(QTextCursor::EndOfWord, QTextCursor::MoveAnchor); | - | ||||||||||||||||||||||||
| 620 | } executed 8 times by 1 test: else {end of blockExecuted by:
| 8 | ||||||||||||||||||||||||
| 621 | cursor.setPosition(cursor.anchor(), QTextCursor::MoveAnchor); | - | ||||||||||||||||||||||||
| 622 | cursor.movePosition(QTextCursor::PreviousCharacter, QTextCursor::KeepAnchor); | - | ||||||||||||||||||||||||
| 623 | cursor.movePosition(QTextCursor::EndOfWord, QTextCursor::KeepAnchor); | - | ||||||||||||||||||||||||
| 624 | if (cursor.position() != cursor.anchor()
| 36-54 | ||||||||||||||||||||||||
| 625 | cursor.setPosition(cursor.anchor(), QTextCursor::MoveAnchor); | - | ||||||||||||||||||||||||
| 626 | cursor.movePosition(QTextCursor::EndOfWord, QTextCursor::MoveAnchor); | - | ||||||||||||||||||||||||
| 627 | } executed 54 times by 1 test: end of blockExecuted by:
| 54 | ||||||||||||||||||||||||
| 628 | } executed 90 times by 1 test: end of blockExecuted by:
| 90 | ||||||||||||||||||||||||
| 629 | - | |||||||||||||||||||||||||
| 630 | cursor.setPosition(pos, QTextCursor::KeepAnchor); | - | ||||||||||||||||||||||||
| 631 | cursor.movePosition(QTextCursor::EndOfWord, QTextCursor::KeepAnchor); | - | ||||||||||||||||||||||||
| 632 | if (cursor.position() != pos
| 40-58 | ||||||||||||||||||||||||
| 633 | cursor.movePosition(QTextCursor::PreviousCharacter, QTextCursor::KeepAnchor); | - | ||||||||||||||||||||||||
| 634 | cursor.movePosition(QTextCursor::StartOfWord, QTextCursor::KeepAnchor); | - | ||||||||||||||||||||||||
| 635 | } executed 58 times by 1 test: end of blockExecuted by:
| 58 | ||||||||||||||||||||||||
| 636 | } executed 98 times by 1 test: end of blockExecuted by:
| 98 | ||||||||||||||||||||||||
| 637 | d->control->setTextCursor(cursor); | - | ||||||||||||||||||||||||
| 638 | } executed 236 times by 1 test: end of blockExecuted by:
| 236 | ||||||||||||||||||||||||
| 639 | bool QQuickTextEdit::isCursorVisible() const | - | ||||||||||||||||||||||||
| 640 | { | - | ||||||||||||||||||||||||
| 641 | const QQuickTextEditPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 642 | return executed 108 times by 1 test: d->cursorVisible;return d->cursorVisible;Executed by:
executed 108 times by 1 test: return d->cursorVisible;Executed by:
| 108 | ||||||||||||||||||||||||
| 643 | } | - | ||||||||||||||||||||||||
| 644 | - | |||||||||||||||||||||||||
| 645 | void QQuickTextEdit::setCursorVisible(bool on) | - | ||||||||||||||||||||||||
| 646 | { | - | ||||||||||||||||||||||||
| 647 | QQuickTextEditPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 648 | if (d->cursorVisible == on
| 342-482 | ||||||||||||||||||||||||
| 649 | return; executed 342 times by 2 tests: return;Executed by:
| 342 | ||||||||||||||||||||||||
| 650 | d->cursorVisible = on; | - | ||||||||||||||||||||||||
| 651 | if (on
| 32-370 | ||||||||||||||||||||||||
| 652 | QQuickTextUtil::createCursor(d); executed 338 times by 3 tests: QQuickTextUtil::createCursor(d);Executed by:
| 338 | ||||||||||||||||||||||||
| 653 | if (!on
| 2-370 | ||||||||||||||||||||||||
| 654 | d->control->setCursorIsFocusIndicator(true); executed 110 times by 3 tests: d->control->setCursorIsFocusIndicator(true);Executed by:
| 110 | ||||||||||||||||||||||||
| 655 | d->control->setCursorVisible(on); | - | ||||||||||||||||||||||||
| 656 | cursorVisibleChanged(d->cursorVisible); | - | ||||||||||||||||||||||||
| 657 | } executed 482 times by 4 tests: end of blockExecuted by:
| 482 | ||||||||||||||||||||||||
| 658 | - | |||||||||||||||||||||||||
| 659 | - | |||||||||||||||||||||||||
| 660 | - | |||||||||||||||||||||||||
| 661 | - | |||||||||||||||||||||||||
| 662 | - | |||||||||||||||||||||||||
| 663 | int QQuickTextEdit::cursorPosition() const | - | ||||||||||||||||||||||||
| 664 | { | - | ||||||||||||||||||||||||
| 665 | const QQuickTextEditPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 666 | return executed 326 times by 1 test: d->control->textCursor().position();return d->control->textCursor().position();Executed by:
executed 326 times by 1 test: return d->control->textCursor().position();Executed by:
| 326 | ||||||||||||||||||||||||
| 667 | } | - | ||||||||||||||||||||||||
| 668 | - | |||||||||||||||||||||||||
| 669 | void QQuickTextEdit::setCursorPosition(int pos) | - | ||||||||||||||||||||||||
| 670 | { | - | ||||||||||||||||||||||||
| 671 | QQuickTextEditPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 672 | if (pos < 0
| 2-670 | ||||||||||||||||||||||||
| 673 | return; executed 8 times by 1 test: return;Executed by:
| 8 | ||||||||||||||||||||||||
| 674 | QTextCursor cursor = d->control->textCursor(); | - | ||||||||||||||||||||||||
| 675 | if (cursor.position() == pos
| 56-520 | ||||||||||||||||||||||||
| 676 | return; executed 88 times by 1 test: return;Executed by:
| 88 | ||||||||||||||||||||||||
| 677 | cursor.setPosition(pos); | - | ||||||||||||||||||||||||
| 678 | d->control->setTextCursor(cursor); | - | ||||||||||||||||||||||||
| 679 | d->control->updateCursorRectangle(true); | - | ||||||||||||||||||||||||
| 680 | } executed 576 times by 1 test: end of blockExecuted by:
| 576 | ||||||||||||||||||||||||
| 681 | QQmlComponent* QQuickTextEdit::cursorDelegate() const | - | ||||||||||||||||||||||||
| 682 | { | - | ||||||||||||||||||||||||
| 683 | const QQuickTextEditPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 684 | return never executed: d->cursorComponent;return d->cursorComponent;never executed: return d->cursorComponent; | 0 | ||||||||||||||||||||||||
| 685 | } | - | ||||||||||||||||||||||||
| 686 | - | |||||||||||||||||||||||||
| 687 | void QQuickTextEdit::setCursorDelegate(QQmlComponent* c) | - | ||||||||||||||||||||||||
| 688 | { | - | ||||||||||||||||||||||||
| 689 | QQuickTextEditPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 690 | QQuickTextUtil::setCursorDelegate(d, c); | - | ||||||||||||||||||||||||
| 691 | } executed 36 times by 1 test: end of blockExecuted by:
| 36 | ||||||||||||||||||||||||
| 692 | - | |||||||||||||||||||||||||
| 693 | void QQuickTextEdit::createCursor() | - | ||||||||||||||||||||||||
| 694 | { | - | ||||||||||||||||||||||||
| 695 | QQuickTextEditPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 696 | d->cursorPending = true; | - | ||||||||||||||||||||||||
| 697 | QQuickTextUtil::createCursor(d); | - | ||||||||||||||||||||||||
| 698 | } executed 2 times by 1 test: end of blockExecuted by:
| 2 | ||||||||||||||||||||||||
| 699 | int QQuickTextEdit::selectionStart() const | - | ||||||||||||||||||||||||
| 700 | { | - | ||||||||||||||||||||||||
| 701 | const QQuickTextEditPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 702 | return executed 1062 times by 4 tests: d->control->textCursor().selectionStart();return d->control->textCursor().selectionStart();Executed by:
executed 1062 times by 4 tests: return d->control->textCursor().selectionStart();Executed by:
| 1062 | ||||||||||||||||||||||||
| 703 | } | - | ||||||||||||||||||||||||
| 704 | int QQuickTextEdit::selectionEnd() const | - | ||||||||||||||||||||||||
| 705 | { | - | ||||||||||||||||||||||||
| 706 | const QQuickTextEditPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 707 | return executed 1062 times by 4 tests: d->control->textCursor().selectionEnd();return d->control->textCursor().selectionEnd();Executed by:
executed 1062 times by 4 tests: return d->control->textCursor().selectionEnd();Executed by:
| 1062 | ||||||||||||||||||||||||
| 708 | } | - | ||||||||||||||||||||||||
| 709 | QString QQuickTextEdit::selectedText() const | - | ||||||||||||||||||||||||
| 710 | { | - | ||||||||||||||||||||||||
| 711 | const QQuickTextEditPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 712 | - | |||||||||||||||||||||||||
| 713 | return executed 1516 times by 1 test: d->richTextreturn d->richText ? d->control->textCursor().selectedText() : d->control->textCursor().selection().toPlainText();Executed by:
executed 1516 times by 1 test: return d->richText ? d->control->textCursor().selectedText() : d->control->textCursor().selection().toPlainText();Executed by:
| 1516 | ||||||||||||||||||||||||
| 714 | ? d->control->textCursor().selectedText() executed 1516 times by 1 test: return d->richText ? d->control->textCursor().selectedText() : d->control->textCursor().selection().toPlainText();Executed by:
| 1516 | ||||||||||||||||||||||||
| 715 | : d->control->textCursor().selection().toPlainText(); executed 1516 times by 1 test: return d->richText ? d->control->textCursor().selectedText() : d->control->textCursor().selection().toPlainText();Executed by:
| 1516 | ||||||||||||||||||||||||
| 716 | - | |||||||||||||||||||||||||
| 717 | - | |||||||||||||||||||||||||
| 718 | - | |||||||||||||||||||||||||
| 719 | } | - | ||||||||||||||||||||||||
| 720 | - | |||||||||||||||||||||||||
| 721 | - | |||||||||||||||||||||||||
| 722 | - | |||||||||||||||||||||||||
| 723 | - | |||||||||||||||||||||||||
| 724 | - | |||||||||||||||||||||||||
| 725 | - | |||||||||||||||||||||||||
| 726 | - | |||||||||||||||||||||||||
| 727 | bool QQuickTextEdit::focusOnPress() const | - | ||||||||||||||||||||||||
| 728 | { | - | ||||||||||||||||||||||||
| 729 | const QQuickTextEditPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 730 | return executed 10 times by 1 test: d->focusOnPress;return d->focusOnPress;Executed by:
executed 10 times by 1 test: return d->focusOnPress;Executed by:
| 10 | ||||||||||||||||||||||||
| 731 | } | - | ||||||||||||||||||||||||
| 732 | - | |||||||||||||||||||||||||
| 733 | void QQuickTextEdit::setFocusOnPress(bool on) | - | ||||||||||||||||||||||||
| 734 | { | - | ||||||||||||||||||||||||
| 735 | QQuickTextEditPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 736 | if (d->focusOnPress == on
| 10-96 | ||||||||||||||||||||||||
| 737 | return; executed 96 times by 1 test: return;Executed by:
| 96 | ||||||||||||||||||||||||
| 738 | d->focusOnPress = on; | - | ||||||||||||||||||||||||
| 739 | activeFocusOnPressChanged(d->focusOnPress); | - | ||||||||||||||||||||||||
| 740 | } executed 10 times by 1 test: end of blockExecuted by:
| 10 | ||||||||||||||||||||||||
| 741 | - | |||||||||||||||||||||||||
| 742 | - | |||||||||||||||||||||||||
| 743 | - | |||||||||||||||||||||||||
| 744 | - | |||||||||||||||||||||||||
| 745 | - | |||||||||||||||||||||||||
| 746 | - | |||||||||||||||||||||||||
| 747 | - | |||||||||||||||||||||||||
| 748 | bool QQuickTextEdit::persistentSelection() const | - | ||||||||||||||||||||||||
| 749 | { | - | ||||||||||||||||||||||||
| 750 | const QQuickTextEditPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 751 | return executed 6 times by 1 test: d->persistentSelection;return d->persistentSelection;Executed by:
executed 6 times by 1 test: return d->persistentSelection;Executed by:
| 6 | ||||||||||||||||||||||||
| 752 | } | - | ||||||||||||||||||||||||
| 753 | - | |||||||||||||||||||||||||
| 754 | void QQuickTextEdit::setPersistentSelection(bool on) | - | ||||||||||||||||||||||||
| 755 | { | - | ||||||||||||||||||||||||
| 756 | QQuickTextEditPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 757 | if (d->persistentSelection == on
| 2 | ||||||||||||||||||||||||
| 758 | return; executed 2 times by 1 test: return;Executed by:
| 2 | ||||||||||||||||||||||||
| 759 | d->persistentSelection = on; | - | ||||||||||||||||||||||||
| 760 | persistentSelectionChanged(d->persistentSelection); | - | ||||||||||||||||||||||||
| 761 | } executed 2 times by 1 test: end of blockExecuted by:
| 2 | ||||||||||||||||||||||||
| 762 | - | |||||||||||||||||||||||||
| 763 | - | |||||||||||||||||||||||||
| 764 | - | |||||||||||||||||||||||||
| 765 | - | |||||||||||||||||||||||||
| 766 | - | |||||||||||||||||||||||||
| 767 | - | |||||||||||||||||||||||||
| 768 | qreal QQuickTextEdit::textMargin() const | - | ||||||||||||||||||||||||
| 769 | { | - | ||||||||||||||||||||||||
| 770 | const QQuickTextEditPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 771 | return executed 70 times by 1 test: d->textMargin;return d->textMargin;Executed by:
executed 70 times by 1 test: return d->textMargin;Executed by:
| 70 | ||||||||||||||||||||||||
| 772 | } | - | ||||||||||||||||||||||||
| 773 | - | |||||||||||||||||||||||||
| 774 | void QQuickTextEdit::setTextMargin(qreal margin) | - | ||||||||||||||||||||||||
| 775 | { | - | ||||||||||||||||||||||||
| 776 | QQuickTextEditPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 777 | if (d->textMargin == margin
| 2-68 | ||||||||||||||||||||||||
| 778 | return; executed 2 times by 1 test: return;Executed by:
| 2 | ||||||||||||||||||||||||
| 779 | d->textMargin = margin; | - | ||||||||||||||||||||||||
| 780 | d->document->setDocumentMargin(d->textMargin); | - | ||||||||||||||||||||||||
| 781 | textMarginChanged(d->textMargin); | - | ||||||||||||||||||||||||
| 782 | } executed 68 times by 1 test: end of blockExecuted by:
| 68 | ||||||||||||||||||||||||
| 783 | Qt::InputMethodHints QQuickTextEdit::inputMethodHints() const | - | ||||||||||||||||||||||||
| 784 | { | - | ||||||||||||||||||||||||
| 785 | - | |||||||||||||||||||||||||
| 786 | - | |||||||||||||||||||||||||
| 787 | - | |||||||||||||||||||||||||
| 788 | const QQuickTextEditPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 789 | return executed 6 times by 1 test: d->inputMethodHints;return d->inputMethodHints;Executed by:
executed 6 times by 1 test: return d->inputMethodHints;Executed by:
| 6 | ||||||||||||||||||||||||
| 790 | - | |||||||||||||||||||||||||
| 791 | } | - | ||||||||||||||||||||||||
| 792 | - | |||||||||||||||||||||||||
| 793 | void QQuickTextEdit::setInputMethodHints(Qt::InputMethodHints hints) | - | ||||||||||||||||||||||||
| 794 | { | - | ||||||||||||||||||||||||
| 795 | - | |||||||||||||||||||||||||
| 796 | - | |||||||||||||||||||||||||
| 797 | - | |||||||||||||||||||||||||
| 798 | QQuickTextEditPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 799 | - | |||||||||||||||||||||||||
| 800 | if (hints == d->inputMethodHints
| 2-4 | ||||||||||||||||||||||||
| 801 | return; executed 2 times by 1 test: return;Executed by:
| 2 | ||||||||||||||||||||||||
| 802 | - | |||||||||||||||||||||||||
| 803 | d->inputMethodHints = hints; | - | ||||||||||||||||||||||||
| 804 | updateInputMethod(Qt::ImHints); | - | ||||||||||||||||||||||||
| 805 | inputMethodHintsChanged(); | - | ||||||||||||||||||||||||
| 806 | - | |||||||||||||||||||||||||
| 807 | } executed 4 times by 1 test: end of blockExecuted by:
| 4 | ||||||||||||||||||||||||
| 808 | - | |||||||||||||||||||||||||
| 809 | void QQuickTextEdit::geometryChanged(const QRectF &newGeometry, | - | ||||||||||||||||||||||||
| 810 | const QRectF &oldGeometry) | - | ||||||||||||||||||||||||
| 811 | { | - | ||||||||||||||||||||||||
| 812 | QQuickTextEditPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 813 | if (!d->inLayout
| 14-4150 | ||||||||||||||||||||||||
| 814 | || (newGeometry.height() != oldGeometry.height()
| 78-2528 | ||||||||||||||||||||||||
| 815 | updateSize(); | - | ||||||||||||||||||||||||
| 816 | updateWholeDocument(); | - | ||||||||||||||||||||||||
| 817 | moveCursorDelegate(); | - | ||||||||||||||||||||||||
| 818 | } executed 248 times by 5 tests: end of blockExecuted by:
| 248 | ||||||||||||||||||||||||
| 819 | QQuickImplicitSizeItem::geometryChanged(newGeometry, oldGeometry); | - | ||||||||||||||||||||||||
| 820 | - | |||||||||||||||||||||||||
| 821 | } executed 4164 times by 6 tests: end of blockExecuted by:
| 4164 | ||||||||||||||||||||||||
| 822 | - | |||||||||||||||||||||||||
| 823 | - | |||||||||||||||||||||||||
| 824 | - | |||||||||||||||||||||||||
| 825 | - | |||||||||||||||||||||||||
| 826 | - | |||||||||||||||||||||||||
| 827 | void QQuickTextEdit::componentComplete() | - | ||||||||||||||||||||||||
| 828 | { | - | ||||||||||||||||||||||||
| 829 | QQuickTextEditPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 830 | QQuickImplicitSizeItem::componentComplete(); | - | ||||||||||||||||||||||||
| 831 | - | |||||||||||||||||||||||||
| 832 | d->document->setBaseUrl(baseUrl()); | - | ||||||||||||||||||||||||
| 833 | - | |||||||||||||||||||||||||
| 834 | if (d->richText
| 76-984 | ||||||||||||||||||||||||
| 835 | d->control->setHtml(d->text); executed 76 times by 3 tests: d->control->setHtml(d->text);Executed by:
| 76 | ||||||||||||||||||||||||
| 836 | else | - | ||||||||||||||||||||||||
| 837 | - | |||||||||||||||||||||||||
| 838 | if (!d->text.isEmpty()
| 160-824 | ||||||||||||||||||||||||
| 839 | d->control->setPlainText(d->text); executed 824 times by 4 tests: d->control->setPlainText(d->text);Executed by:
| 824 | ||||||||||||||||||||||||
| 840 | - | |||||||||||||||||||||||||
| 841 | if (d->dirty
| 246-814 | ||||||||||||||||||||||||
| 842 | d->determineHorizontalAlignment(); | - | ||||||||||||||||||||||||
| 843 | d->updateDefaultTextOption(); | - | ||||||||||||||||||||||||
| 844 | updateSize(); | - | ||||||||||||||||||||||||
| 845 | d->dirty = false; | - | ||||||||||||||||||||||||
| 846 | } executed 246 times by 4 tests: end of blockExecuted by:
| 246 | ||||||||||||||||||||||||
| 847 | if (d->cursorComponent
| 4-1038 | ||||||||||||||||||||||||
| 848 | QQuickTextUtil::createCursor(d); executed 4 times by 1 test: QQuickTextUtil::createCursor(d);Executed by:
| 4 | ||||||||||||||||||||||||
| 849 | } executed 1060 times by 6 tests: end of blockExecuted by:
| 1060 | ||||||||||||||||||||||||
| 850 | bool QQuickTextEdit::selectByKeyboard() const | - | ||||||||||||||||||||||||
| 851 | { | - | ||||||||||||||||||||||||
| 852 | const QQuickTextEditPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 853 | if (d->selectByKeyboardSet
| 8-38 | ||||||||||||||||||||||||
| 854 | return executed 8 times by 1 test: d->selectByKeyboard;return d->selectByKeyboard;Executed by:
executed 8 times by 1 test: return d->selectByKeyboard;Executed by:
| 8 | ||||||||||||||||||||||||
| 855 | return executed 38 times by 1 test: !isReadOnly();return !isReadOnly();Executed by:
executed 38 times by 1 test: return !isReadOnly();Executed by:
| 38 | ||||||||||||||||||||||||
| 856 | } | - | ||||||||||||||||||||||||
| 857 | - | |||||||||||||||||||||||||
| 858 | void QQuickTextEdit::setSelectByKeyboard(bool on) | - | ||||||||||||||||||||||||
| 859 | { | - | ||||||||||||||||||||||||
| 860 | QQuickTextEditPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 861 | bool was = selectByKeyboard(); | - | ||||||||||||||||||||||||
| 862 | if (!d->selectByKeyboardSet
| 0-34 | ||||||||||||||||||||||||
| 863 | d->selectByKeyboardSet = true; | - | ||||||||||||||||||||||||
| 864 | d->selectByKeyboard = on; | - | ||||||||||||||||||||||||
| 865 | if (on
| 18 | ||||||||||||||||||||||||
| 866 | d->control->setTextInteractionFlags(d->control->textInteractionFlags() | Qt::TextSelectableByKeyboard); executed 18 times by 1 test: d->control->setTextInteractionFlags(d->control->textInteractionFlags() | Qt::TextSelectableByKeyboard);Executed by:
| 18 | ||||||||||||||||||||||||
| 867 | else | - | ||||||||||||||||||||||||
| 868 | d->control->setTextInteractionFlags(d->control->textInteractionFlags() & ~Qt::TextSelectableByKeyboard); executed 18 times by 1 test: d->control->setTextInteractionFlags(d->control->textInteractionFlags() & ~Qt::TextSelectableByKeyboard);Executed by:
| 18 | ||||||||||||||||||||||||
| 869 | selectByKeyboardChanged(on); | - | ||||||||||||||||||||||||
| 870 | } executed 36 times by 1 test: end of blockExecuted by:
| 36 | ||||||||||||||||||||||||
| 871 | } executed 36 times by 1 test: end of blockExecuted by:
| 36 | ||||||||||||||||||||||||
| 872 | bool QQuickTextEdit::selectByMouse() const | - | ||||||||||||||||||||||||
| 873 | { | - | ||||||||||||||||||||||||
| 874 | const QQuickTextEditPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 875 | return executed 6 times by 1 test: d->selectByMouse;return d->selectByMouse;Executed by:
executed 6 times by 1 test: return d->selectByMouse;Executed by:
| 6 | ||||||||||||||||||||||||
| 876 | } | - | ||||||||||||||||||||||||
| 877 | - | |||||||||||||||||||||||||
| 878 | void QQuickTextEdit::setSelectByMouse(bool on) | - | ||||||||||||||||||||||||
| 879 | { | - | ||||||||||||||||||||||||
| 880 | QQuickTextEditPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 881 | if (d->selectByMouse != on
| 8-114 | ||||||||||||||||||||||||
| 882 | d->selectByMouse = on; | - | ||||||||||||||||||||||||
| 883 | setKeepMouseGrab(on); | - | ||||||||||||||||||||||||
| 884 | if (on
| 2-112 | ||||||||||||||||||||||||
| 885 | d->control->setTextInteractionFlags(d->control->textInteractionFlags() | Qt::TextSelectableByMouse); executed 112 times by 2 tests: d->control->setTextInteractionFlags(d->control->textInteractionFlags() | Qt::TextSelectableByMouse);Executed by:
| 112 | ||||||||||||||||||||||||
| 886 | else | - | ||||||||||||||||||||||||
| 887 | d->control->setTextInteractionFlags(d->control->textInteractionFlags() & ~Qt::TextSelectableByMouse); executed 2 times by 1 test: d->control->setTextInteractionFlags(d->control->textInteractionFlags() & ~Qt::TextSelectableByMouse);Executed by:
| 2 | ||||||||||||||||||||||||
| 888 | selectByMouseChanged(on); | - | ||||||||||||||||||||||||
| 889 | } executed 114 times by 2 tests: end of blockExecuted by:
| 114 | ||||||||||||||||||||||||
| 890 | } executed 122 times by 2 tests: end of blockExecuted by:
| 122 | ||||||||||||||||||||||||
| 891 | QQuickTextEdit::SelectionMode QQuickTextEdit::mouseSelectionMode() const | - | ||||||||||||||||||||||||
| 892 | { | - | ||||||||||||||||||||||||
| 893 | const QQuickTextEditPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 894 | return executed 6 times by 1 test: d->mouseSelectionMode;return d->mouseSelectionMode;Executed by:
executed 6 times by 1 test: return d->mouseSelectionMode;Executed by:
| 6 | ||||||||||||||||||||||||
| 895 | } | - | ||||||||||||||||||||||||
| 896 | - | |||||||||||||||||||||||||
| 897 | void QQuickTextEdit::setMouseSelectionMode(SelectionMode mode) | - | ||||||||||||||||||||||||
| 898 | { | - | ||||||||||||||||||||||||
| 899 | QQuickTextEditPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 900 | if (d->mouseSelectionMode != mode
| 4-30 | ||||||||||||||||||||||||
| 901 | d->mouseSelectionMode = mode; | - | ||||||||||||||||||||||||
| 902 | d->control->setWordSelectionEnabled(mode == SelectWords); | - | ||||||||||||||||||||||||
| 903 | mouseSelectionModeChanged(mode); | - | ||||||||||||||||||||||||
| 904 | } executed 30 times by 1 test: end of blockExecuted by:
| 30 | ||||||||||||||||||||||||
| 905 | } executed 34 times by 1 test: end of blockExecuted by:
| 34 | ||||||||||||||||||||||||
| 906 | void QQuickTextEdit::setReadOnly(bool r) | - | ||||||||||||||||||||||||
| 907 | { | - | ||||||||||||||||||||||||
| 908 | QQuickTextEditPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 909 | if (r == isReadOnly()
| 36-62 | ||||||||||||||||||||||||
| 910 | return; executed 36 times by 3 tests: return;Executed by:
| 36 | ||||||||||||||||||||||||
| 911 | - | |||||||||||||||||||||||||
| 912 | - | |||||||||||||||||||||||||
| 913 | setFlag(QQuickItem::ItemAcceptsInputMethod, !r); | - | ||||||||||||||||||||||||
| 914 | - | |||||||||||||||||||||||||
| 915 | Qt::TextInteractionFlags flags = Qt::LinksAccessibleByMouse; | - | ||||||||||||||||||||||||
| 916 | if (d->selectByMouse
| 12-50 | ||||||||||||||||||||||||
| 917 | flags = flags | Qt::TextSelectableByMouse; executed 12 times by 1 test: flags = flags | Qt::TextSelectableByMouse;Executed by:
| 12 | ||||||||||||||||||||||||
| 918 | if (d->selectByKeyboardSet
| 8-44 | ||||||||||||||||||||||||
| 919 | flags = flags | Qt::TextSelectableByKeyboard; executed 10 times by 1 test: flags = flags | Qt::TextSelectableByKeyboard;Executed by:
| 10 | ||||||||||||||||||||||||
| 920 | else if (!d->selectByKeyboardSet
| 8-44 | ||||||||||||||||||||||||
| 921 | flags = flags | Qt::TextSelectableByKeyboard; executed 16 times by 1 test: flags = flags | Qt::TextSelectableByKeyboard;Executed by:
| 16 | ||||||||||||||||||||||||
| 922 | if (!r
| 18-44 | ||||||||||||||||||||||||
| 923 | flags = flags | Qt::TextEditable; executed 18 times by 1 test: flags = flags | Qt::TextEditable;Executed by:
| 18 | ||||||||||||||||||||||||
| 924 | d->control->setTextInteractionFlags(flags); | - | ||||||||||||||||||||||||
| 925 | d->control->moveCursor(QTextCursor::End); | - | ||||||||||||||||||||||||
| 926 | - | |||||||||||||||||||||||||
| 927 | - | |||||||||||||||||||||||||
| 928 | updateInputMethod(Qt::ImEnabled); | - | ||||||||||||||||||||||||
| 929 | - | |||||||||||||||||||||||||
| 930 | q_canPasteChanged(); | - | ||||||||||||||||||||||||
| 931 | readOnlyChanged(r); | - | ||||||||||||||||||||||||
| 932 | if (!d->selectByKeyboardSet
| 18-44 | ||||||||||||||||||||||||
| 933 | selectByKeyboardChanged(!r); executed 44 times by 2 tests: selectByKeyboardChanged(!r);Executed by:
| 44 | ||||||||||||||||||||||||
| 934 | if (r
| 18-44 | ||||||||||||||||||||||||
| 935 | setCursorVisible(false); | - | ||||||||||||||||||||||||
| 936 | } executed 44 times by 2 tests: else if (hasActiveFocus()end of blockExecuted by:
| 6-44 | ||||||||||||||||||||||||
| 937 | setCursorVisible(true); | - | ||||||||||||||||||||||||
| 938 | } executed 12 times by 1 test: end of blockExecuted by:
| 12 | ||||||||||||||||||||||||
| 939 | } executed 62 times by 2 tests: end of blockExecuted by:
| 62 | ||||||||||||||||||||||||
| 940 | - | |||||||||||||||||||||||||
| 941 | bool QQuickTextEdit::isReadOnly() const | - | ||||||||||||||||||||||||
| 942 | { | - | ||||||||||||||||||||||||
| 943 | const QQuickTextEditPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 944 | return executed 1732 times by 4 tests: !(d->control->textInteractionFlags() & Qt::TextEditable);return !(d->control->textInteractionFlags() & Qt::TextEditable);Executed by:
executed 1732 times by 4 tests: return !(d->control->textInteractionFlags() & Qt::TextEditable);Executed by:
| 1732 | ||||||||||||||||||||||||
| 945 | } | - | ||||||||||||||||||||||||
| 946 | QRectF QQuickTextEdit::cursorRectangle() const | - | ||||||||||||||||||||||||
| 947 | { | - | ||||||||||||||||||||||||
| 948 | const QQuickTextEditPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 949 | return executed 2190 times by 2 tests: d->control->cursorRect().translated(d->xoff, d->yoff);return d->control->cursorRect().translated(d->xoff, d->yoff);Executed by:
executed 2190 times by 2 tests: return d->control->cursorRect().translated(d->xoff, d->yoff);Executed by:
| 2190 | ||||||||||||||||||||||||
| 950 | } | - | ||||||||||||||||||||||||
| 951 | - | |||||||||||||||||||||||||
| 952 | bool QQuickTextEdit::event(QEvent *event) | - | ||||||||||||||||||||||||
| 953 | { | - | ||||||||||||||||||||||||
| 954 | QQuickTextEditPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 955 | if (event->type() == QEvent::ShortcutOverride
| 660-7114 | ||||||||||||||||||||||||
| 956 | d->control->processEvent(event, QPointF(-d->xoff, -d->yoff)); | - | ||||||||||||||||||||||||
| 957 | return executed 660 times by 2 tests: event->isAccepted();return event->isAccepted();Executed by:
executed 660 times by 2 tests: return event->isAccepted();Executed by:
| 660 | ||||||||||||||||||||||||
| 958 | } | - | ||||||||||||||||||||||||
| 959 | return executed 7114 times by 6 tests: QQuickImplicitSizeItem::event(event);return QQuickImplicitSizeItem::event(event);Executed by:
executed 7114 times by 6 tests: return QQuickImplicitSizeItem::event(event);Executed by:
| 7114 | ||||||||||||||||||||||||
| 960 | } | - | ||||||||||||||||||||||||
| 961 | bool QQuickTextEdit::overwriteMode() const | - | ||||||||||||||||||||||||
| 962 | { | - | ||||||||||||||||||||||||
| 963 | const QQuickTextEditPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 964 | return executed 6 times by 1 test: d->control->overwriteMode();return d->control->overwriteMode();Executed by:
executed 6 times by 1 test: return d->control->overwriteMode();Executed by:
| 6 | ||||||||||||||||||||||||
| 965 | } | - | ||||||||||||||||||||||||
| 966 | - | |||||||||||||||||||||||||
| 967 | void QQuickTextEdit::setOverwriteMode(bool overwrite) | - | ||||||||||||||||||||||||
| 968 | { | - | ||||||||||||||||||||||||
| 969 | QQuickTextEditPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 970 | d->control->setOverwriteMode(overwrite); | - | ||||||||||||||||||||||||
| 971 | } executed 10 times by 1 test: end of blockExecuted by:
| 10 | ||||||||||||||||||||||||
| 972 | - | |||||||||||||||||||||||||
| 973 | - | |||||||||||||||||||||||||
| 974 | - | |||||||||||||||||||||||||
| 975 | - | |||||||||||||||||||||||||
| 976 | - | |||||||||||||||||||||||||
| 977 | void QQuickTextEdit::keyPressEvent(QKeyEvent *event) | - | ||||||||||||||||||||||||
| 978 | { | - | ||||||||||||||||||||||||
| 979 | QQuickTextEditPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 980 | d->control->processEvent(event, QPointF(-d->xoff, -d->yoff)); | - | ||||||||||||||||||||||||
| 981 | if (!event->isAccepted()
| 222-806 | ||||||||||||||||||||||||
| 982 | QQuickImplicitSizeItem::keyPressEvent(event); executed 222 times by 3 tests: QQuickImplicitSizeItem::keyPressEvent(event);Executed by:
| 222 | ||||||||||||||||||||||||
| 983 | } executed 1028 times by 3 tests: end of blockExecuted by:
| 1028 | ||||||||||||||||||||||||
| 984 | - | |||||||||||||||||||||||||
| 985 | - | |||||||||||||||||||||||||
| 986 | - | |||||||||||||||||||||||||
| 987 | - | |||||||||||||||||||||||||
| 988 | - | |||||||||||||||||||||||||
| 989 | void QQuickTextEdit::keyReleaseEvent(QKeyEvent *event) | - | ||||||||||||||||||||||||
| 990 | { | - | ||||||||||||||||||||||||
| 991 | QQuickTextEditPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 992 | d->control->processEvent(event, QPointF(-d->xoff, -d->yoff)); | - | ||||||||||||||||||||||||
| 993 | if (!event->isAccepted()
| 0-1012 | ||||||||||||||||||||||||
| 994 | QQuickImplicitSizeItem::keyReleaseEvent(event); never executed: QQuickImplicitSizeItem::keyReleaseEvent(event); | 0 | ||||||||||||||||||||||||
| 995 | } executed 1012 times by 2 tests: end of blockExecuted by:
| 1012 | ||||||||||||||||||||||||
| 996 | - | |||||||||||||||||||||||||
| 997 | - | |||||||||||||||||||||||||
| 998 | - | |||||||||||||||||||||||||
| 999 | - | |||||||||||||||||||||||||
| 1000 | - | |||||||||||||||||||||||||
| 1001 | - | |||||||||||||||||||||||||
| 1002 | void QQuickTextEdit::deselect() | - | ||||||||||||||||||||||||
| 1003 | { | - | ||||||||||||||||||||||||
| 1004 | QQuickTextEditPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 1005 | QTextCursor c = d->control->textCursor(); | - | ||||||||||||||||||||||||
| 1006 | c.clearSelection(); | - | ||||||||||||||||||||||||
| 1007 | d->control->setTextCursor(c); | - | ||||||||||||||||||||||||
| 1008 | } executed 4 times by 1 test: end of blockExecuted by:
| 4 | ||||||||||||||||||||||||
| 1009 | - | |||||||||||||||||||||||||
| 1010 | - | |||||||||||||||||||||||||
| 1011 | - | |||||||||||||||||||||||||
| 1012 | - | |||||||||||||||||||||||||
| 1013 | - | |||||||||||||||||||||||||
| 1014 | - | |||||||||||||||||||||||||
| 1015 | void QQuickTextEdit::selectAll() | - | ||||||||||||||||||||||||
| 1016 | { | - | ||||||||||||||||||||||||
| 1017 | QQuickTextEditPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 1018 | d->control->selectAll(); | - | ||||||||||||||||||||||||
| 1019 | } executed 14 times by 1 test: end of blockExecuted by:
| 14 | ||||||||||||||||||||||||
| 1020 | - | |||||||||||||||||||||||||
| 1021 | - | |||||||||||||||||||||||||
| 1022 | - | |||||||||||||||||||||||||
| 1023 | - | |||||||||||||||||||||||||
| 1024 | - | |||||||||||||||||||||||||
| 1025 | - | |||||||||||||||||||||||||
| 1026 | void QQuickTextEdit::selectWord() | - | ||||||||||||||||||||||||
| 1027 | { | - | ||||||||||||||||||||||||
| 1028 | QQuickTextEditPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 1029 | QTextCursor c = d->control->textCursor(); | - | ||||||||||||||||||||||||
| 1030 | c.select(QTextCursor::WordUnderCursor); | - | ||||||||||||||||||||||||
| 1031 | d->control->setTextCursor(c); | - | ||||||||||||||||||||||||
| 1032 | } executed 4 times by 1 test: end of blockExecuted by:
| 4 | ||||||||||||||||||||||||
| 1033 | void QQuickTextEdit::select(int start, int end) | - | ||||||||||||||||||||||||
| 1034 | { | - | ||||||||||||||||||||||||
| 1035 | QQuickTextEditPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 1036 | if (start < 0
| 4-360 | ||||||||||||||||||||||||
| 1037 | return; executed 16 times by 1 test: return;Executed by:
| 16 | ||||||||||||||||||||||||
| 1038 | QTextCursor cursor = d->control->textCursor(); | - | ||||||||||||||||||||||||
| 1039 | cursor.beginEditBlock(); | - | ||||||||||||||||||||||||
| 1040 | cursor.setPosition(start, QTextCursor::MoveAnchor); | - | ||||||||||||||||||||||||
| 1041 | cursor.setPosition(end, QTextCursor::KeepAnchor); | - | ||||||||||||||||||||||||
| 1042 | cursor.endEditBlock(); | - | ||||||||||||||||||||||||
| 1043 | d->control->setTextCursor(cursor); | - | ||||||||||||||||||||||||
| 1044 | - | |||||||||||||||||||||||||
| 1045 | - | |||||||||||||||||||||||||
| 1046 | updateSelection(); | - | ||||||||||||||||||||||||
| 1047 | - | |||||||||||||||||||||||||
| 1048 | updateInputMethod(); | - | ||||||||||||||||||||||||
| 1049 | - | |||||||||||||||||||||||||
| 1050 | } executed 348 times by 1 test: end of blockExecuted by:
| 348 | ||||||||||||||||||||||||
| 1051 | - | |||||||||||||||||||||||||
| 1052 | - | |||||||||||||||||||||||||
| 1053 | - | |||||||||||||||||||||||||
| 1054 | - | |||||||||||||||||||||||||
| 1055 | - | |||||||||||||||||||||||||
| 1056 | - | |||||||||||||||||||||||||
| 1057 | - | |||||||||||||||||||||||||
| 1058 | bool QQuickTextEdit::isRightToLeft(int start, int end) | - | ||||||||||||||||||||||||
| 1059 | { | - | ||||||||||||||||||||||||
| 1060 | if (start > end
| 4-164 | ||||||||||||||||||||||||
| 1061 | qmlWarning(this) << "isRightToLeft(start, end) called with the end property being smaller than the start."; | - | ||||||||||||||||||||||||
| 1062 | return executed 4 times by 1 test: false;return false;Executed by:
executed 4 times by 1 test: return false;Executed by:
| 4 | ||||||||||||||||||||||||
| 1063 | } else { | - | ||||||||||||||||||||||||
| 1064 | return executed 164 times by 1 test: getText(start, end).isRightToLeft();return getText(start, end).isRightToLeft();Executed by:
executed 164 times by 1 test: return getText(start, end).isRightToLeft();Executed by:
| 164 | ||||||||||||||||||||||||
| 1065 | } | - | ||||||||||||||||||||||||
| 1066 | } | - | ||||||||||||||||||||||||
| 1067 | - | |||||||||||||||||||||||||
| 1068 | - | |||||||||||||||||||||||||
| 1069 | - | |||||||||||||||||||||||||
| 1070 | - | |||||||||||||||||||||||||
| 1071 | - | |||||||||||||||||||||||||
| 1072 | - | |||||||||||||||||||||||||
| 1073 | - | |||||||||||||||||||||||||
| 1074 | void QQuickTextEdit::cut() | - | ||||||||||||||||||||||||
| 1075 | { | - | ||||||||||||||||||||||||
| 1076 | QQuickTextEditPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 1077 | d->control->cut(); | - | ||||||||||||||||||||||||
| 1078 | } executed 6 times by 1 test: end of blockExecuted by:
| 6 | ||||||||||||||||||||||||
| 1079 | - | |||||||||||||||||||||||||
| 1080 | - | |||||||||||||||||||||||||
| 1081 | - | |||||||||||||||||||||||||
| 1082 | - | |||||||||||||||||||||||||
| 1083 | - | |||||||||||||||||||||||||
| 1084 | - | |||||||||||||||||||||||||
| 1085 | void QQuickTextEdit::copy() | - | ||||||||||||||||||||||||
| 1086 | { | - | ||||||||||||||||||||||||
| 1087 | QQuickTextEditPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 1088 | d->control->copy(); | - | ||||||||||||||||||||||||
| 1089 | } executed 6 times by 1 test: end of blockExecuted by:
| 6 | ||||||||||||||||||||||||
| 1090 | - | |||||||||||||||||||||||||
| 1091 | - | |||||||||||||||||||||||||
| 1092 | - | |||||||||||||||||||||||||
| 1093 | - | |||||||||||||||||||||||||
| 1094 | - | |||||||||||||||||||||||||
| 1095 | - | |||||||||||||||||||||||||
| 1096 | void QQuickTextEdit::paste() | - | ||||||||||||||||||||||||
| 1097 | { | - | ||||||||||||||||||||||||
| 1098 | QQuickTextEditPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 1099 | d->control->paste(); | - | ||||||||||||||||||||||||
| 1100 | } executed 10 times by 1 test: end of blockExecuted by:
| 10 | ||||||||||||||||||||||||
| 1101 | void QQuickTextEdit::undo() | - | ||||||||||||||||||||||||
| 1102 | { | - | ||||||||||||||||||||||||
| 1103 | QQuickTextEditPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 1104 | d->control->undo(); | - | ||||||||||||||||||||||||
| 1105 | } executed 108 times by 1 test: end of blockExecuted by:
| 108 | ||||||||||||||||||||||||
| 1106 | - | |||||||||||||||||||||||||
| 1107 | - | |||||||||||||||||||||||||
| 1108 | - | |||||||||||||||||||||||||
| 1109 | - | |||||||||||||||||||||||||
| 1110 | - | |||||||||||||||||||||||||
| 1111 | - | |||||||||||||||||||||||||
| 1112 | - | |||||||||||||||||||||||||
| 1113 | void QQuickTextEdit::redo() | - | ||||||||||||||||||||||||
| 1114 | { | - | ||||||||||||||||||||||||
| 1115 | QQuickTextEditPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 1116 | d->control->redo(); | - | ||||||||||||||||||||||||
| 1117 | } executed 8 times by 1 test: end of blockExecuted by:
| 8 | ||||||||||||||||||||||||
| 1118 | - | |||||||||||||||||||||||||
| 1119 | - | |||||||||||||||||||||||||
| 1120 | - | |||||||||||||||||||||||||
| 1121 | - | |||||||||||||||||||||||||
| 1122 | - | |||||||||||||||||||||||||
| 1123 | void QQuickTextEdit::mousePressEvent(QMouseEvent *event) | - | ||||||||||||||||||||||||
| 1124 | { | - | ||||||||||||||||||||||||
| 1125 | QQuickTextEditPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 1126 | d->control->processEvent(event, QPointF(-d->xoff, -d->yoff)); | - | ||||||||||||||||||||||||
| 1127 | if (d->focusOnPress
| 16-498 | ||||||||||||||||||||||||
| 1128 | bool hadActiveFocus = hasActiveFocus(); | - | ||||||||||||||||||||||||
| 1129 | forceActiveFocus(Qt::MouseFocusReason); | - | ||||||||||||||||||||||||
| 1130 | - | |||||||||||||||||||||||||
| 1131 | - | |||||||||||||||||||||||||
| 1132 | if (hasActiveFocus()
| 0-498 | ||||||||||||||||||||||||
| 1133 | (static_cast< executed 462 times by 1 test: QGuiApplication *>(QCoreApplication::instance()))->inputMethod()->show();(static_cast<QGuiApplication *>(QCoreApplication::instance()))->inputMethod()->show();Executed by:
executed 462 times by 1 test: (static_cast<QGuiApplication *>(QCoreApplication::instance()))->inputMethod()->show();Executed by:
| 462 | ||||||||||||||||||||||||
| 1134 | - | |||||||||||||||||||||||||
| 1135 | - | |||||||||||||||||||||||||
| 1136 | - | |||||||||||||||||||||||||
| 1137 | } executed 498 times by 1 test: end of blockExecuted by:
| 498 | ||||||||||||||||||||||||
| 1138 | if (!event->isAccepted()
| 0-514 | ||||||||||||||||||||||||
| 1139 | QQuickImplicitSizeItem::mousePressEvent(event); never executed: QQuickImplicitSizeItem::mousePressEvent(event); | 0 | ||||||||||||||||||||||||
| 1140 | } executed 514 times by 1 test: end of blockExecuted by:
| 514 | ||||||||||||||||||||||||
| 1141 | - | |||||||||||||||||||||||||
| 1142 | - | |||||||||||||||||||||||||
| 1143 | - | |||||||||||||||||||||||||
| 1144 | - | |||||||||||||||||||||||||
| 1145 | - | |||||||||||||||||||||||||
| 1146 | void QQuickTextEdit::mouseReleaseEvent(QMouseEvent *event) | - | ||||||||||||||||||||||||
| 1147 | { | - | ||||||||||||||||||||||||
| 1148 | QQuickTextEditPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 1149 | d->control->processEvent(event, QPointF(-d->xoff, -d->yoff)); | - | ||||||||||||||||||||||||
| 1150 | - | |||||||||||||||||||||||||
| 1151 | if (!event->isAccepted()
| 0-514 | ||||||||||||||||||||||||
| 1152 | QQuickImplicitSizeItem::mouseReleaseEvent(event); never executed: QQuickImplicitSizeItem::mouseReleaseEvent(event); | 0 | ||||||||||||||||||||||||
| 1153 | } executed 514 times by 1 test: end of blockExecuted by:
| 514 | ||||||||||||||||||||||||
| 1154 | - | |||||||||||||||||||||||||
| 1155 | - | |||||||||||||||||||||||||
| 1156 | - | |||||||||||||||||||||||||
| 1157 | - | |||||||||||||||||||||||||
| 1158 | - | |||||||||||||||||||||||||
| 1159 | void QQuickTextEdit::mouseDoubleClickEvent(QMouseEvent *event) | - | ||||||||||||||||||||||||
| 1160 | { | - | ||||||||||||||||||||||||
| 1161 | QQuickTextEditPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 1162 | d->control->processEvent(event, QPointF(-d->xoff, -d->yoff)); | - | ||||||||||||||||||||||||
| 1163 | if (!event->isAccepted()
| 0-104 | ||||||||||||||||||||||||
| 1164 | QQuickImplicitSizeItem::mouseDoubleClickEvent(event); never executed: QQuickImplicitSizeItem::mouseDoubleClickEvent(event); | 0 | ||||||||||||||||||||||||
| 1165 | } executed 104 times by 1 test: end of blockExecuted by:
| 104 | ||||||||||||||||||||||||
| 1166 | - | |||||||||||||||||||||||||
| 1167 | - | |||||||||||||||||||||||||
| 1168 | - | |||||||||||||||||||||||||
| 1169 | - | |||||||||||||||||||||||||
| 1170 | - | |||||||||||||||||||||||||
| 1171 | void QQuickTextEdit::mouseMoveEvent(QMouseEvent *event) | - | ||||||||||||||||||||||||
| 1172 | { | - | ||||||||||||||||||||||||
| 1173 | QQuickTextEditPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 1174 | d->control->processEvent(event, QPointF(-d->xoff, -d->yoff)); | - | ||||||||||||||||||||||||
| 1175 | if (!event->isAccepted()
| 0-138 | ||||||||||||||||||||||||
| 1176 | QQuickImplicitSizeItem::mouseMoveEvent(event); never executed: QQuickImplicitSizeItem::mouseMoveEvent(event); | 0 | ||||||||||||||||||||||||
| 1177 | } executed 138 times by 1 test: end of blockExecuted by:
| 138 | ||||||||||||||||||||||||
| 1178 | - | |||||||||||||||||||||||||
| 1179 | - | |||||||||||||||||||||||||
| 1180 | - | |||||||||||||||||||||||||
| 1181 | - | |||||||||||||||||||||||||
| 1182 | - | |||||||||||||||||||||||||
| 1183 | - | |||||||||||||||||||||||||
| 1184 | void QQuickTextEdit::inputMethodEvent(QInputMethodEvent *event) | - | ||||||||||||||||||||||||
| 1185 | { | - | ||||||||||||||||||||||||
| 1186 | QQuickTextEditPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 1187 | const bool wasComposing = isInputMethodComposing(); | - | ||||||||||||||||||||||||
| 1188 | d->control->processEvent(event, QPointF(-d->xoff, -d->yoff)); | - | ||||||||||||||||||||||||
| 1189 | setCursorVisible(d->control->cursorVisible()); | - | ||||||||||||||||||||||||
| 1190 | if (wasComposing != isInputMethodComposing()
| 50-274 | ||||||||||||||||||||||||
| 1191 | inputMethodComposingChanged(); executed 50 times by 1 test: inputMethodComposingChanged();Executed by:
| 50 | ||||||||||||||||||||||||
| 1192 | } executed 324 times by 1 test: end of blockExecuted by:
| 324 | ||||||||||||||||||||||||
| 1193 | - | |||||||||||||||||||||||||
| 1194 | - | |||||||||||||||||||||||||
| 1195 | - | |||||||||||||||||||||||||
| 1196 | - | |||||||||||||||||||||||||
| 1197 | - | |||||||||||||||||||||||||
| 1198 | QVariant QQuickTextEdit::inputMethodQuery(Qt::InputMethodQuery property, QVariant argument) const | - | ||||||||||||||||||||||||
| 1199 | { | - | ||||||||||||||||||||||||
| 1200 | const QQuickTextEditPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 1201 | - | |||||||||||||||||||||||||
| 1202 | QVariant v; | - | ||||||||||||||||||||||||
| 1203 | switch (property) { | - | ||||||||||||||||||||||||
| 1204 | case executed 544 times by 3 tests: Qt::ImEnabled:case Qt::ImEnabled:Executed by:
executed 544 times by 3 tests: case Qt::ImEnabled:Executed by:
| 544 | ||||||||||||||||||||||||
| 1205 | v = (bool)(flags() & ItemAcceptsInputMethod); | - | ||||||||||||||||||||||||
| 1206 | break; executed 544 times by 3 tests: break;Executed by:
| 544 | ||||||||||||||||||||||||
| 1207 | case executed 338 times by 3 tests: Qt::ImHints:case Qt::ImHints:Executed by:
executed 338 times by 3 tests: case Qt::ImHints:Executed by:
| 338 | ||||||||||||||||||||||||
| 1208 | v = (int)d->effectiveInputMethodHints(); | - | ||||||||||||||||||||||||
| 1209 | break; executed 338 times by 3 tests: break;Executed by:
| 338 | ||||||||||||||||||||||||
| 1210 | case never executed: Qt::ImInputItemClipRectangle:case Qt::ImInputItemClipRectangle:never executed: case Qt::ImInputItemClipRectangle: | 0 | ||||||||||||||||||||||||
| 1211 | v = QQuickItem::inputMethodQuery(property); | - | ||||||||||||||||||||||||
| 1212 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 1213 | default executed 26 times by 1 test: :default:Executed by:
executed 26 times by 1 test: default:Executed by:
| 26 | ||||||||||||||||||||||||
| 1214 | if (property == Qt::ImCursorPosition
| 0-26 | ||||||||||||||||||||||||
| 1215 | argument = QVariant(argument.toPointF() - QPointF(d->xoff, d->yoff)); never executed: argument = QVariant(argument.toPointF() - QPointF(d->xoff, d->yoff)); | 0 | ||||||||||||||||||||||||
| 1216 | v = d->control->inputMethodQuery(property, argument); | - | ||||||||||||||||||||||||
| 1217 | if (property == Qt::ImCursorRectangle
| 0-26 | ||||||||||||||||||||||||
| 1218 | v = QVariant(v.toRectF().translated(d->xoff, d->yoff)); executed 26 times by 1 test: v = QVariant(v.toRectF().translated(d->xoff, d->yoff));Executed by:
| 26 | ||||||||||||||||||||||||
| 1219 | break; executed 26 times by 1 test: break;Executed by:
| 26 | ||||||||||||||||||||||||
| 1220 | } | - | ||||||||||||||||||||||||
| 1221 | return executed 908 times by 3 tests: v;return v;Executed by:
executed 908 times by 3 tests: return v;Executed by:
| 908 | ||||||||||||||||||||||||
| 1222 | } | - | ||||||||||||||||||||||||
| 1223 | - | |||||||||||||||||||||||||
| 1224 | - | |||||||||||||||||||||||||
| 1225 | - | |||||||||||||||||||||||||
| 1226 | - | |||||||||||||||||||||||||
| 1227 | - | |||||||||||||||||||||||||
| 1228 | QVariant QQuickTextEdit::inputMethodQuery(Qt::InputMethodQuery property) const | - | ||||||||||||||||||||||||
| 1229 | { | - | ||||||||||||||||||||||||
| 1230 | return executed 908 times by 3 tests: inputMethodQuery(property, QVariant());return inputMethodQuery(property, QVariant());Executed by:
executed 908 times by 3 tests: return inputMethodQuery(property, QVariant());Executed by:
| 908 | ||||||||||||||||||||||||
| 1231 | } | - | ||||||||||||||||||||||||
| 1232 | - | |||||||||||||||||||||||||
| 1233 | - | |||||||||||||||||||||||||
| 1234 | void QQuickTextEdit::triggerPreprocess() | - | ||||||||||||||||||||||||
| 1235 | { | - | ||||||||||||||||||||||||
| 1236 | QQuickTextEditPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 1237 | if (d->updateType == QQuickTextEditPrivate::UpdateNone
| 0 | ||||||||||||||||||||||||
| 1238 | d->updateType = QQuickTextEditPrivate::UpdateOnlyPreprocess; never executed: d->updateType = QQuickTextEditPrivate::UpdateOnlyPreprocess; | 0 | ||||||||||||||||||||||||
| 1239 | polish(); | - | ||||||||||||||||||||||||
| 1240 | update(); | - | ||||||||||||||||||||||||
| 1241 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 1242 | - | |||||||||||||||||||||||||
| 1243 | typedef QQuickTextEditPrivate::Node TextNode; | - | ||||||||||||||||||||||||
| 1244 | using TextNodeIterator = QQuickTextEditPrivate::TextNodeIterator; | - | ||||||||||||||||||||||||
| 1245 | - | |||||||||||||||||||||||||
| 1246 | static inline bool operator<(const TextNode &n1, const TextNode &n2) | - | ||||||||||||||||||||||||
| 1247 | { | - | ||||||||||||||||||||||||
| 1248 | return executed 5896 times by 2 tests: n1.startPos() < n2.startPos();return n1.startPos() < n2.startPos();Executed by:
executed 5896 times by 2 tests: return n1.startPos() < n2.startPos();Executed by:
| 5896 | ||||||||||||||||||||||||
| 1249 | } | - | ||||||||||||||||||||||||
| 1250 | - | |||||||||||||||||||||||||
| 1251 | static inline void updateNodeTransform(QQuickTextNode* node, const QPointF &topLeft) | - | ||||||||||||||||||||||||
| 1252 | { | - | ||||||||||||||||||||||||
| 1253 | QMatrix4x4 transformMatrix; | - | ||||||||||||||||||||||||
| 1254 | transformMatrix.translate(topLeft.x(), topLeft.y()); | - | ||||||||||||||||||||||||
| 1255 | node->setMatrix(transformMatrix); | - | ||||||||||||||||||||||||
| 1256 | } executed 562 times by 4 tests: end of blockExecuted by:
| 562 | ||||||||||||||||||||||||
| 1257 | - | |||||||||||||||||||||||||
| 1258 | - | |||||||||||||||||||||||||
| 1259 | - | |||||||||||||||||||||||||
| 1260 | - | |||||||||||||||||||||||||
| 1261 | - | |||||||||||||||||||||||||
| 1262 | - | |||||||||||||||||||||||||
| 1263 | - | |||||||||||||||||||||||||
| 1264 | void QQuickTextEdit::invalidateFontCaches() | - | ||||||||||||||||||||||||
| 1265 | { | - | ||||||||||||||||||||||||
| 1266 | QQuickTextEditPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 1267 | if (d->document == nullptr
| 0-842 | ||||||||||||||||||||||||
| 1268 | return; never executed: return; | 0 | ||||||||||||||||||||||||
| 1269 | - | |||||||||||||||||||||||||
| 1270 | QTextBlock block; | - | ||||||||||||||||||||||||
| 1271 | for (block = d->document->firstBlock(); block.isValid()
| 842-1826 | ||||||||||||||||||||||||
| 1272 | if (block.layout() != nullptr
| 0-1826 | ||||||||||||||||||||||||
| 1273 | block.layout()->engine()->resetFontEngineCache(); executed 1826 times by 4 tests: block.layout()->engine()->resetFontEngineCache();Executed by:
| 1826 | ||||||||||||||||||||||||
| 1274 | } executed 1826 times by 4 tests: end of blockExecuted by:
| 1826 | ||||||||||||||||||||||||
| 1275 | } executed 842 times by 4 tests: end of blockExecuted by:
| 842 | ||||||||||||||||||||||||
| 1276 | - | |||||||||||||||||||||||||
| 1277 | inline void resetEngine(QQuickTextNodeEngine *engine, const QColor& textColor, const QColor& selectedTextColor, const QColor& selectionColor) | - | ||||||||||||||||||||||||
| 1278 | { | - | ||||||||||||||||||||||||
| 1279 | *engine = QQuickTextNodeEngine(); | - | ||||||||||||||||||||||||
| 1280 | engine->setTextColor(textColor); | - | ||||||||||||||||||||||||
| 1281 | engine->setSelectedTextColor(selectedTextColor); | - | ||||||||||||||||||||||||
| 1282 | engine->setSelectionColor(selectionColor); | - | ||||||||||||||||||||||||
| 1283 | } executed 854 times by 4 tests: end of blockExecuted by:
| 854 | ||||||||||||||||||||||||
| 1284 | - | |||||||||||||||||||||||||
| 1285 | QSGNode *QQuickTextEdit::updatePaintNode(QSGNode *oldNode, UpdatePaintNodeData *updatePaintNodeData) | - | ||||||||||||||||||||||||
| 1286 | { | - | ||||||||||||||||||||||||
| 1287 | (void)updatePaintNodeData;; | - | ||||||||||||||||||||||||
| 1288 | QQuickTextEditPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 1289 | - | |||||||||||||||||||||||||
| 1290 | if (d->updateType != QQuickTextEditPrivate::UpdatePaintNode
| 0-422 | ||||||||||||||||||||||||
| 1291 | - | |||||||||||||||||||||||||
| 1292 | d->updateType = QQuickTextEditPrivate::UpdateNone; | - | ||||||||||||||||||||||||
| 1293 | return never executed: oldNode;return oldNode;never executed: return oldNode; | 0 | ||||||||||||||||||||||||
| 1294 | } | - | ||||||||||||||||||||||||
| 1295 | - | |||||||||||||||||||||||||
| 1296 | d->updateType = QQuickTextEditPrivate::UpdateNone; | - | ||||||||||||||||||||||||
| 1297 | - | |||||||||||||||||||||||||
| 1298 | if (!oldNode
| 188-234 | ||||||||||||||||||||||||
| 1299 | - | |||||||||||||||||||||||||
| 1300 | - | |||||||||||||||||||||||||
| 1301 | d->textNodeMap.clear(); | - | ||||||||||||||||||||||||
| 1302 | } executed 234 times by 4 tests: end of blockExecuted by:
| 234 | ||||||||||||||||||||||||
| 1303 | - | |||||||||||||||||||||||||
| 1304 | RootNode *rootNode = static_cast<RootNode *>(oldNode); | - | ||||||||||||||||||||||||
| 1305 | TextNodeIterator nodeIterator = d->textNodeMap.begin(); | - | ||||||||||||||||||||||||
| 1306 | while (nodeIterator != d->textNodeMap.end()
| 58-364 | ||||||||||||||||||||||||
| 1307 | ++ executed 246 times by 2 tests: nodeIterator;++nodeIterator;Executed by:
executed 246 times by 2 tests: ++nodeIterator;Executed by:
| 246 | ||||||||||||||||||||||||
| 1308 | - | |||||||||||||||||||||||||
| 1309 | QQuickTextNodeEngine engine; | - | ||||||||||||||||||||||||
| 1310 | QQuickTextNodeEngine frameDecorationsEngine; | - | ||||||||||||||||||||||||
| 1311 | - | |||||||||||||||||||||||||
| 1312 | if (!oldNode
| 58-234 | ||||||||||||||||||||||||
| 1313 | - | |||||||||||||||||||||||||
| 1314 | if (!oldNode
| 58-234 | ||||||||||||||||||||||||
| 1315 | rootNode = new RootNode; executed 234 times by 4 tests: rootNode = new RootNode;Executed by:
| 234 | ||||||||||||||||||||||||
| 1316 | - | |||||||||||||||||||||||||
| 1317 | int firstDirtyPos = 0; | - | ||||||||||||||||||||||||
| 1318 | if (nodeIterator != d->textNodeMap.end()
| 58-234 | ||||||||||||||||||||||||
| 1319 | firstDirtyPos = nodeIterator->startPos(); | - | ||||||||||||||||||||||||
| 1320 | do { | - | ||||||||||||||||||||||||
| 1321 | rootNode->removeChildNode(nodeIterator->textNode()); | - | ||||||||||||||||||||||||
| 1322 | delete nodeIterator->textNode(); | - | ||||||||||||||||||||||||
| 1323 | nodeIterator = d->textNodeMap.erase(nodeIterator); | - | ||||||||||||||||||||||||
| 1324 | } executed 70 times by 1 test: while (nodeIterator != d->textNodeMap.end()end of blockExecuted by:
| 12-70 | ||||||||||||||||||||||||
| 1325 | } executed 58 times by 1 test: end of blockExecuted by:
| 58 | ||||||||||||||||||||||||
| 1326 | - | |||||||||||||||||||||||||
| 1327 | - | |||||||||||||||||||||||||
| 1328 | rootNode->resetFrameDecorations(d->createTextNode()); | - | ||||||||||||||||||||||||
| 1329 | resetEngine(&frameDecorationsEngine, d->color, d->selectedTextColor, d->selectionColor); | - | ||||||||||||||||||||||||
| 1330 | - | |||||||||||||||||||||||||
| 1331 | QQuickTextNode *node = nullptr; | - | ||||||||||||||||||||||||
| 1332 | - | |||||||||||||||||||||||||
| 1333 | int currentNodeSize = 0; | - | ||||||||||||||||||||||||
| 1334 | int nodeStart = firstDirtyPos; | - | ||||||||||||||||||||||||
| 1335 | QPointF basePosition(d->xoff, d->yoff); | - | ||||||||||||||||||||||||
| 1336 | QMatrix4x4 basePositionMatrix; | - | ||||||||||||||||||||||||
| 1337 | basePositionMatrix.translate(basePosition.x(), basePosition.y()); | - | ||||||||||||||||||||||||
| 1338 | rootNode->setMatrix(basePositionMatrix); | - | ||||||||||||||||||||||||
| 1339 | - | |||||||||||||||||||||||||
| 1340 | QPointF nodeOffset; | - | ||||||||||||||||||||||||
| 1341 | const TextNode firstCleanNode = (
| 38-254 | ||||||||||||||||||||||||
| 1342 | : TextNode(); | - | ||||||||||||||||||||||||
| 1343 | - | |||||||||||||||||||||||||
| 1344 | QList<QTextFrame *> frames; | - | ||||||||||||||||||||||||
| 1345 | frames.append(d->document->rootFrame()); | - | ||||||||||||||||||||||||
| 1346 | - | |||||||||||||||||||||||||
| 1347 | while (!frames.isEmpty()
| 292 | ||||||||||||||||||||||||
| 1348 | QTextFrame *textFrame = frames.takeFirst(); | - | ||||||||||||||||||||||||
| 1349 | frames.append(textFrame->childFrames()); | - | ||||||||||||||||||||||||
| 1350 | frameDecorationsEngine.addFrameDecorations(d->document, textFrame); | - | ||||||||||||||||||||||||
| 1351 | - | |||||||||||||||||||||||||
| 1352 | if (textFrame->lastPosition() < firstDirtyPos
| 0-292 | ||||||||||||||||||||||||
| 1353 | || textFrame->firstPosition() >= firstCleanNode.startPos()
| 0-292 | ||||||||||||||||||||||||
| 1354 | continue; never executed: continue; | 0 | ||||||||||||||||||||||||
| 1355 | node = d->createTextNode(); | - | ||||||||||||||||||||||||
| 1356 | resetEngine(&engine, d->color, d->selectedTextColor, d->selectionColor); | - | ||||||||||||||||||||||||
| 1357 | - | |||||||||||||||||||||||||
| 1358 | if (textFrame->firstPosition() > textFrame->lastPosition()
| 0-292 | ||||||||||||||||||||||||
| 1359 | && textFrame->frameFormat().position() != QTextFrameFormat::InFlow
| 0 | ||||||||||||||||||||||||
| 1360 | updateNodeTransform(node, d->document->documentLayout()->frameBoundingRect(textFrame).topLeft()); | - | ||||||||||||||||||||||||
| 1361 | const int pos = textFrame->firstPosition() - 1; | - | ||||||||||||||||||||||||
| 1362 | ProtectedLayoutAccessor *a = static_cast<ProtectedLayoutAccessor *>(d->document->documentLayout()); | - | ||||||||||||||||||||||||
| 1363 | QTextCharFormat format = a->formatAccessor(pos); | - | ||||||||||||||||||||||||
| 1364 | QTextBlock block = textFrame->firstCursorPosition().block(); | - | ||||||||||||||||||||||||
| 1365 | engine.setCurrentLine(block.layout()->lineForTextPosition(pos - block.position())); | - | ||||||||||||||||||||||||
| 1366 | engine.addTextObject(QPointF(0, 0), format, QQuickTextNodeEngine::Unselected, d->document, | - | ||||||||||||||||||||||||
| 1367 | pos, textFrame->frameFormat().position()); | - | ||||||||||||||||||||||||
| 1368 | nodeStart = pos; | - | ||||||||||||||||||||||||
| 1369 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||
| 1370 | - | |||||||||||||||||||||||||
| 1371 | QList<int> frameBoundaries; | - | ||||||||||||||||||||||||
| 1372 | frameBoundaries.reserve(frames.size()); | - | ||||||||||||||||||||||||
| 1373 | for (QTextFrame *frame : qAsConst(frames)) | - | ||||||||||||||||||||||||
| 1374 | frameBoundaries.append(frame->firstPosition()); never executed: frameBoundaries.append(frame->firstPosition()); | 0 | ||||||||||||||||||||||||
| 1375 | std::sort(frameBoundaries.begin(), frameBoundaries.end()); | - | ||||||||||||||||||||||||
| 1376 | - | |||||||||||||||||||||||||
| 1377 | QTextFrame::iterator it = textFrame->begin(); | - | ||||||||||||||||||||||||
| 1378 | while (!it.atEnd()
| 0-570 | ||||||||||||||||||||||||
| 1379 | QTextBlock block = it.currentBlock(); | - | ||||||||||||||||||||||||
| 1380 | ++it; | - | ||||||||||||||||||||||||
| 1381 | if (block.position() < firstDirtyPos
| 8-562 | ||||||||||||||||||||||||
| 1382 | continue; executed 8 times by 1 test: continue;Executed by:
| 8 | ||||||||||||||||||||||||
| 1383 | - | |||||||||||||||||||||||||
| 1384 | if (!engine.hasContents()
| 0-562 | ||||||||||||||||||||||||
| 1385 | nodeOffset = d->document->documentLayout()->blockBoundingRect(block).topLeft(); | - | ||||||||||||||||||||||||
| 1386 | updateNodeTransform(node, nodeOffset); | - | ||||||||||||||||||||||||
| 1387 | nodeStart = block.position(); | - | ||||||||||||||||||||||||
| 1388 | } executed 562 times by 4 tests: end of blockExecuted by:
| 562 | ||||||||||||||||||||||||
| 1389 | - | |||||||||||||||||||||||||
| 1390 | engine.addTextBlock(d->document, block, -nodeOffset, d->color, QColor(), selectionStart(), selectionEnd() - 1); | - | ||||||||||||||||||||||||
| 1391 | currentNodeSize += block.length(); | - | ||||||||||||||||||||||||
| 1392 | - | |||||||||||||||||||||||||
| 1393 | if ((
| 38-308 | ||||||||||||||||||||||||
| 1394 | break; executed 292 times by 4 tests: break;Executed by:
| 292 | ||||||||||||||||||||||||
| 1395 | - | |||||||||||||||||||||||||
| 1396 | QList<int>::const_iterator lowerBound = std::lower_bound(frameBoundaries.constBegin(), frameBoundaries.constEnd(), block.next().position()); | - | ||||||||||||||||||||||||
| 1397 | if (currentNodeSize > nodeBreakingSize
| 0-270 | ||||||||||||||||||||||||
| 1398 | currentNodeSize = 0; | - | ||||||||||||||||||||||||
| 1399 | d->addCurrentTextNodeToRoot(&engine, rootNode, node, nodeIterator, nodeStart); | - | ||||||||||||||||||||||||
| 1400 | node = d->createTextNode(); | - | ||||||||||||||||||||||||
| 1401 | resetEngine(&engine, d->color, d->selectedTextColor, d->selectionColor); | - | ||||||||||||||||||||||||
| 1402 | nodeStart = block.next().position(); | - | ||||||||||||||||||||||||
| 1403 | } executed 270 times by 2 tests: end of blockExecuted by:
| 270 | ||||||||||||||||||||||||
| 1404 | } executed 270 times by 2 tests: end of blockExecuted by:
| 270 | ||||||||||||||||||||||||
| 1405 | } executed 292 times by 4 tests: end of blockExecuted by:
| 292 | ||||||||||||||||||||||||
| 1406 | d->addCurrentTextNodeToRoot(&engine, rootNode, node, nodeIterator, nodeStart); | - | ||||||||||||||||||||||||
| 1407 | } executed 292 times by 4 tests: end of blockExecuted by:
| 292 | ||||||||||||||||||||||||
| 1408 | frameDecorationsEngine.addToSceneGraph(rootNode->frameDecorationsNode, QQuickText::Normal, QColor()); | - | ||||||||||||||||||||||||
| 1409 | - | |||||||||||||||||||||||||
| 1410 | rootNode->prependChildNode(rootNode->frameDecorationsNode); | - | ||||||||||||||||||||||||
| 1411 | - | |||||||||||||||||||||||||
| 1412 | ((nodeIterator == d->textNodeMap.end() || (nodeIterator->textNode() == firstCleanNode.textNode() && nodeIterator->startPos() == firstCleanNode.startPos())) ? static_cast<void>(0) : qt_assert("nodeIterator == d->textNodeMap.end() || (nodeIterator->textNode() == firstCleanNode.textNode() && nodeIterator->startPos() == firstCleanNode.startPos())", | - | ||||||||||||||||||||||||
| 1413 | - | |||||||||||||||||||||||||
| 1414 | __FILE__ | - | ||||||||||||||||||||||||
| 1415 | , | - | ||||||||||||||||||||||||
| 1416 | - | |||||||||||||||||||||||||
| 1417 | 2141 | - | ||||||||||||||||||||||||
| 1418 | )) | - | ||||||||||||||||||||||||
| 1419 | - | |||||||||||||||||||||||||
| 1420 | ; | - | ||||||||||||||||||||||||
| 1421 | - | |||||||||||||||||||||||||
| 1422 | if (firstCleanNode.textNode() != nullptr
| 38-254 | ||||||||||||||||||||||||
| 1423 | QPointF oldOffset = firstCleanNode.textNode()->matrix().map(QPointF(0,0)); | - | ||||||||||||||||||||||||
| 1424 | QPointF currentOffset = d->document->documentLayout()->blockBoundingRect( | - | ||||||||||||||||||||||||
| 1425 | d->document->findBlock(firstCleanNode.startPos())).topLeft(); | - | ||||||||||||||||||||||||
| 1426 | QPointF delta = currentOffset - oldOffset; | - | ||||||||||||||||||||||||
| 1427 | while (nodeIterator != d->textNodeMap.end()
| 38-106 | ||||||||||||||||||||||||
| 1428 | QMatrix4x4 transformMatrix = nodeIterator->textNode()->matrix(); | - | ||||||||||||||||||||||||
| 1429 | transformMatrix.translate(delta.x(), delta.y()); | - | ||||||||||||||||||||||||
| 1430 | nodeIterator->textNode()->setMatrix(transformMatrix); | - | ||||||||||||||||||||||||
| 1431 | ++nodeIterator; | - | ||||||||||||||||||||||||
| 1432 | } executed 106 times by 1 test: end of blockExecuted by:
| 106 | ||||||||||||||||||||||||
| 1433 | - | |||||||||||||||||||||||||
| 1434 | } executed 38 times by 1 test: end of blockExecuted by:
| 38 | ||||||||||||||||||||||||
| 1435 | - | |||||||||||||||||||||||||
| 1436 | - | |||||||||||||||||||||||||
| 1437 | - | |||||||||||||||||||||||||
| 1438 | std::sort(d->textNodeMap.begin(), d->textNodeMap.end()); | - | ||||||||||||||||||||||||
| 1439 | } executed 292 times by 4 tests: end of blockExecuted by:
| 292 | ||||||||||||||||||||||||
| 1440 | - | |||||||||||||||||||||||||
| 1441 | if (d->cursorComponent == nullptr
| 86-336 | ||||||||||||||||||||||||
| 1442 | QSGInternalRectangleNode* cursor = nullptr; | - | ||||||||||||||||||||||||
| 1443 | if (!isReadOnly()
| 2-330 | ||||||||||||||||||||||||
| 1444 | cursor = d->sceneGraphContext()->createInternalRectangleNode(d->control->cursorRect(), d->color); executed 140 times by 3 tests: cursor = d->sceneGraphContext()->createInternalRectangleNode(d->control->cursorRect(), d->color);Executed by:
| 140 | ||||||||||||||||||||||||
| 1445 | rootNode->resetCursorNode(cursor); | - | ||||||||||||||||||||||||
| 1446 | } executed 336 times by 4 tests: end of blockExecuted by:
| 336 | ||||||||||||||||||||||||
| 1447 | - | |||||||||||||||||||||||||
| 1448 | invalidateFontCaches(); | - | ||||||||||||||||||||||||
| 1449 | - | |||||||||||||||||||||||||
| 1450 | return executed 422 times by 4 tests: rootNode;return rootNode;Executed by:
executed 422 times by 4 tests: return rootNode;Executed by:
| 422 | ||||||||||||||||||||||||
| 1451 | } | - | ||||||||||||||||||||||||
| 1452 | - | |||||||||||||||||||||||||
| 1453 | void QQuickTextEdit::updatePolish() | - | ||||||||||||||||||||||||
| 1454 | { | - | ||||||||||||||||||||||||
| 1455 | invalidateFontCaches(); | - | ||||||||||||||||||||||||
| 1456 | } executed 420 times by 4 tests: end of blockExecuted by:
| 420 | ||||||||||||||||||||||||
| 1457 | - | |||||||||||||||||||||||||
| 1458 | - | |||||||||||||||||||||||||
| 1459 | - | |||||||||||||||||||||||||
| 1460 | - | |||||||||||||||||||||||||
| 1461 | - | |||||||||||||||||||||||||
| 1462 | - | |||||||||||||||||||||||||
| 1463 | - | |||||||||||||||||||||||||
| 1464 | bool QQuickTextEdit::canPaste() const | - | ||||||||||||||||||||||||
| 1465 | { | - | ||||||||||||||||||||||||
| 1466 | const QQuickTextEditPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 1467 | if (!d->canPasteValid
| 4-8 | ||||||||||||||||||||||||
| 1468 | const_cast<QQuickTextEditPrivate *>(d)->canPaste = d->control->canPaste(); | - | ||||||||||||||||||||||||
| 1469 | const_cast<QQuickTextEditPrivate *>(d)->canPasteValid = true; | - | ||||||||||||||||||||||||
| 1470 | } executed 4 times by 1 test: end of blockExecuted by:
| 4 | ||||||||||||||||||||||||
| 1471 | return executed 12 times by 1 test: d->canPaste;return d->canPaste;Executed by:
executed 12 times by 1 test: return d->canPaste;Executed by:
| 12 | ||||||||||||||||||||||||
| 1472 | } | - | ||||||||||||||||||||||||
| 1473 | bool QQuickTextEdit::canUndo() const | - | ||||||||||||||||||||||||
| 1474 | { | - | ||||||||||||||||||||||||
| 1475 | const QQuickTextEditPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 1476 | return executed 98 times by 1 test: d->document->isUndoAvailable();return d->document->isUndoAvailable();Executed by:
executed 98 times by 1 test: return d->document->isUndoAvailable();Executed by:
| 98 | ||||||||||||||||||||||||
| 1477 | } | - | ||||||||||||||||||||||||
| 1478 | bool QQuickTextEdit::canRedo() const | - | ||||||||||||||||||||||||
| 1479 | { | - | ||||||||||||||||||||||||
| 1480 | const QQuickTextEditPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 1481 | return executed 28 times by 1 test: d->document->isRedoAvailable();return d->document->isRedoAvailable();Executed by:
executed 28 times by 1 test: return d->document->isRedoAvailable();Executed by:
| 28 | ||||||||||||||||||||||||
| 1482 | } | - | ||||||||||||||||||||||||
| 1483 | bool QQuickTextEdit::isInputMethodComposing() const | - | ||||||||||||||||||||||||
| 1484 | { | - | ||||||||||||||||||||||||
| 1485 | - | |||||||||||||||||||||||||
| 1486 | - | |||||||||||||||||||||||||
| 1487 | - | |||||||||||||||||||||||||
| 1488 | const QQuickTextEditPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 1489 | return executed 672 times by 1 test: d->control->hasImState();return d->control->hasImState();Executed by:
executed 672 times by 1 test: return d->control->hasImState();Executed by:
| 672 | ||||||||||||||||||||||||
| 1490 | - | |||||||||||||||||||||||||
| 1491 | } | - | ||||||||||||||||||||||||
| 1492 | - | |||||||||||||||||||||||||
| 1493 | QQuickTextEditPrivate::ExtraData::ExtraData() | - | ||||||||||||||||||||||||
| 1494 | : padding(0) | - | ||||||||||||||||||||||||
| 1495 | , topPadding(0) | - | ||||||||||||||||||||||||
| 1496 | , leftPadding(0) | - | ||||||||||||||||||||||||
| 1497 | , rightPadding(0) | - | ||||||||||||||||||||||||
| 1498 | , bottomPadding(0) | - | ||||||||||||||||||||||||
| 1499 | , explicitTopPadding(false) | - | ||||||||||||||||||||||||
| 1500 | , explicitLeftPadding(false) | - | ||||||||||||||||||||||||
| 1501 | , explicitRightPadding(false) | - | ||||||||||||||||||||||||
| 1502 | , explicitBottomPadding(false) | - | ||||||||||||||||||||||||
| 1503 | , implicitResize(true) | - | ||||||||||||||||||||||||
| 1504 | { | - | ||||||||||||||||||||||||
| 1505 | } executed 2 times by 1 test: end of blockExecuted by:
| 2 | ||||||||||||||||||||||||
| 1506 | - | |||||||||||||||||||||||||
| 1507 | void QQuickTextEditPrivate::init() | - | ||||||||||||||||||||||||
| 1508 | { | - | ||||||||||||||||||||||||
| 1509 | QQuickTextEdit * const q = q_func(); | - | ||||||||||||||||||||||||
| 1510 | - | |||||||||||||||||||||||||
| 1511 | - | |||||||||||||||||||||||||
| 1512 | if (QGuiApplication::clipboard()->supportsSelection()
| 0-1076 | ||||||||||||||||||||||||
| 1513 | q->setAcceptedMouseButtons(Qt::LeftButton | Qt::MiddleButton); executed 1076 times by 6 tests: q->setAcceptedMouseButtons(Qt::LeftButton | Qt::MiddleButton);Executed by:
| 1076 | ||||||||||||||||||||||||
| 1514 | else | - | ||||||||||||||||||||||||
| 1515 | - | |||||||||||||||||||||||||
| 1516 | q->setAcceptedMouseButtons(Qt::LeftButton); never executed: q->setAcceptedMouseButtons(Qt::LeftButton); | 0 | ||||||||||||||||||||||||
| 1517 | - | |||||||||||||||||||||||||
| 1518 | - | |||||||||||||||||||||||||
| 1519 | q->setFlag(QQuickItem::ItemAcceptsInputMethod); | - | ||||||||||||||||||||||||
| 1520 | - | |||||||||||||||||||||||||
| 1521 | q->setFlag(QQuickItem::ItemHasContents); | - | ||||||||||||||||||||||||
| 1522 | - | |||||||||||||||||||||||||
| 1523 | q->setAcceptHoverEvents(true); | - | ||||||||||||||||||||||||
| 1524 | - | |||||||||||||||||||||||||
| 1525 | document = new QQuickTextDocumentWithImageResources(q); | - | ||||||||||||||||||||||||
| 1526 | - | |||||||||||||||||||||||||
| 1527 | control = new QQuickTextControl(document, q); | - | ||||||||||||||||||||||||
| 1528 | control->setTextInteractionFlags(Qt::LinksAccessibleByMouse | Qt::TextSelectableByKeyboard | Qt::TextEditable); | - | ||||||||||||||||||||||||
| 1529 | control->setAcceptRichText(false); | - | ||||||||||||||||||||||||
| 1530 | control->setCursorIsFocusIndicator(true); | - | ||||||||||||||||||||||||
| 1531 | - | |||||||||||||||||||||||||
| 1532 | { QQuickTextControl *sender = (control); QQuickTextEdit *receiver = (q); const char *signal = (qFlagLocation("2""updateCursorRequest()" "\0" __FILE__ ":" "2282")); const char *method = (qFlagLocation("1""updateCursor()" "\0" __FILE__ ":" "2282")); static int signalIdx = -1; static int methodIdx = -1; if (signalIdx < 0
executed 12 times by 6 tests: if (methodIdx < 0end of blockExecuted by:
executed 12 times by 6 tests: else methodIdx = QQuickTextEdit::staticMetaObject.indexOfSignal(method+1);methodIdx = QQuickTextEdit::staticMetaObject.indexOfSlot(method+1);Executed by:
never executed: } ((signalIdx != -1 && methodIdx != -1) ? static_cast<void>(0) : qt_assert("signalIdx != -1 && methodIdx != -1", __FILE__, 2282)); QMetaObject::connect(sender, signalIdx, receiver, methodIdx, Qt::DirectConnection); };methodIdx = QQuickTextEdit::staticMetaObject.indexOfSignal(method+1); | 0-1064 | ||||||||||||||||||||||||
| 1533 | { QQuickTextControl *sender = (control); QQuickTextEdit *receiver = (q); const char *signal = (qFlagLocation("2""selectionChanged()" "\0" __FILE__ ":" "2283")); const char *method = (qFlagLocation("2""selectedTextChanged()" "\0" __FILE__ ":" "2283")); static int signalIdx = -1; static int methodIdx = -1; if (signalIdx < 0
executed 12 times by 6 tests: if (methodIdx < 0end of blockExecuted by:
never executed: else methodIdx = QQuickTextEdit::staticMetaObject.indexOfSignal(method+1);methodIdx = QQuickTextEdit::staticMetaObject.indexOfSlot(method+1);executed 12 times by 6 tests: } ((signalIdx != -1 && methodIdx != -1) ? static_cast<void>(0) : qt_assert("signalIdx != -1 && methodIdx != -1", __FILE__, 2283)); QMetaObject::connect(sender, signalIdx, receiver, methodIdx, Qt::DirectConnection); };methodIdx = QQuickTextEdit::staticMetaObject.indexOfSignal(method+1);Executed by:
| 0-1064 | ||||||||||||||||||||||||
| 1534 | { QQuickTextControl *sender = (control); QQuickTextEdit *receiver = (q); const char *signal = (qFlagLocation("2""selectionChanged()" "\0" __FILE__ ":" "2284")); const char *method = (qFlagLocation("1""updateSelection()" "\0" __FILE__ ":" "2284")); static int signalIdx = -1; static int methodIdx = -1; if (signalIdx < 0
executed 12 times by 6 tests: if (methodIdx < 0end of blockExecuted by:
executed 12 times by 6 tests: else methodIdx = QQuickTextEdit::staticMetaObject.indexOfSignal(method+1);methodIdx = QQuickTextEdit::staticMetaObject.indexOfSlot(method+1);Executed by:
never executed: } ((signalIdx != -1 && methodIdx != -1) ? static_cast<void>(0) : qt_assert("signalIdx != -1 && methodIdx != -1", __FILE__, 2284)); QMetaObject::connect(sender, signalIdx, receiver, methodIdx, Qt::DirectConnection); };methodIdx = QQuickTextEdit::staticMetaObject.indexOfSignal(method+1); | 0-1064 | ||||||||||||||||||||||||
| 1535 | { QQuickTextControl *sender = (control); QQuickTextEdit *receiver = (q); const char *signal = (qFlagLocation("2""cursorPositionChanged()" "\0" __FILE__ ":" "2285")); const char *method = (qFlagLocation("1""updateSelection()" "\0" __FILE__ ":" "2285")); static int signalIdx = -1; static int methodIdx = -1; if (signalIdx < 0
executed 12 times by 6 tests: if (methodIdx < 0end of blockExecuted by:
executed 12 times by 6 tests: else methodIdx = QQuickTextEdit::staticMetaObject.indexOfSignal(method+1);methodIdx = QQuickTextEdit::staticMetaObject.indexOfSlot(method+1);Executed by:
never executed: } ((signalIdx != -1 && methodIdx != -1) ? static_cast<void>(0) : qt_assert("signalIdx != -1 && methodIdx != -1", __FILE__, 2285)); QMetaObject::connect(sender, signalIdx, receiver, methodIdx, Qt::DirectConnection); };methodIdx = QQuickTextEdit::staticMetaObject.indexOfSignal(method+1); | 0-1064 | ||||||||||||||||||||||||
| 1536 | { QQuickTextControl *sender = (control); QQuickTextEdit *receiver = (q); const char *signal = (qFlagLocation("2""cursorPositionChanged()" "\0" __FILE__ ":" "2286")); const char *method = (qFlagLocation("2""cursorPositionChanged()" "\0" __FILE__ ":" "2286")); static int signalIdx = -1; static int methodIdx = -1; if (signalIdx < 0
executed 12 times by 6 tests: if (methodIdx < 0end of blockExecuted by:
never executed: else methodIdx = QQuickTextEdit::staticMetaObject.indexOfSignal(method+1);methodIdx = QQuickTextEdit::staticMetaObject.indexOfSlot(method+1);executed 12 times by 6 tests: } ((signalIdx != -1 && methodIdx != -1) ? static_cast<void>(0) : qt_assert("signalIdx != -1 && methodIdx != -1", __FILE__, 2286)); QMetaObject::connect(sender, signalIdx, receiver, methodIdx, Qt::DirectConnection); };methodIdx = QQuickTextEdit::staticMetaObject.indexOfSignal(method+1);Executed by:
| 0-1064 | ||||||||||||||||||||||||
| 1537 | { QQuickTextControl *sender = (control); QQuickTextEdit *receiver = (q); const char *signal = (qFlagLocation("2""cursorRectangleChanged()" "\0" __FILE__ ":" "2287")); const char *method = (qFlagLocation("1""moveCursorDelegate()" "\0" __FILE__ ":" "2287")); static int signalIdx = -1; static int methodIdx = -1; if (signalIdx < 0
executed 12 times by 6 tests: if (methodIdx < 0end of blockExecuted by:
executed 12 times by 6 tests: else methodIdx = QQuickTextEdit::staticMetaObject.indexOfSignal(method+1);methodIdx = QQuickTextEdit::staticMetaObject.indexOfSlot(method+1);Executed by:
never executed: } ((signalIdx != -1 && methodIdx != -1) ? static_cast<void>(0) : qt_assert("signalIdx != -1 && methodIdx != -1", __FILE__, 2287)); QMetaObject::connect(sender, signalIdx, receiver, methodIdx, Qt::DirectConnection); };methodIdx = QQuickTextEdit::staticMetaObject.indexOfSignal(method+1); | 0-1064 | ||||||||||||||||||||||||
| 1538 | { QQuickTextControl *sender = (control); QQuickTextEdit *receiver = (q); const char *signal = (qFlagLocation("2""linkActivated(QString)" "\0" __FILE__ ":" "2288")); const char *method = (qFlagLocation("2""linkActivated(QString)" "\0" __FILE__ ":" "2288")); static int signalIdx = -1; static int methodIdx = -1; if (signalIdx < 0
executed 12 times by 6 tests: if (methodIdx < 0end of blockExecuted by:
never executed: else methodIdx = QQuickTextEdit::staticMetaObject.indexOfSignal(method+1);methodIdx = QQuickTextEdit::staticMetaObject.indexOfSlot(method+1);executed 12 times by 6 tests: } ((signalIdx != -1 && methodIdx != -1) ? static_cast<void>(0) : qt_assert("signalIdx != -1 && methodIdx != -1", __FILE__, 2288)); QMetaObject::connect(sender, signalIdx, receiver, methodIdx, Qt::DirectConnection); };methodIdx = QQuickTextEdit::staticMetaObject.indexOfSignal(method+1);Executed by:
| 0-1064 | ||||||||||||||||||||||||
| 1539 | { QQuickTextControl *sender = (control); QQuickTextEdit *receiver = (q); const char *signal = (qFlagLocation("2""linkHovered(QString)" "\0" __FILE__ ":" "2289")); const char *method = (qFlagLocation("2""linkHovered(QString)" "\0" __FILE__ ":" "2289")); static int signalIdx = -1; static int methodIdx = -1; if (signalIdx < 0
executed 12 times by 6 tests: if (methodIdx < 0end of blockExecuted by:
never executed: else methodIdx = QQuickTextEdit::staticMetaObject.indexOfSignal(method+1);methodIdx = QQuickTextEdit::staticMetaObject.indexOfSlot(method+1);executed 12 times by 6 tests: } ((signalIdx != -1 && methodIdx != -1) ? static_cast<void>(0) : qt_assert("signalIdx != -1 && methodIdx != -1", __FILE__, 2289)); QMetaObject::connect(sender, signalIdx, receiver, methodIdx, Qt::DirectConnection); };methodIdx = QQuickTextEdit::staticMetaObject.indexOfSignal(method+1);Executed by:
| 0-1064 | ||||||||||||||||||||||||
| 1540 | { QQuickTextControl *sender = (control); QQuickTextEdit *receiver = (q); const char *signal = (qFlagLocation("2""overwriteModeChanged(bool)" "\0" __FILE__ ":" "2290")); const char *method = (qFlagLocation("2""overwriteModeChanged(bool)" "\0" __FILE__ ":" "2290")); static int signalIdx = -1; static int methodIdx = -1; if (signalIdx < 0
executed 12 times by 6 tests: if (methodIdx < 0end of blockExecuted by:
never executed: else methodIdx = QQuickTextEdit::staticMetaObject.indexOfSignal(method+1);methodIdx = QQuickTextEdit::staticMetaObject.indexOfSlot(method+1);executed 12 times by 6 tests: } ((signalIdx != -1 && methodIdx != -1) ? static_cast<void>(0) : qt_assert("signalIdx != -1 && methodIdx != -1", __FILE__, 2290)); QMetaObject::connect(sender, signalIdx, receiver, methodIdx, Qt::DirectConnection); };methodIdx = QQuickTextEdit::staticMetaObject.indexOfSignal(method+1);Executed by:
| 0-1064 | ||||||||||||||||||||||||
| 1541 | { QQuickTextControl *sender = (control); QQuickTextEdit *receiver = (q); const char *signal = (qFlagLocation("2""textChanged()" "\0" __FILE__ ":" "2291")); const char *method = (qFlagLocation("1""q_textChanged()" "\0" __FILE__ ":" "2291")); static int signalIdx = -1; static int methodIdx = -1; if (signalIdx < 0
executed 12 times by 6 tests: if (methodIdx < 0end of blockExecuted by:
executed 12 times by 6 tests: else methodIdx = QQuickTextEdit::staticMetaObject.indexOfSignal(method+1);methodIdx = QQuickTextEdit::staticMetaObject.indexOfSlot(method+1);Executed by:
never executed: } ((signalIdx != -1 && methodIdx != -1) ? static_cast<void>(0) : qt_assert("signalIdx != -1 && methodIdx != -1", __FILE__, 2291)); QMetaObject::connect(sender, signalIdx, receiver, methodIdx, Qt::DirectConnection); };methodIdx = QQuickTextEdit::staticMetaObject.indexOfSignal(method+1); | 0-1064 | ||||||||||||||||||||||||
| 1542 | { QQuickTextControl *sender = (control); QQuickTextEdit *receiver = (q); const char *signal = (qFlagLocation("2""preeditTextChanged()" "\0" __FILE__ ":" "2292")); const char *method = (qFlagLocation("2""preeditTextChanged()" "\0" __FILE__ ":" "2292")); static int signalIdx = -1; static int methodIdx = -1; if (signalIdx < 0
executed 12 times by 6 tests: if (methodIdx < 0end of blockExecuted by:
never executed: else methodIdx = QQuickTextEdit::staticMetaObject.indexOfSignal(method+1);methodIdx = QQuickTextEdit::staticMetaObject.indexOfSlot(method+1);executed 12 times by 6 tests: } ((signalIdx != -1 && methodIdx != -1) ? static_cast<void>(0) : qt_assert("signalIdx != -1 && methodIdx != -1", __FILE__, 2292)); QMetaObject::connect(sender, signalIdx, receiver, methodIdx, Qt::DirectConnection); };methodIdx = QQuickTextEdit::staticMetaObject.indexOfSignal(method+1);Executed by:
| 0-1064 | ||||||||||||||||||||||||
| 1543 | - | |||||||||||||||||||||||||
| 1544 | { QClipboard *sender = (QGuiApplication::clipboard()); QQuickTextEdit *receiver = (q); const char *signal = (qFlagLocation("2""dataChanged()" "\0" __FILE__ ":" "2294")); const char *method = (qFlagLocation("1""q_canPasteChanged()" "\0" __FILE__ ":" "2294")); static int signalIdx = -1; static int methodIdx = -1; if (signalIdx < 0
executed 12 times by 6 tests: if (methodIdx < 0end of blockExecuted by:
executed 12 times by 6 tests: else methodIdx = QQuickTextEdit::staticMetaObject.indexOfSignal(method+1);methodIdx = QQuickTextEdit::staticMetaObject.indexOfSlot(method+1);Executed by:
never executed: } ((signalIdx != -1 && methodIdx != -1) ? static_cast<void>(0) : qt_assert("signalIdx != -1 && methodIdx != -1", __FILE__, 2294)); QMetaObject::connect(sender, signalIdx, receiver, methodIdx, Qt::DirectConnection); };methodIdx = QQuickTextEdit::staticMetaObject.indexOfSignal(method+1); | 0-1064 | ||||||||||||||||||||||||
| 1545 | - | |||||||||||||||||||||||||
| 1546 | { QQuickTextDocumentWithImageResources *sender = (document); QQuickTextEdit *receiver = (q); const char *signal = (qFlagLocation("2""undoAvailable(bool)" "\0" __FILE__ ":" "2296")); const char *method = (qFlagLocation("2""canUndoChanged()" "\0" __FILE__ ":" "2296")); static int signalIdx = -1; static int methodIdx = -1; if (signalIdx < 0
executed 12 times by 6 tests: if (methodIdx < 0end of blockExecuted by:
never executed: else methodIdx = QQuickTextEdit::staticMetaObject.indexOfSignal(method+1);methodIdx = QQuickTextEdit::staticMetaObject.indexOfSlot(method+1);executed 12 times by 6 tests: } ((signalIdx != -1 && methodIdx != -1) ? static_cast<void>(0) : qt_assert("signalIdx != -1 && methodIdx != -1", __FILE__, 2296)); QMetaObject::connect(sender, signalIdx, receiver, methodIdx, Qt::DirectConnection); };methodIdx = QQuickTextEdit::staticMetaObject.indexOfSignal(method+1);Executed by:
| 0-1064 | ||||||||||||||||||||||||
| 1547 | { QQuickTextDocumentWithImageResources *sender = (document); QQuickTextEdit *receiver = (q); const char *signal = (qFlagLocation("2""redoAvailable(bool)" "\0" __FILE__ ":" "2297")); const char *method = (qFlagLocation("2""canRedoChanged()" "\0" __FILE__ ":" "2297")); static int signalIdx = -1; static int methodIdx = -1; if (signalIdx < 0
executed 12 times by 6 tests: if (methodIdx < 0end of blockExecuted by:
never executed: else methodIdx = QQuickTextEdit::staticMetaObject.indexOfSignal(method+1);methodIdx = QQuickTextEdit::staticMetaObject.indexOfSlot(method+1);executed 12 times by 6 tests: } ((signalIdx != -1 && methodIdx != -1) ? static_cast<void>(0) : qt_assert("signalIdx != -1 && methodIdx != -1", __FILE__, 2297)); QMetaObject::connect(sender, signalIdx, receiver, methodIdx, Qt::DirectConnection); };methodIdx = QQuickTextEdit::staticMetaObject.indexOfSignal(method+1);Executed by:
| 0-1064 | ||||||||||||||||||||||||
| 1548 | { QQuickTextDocumentWithImageResources *sender = (document); QQuickTextEdit *receiver = (q); const char *signal = (qFlagLocation("2""imagesLoaded()" "\0" __FILE__ ":" "2298")); const char *method = (qFlagLocation("1""updateSize()" "\0" __FILE__ ":" "2298")); static int signalIdx = -1; static int methodIdx = -1; if (signalIdx < 0
executed 12 times by 6 tests: if (methodIdx < 0end of blockExecuted by:
executed 12 times by 6 tests: else methodIdx = QQuickTextEdit::staticMetaObject.indexOfSignal(method+1);methodIdx = QQuickTextEdit::staticMetaObject.indexOfSlot(method+1);Executed by:
never executed: } ((signalIdx != -1 && methodIdx != -1) ? static_cast<void>(0) : qt_assert("signalIdx != -1 && methodIdx != -1", __FILE__, 2298)); QMetaObject::connect(sender, signalIdx, receiver, methodIdx, Qt::DirectConnection); };methodIdx = QQuickTextEdit::staticMetaObject.indexOfSignal(method+1); | 0-1064 | ||||||||||||||||||||||||
| 1549 | QObject::connect(document, &QQuickTextDocumentWithImageResources::contentsChange, q, &QQuickTextEdit::q_contentsChange); | - | ||||||||||||||||||||||||
| 1550 | QObject::connect(document->documentLayout(), &QAbstractTextDocumentLayout::updateBlock, q, &QQuickTextEdit::invalidateBlock); | - | ||||||||||||||||||||||||
| 1551 | - | |||||||||||||||||||||||||
| 1552 | document->setDefaultFont(font); | - | ||||||||||||||||||||||||
| 1553 | document->setDocumentMargin(textMargin); | - | ||||||||||||||||||||||||
| 1554 | document->setUndoRedoEnabled(false); | - | ||||||||||||||||||||||||
| 1555 | document->setUndoRedoEnabled(true); | - | ||||||||||||||||||||||||
| 1556 | updateDefaultTextOption(); | - | ||||||||||||||||||||||||
| 1557 | q->updateSize(); | - | ||||||||||||||||||||||||
| 1558 | } executed 1076 times by 6 tests: end of blockExecuted by:
| 1076 | ||||||||||||||||||||||||
| 1559 | - | |||||||||||||||||||||||||
| 1560 | void QQuickTextEditPrivate::resetInputMethod() | - | ||||||||||||||||||||||||
| 1561 | { | - | ||||||||||||||||||||||||
| 1562 | QQuickTextEdit * const q = q_func(); | - | ||||||||||||||||||||||||
| 1563 | if (!q->isReadOnly()
| 0-6 | ||||||||||||||||||||||||
| 1564 | QGuiApplication::inputMethod()->reset(); executed 6 times by 1 test: QGuiApplication::inputMethod()->reset();Executed by:
| 6 | ||||||||||||||||||||||||
| 1565 | } executed 6 times by 1 test: end of blockExecuted by:
| 6 | ||||||||||||||||||||||||
| 1566 | - | |||||||||||||||||||||||||
| 1567 | void QQuickTextEdit::q_textChanged() | - | ||||||||||||||||||||||||
| 1568 | { | - | ||||||||||||||||||||||||
| 1569 | QQuickTextEditPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 1570 | d->textCached = false; | - | ||||||||||||||||||||||||
| 1571 | for (QTextBlock it = d->document->begin(); it != d->document->end()
| 1340-3790 | ||||||||||||||||||||||||
| 1572 | d->contentDirection = d->textDirection(it.text()); | - | ||||||||||||||||||||||||
| 1573 | if (d->contentDirection != Qt::LayoutDirectionAuto
| 1340-2450 | ||||||||||||||||||||||||
| 1574 | break; executed 2450 times by 5 tests: break;Executed by:
| 2450 | ||||||||||||||||||||||||
| 1575 | } executed 1340 times by 6 tests: end of blockExecuted by:
| 1340 | ||||||||||||||||||||||||
| 1576 | d->determineHorizontalAlignment(); | - | ||||||||||||||||||||||||
| 1577 | d->updateDefaultTextOption(); | - | ||||||||||||||||||||||||
| 1578 | updateSize(); | - | ||||||||||||||||||||||||
| 1579 | textChanged(); | - | ||||||||||||||||||||||||
| 1580 | } executed 3790 times by 6 tests: end of blockExecuted by:
| 3790 | ||||||||||||||||||||||||
| 1581 | - | |||||||||||||||||||||||||
| 1582 | void QQuickTextEdit::markDirtyNodesForRange(int start, int end, int charDelta) | - | ||||||||||||||||||||||||
| 1583 | { | - | ||||||||||||||||||||||||
| 1584 | QQuickTextEditPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 1585 | if (start == end
| 1144-6074 | ||||||||||||||||||||||||
| 1586 | return; executed 1144 times by 6 tests: return;Executed by:
| 1144 | ||||||||||||||||||||||||
| 1587 | - | |||||||||||||||||||||||||
| 1588 | TextNode dummyNode(start); | - | ||||||||||||||||||||||||
| 1589 | - | |||||||||||||||||||||||||
| 1590 | const TextNodeIterator textNodeMapBegin = d->textNodeMap.begin(); | - | ||||||||||||||||||||||||
| 1591 | const TextNodeIterator textNodeMapEnd = d->textNodeMap.end(); | - | ||||||||||||||||||||||||
| 1592 | - | |||||||||||||||||||||||||
| 1593 | TextNodeIterator it = std::lower_bound(textNodeMapBegin, textNodeMapEnd, dummyNode); | - | ||||||||||||||||||||||||
| 1594 | - | |||||||||||||||||||||||||
| 1595 | - | |||||||||||||||||||||||||
| 1596 | if (it != textNodeMapBegin
| 520-5554 | ||||||||||||||||||||||||
| 1597 | --it; | - | ||||||||||||||||||||||||
| 1598 | TextNode otherDummy(it->startPos()); | - | ||||||||||||||||||||||||
| 1599 | it = std::lower_bound(textNodeMapBegin, textNodeMapEnd, otherDummy); | - | ||||||||||||||||||||||||
| 1600 | } executed 520 times by 1 test: end of blockExecuted by:
| 520 | ||||||||||||||||||||||||
| 1601 | - | |||||||||||||||||||||||||
| 1602 | - | |||||||||||||||||||||||||
| 1603 | while (it != textNodeMapEnd
| 3612-5160 | ||||||||||||||||||||||||
| 1604 | if (it->startPos() <= end
| 920-2692 | ||||||||||||||||||||||||
| 1605 | it->setDirty(); executed 2692 times by 1 test: it->setDirty();Executed by:
| 2692 | ||||||||||||||||||||||||
| 1606 | else if (charDelta
| 6-914 | ||||||||||||||||||||||||
| 1607 | it->moveStartPos(charDelta); executed 6 times by 1 test: it->moveStartPos(charDelta);Executed by:
| 6 | ||||||||||||||||||||||||
| 1608 | else | - | ||||||||||||||||||||||||
| 1609 | return; executed 914 times by 1 test: return;Executed by:
| 914 | ||||||||||||||||||||||||
| 1610 | ++it; | - | ||||||||||||||||||||||||
| 1611 | } executed 2698 times by 1 test: end of blockExecuted by:
| 2698 | ||||||||||||||||||||||||
| 1612 | } executed 5160 times by 5 tests: end of blockExecuted by:
| 5160 | ||||||||||||||||||||||||
| 1613 | - | |||||||||||||||||||||||||
| 1614 | void QQuickTextEdit::q_contentsChange(int pos, int charsRemoved, int charsAdded) | - | ||||||||||||||||||||||||
| 1615 | { | - | ||||||||||||||||||||||||
| 1616 | QQuickTextEditPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 1617 | - | |||||||||||||||||||||||||
| 1618 | const int editRange = pos + qMax(charsAdded, charsRemoved); | - | ||||||||||||||||||||||||
| 1619 | const int delta = charsAdded - charsRemoved; | - | ||||||||||||||||||||||||
| 1620 | - | |||||||||||||||||||||||||
| 1621 | markDirtyNodesForRange(pos, editRange, delta); | - | ||||||||||||||||||||||||
| 1622 | - | |||||||||||||||||||||||||
| 1623 | polish(); | - | ||||||||||||||||||||||||
| 1624 | if (isComponentComplete()
| 68-4442 | ||||||||||||||||||||||||
| 1625 | d->updateType = QQuickTextEditPrivate::UpdatePaintNode; | - | ||||||||||||||||||||||||
| 1626 | update(); | - | ||||||||||||||||||||||||
| 1627 | } executed 4442 times by 6 tests: end of blockExecuted by:
| 4442 | ||||||||||||||||||||||||
| 1628 | } executed 4510 times by 6 tests: end of blockExecuted by:
| 4510 | ||||||||||||||||||||||||
| 1629 | - | |||||||||||||||||||||||||
| 1630 | void QQuickTextEdit::moveCursorDelegate() | - | ||||||||||||||||||||||||
| 1631 | { | - | ||||||||||||||||||||||||
| 1632 | QQuickTextEditPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 1633 | - | |||||||||||||||||||||||||
| 1634 | updateInputMethod(); | - | ||||||||||||||||||||||||
| 1635 | - | |||||||||||||||||||||||||
| 1636 | cursorRectangleChanged(); | - | ||||||||||||||||||||||||
| 1637 | if (!d->cursorItem
| 1080-6228 | ||||||||||||||||||||||||
| 1638 | return; executed 6228 times by 6 tests: return;Executed by:
| 6228 | ||||||||||||||||||||||||
| 1639 | QRectF cursorRect = cursorRectangle(); | - | ||||||||||||||||||||||||
| 1640 | d->cursorItem->setX(cursorRect.x()); | - | ||||||||||||||||||||||||
| 1641 | d->cursorItem->setY(cursorRect.y()); | - | ||||||||||||||||||||||||
| 1642 | d->cursorItem->setHeight(cursorRect.height()); | - | ||||||||||||||||||||||||
| 1643 | } executed 1080 times by 1 test: end of blockExecuted by:
| 1080 | ||||||||||||||||||||||||
| 1644 | - | |||||||||||||||||||||||||
| 1645 | void QQuickTextEdit::updateSelection() | - | ||||||||||||||||||||||||
| 1646 | { | - | ||||||||||||||||||||||||
| 1647 | QQuickTextEditPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 1648 | - | |||||||||||||||||||||||||
| 1649 | - | |||||||||||||||||||||||||
| 1650 | if (d->control->textCursor().hasSelection()
| 222-2544 | ||||||||||||||||||||||||
| 1651 | markDirtyNodesForRange(qMin(d->lastSelectionStart, d->control->textCursor().selectionStart()), qMax(d->control->textCursor().selectionEnd(), d->lastSelectionEnd), 0); | - | ||||||||||||||||||||||||
| 1652 | polish(); | - | ||||||||||||||||||||||||
| 1653 | if (isComponentComplete()
| 0-2708 | ||||||||||||||||||||||||
| 1654 | d->updateType = QQuickTextEditPrivate::UpdatePaintNode; | - | ||||||||||||||||||||||||
| 1655 | update(); | - | ||||||||||||||||||||||||
| 1656 | } executed 2708 times by 1 test: end of blockExecuted by:
| 2708 | ||||||||||||||||||||||||
| 1657 | } executed 2708 times by 1 test: end of blockExecuted by:
| 2708 | ||||||||||||||||||||||||
| 1658 | - | |||||||||||||||||||||||||
| 1659 | d->hadSelection = d->control->textCursor().hasSelection(); | - | ||||||||||||||||||||||||
| 1660 | - | |||||||||||||||||||||||||
| 1661 | if (d->lastSelectionStart != d->control->textCursor().selectionStart()
| 2494-2536 | ||||||||||||||||||||||||
| 1662 | d->lastSelectionStart = d->control->textCursor().selectionStart(); | - | ||||||||||||||||||||||||
| 1663 | selectionStartChanged(); | - | ||||||||||||||||||||||||
| 1664 | } executed 2494 times by 2 tests: end of blockExecuted by:
| 2494 | ||||||||||||||||||||||||
| 1665 | if (d->lastSelectionEnd != d->control->textCursor().selectionEnd()
| 2340-2690 | ||||||||||||||||||||||||
| 1666 | d->lastSelectionEnd = d->control->textCursor().selectionEnd(); | - | ||||||||||||||||||||||||
| 1667 | selectionEndChanged(); | - | ||||||||||||||||||||||||
| 1668 | } executed 2690 times by 2 tests: end of blockExecuted by:
| 2690 | ||||||||||||||||||||||||
| 1669 | } executed 5030 times by 2 tests: end of blockExecuted by:
| 5030 | ||||||||||||||||||||||||
| 1670 | - | |||||||||||||||||||||||||
| 1671 | QRectF QQuickTextEdit::boundingRect() const | - | ||||||||||||||||||||||||
| 1672 | { | - | ||||||||||||||||||||||||
| 1673 | const QQuickTextEditPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 1674 | QRectF r( | - | ||||||||||||||||||||||||
| 1675 | QQuickTextUtil::alignedX(d->contentSize.width(), width(), effectiveHAlign()), | - | ||||||||||||||||||||||||
| 1676 | d->yoff, | - | ||||||||||||||||||||||||
| 1677 | d->contentSize.width(), | - | ||||||||||||||||||||||||
| 1678 | d->contentSize.height()); | - | ||||||||||||||||||||||||
| 1679 | - | |||||||||||||||||||||||||
| 1680 | int cursorWidth = 1; | - | ||||||||||||||||||||||||
| 1681 | if (d->cursorItem
| 32 | ||||||||||||||||||||||||
| 1682 | cursorWidth = 0; executed 32 times by 1 test: cursorWidth = 0;Executed by:
| 32 | ||||||||||||||||||||||||
| 1683 | else if (!d->document->isEmpty()
| 8-24 | ||||||||||||||||||||||||
| 1684 | cursorWidth += 3; executed 24 times by 1 test: cursorWidth += 3;Executed by:
| 24 | ||||||||||||||||||||||||
| 1685 | - | |||||||||||||||||||||||||
| 1686 | - | |||||||||||||||||||||||||
| 1687 | r.setRight(r.right() + cursorWidth); | - | ||||||||||||||||||||||||
| 1688 | - | |||||||||||||||||||||||||
| 1689 | return executed 64 times by 1 test: r;return r;Executed by:
executed 64 times by 1 test: return r;Executed by:
| 64 | ||||||||||||||||||||||||
| 1690 | } | - | ||||||||||||||||||||||||
| 1691 | - | |||||||||||||||||||||||||
| 1692 | QRectF QQuickTextEdit::clipRect() const | - | ||||||||||||||||||||||||
| 1693 | { | - | ||||||||||||||||||||||||
| 1694 | const QQuickTextEditPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 1695 | QRectF r = QQuickImplicitSizeItem::clipRect(); | - | ||||||||||||||||||||||||
| 1696 | int cursorWidth = 1; | - | ||||||||||||||||||||||||
| 1697 | if (d->cursorItem
| 32 | ||||||||||||||||||||||||
| 1698 | cursorWidth = d->cursorItem->width(); executed 32 times by 1 test: cursorWidth = d->cursorItem->width();Executed by:
| 32 | ||||||||||||||||||||||||
| 1699 | if (!d->document->isEmpty()
| 8-56 | ||||||||||||||||||||||||
| 1700 | cursorWidth += 3; executed 56 times by 1 test: cursorWidth += 3;Executed by:
| 56 | ||||||||||||||||||||||||
| 1701 | - | |||||||||||||||||||||||||
| 1702 | - | |||||||||||||||||||||||||
| 1703 | - | |||||||||||||||||||||||||
| 1704 | r.setRight(r.right() + cursorWidth); | - | ||||||||||||||||||||||||
| 1705 | return executed 64 times by 1 test: r;return r;Executed by:
executed 64 times by 1 test: return r;Executed by:
| 64 | ||||||||||||||||||||||||
| 1706 | } | - | ||||||||||||||||||||||||
| 1707 | - | |||||||||||||||||||||||||
| 1708 | qreal QQuickTextEditPrivate::getImplicitWidth() const | - | ||||||||||||||||||||||||
| 1709 | { | - | ||||||||||||||||||||||||
| 1710 | const QQuickTextEdit * const q = q_func(); | - | ||||||||||||||||||||||||
| 1711 | if (!requireImplicitWidth
| 26-74 | ||||||||||||||||||||||||
| 1712 | - | |||||||||||||||||||||||||
| 1713 | - | |||||||||||||||||||||||||
| 1714 | const_cast<QQuickTextEditPrivate*>(this)->requireImplicitWidth = true; | - | ||||||||||||||||||||||||
| 1715 | const_cast<QQuickTextEdit*>(q)->updateSize(); | - | ||||||||||||||||||||||||
| 1716 | } executed 26 times by 1 test: end of blockExecuted by:
| 26 | ||||||||||||||||||||||||
| 1717 | return executed 100 times by 1 test: implicitWidth;return implicitWidth;Executed by:
executed 100 times by 1 test: return implicitWidth;Executed by:
| 100 | ||||||||||||||||||||||||
| 1718 | } | - | ||||||||||||||||||||||||
| 1719 | - | |||||||||||||||||||||||||
| 1720 | - | |||||||||||||||||||||||||
| 1721 | - | |||||||||||||||||||||||||
| 1722 | void QQuickTextEdit::updateSize() | - | ||||||||||||||||||||||||
| 1723 | { | - | ||||||||||||||||||||||||
| 1724 | QQuickTextEditPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 1725 | if (!isComponentComplete()
| 466-5230 | ||||||||||||||||||||||||
| 1726 | d->dirty = true; | - | ||||||||||||||||||||||||
| 1727 | return; executed 466 times by 4 tests: return;Executed by:
| 466 | ||||||||||||||||||||||||
| 1728 | } | - | ||||||||||||||||||||||||
| 1729 | - | |||||||||||||||||||||||||
| 1730 | qreal naturalWidth = d->implicitWidth - leftPadding() - rightPadding(); | - | ||||||||||||||||||||||||
| 1731 | - | |||||||||||||||||||||||||
| 1732 | qreal newWidth = d->document->idealWidth(); | - | ||||||||||||||||||||||||
| 1733 | - | |||||||||||||||||||||||||
| 1734 | - | |||||||||||||||||||||||||
| 1735 | if (widthValid()
| 910-4320 | ||||||||||||||||||||||||
| 1736 | if (!d->requireImplicitWidth
| 60-850 | ||||||||||||||||||||||||
| 1737 | implicitWidthChanged(); | - | ||||||||||||||||||||||||
| 1738 | - | |||||||||||||||||||||||||
| 1739 | if (d->requireImplicitWidth
| 0-850 | ||||||||||||||||||||||||
| 1740 | return; never executed: return; | 0 | ||||||||||||||||||||||||
| 1741 | } executed 850 times by 5 tests: end of blockExecuted by:
| 850 | ||||||||||||||||||||||||
| 1742 | if (d->requireImplicitWidth
| 60-850 | ||||||||||||||||||||||||
| 1743 | d->document->setTextWidth(-1); | - | ||||||||||||||||||||||||
| 1744 | naturalWidth = d->document->idealWidth(); | - | ||||||||||||||||||||||||
| 1745 | - | |||||||||||||||||||||||||
| 1746 | const bool wasInLayout = d->inLayout; | - | ||||||||||||||||||||||||
| 1747 | d->inLayout = true; | - | ||||||||||||||||||||||||
| 1748 | if (d->isImplicitResizeEnabled()
| 0-60 | ||||||||||||||||||||||||
| 1749 | setImplicitWidth(naturalWidth + leftPadding() + rightPadding()); executed 60 times by 1 test: setImplicitWidth(naturalWidth + leftPadding() + rightPadding());Executed by:
| 60 | ||||||||||||||||||||||||
| 1750 | d->inLayout = wasInLayout; | - | ||||||||||||||||||||||||
| 1751 | if (d->inLayout
| 0-60 | ||||||||||||||||||||||||
| 1752 | return; never executed: return; | 0 | ||||||||||||||||||||||||
| 1753 | } executed 60 times by 1 test: end of blockExecuted by:
| 60 | ||||||||||||||||||||||||
| 1754 | if (d->document->textWidth() != width()
| 226-684 | ||||||||||||||||||||||||
| 1755 | d->document->setTextWidth(width() - leftPadding() - rightPadding()); | - | ||||||||||||||||||||||||
| 1756 | newWidth = d->document->idealWidth(); | - | ||||||||||||||||||||||||
| 1757 | } executed 226 times by 5 tests: end of blockExecuted by:
| 226 | ||||||||||||||||||||||||
| 1758 | - | |||||||||||||||||||||||||
| 1759 | } executed 910 times by 5 tests: else if (d->wrapMode == NoWrapend of blockExecuted by:
| 2-4318 | ||||||||||||||||||||||||
| 1760 | d->document->setTextWidth(newWidth); | - | ||||||||||||||||||||||||
| 1761 | } executed 3920 times by 6 tests: else {end of blockExecuted by:
| 3920 | ||||||||||||||||||||||||
| 1762 | d->document->setTextWidth(-1); | - | ||||||||||||||||||||||||
| 1763 | } executed 400 times by 1 test: end of blockExecuted by:
| 400 | ||||||||||||||||||||||||
| 1764 | - | |||||||||||||||||||||||||
| 1765 | QFontMetricsF fm(d->font); | - | ||||||||||||||||||||||||
| 1766 | qreal newHeight = d->document->isEmpty()
| 2302-2928 | ||||||||||||||||||||||||
| 1767 | - | |||||||||||||||||||||||||
| 1768 | if (d->isImplicitResizeEnabled()
| 0-5230 | ||||||||||||||||||||||||
| 1769 | - | |||||||||||||||||||||||||
| 1770 | if (!widthValid()
| 910-4320 | ||||||||||||||||||||||||
| 1771 | setImplicitSize(newWidth + leftPadding() + rightPadding(), newHeight + topPadding() + bottomPadding()); executed 4320 times by 6 tests: setImplicitSize(newWidth + leftPadding() + rightPadding(), newHeight + topPadding() + bottomPadding());Executed by:
| 4320 | ||||||||||||||||||||||||
| 1772 | else | - | ||||||||||||||||||||||||
| 1773 | setImplicitHeight(newHeight + topPadding() + bottomPadding()); executed 910 times by 5 tests: setImplicitHeight(newHeight + topPadding() + bottomPadding());Executed by:
| 910 | ||||||||||||||||||||||||
| 1774 | } | - | ||||||||||||||||||||||||
| 1775 | - | |||||||||||||||||||||||||
| 1776 | d->xoff = leftPadding() + qMax(qreal(0), QQuickTextUtil::alignedX(d->document->size().width(), width() - leftPadding() - rightPadding(), effectiveHAlign())); | - | ||||||||||||||||||||||||
| 1777 | d->yoff = topPadding() + QQuickTextUtil::alignedY(d->document->size().height(), height() - topPadding() - bottomPadding(), d->vAlign); | - | ||||||||||||||||||||||||
| 1778 | setBaselineOffset(fm.ascent() + d->yoff + d->textMargin); | - | ||||||||||||||||||||||||
| 1779 | - | |||||||||||||||||||||||||
| 1780 | QSizeF size(newWidth, newHeight); | - | ||||||||||||||||||||||||
| 1781 | if (d->contentSize != size
| 882-4348 | ||||||||||||||||||||||||
| 1782 | d->contentSize = size; | - | ||||||||||||||||||||||||
| 1783 | contentSizeChanged(); | - | ||||||||||||||||||||||||
| 1784 | updateTotalLines(); | - | ||||||||||||||||||||||||
| 1785 | } executed 4348 times by 6 tests: end of blockExecuted by:
| 4348 | ||||||||||||||||||||||||
| 1786 | } executed 5230 times by 6 tests: end of blockExecuted by:
| 5230 | ||||||||||||||||||||||||
| 1787 | - | |||||||||||||||||||||||||
| 1788 | void QQuickTextEdit::updateWholeDocument() | - | ||||||||||||||||||||||||
| 1789 | { | - | ||||||||||||||||||||||||
| 1790 | QQuickTextEditPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 1791 | if (!d->textNodeMap.isEmpty()
| 4-406 | ||||||||||||||||||||||||
| 1792 | for (TextNode &node : d->textNodeMap) | - | ||||||||||||||||||||||||
| 1793 | node.setDirty(); executed 4 times by 1 test: node.setDirty();Executed by:
| 4 | ||||||||||||||||||||||||
| 1794 | } executed 4 times by 1 test: end of blockExecuted by:
| 4 | ||||||||||||||||||||||||
| 1795 | - | |||||||||||||||||||||||||
| 1796 | polish(); | - | ||||||||||||||||||||||||
| 1797 | if (isComponentComplete()
| 64-346 | ||||||||||||||||||||||||
| 1798 | d->updateType = QQuickTextEditPrivate::UpdatePaintNode; | - | ||||||||||||||||||||||||
| 1799 | update(); | - | ||||||||||||||||||||||||
| 1800 | } executed 64 times by 3 tests: end of blockExecuted by:
| 64 | ||||||||||||||||||||||||
| 1801 | } executed 410 times by 5 tests: end of blockExecuted by:
| 410 | ||||||||||||||||||||||||
| 1802 | - | |||||||||||||||||||||||||
| 1803 | void QQuickTextEdit::invalidateBlock(const QTextBlock &block) | - | ||||||||||||||||||||||||
| 1804 | { | - | ||||||||||||||||||||||||
| 1805 | QQuickTextEditPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 1806 | markDirtyNodesForRange(block.position(), block.position() + block.length(), 0); | - | ||||||||||||||||||||||||
| 1807 | - | |||||||||||||||||||||||||
| 1808 | polish(); | - | ||||||||||||||||||||||||
| 1809 | if (isComponentComplete()
| 0 | ||||||||||||||||||||||||
| 1810 | d->updateType = QQuickTextEditPrivate::UpdatePaintNode; | - | ||||||||||||||||||||||||
| 1811 | update(); | - | ||||||||||||||||||||||||
| 1812 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 1813 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 1814 | - | |||||||||||||||||||||||||
| 1815 | void QQuickTextEdit::updateCursor() | - | ||||||||||||||||||||||||
| 1816 | { | - | ||||||||||||||||||||||||
| 1817 | QQuickTextEditPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 1818 | polish(); | - | ||||||||||||||||||||||||
| 1819 | if (isComponentComplete()
| 40-4126 | ||||||||||||||||||||||||
| 1820 | d->updateType = QQuickTextEditPrivate::UpdatePaintNode; | - | ||||||||||||||||||||||||
| 1821 | update(); | - | ||||||||||||||||||||||||
| 1822 | } executed 4126 times by 3 tests: end of blockExecuted by:
| 4126 | ||||||||||||||||||||||||
| 1823 | } executed 4166 times by 4 tests: end of blockExecuted by:
| 4166 | ||||||||||||||||||||||||
| 1824 | - | |||||||||||||||||||||||||
| 1825 | void QQuickTextEdit::q_updateAlignment() | - | ||||||||||||||||||||||||
| 1826 | { | - | ||||||||||||||||||||||||
| 1827 | QQuickTextEditPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 1828 | if (d->determineHorizontalAlignment()
| 14-340 | ||||||||||||||||||||||||
| 1829 | d->updateDefaultTextOption(); | - | ||||||||||||||||||||||||
| 1830 | d->xoff = qMax(qreal(0), QQuickTextUtil::alignedX(d->document->size().width(), width(), effectiveHAlign())); | - | ||||||||||||||||||||||||
| 1831 | moveCursorDelegate(); | - | ||||||||||||||||||||||||
| 1832 | } executed 14 times by 1 test: end of blockExecuted by:
| 14 | ||||||||||||||||||||||||
| 1833 | } executed 354 times by 3 tests: end of blockExecuted by:
| 354 | ||||||||||||||||||||||||
| 1834 | - | |||||||||||||||||||||||||
| 1835 | void QQuickTextEdit::updateTotalLines() | - | ||||||||||||||||||||||||
| 1836 | { | - | ||||||||||||||||||||||||
| 1837 | QQuickTextEditPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 1838 | - | |||||||||||||||||||||||||
| 1839 | int subLines = 0; | - | ||||||||||||||||||||||||
| 1840 | - | |||||||||||||||||||||||||
| 1841 | for (QTextBlock it = d->document->begin(); it != d->document->end()
| 4348-4702 | ||||||||||||||||||||||||
| 1842 | QTextLayout *layout = it.layout(); | - | ||||||||||||||||||||||||
| 1843 | if (!layout
| 0-4702 | ||||||||||||||||||||||||
| 1844 | continue; never executed: continue; | 0 | ||||||||||||||||||||||||
| 1845 | subLines += layout->lineCount()-1; | - | ||||||||||||||||||||||||
| 1846 | } executed 4702 times by 6 tests: end of blockExecuted by:
| 4702 | ||||||||||||||||||||||||
| 1847 | - | |||||||||||||||||||||||||
| 1848 | int newTotalLines = d->document->lineCount() + subLines; | - | ||||||||||||||||||||||||
| 1849 | if (d->lineCount != newTotalLines
| 1300-3048 | ||||||||||||||||||||||||
| 1850 | d->lineCount = newTotalLines; | - | ||||||||||||||||||||||||
| 1851 | lineCountChanged(); | - | ||||||||||||||||||||||||
| 1852 | } executed 1300 times by 6 tests: end of blockExecuted by:
| 1300 | ||||||||||||||||||||||||
| 1853 | } executed 4348 times by 6 tests: end of blockExecuted by:
| 4348 | ||||||||||||||||||||||||
| 1854 | - | |||||||||||||||||||||||||
| 1855 | void QQuickTextEditPrivate::updateDefaultTextOption() | - | ||||||||||||||||||||||||
| 1856 | { | - | ||||||||||||||||||||||||
| 1857 | QQuickTextEdit * const q = q_func(); | - | ||||||||||||||||||||||||
| 1858 | QTextOption opt = document->defaultTextOption(); | - | ||||||||||||||||||||||||
| 1859 | const Qt::Alignment oldAlignment = opt.alignment(); | - | ||||||||||||||||||||||||
| 1860 | Qt::LayoutDirection oldTextDirection = opt.textDirection(); | - | ||||||||||||||||||||||||
| 1861 | - | |||||||||||||||||||||||||
| 1862 | QQuickTextEdit::HAlignment horizontalAlignment = q->effectiveHAlign(); | - | ||||||||||||||||||||||||
| 1863 | if (contentDirection == Qt::RightToLeft
| 54-5256 | ||||||||||||||||||||||||
| 1864 | if (horizontalAlignment == QQuickTextEdit::AlignLeft
| 8-46 | ||||||||||||||||||||||||
| 1865 | horizontalAlignment = QQuickTextEdit::AlignRight; executed 8 times by 1 test: horizontalAlignment = QQuickTextEdit::AlignRight;Executed by:
| 8 | ||||||||||||||||||||||||
| 1866 | else if (horizontalAlignment == QQuickTextEdit::AlignRight
| 2-44 | ||||||||||||||||||||||||
| 1867 | horizontalAlignment = QQuickTextEdit::AlignLeft; executed 44 times by 2 tests: horizontalAlignment = QQuickTextEdit::AlignLeft;Executed by:
| 44 | ||||||||||||||||||||||||
| 1868 | } executed 54 times by 2 tests: end of blockExecuted by:
| 54 | ||||||||||||||||||||||||
| 1869 | if (!hAlignImplicit
| 116-5194 | ||||||||||||||||||||||||
| 1870 | opt.setAlignment((Qt::Alignment)(int)(horizontalAlignment | vAlign)); executed 116 times by 1 test: opt.setAlignment((Qt::Alignment)(int)(horizontalAlignment | vAlign));Executed by:
| 116 | ||||||||||||||||||||||||
| 1871 | else | - | ||||||||||||||||||||||||
| 1872 | opt.setAlignment(Qt::Alignment(vAlign)); executed 5194 times by 6 tests: opt.setAlignment(Qt::Alignment(vAlign));Executed by:
| 5194 | ||||||||||||||||||||||||
| 1873 | - | |||||||||||||||||||||||||
| 1874 | - | |||||||||||||||||||||||||
| 1875 | if (contentDirection == Qt::LayoutDirectionAuto
| 2562-2748 | ||||||||||||||||||||||||
| 1876 | opt.setTextDirection((static_cast<QGuiApplication *>(QCoreApplication::instance()))->inputMethod()->inputDirection()); | - | ||||||||||||||||||||||||
| 1877 | } executed 2562 times by 6 tests: elseend of blockExecuted by:
| 2562 | ||||||||||||||||||||||||
| 1878 | - | |||||||||||||||||||||||||
| 1879 | { | - | ||||||||||||||||||||||||
| 1880 | opt.setTextDirection(contentDirection); | - | ||||||||||||||||||||||||
| 1881 | } executed 2748 times by 5 tests: end of blockExecuted by:
| 2748 | ||||||||||||||||||||||||
| 1882 | - | |||||||||||||||||||||||||
| 1883 | QTextOption::WrapMode oldWrapMode = opt.wrapMode(); | - | ||||||||||||||||||||||||
| 1884 | opt.setWrapMode(QTextOption::WrapMode(wrapMode)); | - | ||||||||||||||||||||||||
| 1885 | - | |||||||||||||||||||||||||
| 1886 | bool oldUseDesignMetrics = opt.useDesignMetrics(); | - | ||||||||||||||||||||||||
| 1887 | opt.setUseDesignMetrics(renderType != QQuickTextEdit::NativeRendering); | - | ||||||||||||||||||||||||
| 1888 | - | |||||||||||||||||||||||||
| 1889 | if (oldWrapMode != opt.wrapMode()
| 116-4126 | ||||||||||||||||||||||||
| 1890 | || oldTextDirection != opt.textDirection()
| 36-3974 | ||||||||||||||||||||||||
| 1891 | || oldUseDesignMetrics != opt.useDesignMetrics()
| 4-3970 | ||||||||||||||||||||||||
| 1892 | document->setDefaultTextOption(opt); | - | ||||||||||||||||||||||||
| 1893 | } executed 1340 times by 6 tests: end of blockExecuted by:
| 1340 | ||||||||||||||||||||||||
| 1894 | } executed 5310 times by 6 tests: end of blockExecuted by:
| 5310 | ||||||||||||||||||||||||
| 1895 | - | |||||||||||||||||||||||||
| 1896 | void QQuickTextEdit::focusInEvent(QFocusEvent *event) | - | ||||||||||||||||||||||||
| 1897 | { | - | ||||||||||||||||||||||||
| 1898 | QQuickTextEditPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 1899 | d->handleFocusEvent(event); | - | ||||||||||||||||||||||||
| 1900 | QQuickImplicitSizeItem::focusInEvent(event); | - | ||||||||||||||||||||||||
| 1901 | } executed 338 times by 3 tests: end of blockExecuted by:
| 338 | ||||||||||||||||||||||||
| 1902 | - | |||||||||||||||||||||||||
| 1903 | void QQuickTextEdit::focusOutEvent(QFocusEvent *event) | - | ||||||||||||||||||||||||
| 1904 | { | - | ||||||||||||||||||||||||
| 1905 | QQuickTextEditPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 1906 | d->handleFocusEvent(event); | - | ||||||||||||||||||||||||
| 1907 | QQuickImplicitSizeItem::focusOutEvent(event); | - | ||||||||||||||||||||||||
| 1908 | } executed 94 times by 3 tests: end of blockExecuted by:
| 94 | ||||||||||||||||||||||||
| 1909 | - | |||||||||||||||||||||||||
| 1910 | void QQuickTextEditPrivate::handleFocusEvent(QFocusEvent *event) | - | ||||||||||||||||||||||||
| 1911 | { | - | ||||||||||||||||||||||||
| 1912 | QQuickTextEdit * const q = q_func(); | - | ||||||||||||||||||||||||
| 1913 | bool focus = event->type() == QEvent::FocusIn; | - | ||||||||||||||||||||||||
| 1914 | if (!q->isReadOnly()
| 28-404 | ||||||||||||||||||||||||
| 1915 | q->setCursorVisible(focus); executed 404 times by 3 tests: q->setCursorVisible(focus);Executed by:
| 404 | ||||||||||||||||||||||||
| 1916 | control->processEvent(event, QPointF(-xoff, -yoff)); | - | ||||||||||||||||||||||||
| 1917 | if (focus
| 94-338 | ||||||||||||||||||||||||
| 1918 | q->q_updateAlignment(); | - | ||||||||||||||||||||||||
| 1919 | - | |||||||||||||||||||||||||
| 1920 | if (focusOnPress
| 2-336 | ||||||||||||||||||||||||
| 1921 | (static_cast< executed 314 times by 3 tests: QGuiApplication *>(QCoreApplication::instance()))->inputMethod()->show();(static_cast<QGuiApplication *>(QCoreApplication::instance()))->inputMethod()->show();Executed by:
executed 314 times by 3 tests: (static_cast<QGuiApplication *>(QCoreApplication::instance()))->inputMethod()->show();Executed by:
| 314 | ||||||||||||||||||||||||
| 1922 | q->connect(QGuiApplication::inputMethod(), qFlagLocation("2""inputDirectionChanged(Qt::LayoutDirection)" "\0" __FILE__ ":" "2672"), | - | ||||||||||||||||||||||||
| 1923 | q, qFlagLocation("1""q_updateAlignment()" "\0" __FILE__ ":" "2673")); | - | ||||||||||||||||||||||||
| 1924 | - | |||||||||||||||||||||||||
| 1925 | } executed 338 times by 3 tests: else {end of blockExecuted by:
| 338 | ||||||||||||||||||||||||
| 1926 | - | |||||||||||||||||||||||||
| 1927 | q->disconnect(QGuiApplication::inputMethod(), qFlagLocation("2""inputDirectionChanged(Qt::LayoutDirection)" "\0" __FILE__ ":" "2677"), | - | ||||||||||||||||||||||||
| 1928 | q, qFlagLocation("1""q_updateAlignment()" "\0" __FILE__ ":" "2678")); | - | ||||||||||||||||||||||||
| 1929 | - | |||||||||||||||||||||||||
| 1930 | q->editingFinished(); | - | ||||||||||||||||||||||||
| 1931 | } executed 94 times by 3 tests: end of blockExecuted by:
| 94 | ||||||||||||||||||||||||
| 1932 | } | - | ||||||||||||||||||||||||
| 1933 | - | |||||||||||||||||||||||||
| 1934 | void QQuickTextEditPrivate::addCurrentTextNodeToRoot(QQuickTextNodeEngine *engine, QSGTransformNode *root, QQuickTextNode *node, TextNodeIterator &it, int startPos) | - | ||||||||||||||||||||||||
| 1935 | { | - | ||||||||||||||||||||||||
| 1936 | engine->addToSceneGraph(node, QQuickText::Normal, QColor()); | - | ||||||||||||||||||||||||
| 1937 | it = textNodeMap.insert(it, TextNode(startPos, node)); | - | ||||||||||||||||||||||||
| 1938 | ++it; | - | ||||||||||||||||||||||||
| 1939 | root->appendChildNode(node); | - | ||||||||||||||||||||||||
| 1940 | } executed 562 times by 4 tests: end of blockExecuted by:
| 562 | ||||||||||||||||||||||||
| 1941 | - | |||||||||||||||||||||||||
| 1942 | QQuickTextNode *QQuickTextEditPrivate::createTextNode() | - | ||||||||||||||||||||||||
| 1943 | { | - | ||||||||||||||||||||||||
| 1944 | QQuickTextEdit * const q = q_func(); | - | ||||||||||||||||||||||||
| 1945 | QQuickTextNode* node = new QQuickTextNode(q); | - | ||||||||||||||||||||||||
| 1946 | node->setUseNativeRenderer(renderType == QQuickTextEdit::NativeRendering); | - | ||||||||||||||||||||||||
| 1947 | return executed 854 times by 4 tests: node;return node;Executed by:
executed 854 times by 4 tests: return node;Executed by:
| 854 | ||||||||||||||||||||||||
| 1948 | } | - | ||||||||||||||||||||||||
| 1949 | - | |||||||||||||||||||||||||
| 1950 | void QQuickTextEdit::q_canPasteChanged() | - | ||||||||||||||||||||||||
| 1951 | { | - | ||||||||||||||||||||||||
| 1952 | QQuickTextEditPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 1953 | bool old = d->canPaste; | - | ||||||||||||||||||||||||
| 1954 | d->canPaste = d->control->canPaste(); | - | ||||||||||||||||||||||||
| 1955 | bool changed = old!=d->canPaste
| 42-3282 | ||||||||||||||||||||||||
| 1956 | d->canPasteValid = true; | - | ||||||||||||||||||||||||
| 1957 | if (changed
| 1788-3240 | ||||||||||||||||||||||||
| 1958 | canPasteChanged(); executed 1788 times by 2 tests: canPasteChanged();Executed by:
| 1788 | ||||||||||||||||||||||||
| 1959 | } executed 5028 times by 2 tests: end of blockExecuted by:
| 5028 | ||||||||||||||||||||||||
| 1960 | QString QQuickTextEdit::getText(int start, int end) const | - | ||||||||||||||||||||||||
| 1961 | { | - | ||||||||||||||||||||||||
| 1962 | const QQuickTextEditPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 1963 | start = qBound(0, start, d->document->characterCount() - 1); | - | ||||||||||||||||||||||||
| 1964 | end = qBound(0, end, d->document->characterCount() - 1); | - | ||||||||||||||||||||||||
| 1965 | QTextCursor cursor(d->document); | - | ||||||||||||||||||||||||
| 1966 | cursor.setPosition(start, QTextCursor::MoveAnchor); | - | ||||||||||||||||||||||||
| 1967 | cursor.setPosition(end, QTextCursor::KeepAnchor); | - | ||||||||||||||||||||||||
| 1968 | - | |||||||||||||||||||||||||
| 1969 | return executed 208 times by 1 test: d->richTextreturn d->richText ? cursor.selectedText() : cursor.selection().toPlainText();Executed by:
executed 208 times by 1 test: return d->richText ? cursor.selectedText() : cursor.selection().toPlainText();Executed by:
| 208 | ||||||||||||||||||||||||
| 1970 | ? cursor.selectedText() executed 208 times by 1 test: return d->richText ? cursor.selectedText() : cursor.selection().toPlainText();Executed by:
| 208 | ||||||||||||||||||||||||
| 1971 | : cursor.selection().toPlainText(); executed 208 times by 1 test: return d->richText ? cursor.selectedText() : cursor.selection().toPlainText();Executed by:
| 208 | ||||||||||||||||||||||||
| 1972 | - | |||||||||||||||||||||||||
| 1973 | - | |||||||||||||||||||||||||
| 1974 | - | |||||||||||||||||||||||||
| 1975 | } | - | ||||||||||||||||||||||||
| 1976 | QString QQuickTextEdit::getFormattedText(int start, int end) const | - | ||||||||||||||||||||||||
| 1977 | { | - | ||||||||||||||||||||||||
| 1978 | const QQuickTextEditPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 1979 | - | |||||||||||||||||||||||||
| 1980 | start = qBound(0, start, d->document->characterCount() - 1); | - | ||||||||||||||||||||||||
| 1981 | end = qBound(0, end, d->document->characterCount() - 1); | - | ||||||||||||||||||||||||
| 1982 | - | |||||||||||||||||||||||||
| 1983 | QTextCursor cursor(d->document); | - | ||||||||||||||||||||||||
| 1984 | cursor.setPosition(start, QTextCursor::MoveAnchor); | - | ||||||||||||||||||||||||
| 1985 | cursor.setPosition(end, QTextCursor::KeepAnchor); | - | ||||||||||||||||||||||||
| 1986 | - | |||||||||||||||||||||||||
| 1987 | if (d->richText
| 8-16 | ||||||||||||||||||||||||
| 1988 | - | |||||||||||||||||||||||||
| 1989 | return executed 8 times by 1 test: cursor.selection().toHtml();return cursor.selection().toHtml();Executed by:
executed 8 times by 1 test: return cursor.selection().toHtml();Executed by:
| 8 | ||||||||||||||||||||||||
| 1990 | - | |||||||||||||||||||||||||
| 1991 | - | |||||||||||||||||||||||||
| 1992 | - | |||||||||||||||||||||||||
| 1993 | } else { | - | ||||||||||||||||||||||||
| 1994 | return executed 16 times by 1 test: cursor.selection().toPlainText();return cursor.selection().toPlainText();Executed by:
executed 16 times by 1 test: return cursor.selection().toPlainText();Executed by:
| 16 | ||||||||||||||||||||||||
| 1995 | } | - | ||||||||||||||||||||||||
| 1996 | } | - | ||||||||||||||||||||||||
| 1997 | - | |||||||||||||||||||||||||
| 1998 | - | |||||||||||||||||||||||||
| 1999 | - | |||||||||||||||||||||||||
| 2000 | - | |||||||||||||||||||||||||
| 2001 | - | |||||||||||||||||||||||||
| 2002 | - | |||||||||||||||||||||||||
| 2003 | void QQuickTextEdit::insert(int position, const QString &text) | - | ||||||||||||||||||||||||
| 2004 | { | - | ||||||||||||||||||||||||
| 2005 | QQuickTextEditPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 2006 | if (position < 0
| 2-34 | ||||||||||||||||||||||||
| 2007 | return; executed 4 times by 1 test: return;Executed by:
| 4 | ||||||||||||||||||||||||
| 2008 | QTextCursor cursor(d->document); | - | ||||||||||||||||||||||||
| 2009 | cursor.setPosition(position); | - | ||||||||||||||||||||||||
| 2010 | d->richText = d->richText
| 0-30 | ||||||||||||||||||||||||
| 2011 | if (d->richText
| 4-28 | ||||||||||||||||||||||||
| 2012 | - | |||||||||||||||||||||||||
| 2013 | cursor.insertHtml(text); | - | ||||||||||||||||||||||||
| 2014 | - | |||||||||||||||||||||||||
| 2015 | - | |||||||||||||||||||||||||
| 2016 | - | |||||||||||||||||||||||||
| 2017 | } executed 4 times by 1 test: else {end of blockExecuted by:
| 4 | ||||||||||||||||||||||||
| 2018 | cursor.insertText(text); | - | ||||||||||||||||||||||||
| 2019 | } executed 28 times by 1 test: end of blockExecuted by:
| 28 | ||||||||||||||||||||||||
| 2020 | d->control->updateCursorRectangle(false); | - | ||||||||||||||||||||||||
| 2021 | } executed 32 times by 1 test: end of blockExecuted by:
| 32 | ||||||||||||||||||||||||
| 2022 | - | |||||||||||||||||||||||||
| 2023 | - | |||||||||||||||||||||||||
| 2024 | - | |||||||||||||||||||||||||
| 2025 | - | |||||||||||||||||||||||||
| 2026 | - | |||||||||||||||||||||||||
| 2027 | - | |||||||||||||||||||||||||
| 2028 | - | |||||||||||||||||||||||||
| 2029 | void QQuickTextEdit::remove(int start, int end) | - | ||||||||||||||||||||||||
| 2030 | { | - | ||||||||||||||||||||||||
| 2031 | QQuickTextEditPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 2032 | start = qBound(0, start, d->document->characterCount() - 1); | - | ||||||||||||||||||||||||
| 2033 | end = qBound(0, end, d->document->characterCount() - 1); | - | ||||||||||||||||||||||||
| 2034 | QTextCursor cursor(d->document); | - | ||||||||||||||||||||||||
| 2035 | cursor.setPosition(start, QTextCursor::MoveAnchor); | - | ||||||||||||||||||||||||
| 2036 | cursor.setPosition(end, QTextCursor::KeepAnchor); | - | ||||||||||||||||||||||||
| 2037 | cursor.removeSelectedText(); | - | ||||||||||||||||||||||||
| 2038 | d->control->updateCursorRectangle(false); | - | ||||||||||||||||||||||||
| 2039 | } executed 42 times by 1 test: end of blockExecuted by:
| 42 | ||||||||||||||||||||||||
| 2040 | QQuickTextDocument *QQuickTextEdit::textDocument() | - | ||||||||||||||||||||||||
| 2041 | { | - | ||||||||||||||||||||||||
| 2042 | QQuickTextEditPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 2043 | if (!d->quickDocument
| 0-2 | ||||||||||||||||||||||||
| 2044 | d->quickDocument = new QQuickTextDocument(this); executed 2 times by 1 test: d->quickDocument = new QQuickTextDocument(this);Executed by:
| 2 | ||||||||||||||||||||||||
| 2045 | return executed 2 times by 1 test: d->quickDocument;return d->quickDocument;Executed by:
executed 2 times by 1 test: return d->quickDocument;Executed by:
| 2 | ||||||||||||||||||||||||
| 2046 | } | - | ||||||||||||||||||||||||
| 2047 | - | |||||||||||||||||||||||||
| 2048 | bool QQuickTextEditPrivate::isLinkHoveredConnected() | - | ||||||||||||||||||||||||
| 2049 | { | - | ||||||||||||||||||||||||
| 2050 | QQuickTextEdit * const q = q_func(); | - | ||||||||||||||||||||||||
| 2051 | do { QObject *sender = (q); void (QQuickTextEdit::*signal)(const QString &) = &QQuickTextEdit::linkHovered; static QMetaMethod method = QMetaMethod::fromSignal(signal); static int signalIdx = QMetaObjectPrivate::signalIndex(method); return executed 442 times by 1 test: QObjectPrivate::get(sender)->isSignalConnected(signalIdx);return QObjectPrivate::get(sender)->isSignalConnected(signalIdx);Executed by:
executed 442 times by 1 test: } while (0);return QObjectPrivate::get(sender)->isSignalConnected(signalIdx);Executed by:
| 442 | ||||||||||||||||||||||||
| 2052 | } | - | ||||||||||||||||||||||||
| 2053 | QString QQuickTextEdit::hoveredLink() const | - | ||||||||||||||||||||||||
| 2054 | { | - | ||||||||||||||||||||||||
| 2055 | const QQuickTextEditPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 2056 | if (const_cast<
| 0-8 | ||||||||||||||||||||||||
| 2057 | return executed 8 times by 1 test: d->control->hoveredLink();return d->control->hoveredLink();Executed by:
executed 8 times by 1 test: return d->control->hoveredLink();Executed by:
| 8 | ||||||||||||||||||||||||
| 2058 | } else { | - | ||||||||||||||||||||||||
| 2059 | - | |||||||||||||||||||||||||
| 2060 | if (QQuickWindow *wnd = window()
| 0 | ||||||||||||||||||||||||
| 2061 | QPointF pos = QCursor::pos(wnd->screen()) - wnd->position() - mapToScene(QPointF(0, 0)); | - | ||||||||||||||||||||||||
| 2062 | return never executed: d->control->anchorAt(pos);return d->control->anchorAt(pos);never executed: return d->control->anchorAt(pos); | 0 | ||||||||||||||||||||||||
| 2063 | } | - | ||||||||||||||||||||||||
| 2064 | - | |||||||||||||||||||||||||
| 2065 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 2066 | return never executed: QString();return QString();never executed: return QString(); | 0 | ||||||||||||||||||||||||
| 2067 | } | - | ||||||||||||||||||||||||
| 2068 | - | |||||||||||||||||||||||||
| 2069 | void QQuickTextEdit::hoverEnterEvent(QHoverEvent *event) | - | ||||||||||||||||||||||||
| 2070 | { | - | ||||||||||||||||||||||||
| 2071 | QQuickTextEditPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 2072 | if (d->isLinkHoveredConnected()
| 2-118 | ||||||||||||||||||||||||
| 2073 | d->control->processEvent(event, QPointF(-d->xoff, -d->yoff)); executed 2 times by 1 test: d->control->processEvent(event, QPointF(-d->xoff, -d->yoff));Executed by:
| 2 | ||||||||||||||||||||||||
| 2074 | } executed 120 times by 1 test: end of blockExecuted by:
| 120 | ||||||||||||||||||||||||
| 2075 | - | |||||||||||||||||||||||||
| 2076 | void QQuickTextEdit::hoverMoveEvent(QHoverEvent *event) | - | ||||||||||||||||||||||||
| 2077 | { | - | ||||||||||||||||||||||||
| 2078 | QQuickTextEditPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 2079 | if (d->isLinkHoveredConnected()
| 6-306 | ||||||||||||||||||||||||
| 2080 | d->control->processEvent(event, QPointF(-d->xoff, -d->yoff)); executed 6 times by 1 test: d->control->processEvent(event, QPointF(-d->xoff, -d->yoff));Executed by:
| 6 | ||||||||||||||||||||||||
| 2081 | } executed 312 times by 1 test: end of blockExecuted by:
| 312 | ||||||||||||||||||||||||
| 2082 | - | |||||||||||||||||||||||||
| 2083 | void QQuickTextEdit::hoverLeaveEvent(QHoverEvent *event) | - | ||||||||||||||||||||||||
| 2084 | { | - | ||||||||||||||||||||||||
| 2085 | QQuickTextEditPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 2086 | if (d->isLinkHoveredConnected()
| 0-2 | ||||||||||||||||||||||||
| 2087 | d->control->processEvent(event, QPointF(-d->xoff, -d->yoff)); never executed: d->control->processEvent(event, QPointF(-d->xoff, -d->yoff)); | 0 | ||||||||||||||||||||||||
| 2088 | } executed 2 times by 1 test: end of blockExecuted by:
| 2 | ||||||||||||||||||||||||
| 2089 | void QQuickTextEdit::append(const QString &text) | - | ||||||||||||||||||||||||
| 2090 | { | - | ||||||||||||||||||||||||
| 2091 | QQuickTextEditPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 2092 | QTextCursor cursor(d->document); | - | ||||||||||||||||||||||||
| 2093 | cursor.beginEditBlock(); | - | ||||||||||||||||||||||||
| 2094 | cursor.movePosition(QTextCursor::End); | - | ||||||||||||||||||||||||
| 2095 | - | |||||||||||||||||||||||||
| 2096 | if (!d->document->isEmpty()
| 0-20 | ||||||||||||||||||||||||
| 2097 | cursor.insertBlock(); executed 20 times by 1 test: cursor.insertBlock();Executed by:
| 20 | ||||||||||||||||||||||||
| 2098 | - | |||||||||||||||||||||||||
| 2099 | - | |||||||||||||||||||||||||
| 2100 | if (d->format == RichText
| 0-18 | ||||||||||||||||||||||||
| 2101 | cursor.insertHtml(text); | - | ||||||||||||||||||||||||
| 2102 | } executed 4 times by 1 test: else {end of blockExecuted by:
| 4 | ||||||||||||||||||||||||
| 2103 | cursor.insertText(text); | - | ||||||||||||||||||||||||
| 2104 | } executed 16 times by 1 test: end of blockExecuted by:
| 16 | ||||||||||||||||||||||||
| 2105 | - | |||||||||||||||||||||||||
| 2106 | - | |||||||||||||||||||||||||
| 2107 | - | |||||||||||||||||||||||||
| 2108 | - | |||||||||||||||||||||||||
| 2109 | cursor.endEditBlock(); | - | ||||||||||||||||||||||||
| 2110 | d->control->updateCursorRectangle(false); | - | ||||||||||||||||||||||||
| 2111 | } executed 20 times by 1 test: end of blockExecuted by:
| 20 | ||||||||||||||||||||||||
| 2112 | QString QQuickTextEdit::linkAt(qreal x, qreal y) const | - | ||||||||||||||||||||||||
| 2113 | { | - | ||||||||||||||||||||||||
| 2114 | const QQuickTextEditPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 2115 | return executed 8 times by 1 test: d->control->anchorAt(QPointF(x + topPadding(), y + leftPadding()));return d->control->anchorAt(QPointF(x + topPadding(), y + leftPadding()));Executed by:
executed 8 times by 1 test: return d->control->anchorAt(QPointF(x + topPadding(), y + leftPadding()));Executed by:
| 8 | ||||||||||||||||||||||||
| 2116 | } | - | ||||||||||||||||||||||||
| 2117 | qreal QQuickTextEdit::padding() const | - | ||||||||||||||||||||||||
| 2118 | { | - | ||||||||||||||||||||||||
| 2119 | const QQuickTextEditPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 2120 | return executed 2 times by 1 test: d->padding();return d->padding();Executed by:
executed 2 times by 1 test: return d->padding();Executed by:
| 2 | ||||||||||||||||||||||||
| 2121 | } | - | ||||||||||||||||||||||||
| 2122 | - | |||||||||||||||||||||||||
| 2123 | void QQuickTextEdit::setPadding(qreal padding) | - | ||||||||||||||||||||||||
| 2124 | { | - | ||||||||||||||||||||||||
| 2125 | QQuickTextEditPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 2126 | if (qFuzzyCompare(d->padding(), padding)
| 0-4 | ||||||||||||||||||||||||
| 2127 | return; never executed: return; | 0 | ||||||||||||||||||||||||
| 2128 | - | |||||||||||||||||||||||||
| 2129 | d->extra.value().padding = padding; | - | ||||||||||||||||||||||||
| 2130 | updateSize(); | - | ||||||||||||||||||||||||
| 2131 | if (isComponentComplete()
| 2 | ||||||||||||||||||||||||
| 2132 | d->updateType = QQuickTextEditPrivate::UpdatePaintNode; | - | ||||||||||||||||||||||||
| 2133 | update(); | - | ||||||||||||||||||||||||
| 2134 | } executed 2 times by 1 test: end of blockExecuted by:
| 2 | ||||||||||||||||||||||||
| 2135 | paddingChanged(); | - | ||||||||||||||||||||||||
| 2136 | if (!d->extra.isAllocated()
| 0-4 | ||||||||||||||||||||||||
| 2137 | topPaddingChanged(); executed 2 times by 1 test: topPaddingChanged();Executed by:
| 2 | ||||||||||||||||||||||||
| 2138 | if (!d->extra.isAllocated()
| 0-4 | ||||||||||||||||||||||||
| 2139 | leftPaddingChanged(); executed 2 times by 1 test: leftPaddingChanged();Executed by:
| 2 | ||||||||||||||||||||||||
| 2140 | if (!d->extra.isAllocated()
| 0-4 | ||||||||||||||||||||||||
| 2141 | rightPaddingChanged(); executed 2 times by 1 test: rightPaddingChanged();Executed by:
| 2 | ||||||||||||||||||||||||
| 2142 | if (!d->extra.isAllocated()
| 0-4 | ||||||||||||||||||||||||
| 2143 | bottomPaddingChanged(); executed 2 times by 1 test: bottomPaddingChanged();Executed by:
| 2 | ||||||||||||||||||||||||
| 2144 | } executed 4 times by 1 test: end of blockExecuted by:
| 4 | ||||||||||||||||||||||||
| 2145 | - | |||||||||||||||||||||||||
| 2146 | void QQuickTextEdit::resetPadding() | - | ||||||||||||||||||||||||
| 2147 | { | - | ||||||||||||||||||||||||
| 2148 | setPadding(0); | - | ||||||||||||||||||||||||
| 2149 | } executed 2 times by 1 test: end of blockExecuted by:
| 2 | ||||||||||||||||||||||||
| 2150 | - | |||||||||||||||||||||||||
| 2151 | qreal QQuickTextEdit::topPadding() const | - | ||||||||||||||||||||||||
| 2152 | { | - | ||||||||||||||||||||||||
| 2153 | const QQuickTextEditPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 2154 | if (d->extra.isAllocated()
| 36-15614 | ||||||||||||||||||||||||
| 2155 | return executed 72 times by 1 test: d->extra->topPadding;return d->extra->topPadding;Executed by:
executed 72 times by 1 test: return d->extra->topPadding;Executed by:
| 72 | ||||||||||||||||||||||||
| 2156 | return executed 15650 times by 6 tests: d->padding();return d->padding();Executed by:
executed 15650 times by 6 tests: return d->padding();Executed by:
| 15650 | ||||||||||||||||||||||||
| 2157 | } | - | ||||||||||||||||||||||||
| 2158 | - | |||||||||||||||||||||||||
| 2159 | void QQuickTextEdit::setTopPadding(qreal padding) | - | ||||||||||||||||||||||||
| 2160 | { | - | ||||||||||||||||||||||||
| 2161 | QQuickTextEditPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 2162 | d->setTopPadding(padding); | - | ||||||||||||||||||||||||
| 2163 | } executed 4 times by 1 test: end of blockExecuted by:
| 4 | ||||||||||||||||||||||||
| 2164 | - | |||||||||||||||||||||||||
| 2165 | void QQuickTextEdit::resetTopPadding() | - | ||||||||||||||||||||||||
| 2166 | { | - | ||||||||||||||||||||||||
| 2167 | QQuickTextEditPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 2168 | d->setTopPadding(0, true); | - | ||||||||||||||||||||||||
| 2169 | } executed 2 times by 1 test: end of blockExecuted by:
| 2 | ||||||||||||||||||||||||
| 2170 | - | |||||||||||||||||||||||||
| 2171 | qreal QQuickTextEdit::leftPadding() const | - | ||||||||||||||||||||||||
| 2172 | { | - | ||||||||||||||||||||||||
| 2173 | const QQuickTextEditPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 2174 | if (d->extra.isAllocated()
| 46-20168 | ||||||||||||||||||||||||
| 2175 | return executed 114 times by 1 test: d->extra->leftPadding;return d->extra->leftPadding;Executed by:
executed 114 times by 1 test: return d->extra->leftPadding;Executed by:
| 114 | ||||||||||||||||||||||||
| 2176 | return executed 20214 times by 6 tests: d->padding();return d->padding();Executed by:
executed 20214 times by 6 tests: return d->padding();Executed by:
| 20214 | ||||||||||||||||||||||||
| 2177 | } | - | ||||||||||||||||||||||||
| 2178 | - | |||||||||||||||||||||||||
| 2179 | void QQuickTextEdit::setLeftPadding(qreal padding) | - | ||||||||||||||||||||||||
| 2180 | { | - | ||||||||||||||||||||||||
| 2181 | QQuickTextEditPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 2182 | d->setLeftPadding(padding); | - | ||||||||||||||||||||||||
| 2183 | } executed 4 times by 1 test: end of blockExecuted by:
| 4 | ||||||||||||||||||||||||
| 2184 | - | |||||||||||||||||||||||||
| 2185 | void QQuickTextEdit::resetLeftPadding() | - | ||||||||||||||||||||||||
| 2186 | { | - | ||||||||||||||||||||||||
| 2187 | QQuickTextEditPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 2188 | d->setLeftPadding(0, true); | - | ||||||||||||||||||||||||
| 2189 | } executed 2 times by 1 test: end of blockExecuted by:
| 2 | ||||||||||||||||||||||||
| 2190 | - | |||||||||||||||||||||||||
| 2191 | qreal QQuickTextEdit::rightPadding() const | - | ||||||||||||||||||||||||
| 2192 | { | - | ||||||||||||||||||||||||
| 2193 | const QQuickTextEditPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 2194 | if (d->extra.isAllocated()
| 30-14958 | ||||||||||||||||||||||||
| 2195 | return executed 102 times by 1 test: d->extra->rightPadding;return d->extra->rightPadding;Executed by:
executed 102 times by 1 test: return d->extra->rightPadding;Executed by:
| 102 | ||||||||||||||||||||||||
| 2196 | return executed 14988 times by 6 tests: d->padding();return d->padding();Executed by:
executed 14988 times by 6 tests: return d->padding();Executed by:
| 14988 | ||||||||||||||||||||||||
| 2197 | } | - | ||||||||||||||||||||||||
| 2198 | - | |||||||||||||||||||||||||
| 2199 | void QQuickTextEdit::setRightPadding(qreal padding) | - | ||||||||||||||||||||||||
| 2200 | { | - | ||||||||||||||||||||||||
| 2201 | QQuickTextEditPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 2202 | d->setRightPadding(padding); | - | ||||||||||||||||||||||||
| 2203 | } executed 4 times by 1 test: end of blockExecuted by:
| 4 | ||||||||||||||||||||||||
| 2204 | - | |||||||||||||||||||||||||
| 2205 | void QQuickTextEdit::resetRightPadding() | - | ||||||||||||||||||||||||
| 2206 | { | - | ||||||||||||||||||||||||
| 2207 | QQuickTextEditPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 2208 | d->setRightPadding(0, true); | - | ||||||||||||||||||||||||
| 2209 | } executed 2 times by 1 test: end of blockExecuted by:
| 2 | ||||||||||||||||||||||||
| 2210 | - | |||||||||||||||||||||||||
| 2211 | qreal QQuickTextEdit::bottomPadding() const | - | ||||||||||||||||||||||||
| 2212 | { | - | ||||||||||||||||||||||||
| 2213 | const QQuickTextEditPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 2214 | if (d->extra.isAllocated()
| 12-10406 | ||||||||||||||||||||||||
| 2215 | return executed 66 times by 1 test: d->extra->bottomPadding;return d->extra->bottomPadding;Executed by:
executed 66 times by 1 test: return d->extra->bottomPadding;Executed by:
| 66 | ||||||||||||||||||||||||
| 2216 | return executed 10418 times by 6 tests: d->padding();return d->padding();Executed by:
executed 10418 times by 6 tests: return d->padding();Executed by:
| 10418 | ||||||||||||||||||||||||
| 2217 | } | - | ||||||||||||||||||||||||
| 2218 | - | |||||||||||||||||||||||||
| 2219 | void QQuickTextEdit::setBottomPadding(qreal padding) | - | ||||||||||||||||||||||||
| 2220 | { | - | ||||||||||||||||||||||||
| 2221 | QQuickTextEditPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 2222 | d->setBottomPadding(padding); | - | ||||||||||||||||||||||||
| 2223 | } executed 4 times by 1 test: end of blockExecuted by:
| 4 | ||||||||||||||||||||||||
| 2224 | - | |||||||||||||||||||||||||
| 2225 | void QQuickTextEdit::resetBottomPadding() | - | ||||||||||||||||||||||||
| 2226 | { | - | ||||||||||||||||||||||||
| 2227 | QQuickTextEditPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 2228 | d->setBottomPadding(0, true); | - | ||||||||||||||||||||||||
| 2229 | } executed 2 times by 1 test: end of blockExecuted by:
| 2 | ||||||||||||||||||||||||
| 2230 | int QQuickTextEdit::tabStopDistance() const | - | ||||||||||||||||||||||||
| 2231 | { | - | ||||||||||||||||||||||||
| 2232 | const QQuickTextEditPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 2233 | return never executed: d->document->defaultTextOption().tabStopDistance();return d->document->defaultTextOption().tabStopDistance();never executed: return d->document->defaultTextOption().tabStopDistance(); | 0 | ||||||||||||||||||||||||
| 2234 | } | - | ||||||||||||||||||||||||
| 2235 | - | |||||||||||||||||||||||||
| 2236 | void QQuickTextEdit::setTabStopDistance(qreal distance) | - | ||||||||||||||||||||||||
| 2237 | { | - | ||||||||||||||||||||||||
| 2238 | QQuickTextEditPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 2239 | QTextOption textOptions = d->document->defaultTextOption(); | - | ||||||||||||||||||||||||
| 2240 | if (textOptions.tabStopDistance() == distance
| 0 | ||||||||||||||||||||||||
| 2241 | return; never executed: return; | 0 | ||||||||||||||||||||||||
| 2242 | - | |||||||||||||||||||||||||
| 2243 | textOptions.setTabStopDistance(distance); | - | ||||||||||||||||||||||||
| 2244 | d->document->setDefaultTextOption(textOptions); | - | ||||||||||||||||||||||||
| 2245 | tabStopDistanceChanged(distance); | - | ||||||||||||||||||||||||
| 2246 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 2247 | void QQuickTextEdit::clear() | - | ||||||||||||||||||||||||
| 2248 | { | - | ||||||||||||||||||||||||
| 2249 | QQuickTextEditPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 2250 | d->resetInputMethod(); | - | ||||||||||||||||||||||||
| 2251 | d->control->clear(); | - | ||||||||||||||||||||||||
| 2252 | } executed 6 times by 1 test: end of blockExecuted by:
| 6 | ||||||||||||||||||||||||
| 2253 | - | |||||||||||||||||||||||||
| 2254 | - | |||||||||||||||||||||||||
| 2255 | - | |||||||||||||||||||||||||
| Switch to Source code | Preprocessed file |