| Absolute File Name: | /home/opencoverage/opencoverage/guest-scripts/qtdeclarative/src/qtdeclarative/src/quick/items/qquicktextcontrol.cpp |
| Switch to Source code | Preprocessed file |
| Line | Source | Count | ||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 1 | - | |||||||||||||||||||||||||
| 2 | - | |||||||||||||||||||||||||
| 3 | - | |||||||||||||||||||||||||
| 4 | - | |||||||||||||||||||||||||
| 5 | - | |||||||||||||||||||||||||
| 6 | - | |||||||||||||||||||||||||
| 7 | - | |||||||||||||||||||||||||
| 8 | const int textCursorWidth = 1; | - | ||||||||||||||||||||||||
| 9 | - | |||||||||||||||||||||||||
| 10 | - | |||||||||||||||||||||||||
| 11 | extern const QLoggingCategory &DBG_HOVER_TRACE(); | - | ||||||||||||||||||||||||
| 12 | - | |||||||||||||||||||||||||
| 13 | - | |||||||||||||||||||||||||
| 14 | static QTextLine currentTextLine(const QTextCursor &cursor) | - | ||||||||||||||||||||||||
| 15 | { | - | ||||||||||||||||||||||||
| 16 | const QTextBlock block = cursor.block(); | - | ||||||||||||||||||||||||
| 17 | if (!block.isValid()
| 0-232 | ||||||||||||||||||||||||
| 18 | return never executed: QTextLine();return QTextLine();never executed: return QTextLine(); | 0 | ||||||||||||||||||||||||
| 19 | - | |||||||||||||||||||||||||
| 20 | const QTextLayout *layout = block.layout(); | - | ||||||||||||||||||||||||
| 21 | if (!layout
| 0-232 | ||||||||||||||||||||||||
| 22 | return never executed: QTextLine();return QTextLine();never executed: return QTextLine(); | 0 | ||||||||||||||||||||||||
| 23 | - | |||||||||||||||||||||||||
| 24 | const int relativePos = cursor.position() - block.position(); | - | ||||||||||||||||||||||||
| 25 | return executed 232 times by 1 test: layout->lineForTextPosition(relativePos);return layout->lineForTextPosition(relativePos);Executed by:
executed 232 times by 1 test: return layout->lineForTextPosition(relativePos);Executed by:
| 232 | ||||||||||||||||||||||||
| 26 | } | - | ||||||||||||||||||||||||
| 27 | - | |||||||||||||||||||||||||
| 28 | QQuickTextControlPrivate::QQuickTextControlPrivate() | - | ||||||||||||||||||||||||
| 29 | : doc(nullptr), | - | ||||||||||||||||||||||||
| 30 | - | |||||||||||||||||||||||||
| 31 | preeditCursor(0), | - | ||||||||||||||||||||||||
| 32 | - | |||||||||||||||||||||||||
| 33 | interactionFlags(Qt::TextEditorInteraction), | - | ||||||||||||||||||||||||
| 34 | cursorOn(false), | - | ||||||||||||||||||||||||
| 35 | cursorIsFocusIndicator(false), | - | ||||||||||||||||||||||||
| 36 | mousePressed(false), | - | ||||||||||||||||||||||||
| 37 | lastSelectionState(false), | - | ||||||||||||||||||||||||
| 38 | ignoreAutomaticScrollbarAdjustement(false), | - | ||||||||||||||||||||||||
| 39 | overwriteMode(false), | - | ||||||||||||||||||||||||
| 40 | acceptRichText(true), | - | ||||||||||||||||||||||||
| 41 | cursorVisible(false), | - | ||||||||||||||||||||||||
| 42 | cursorBlinkingEnabled(false), | - | ||||||||||||||||||||||||
| 43 | hasFocus(false), | - | ||||||||||||||||||||||||
| 44 | hadSelectionOnMousePress(false), | - | ||||||||||||||||||||||||
| 45 | wordSelectionEnabled(false), | - | ||||||||||||||||||||||||
| 46 | hasImState(false), | - | ||||||||||||||||||||||||
| 47 | cursorRectangleChanged(false), | - | ||||||||||||||||||||||||
| 48 | lastSelectionStart(-1), | - | ||||||||||||||||||||||||
| 49 | lastSelectionEnd(-1) | - | ||||||||||||||||||||||||
| 50 | {} executed 1080 times by 6 tests: end of blockExecuted by:
| 1080 | ||||||||||||||||||||||||
| 51 | - | |||||||||||||||||||||||||
| 52 | bool QQuickTextControlPrivate::cursorMoveKeyEvent(QKeyEvent *e) | - | ||||||||||||||||||||||||
| 53 | { | - | ||||||||||||||||||||||||
| 54 | - | |||||||||||||||||||||||||
| 55 | - | |||||||||||||||||||||||||
| 56 | - | |||||||||||||||||||||||||
| 57 | - | |||||||||||||||||||||||||
| 58 | QQuickTextControl * const q = q_func(); | - | ||||||||||||||||||||||||
| 59 | if (cursor.isNull()
| 0-890 | ||||||||||||||||||||||||
| 60 | return never executed: false;return false;never executed: return false; | 0 | ||||||||||||||||||||||||
| 61 | - | |||||||||||||||||||||||||
| 62 | const QTextCursor oldSelection = cursor; | - | ||||||||||||||||||||||||
| 63 | const int oldCursorPos = cursor.position(); | - | ||||||||||||||||||||||||
| 64 | - | |||||||||||||||||||||||||
| 65 | QTextCursor::MoveMode mode = QTextCursor::MoveAnchor; | - | ||||||||||||||||||||||||
| 66 | QTextCursor::MoveOperation op = QTextCursor::NoMove; | - | ||||||||||||||||||||||||
| 67 | - | |||||||||||||||||||||||||
| 68 | if (false) { dead code: { } | - | ||||||||||||||||||||||||
| 69 | } dead code: { } | - | ||||||||||||||||||||||||
| 70 | - | |||||||||||||||||||||||||
| 71 | if (e == QKeySequence::MoveToNextChar
| 28-862 | ||||||||||||||||||||||||
| 72 | op = QTextCursor::Right; | - | ||||||||||||||||||||||||
| 73 | } executed 28 times by 2 tests: end of blockExecuted by:
| 28 | ||||||||||||||||||||||||
| 74 | else if (e == QKeySequence::MoveToPreviousChar
| 26-836 | ||||||||||||||||||||||||
| 75 | op = QTextCursor::Left; | - | ||||||||||||||||||||||||
| 76 | } executed 26 times by 1 test: end of blockExecuted by:
| 26 | ||||||||||||||||||||||||
| 77 | else if (e == QKeySequence::SelectNextChar
| 22-814 | ||||||||||||||||||||||||
| 78 | op = QTextCursor::Right; | - | ||||||||||||||||||||||||
| 79 | mode = QTextCursor::KeepAnchor; | - | ||||||||||||||||||||||||
| 80 | } executed 22 times by 1 test: end of blockExecuted by:
| 22 | ||||||||||||||||||||||||
| 81 | else if (e == QKeySequence::SelectPreviousChar
| 26-788 | ||||||||||||||||||||||||
| 82 | op = QTextCursor::Left; | - | ||||||||||||||||||||||||
| 83 | mode = QTextCursor::KeepAnchor; | - | ||||||||||||||||||||||||
| 84 | } executed 26 times by 1 test: end of blockExecuted by:
| 26 | ||||||||||||||||||||||||
| 85 | else if (e == QKeySequence::SelectNextWord
| 6-782 | ||||||||||||||||||||||||
| 86 | op = QTextCursor::WordRight; | - | ||||||||||||||||||||||||
| 87 | mode = QTextCursor::KeepAnchor; | - | ||||||||||||||||||||||||
| 88 | } executed 6 times by 1 test: end of blockExecuted by:
| 6 | ||||||||||||||||||||||||
| 89 | else if (e == QKeySequence::SelectPreviousWord
| 6-776 | ||||||||||||||||||||||||
| 90 | op = QTextCursor::WordLeft; | - | ||||||||||||||||||||||||
| 91 | mode = QTextCursor::KeepAnchor; | - | ||||||||||||||||||||||||
| 92 | } executed 6 times by 1 test: end of blockExecuted by:
| 6 | ||||||||||||||||||||||||
| 93 | else if (e == QKeySequence::SelectStartOfLine
| 6-770 | ||||||||||||||||||||||||
| 94 | op = QTextCursor::StartOfLine; | - | ||||||||||||||||||||||||
| 95 | mode = QTextCursor::KeepAnchor; | - | ||||||||||||||||||||||||
| 96 | } executed 6 times by 1 test: end of blockExecuted by:
| 6 | ||||||||||||||||||||||||
| 97 | else if (e == QKeySequence::SelectEndOfLine
| 4-766 | ||||||||||||||||||||||||
| 98 | op = QTextCursor::EndOfLine; | - | ||||||||||||||||||||||||
| 99 | mode = QTextCursor::KeepAnchor; | - | ||||||||||||||||||||||||
| 100 | } executed 4 times by 1 test: end of blockExecuted by:
| 4 | ||||||||||||||||||||||||
| 101 | else if (e == QKeySequence::SelectStartOfBlock
| 0-766 | ||||||||||||||||||||||||
| 102 | op = QTextCursor::StartOfBlock; | - | ||||||||||||||||||||||||
| 103 | mode = QTextCursor::KeepAnchor; | - | ||||||||||||||||||||||||
| 104 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 105 | else if (e == QKeySequence::SelectEndOfBlock
| 0-766 | ||||||||||||||||||||||||
| 106 | op = QTextCursor::EndOfBlock; | - | ||||||||||||||||||||||||
| 107 | mode = QTextCursor::KeepAnchor; | - | ||||||||||||||||||||||||
| 108 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 109 | else if (e == QKeySequence::SelectStartOfDocument
| 0-766 | ||||||||||||||||||||||||
| 110 | op = QTextCursor::Start; | - | ||||||||||||||||||||||||
| 111 | mode = QTextCursor::KeepAnchor; | - | ||||||||||||||||||||||||
| 112 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 113 | else if (e == QKeySequence::SelectEndOfDocument
| 2-764 | ||||||||||||||||||||||||
| 114 | op = QTextCursor::End; | - | ||||||||||||||||||||||||
| 115 | mode = QTextCursor::KeepAnchor; | - | ||||||||||||||||||||||||
| 116 | } executed 2 times by 1 test: end of blockExecuted by:
| 2 | ||||||||||||||||||||||||
| 117 | else if (e == QKeySequence::SelectPreviousLine
| 0-764 | ||||||||||||||||||||||||
| 118 | op = QTextCursor::Up; | - | ||||||||||||||||||||||||
| 119 | mode = QTextCursor::KeepAnchor; | - | ||||||||||||||||||||||||
| 120 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 121 | else if (e == QKeySequence::SelectNextLine
| 0-764 | ||||||||||||||||||||||||
| 122 | op = QTextCursor::Down; | - | ||||||||||||||||||||||||
| 123 | mode = QTextCursor::KeepAnchor; | - | ||||||||||||||||||||||||
| 124 | { | - | ||||||||||||||||||||||||
| 125 | QTextBlock block = cursor.block(); | - | ||||||||||||||||||||||||
| 126 | QTextLine line = currentTextLine(cursor); | - | ||||||||||||||||||||||||
| 127 | if (!block.next().isValid()
| 0 | ||||||||||||||||||||||||
| 128 | && line.isValid()
| 0 | ||||||||||||||||||||||||
| 129 | && line.lineNumber() == block.layout()->lineCount() - 1
| 0 | ||||||||||||||||||||||||
| 130 | op = QTextCursor::End; never executed: op = QTextCursor::End; | 0 | ||||||||||||||||||||||||
| 131 | } | - | ||||||||||||||||||||||||
| 132 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 133 | else if (e == QKeySequence::MoveToNextWord
| 4-760 | ||||||||||||||||||||||||
| 134 | op = QTextCursor::WordRight; | - | ||||||||||||||||||||||||
| 135 | } executed 4 times by 1 test: end of blockExecuted by:
| 4 | ||||||||||||||||||||||||
| 136 | else if (e == QKeySequence::MoveToPreviousWord
| 4-756 | ||||||||||||||||||||||||
| 137 | op = QTextCursor::WordLeft; | - | ||||||||||||||||||||||||
| 138 | } executed 4 times by 1 test: end of blockExecuted by:
| 4 | ||||||||||||||||||||||||
| 139 | else if (e == QKeySequence::MoveToEndOfBlock
| 0-756 | ||||||||||||||||||||||||
| 140 | op = QTextCursor::EndOfBlock; | - | ||||||||||||||||||||||||
| 141 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 142 | else if (e == QKeySequence::MoveToStartOfBlock
| 0-756 | ||||||||||||||||||||||||
| 143 | op = QTextCursor::StartOfBlock; | - | ||||||||||||||||||||||||
| 144 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 145 | else if (e == QKeySequence::MoveToNextLine
| 0-756 | ||||||||||||||||||||||||
| 146 | op = QTextCursor::Down; | - | ||||||||||||||||||||||||
| 147 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 148 | else if (e == QKeySequence::MoveToPreviousLine
| 0-756 | ||||||||||||||||||||||||
| 149 | op = QTextCursor::Up; | - | ||||||||||||||||||||||||
| 150 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 151 | else if (e == QKeySequence::MoveToStartOfLine
| 10-746 | ||||||||||||||||||||||||
| 152 | op = QTextCursor::StartOfLine; | - | ||||||||||||||||||||||||
| 153 | } executed 10 times by 1 test: end of blockExecuted by:
| 10 | ||||||||||||||||||||||||
| 154 | else if (e == QKeySequence::MoveToEndOfLine
| 2-744 | ||||||||||||||||||||||||
| 155 | op = QTextCursor::EndOfLine; | - | ||||||||||||||||||||||||
| 156 | } executed 2 times by 1 test: end of blockExecuted by:
| 2 | ||||||||||||||||||||||||
| 157 | else if (e == QKeySequence::MoveToStartOfDocument
| 0-744 | ||||||||||||||||||||||||
| 158 | op = QTextCursor::Start; | - | ||||||||||||||||||||||||
| 159 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 160 | else if (e == QKeySequence::MoveToEndOfDocument
| 0-744 | ||||||||||||||||||||||||
| 161 | op = QTextCursor::End; | - | ||||||||||||||||||||||||
| 162 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 163 | - | |||||||||||||||||||||||||
| 164 | else { | - | ||||||||||||||||||||||||
| 165 | return executed 744 times by 2 tests: false;return false;Executed by:
executed 744 times by 2 tests: return false;Executed by:
| 744 | ||||||||||||||||||||||||
| 166 | } | - | ||||||||||||||||||||||||
| 167 | bool visualNavigation = cursor.visualNavigation(); | - | ||||||||||||||||||||||||
| 168 | cursor.setVisualNavigation(true); | - | ||||||||||||||||||||||||
| 169 | const bool moved = cursor.movePosition(op, mode); | - | ||||||||||||||||||||||||
| 170 | cursor.setVisualNavigation(visualNavigation); | - | ||||||||||||||||||||||||
| 171 | - | |||||||||||||||||||||||||
| 172 | bool isNavigationEvent | - | ||||||||||||||||||||||||
| 173 | = e->key() == Qt::Key_Up
| 0-146 | ||||||||||||||||||||||||
| 174 | || e->key() == Qt::Key_Down
| 0-146 | ||||||||||||||||||||||||
| 175 | || e->key() == Qt::Key_Left
| 46-100 | ||||||||||||||||||||||||
| 176 | || e->key() == Qt::Key_Right
| 48-52 | ||||||||||||||||||||||||
| 177 | - | |||||||||||||||||||||||||
| 178 | if (moved
| 18-128 | ||||||||||||||||||||||||
| 179 | if (cursor.position() != oldCursorPos
| 0-128 | ||||||||||||||||||||||||
| 180 | q->cursorPositionChanged(); executed 128 times by 2 tests: q->cursorPositionChanged();Executed by:
| 128 | ||||||||||||||||||||||||
| 181 | q->updateCursorRectangle(true); | - | ||||||||||||||||||||||||
| 182 | } executed 128 times by 2 tests: else if (isNavigationEventend of blockExecuted by:
| 0-128 | ||||||||||||||||||||||||
| 183 | return executed 14 times by 2 tests: false;return false;Executed by:
executed 14 times by 2 tests: return false;Executed by:
| 14 | ||||||||||||||||||||||||
| 184 | } | - | ||||||||||||||||||||||||
| 185 | - | |||||||||||||||||||||||||
| 186 | selectionChanged( (mode == QTextCursor::KeepAnchor)); | - | ||||||||||||||||||||||||
| 187 | - | |||||||||||||||||||||||||
| 188 | repaintOldAndNewSelection(oldSelection); | - | ||||||||||||||||||||||||
| 189 | - | |||||||||||||||||||||||||
| 190 | return executed 132 times by 2 tests: true;return true;Executed by:
executed 132 times by 2 tests: return true;Executed by:
| 132 | ||||||||||||||||||||||||
| 191 | } | - | ||||||||||||||||||||||||
| 192 | - | |||||||||||||||||||||||||
| 193 | void QQuickTextControlPrivate::updateCurrentCharFormat() | - | ||||||||||||||||||||||||
| 194 | { | - | ||||||||||||||||||||||||
| 195 | QQuickTextControl * const q = q_func(); | - | ||||||||||||||||||||||||
| 196 | - | |||||||||||||||||||||||||
| 197 | QTextCharFormat fmt = cursor.charFormat(); | - | ||||||||||||||||||||||||
| 198 | if (fmt == lastCharFormat
| 10-7560 | ||||||||||||||||||||||||
| 199 | return; executed 7560 times by 6 tests: return;Executed by:
| 7560 | ||||||||||||||||||||||||
| 200 | lastCharFormat = fmt; | - | ||||||||||||||||||||||||
| 201 | - | |||||||||||||||||||||||||
| 202 | q->currentCharFormatChanged(fmt); | - | ||||||||||||||||||||||||
| 203 | cursorRectangleChanged = true; | - | ||||||||||||||||||||||||
| 204 | } executed 10 times by 1 test: end of blockExecuted by:
| 10 | ||||||||||||||||||||||||
| 205 | - | |||||||||||||||||||||||||
| 206 | void QQuickTextControlPrivate::setContent(Qt::TextFormat format, const QString &text) | - | ||||||||||||||||||||||||
| 207 | { | - | ||||||||||||||||||||||||
| 208 | QQuickTextControl * const q = q_func(); | - | ||||||||||||||||||||||||
| 209 | - | |||||||||||||||||||||||||
| 210 | - | |||||||||||||||||||||||||
| 211 | cancelPreedit(); | - | ||||||||||||||||||||||||
| 212 | - | |||||||||||||||||||||||||
| 213 | - | |||||||||||||||||||||||||
| 214 | - | |||||||||||||||||||||||||
| 215 | - | |||||||||||||||||||||||||
| 216 | const QTextCharFormat charFormatForInsertion = cursor.charFormat(); | - | ||||||||||||||||||||||||
| 217 | - | |||||||||||||||||||||||||
| 218 | bool previousUndoRedoState = doc->isUndoRedoEnabled(); | - | ||||||||||||||||||||||||
| 219 | doc->setUndoRedoEnabled(false); | - | ||||||||||||||||||||||||
| 220 | - | |||||||||||||||||||||||||
| 221 | const int oldCursorPos = cursor.position(); | - | ||||||||||||||||||||||||
| 222 | - | |||||||||||||||||||||||||
| 223 | - | |||||||||||||||||||||||||
| 224 | { QTextDocument *sender = (doc); QQuickTextControl *receiver = (q); const char *signal = (qFlagLocation("2""contentsChanged()" "\0" __FILE__ ":" "303")); const char *method = (qFlagLocation("2""textChanged()" "\0" __FILE__ ":" "303")); static int signalIdx = -1; static int methodIdx = -1; if (signalIdx < 0
executed 10 times by 5 tests: if (methodIdx < 0end of blockExecuted by:
never executed: else methodIdx = QQuickTextControl::staticMetaObject.indexOfSignal(method+1);methodIdx = QQuickTextControl::staticMetaObject.indexOfSlot(method+1);executed 10 times by 5 tests: } ((signalIdx != -1 && methodIdx != -1) ? static_cast<void>(0) : qt_assert("signalIdx != -1 && methodIdx != -1", __FILE__, 303)); QMetaObject::disconnect(sender, signalIdx, receiver, methodIdx); };methodIdx = QQuickTextControl::staticMetaObject.indexOfSignal(method+1);Executed by:
| 0-1058 | ||||||||||||||||||||||||
| 225 | - | |||||||||||||||||||||||||
| 226 | if (!text.isEmpty()
| 24-1044 | ||||||||||||||||||||||||
| 227 | - | |||||||||||||||||||||||||
| 228 | - | |||||||||||||||||||||||||
| 229 | - | |||||||||||||||||||||||||
| 230 | - | |||||||||||||||||||||||||
| 231 | - | |||||||||||||||||||||||||
| 232 | - | |||||||||||||||||||||||||
| 233 | cursor = QTextCursor(); | - | ||||||||||||||||||||||||
| 234 | if (format == Qt::PlainText
| 94-950 | ||||||||||||||||||||||||
| 235 | QTextCursor formatCursor(doc); | - | ||||||||||||||||||||||||
| 236 | - | |||||||||||||||||||||||||
| 237 | - | |||||||||||||||||||||||||
| 238 | - | |||||||||||||||||||||||||
| 239 | formatCursor.beginEditBlock(); | - | ||||||||||||||||||||||||
| 240 | doc->setPlainText(text); | - | ||||||||||||||||||||||||
| 241 | doc->setUndoRedoEnabled(false); | - | ||||||||||||||||||||||||
| 242 | formatCursor.select(QTextCursor::Document); | - | ||||||||||||||||||||||||
| 243 | formatCursor.setCharFormat(charFormatForInsertion); | - | ||||||||||||||||||||||||
| 244 | formatCursor.endEditBlock(); | - | ||||||||||||||||||||||||
| 245 | } executed 950 times by 5 tests: else {end of blockExecuted by:
| 950 | ||||||||||||||||||||||||
| 246 | - | |||||||||||||||||||||||||
| 247 | doc->setHtml(text); | - | ||||||||||||||||||||||||
| 248 | - | |||||||||||||||||||||||||
| 249 | - | |||||||||||||||||||||||||
| 250 | - | |||||||||||||||||||||||||
| 251 | doc->setUndoRedoEnabled(false); | - | ||||||||||||||||||||||||
| 252 | } executed 94 times by 3 tests: end of blockExecuted by:
| 94 | ||||||||||||||||||||||||
| 253 | cursor = QTextCursor(doc); | - | ||||||||||||||||||||||||
| 254 | } executed 1044 times by 5 tests: else {end of blockExecuted by:
| 1044 | ||||||||||||||||||||||||
| 255 | doc->clear(); | - | ||||||||||||||||||||||||
| 256 | } executed 24 times by 1 test: end of blockExecuted by:
| 24 | ||||||||||||||||||||||||
| 257 | cursor.setCharFormat(charFormatForInsertion); | - | ||||||||||||||||||||||||
| 258 | - | |||||||||||||||||||||||||
| 259 | { QTextDocument *sender = (doc); QQuickTextControl *receiver = (q); const char *signal = (qFlagLocation("2""contentsChanged()" "\0" __FILE__ ":" "338")); const char *method = (qFlagLocation("2""textChanged()" "\0" __FILE__ ":" "338")); static int signalIdx = -1; static int methodIdx = -1; if (signalIdx < 0
executed 10 times by 5 tests: if (methodIdx < 0end of blockExecuted by:
never executed: else methodIdx = QQuickTextControl::staticMetaObject.indexOfSignal(method+1);methodIdx = QQuickTextControl::staticMetaObject.indexOfSlot(method+1);executed 10 times by 5 tests: } ((signalIdx != -1 && methodIdx != -1) ? static_cast<void>(0) : qt_assert("signalIdx != -1 && methodIdx != -1", __FILE__, 338)); QMetaObject::connect(sender, signalIdx, receiver, methodIdx, Qt::DirectConnection); };methodIdx = QQuickTextControl::staticMetaObject.indexOfSignal(method+1);Executed by:
| 0-1058 | ||||||||||||||||||||||||
| 260 | q->textChanged(); | - | ||||||||||||||||||||||||
| 261 | doc->setUndoRedoEnabled(previousUndoRedoState); | - | ||||||||||||||||||||||||
| 262 | _q_updateCurrentCharFormatAndSelection(); | - | ||||||||||||||||||||||||
| 263 | doc->setModified(false); | - | ||||||||||||||||||||||||
| 264 | - | |||||||||||||||||||||||||
| 265 | q->updateCursorRectangle(true); | - | ||||||||||||||||||||||||
| 266 | if (cursor.position() != oldCursorPos
| 20-1048 | ||||||||||||||||||||||||
| 267 | q->cursorPositionChanged(); executed 20 times by 1 test: q->cursorPositionChanged();Executed by:
| 20 | ||||||||||||||||||||||||
| 268 | } executed 1068 times by 5 tests: end of blockExecuted by:
| 1068 | ||||||||||||||||||||||||
| 269 | - | |||||||||||||||||||||||||
| 270 | void QQuickTextControlPrivate::setCursorPosition(const QPointF &pos) | - | ||||||||||||||||||||||||
| 271 | { | - | ||||||||||||||||||||||||
| 272 | QQuickTextControl * const q = q_func(); | - | ||||||||||||||||||||||||
| 273 | const int cursorPos = q->hitTest(pos, Qt::FuzzyHit); | - | ||||||||||||||||||||||||
| 274 | if (cursorPos == -1
| 0-106 | ||||||||||||||||||||||||
| 275 | return; never executed: return; | 0 | ||||||||||||||||||||||||
| 276 | cursor.setPosition(cursorPos); | - | ||||||||||||||||||||||||
| 277 | } executed 106 times by 1 test: end of blockExecuted by:
| 106 | ||||||||||||||||||||||||
| 278 | - | |||||||||||||||||||||||||
| 279 | void QQuickTextControlPrivate::setCursorPosition(int pos, QTextCursor::MoveMode mode) | - | ||||||||||||||||||||||||
| 280 | { | - | ||||||||||||||||||||||||
| 281 | cursor.setPosition(pos, mode); | - | ||||||||||||||||||||||||
| 282 | - | |||||||||||||||||||||||||
| 283 | if (mode != QTextCursor::KeepAnchor
| 132-332 | ||||||||||||||||||||||||
| 284 | selectedWordOnDoubleClick = QTextCursor(); | - | ||||||||||||||||||||||||
| 285 | selectedBlockOnTripleClick = QTextCursor(); | - | ||||||||||||||||||||||||
| 286 | } executed 332 times by 1 test: end of blockExecuted by:
| 332 | ||||||||||||||||||||||||
| 287 | } executed 464 times by 1 test: end of blockExecuted by:
| 464 | ||||||||||||||||||||||||
| 288 | - | |||||||||||||||||||||||||
| 289 | void QQuickTextControlPrivate::repaintCursor() | - | ||||||||||||||||||||||||
| 290 | { | - | ||||||||||||||||||||||||
| 291 | QQuickTextControl * const q = q_func(); | - | ||||||||||||||||||||||||
| 292 | q->updateCursorRequest(); | - | ||||||||||||||||||||||||
| 293 | } executed 2022 times by 6 tests: end of blockExecuted by:
| 2022 | ||||||||||||||||||||||||
| 294 | - | |||||||||||||||||||||||||
| 295 | void QQuickTextControlPrivate::repaintOldAndNewSelection(const QTextCursor &oldSelection) | - | ||||||||||||||||||||||||
| 296 | { | - | ||||||||||||||||||||||||
| 297 | QQuickTextControl * const q = q_func(); | - | ||||||||||||||||||||||||
| 298 | if (cursor.hasSelection()
| 1376-2266 | ||||||||||||||||||||||||
| 299 | && oldSelection.hasSelection()
| 568-808 | ||||||||||||||||||||||||
| 300 | && cursor.currentFrame() == oldSelection.currentFrame()
| 0-808 | ||||||||||||||||||||||||
| 301 | && !cursor.hasComplexSelection()
| 0-808 | ||||||||||||||||||||||||
| 302 | && !oldSelection.hasComplexSelection()
| 0-808 | ||||||||||||||||||||||||
| 303 | && cursor.anchor() == oldSelection.anchor()
| 156-652 | ||||||||||||||||||||||||
| 304 | ) { | - | ||||||||||||||||||||||||
| 305 | QTextCursor differenceSelection(doc); | - | ||||||||||||||||||||||||
| 306 | differenceSelection.setPosition(oldSelection.position()); | - | ||||||||||||||||||||||||
| 307 | differenceSelection.setPosition(cursor.position(), QTextCursor::KeepAnchor); | - | ||||||||||||||||||||||||
| 308 | q->updateRequest(); | - | ||||||||||||||||||||||||
| 309 | } executed 652 times by 1 test: else {end of blockExecuted by:
| 652 | ||||||||||||||||||||||||
| 310 | if (!oldSelection.hasSelection()
| 344-2646 | ||||||||||||||||||||||||
| 311 | if (!oldSelection.isNull()
| 936-1142 | ||||||||||||||||||||||||
| 312 | q->updateCursorRequest(); executed 1142 times by 3 tests: q->updateCursorRequest();Executed by:
| 1142 | ||||||||||||||||||||||||
| 313 | q->updateCursorRequest(); | - | ||||||||||||||||||||||||
| 314 | - | |||||||||||||||||||||||||
| 315 | } executed 2078 times by 3 tests: else {end of blockExecuted by:
| 2078 | ||||||||||||||||||||||||
| 316 | if (!oldSelection.isNull()
| 26-886 | ||||||||||||||||||||||||
| 317 | q->updateRequest(); executed 886 times by 1 test: q->updateRequest();Executed by:
| 886 | ||||||||||||||||||||||||
| 318 | q->updateRequest(); | - | ||||||||||||||||||||||||
| 319 | } executed 912 times by 1 test: end of blockExecuted by:
| 912 | ||||||||||||||||||||||||
| 320 | } | - | ||||||||||||||||||||||||
| 321 | } | - | ||||||||||||||||||||||||
| 322 | - | |||||||||||||||||||||||||
| 323 | void QQuickTextControlPrivate::selectionChanged(bool forceEmitSelectionChanged ) | - | ||||||||||||||||||||||||
| 324 | { | - | ||||||||||||||||||||||||
| 325 | QQuickTextControl * const q = q_func(); | - | ||||||||||||||||||||||||
| 326 | if (forceEmitSelectionChanged
| 792-7852 | ||||||||||||||||||||||||
| 327 | - | |||||||||||||||||||||||||
| 328 | if (hasFocus
| 22-770 | ||||||||||||||||||||||||
| 329 | (static_cast< executed 770 times by 1 test: QGuiApplication *>(QCoreApplication::instance()))->inputMethod()->update(Qt::ImCurrentSelection);(static_cast<QGuiApplication *>(QCoreApplication::instance()))->inputMethod()->update(Qt::ImCurrentSelection);Executed by:
executed 770 times by 1 test: (static_cast<QGuiApplication *>(QCoreApplication::instance()))->inputMethod()->update(Qt::ImCurrentSelection);Executed by:
| 770 | ||||||||||||||||||||||||
| 330 | - | |||||||||||||||||||||||||
| 331 | q->selectionChanged(); | - | ||||||||||||||||||||||||
| 332 | } executed 792 times by 1 test: end of blockExecuted by:
| 792 | ||||||||||||||||||||||||
| 333 | - | |||||||||||||||||||||||||
| 334 | bool current = cursor.hasSelection(); | - | ||||||||||||||||||||||||
| 335 | int selectionStart = cursor.selectionStart(); | - | ||||||||||||||||||||||||
| 336 | int selectionEnd = cursor.selectionEnd(); | - | ||||||||||||||||||||||||
| 337 | if (current == lastSelectionState
| 184-7890 | ||||||||||||||||||||||||
| 338 | return; executed 7484 times by 6 tests: return;Executed by:
| 7484 | ||||||||||||||||||||||||
| 339 | - | |||||||||||||||||||||||||
| 340 | if (lastSelectionState != current
| 406-754 | ||||||||||||||||||||||||
| 341 | lastSelectionState = current; | - | ||||||||||||||||||||||||
| 342 | q->copyAvailable(current); | - | ||||||||||||||||||||||||
| 343 | } executed 754 times by 1 test: end of blockExecuted by:
| 754 | ||||||||||||||||||||||||
| 344 | - | |||||||||||||||||||||||||
| 345 | lastSelectionStart = selectionStart; | - | ||||||||||||||||||||||||
| 346 | lastSelectionEnd = selectionEnd; | - | ||||||||||||||||||||||||
| 347 | - | |||||||||||||||||||||||||
| 348 | if (!forceEmitSelectionChanged
| 184-976 | ||||||||||||||||||||||||
| 349 | - | |||||||||||||||||||||||||
| 350 | if (hasFocus
| 422-554 | ||||||||||||||||||||||||
| 351 | (static_cast< executed 422 times by 1 test: QGuiApplication *>(QCoreApplication::instance()))->inputMethod()->update(Qt::ImCurrentSelection);(static_cast<QGuiApplication *>(QCoreApplication::instance()))->inputMethod()->update(Qt::ImCurrentSelection);Executed by:
executed 422 times by 1 test: (static_cast<QGuiApplication *>(QCoreApplication::instance()))->inputMethod()->update(Qt::ImCurrentSelection);Executed by:
| 422 | ||||||||||||||||||||||||
| 352 | - | |||||||||||||||||||||||||
| 353 | q->selectionChanged(); | - | ||||||||||||||||||||||||
| 354 | } executed 976 times by 1 test: end of blockExecuted by:
| 976 | ||||||||||||||||||||||||
| 355 | q->updateCursorRectangle(true); | - | ||||||||||||||||||||||||
| 356 | } executed 1160 times by 1 test: end of blockExecuted by:
| 1160 | ||||||||||||||||||||||||
| 357 | - | |||||||||||||||||||||||||
| 358 | void QQuickTextControlPrivate::_q_updateCurrentCharFormatAndSelection() | - | ||||||||||||||||||||||||
| 359 | { | - | ||||||||||||||||||||||||
| 360 | updateCurrentCharFormat(); | - | ||||||||||||||||||||||||
| 361 | selectionChanged(); | - | ||||||||||||||||||||||||
| 362 | } executed 6768 times by 6 tests: end of blockExecuted by:
| 6768 | ||||||||||||||||||||||||
| 363 | - | |||||||||||||||||||||||||
| 364 | - | |||||||||||||||||||||||||
| 365 | void QQuickTextControlPrivate::setClipboardSelection() | - | ||||||||||||||||||||||||
| 366 | { | - | ||||||||||||||||||||||||
| 367 | QClipboard *clipboard = QGuiApplication::clipboard(); | - | ||||||||||||||||||||||||
| 368 | if (!cursor.hasSelection()
| 0-872 | ||||||||||||||||||||||||
| 369 | return; executed 872 times by 2 tests: return;Executed by:
| 872 | ||||||||||||||||||||||||
| 370 | QQuickTextControl * const q = q_func(); | - | ||||||||||||||||||||||||
| 371 | QMimeData *data = q->createMimeDataFromSelection(); | - | ||||||||||||||||||||||||
| 372 | clipboard->setMimeData(data, QClipboard::Selection); | - | ||||||||||||||||||||||||
| 373 | } executed 604 times by 1 test: end of blockExecuted by:
| 604 | ||||||||||||||||||||||||
| 374 | - | |||||||||||||||||||||||||
| 375 | - | |||||||||||||||||||||||||
| 376 | void QQuickTextControlPrivate::_q_updateCursorPosChanged(const QTextCursor &someCursor) | - | ||||||||||||||||||||||||
| 377 | { | - | ||||||||||||||||||||||||
| 378 | QQuickTextControl * const q = q_func(); | - | ||||||||||||||||||||||||
| 379 | if (someCursor.isCopyOf(cursor)
| 1042-1056 | ||||||||||||||||||||||||
| 380 | q->cursorPositionChanged(); | - | ||||||||||||||||||||||||
| 381 | q->updateCursorRectangle(true); | - | ||||||||||||||||||||||||
| 382 | } executed 1042 times by 1 test: end of blockExecuted by:
| 1042 | ||||||||||||||||||||||||
| 383 | } executed 2098 times by 5 tests: end of blockExecuted by:
| 2098 | ||||||||||||||||||||||||
| 384 | - | |||||||||||||||||||||||||
| 385 | void QQuickTextControlPrivate::setBlinkingCursorEnabled(bool enable) | - | ||||||||||||||||||||||||
| 386 | { | - | ||||||||||||||||||||||||
| 387 | if (cursorBlinkingEnabled == enable
| 454-490 | ||||||||||||||||||||||||
| 388 | return; executed 454 times by 3 tests: return;Executed by:
| 454 | ||||||||||||||||||||||||
| 389 | - | |||||||||||||||||||||||||
| 390 | cursorBlinkingEnabled = enable; | - | ||||||||||||||||||||||||
| 391 | updateCursorFlashTime(); | - | ||||||||||||||||||||||||
| 392 | - | |||||||||||||||||||||||||
| 393 | if (enable
| 112-378 | ||||||||||||||||||||||||
| 394 | connect((static_cast<QGuiApplication *>(QCoreApplication::instance()))->styleHints(), &QStyleHints::cursorFlashTimeChanged, this, &QQuickTextControlPrivate::updateCursorFlashTime); executed 378 times by 4 tests: connect((static_cast<QGuiApplication *>(QCoreApplication::instance()))->styleHints(), &QStyleHints::cursorFlashTimeChanged, this, &QQuickTextControlPrivate::updateCursorFlashTime);Executed by:
| 378 | ||||||||||||||||||||||||
| 395 | else | - | ||||||||||||||||||||||||
| 396 | disconnect((static_cast<QGuiApplication *>(QCoreApplication::instance()))->styleHints(), &QStyleHints::cursorFlashTimeChanged, this, &QQuickTextControlPrivate::updateCursorFlashTime); executed 112 times by 3 tests: disconnect((static_cast<QGuiApplication *>(QCoreApplication::instance()))->styleHints(), &QStyleHints::cursorFlashTimeChanged, this, &QQuickTextControlPrivate::updateCursorFlashTime);Executed by:
| 112 | ||||||||||||||||||||||||
| 397 | } | - | ||||||||||||||||||||||||
| 398 | - | |||||||||||||||||||||||||
| 399 | void QQuickTextControlPrivate::updateCursorFlashTime() | - | ||||||||||||||||||||||||
| 400 | { | - | ||||||||||||||||||||||||
| 401 | - | |||||||||||||||||||||||||
| 402 | - | |||||||||||||||||||||||||
| 403 | - | |||||||||||||||||||||||||
| 404 | cursorOn = true; | - | ||||||||||||||||||||||||
| 405 | int flashTime = QGuiApplication::styleHints()->cursorFlashTime(); | - | ||||||||||||||||||||||||
| 406 | - | |||||||||||||||||||||||||
| 407 | if (cursorBlinkingEnabled
| 0-378 | ||||||||||||||||||||||||
| 408 | cursorBlinkTimer.start(flashTime / 2, q_func()); executed 378 times by 4 tests: cursorBlinkTimer.start(flashTime / 2, q_func());Executed by:
| 378 | ||||||||||||||||||||||||
| 409 | else | - | ||||||||||||||||||||||||
| 410 | cursorBlinkTimer.stop(); executed 112 times by 3 tests: cursorBlinkTimer.stop();Executed by:
| 112 | ||||||||||||||||||||||||
| 411 | - | |||||||||||||||||||||||||
| 412 | repaintCursor(); | - | ||||||||||||||||||||||||
| 413 | } executed 490 times by 4 tests: end of blockExecuted by:
| 490 | ||||||||||||||||||||||||
| 414 | - | |||||||||||||||||||||||||
| 415 | void QQuickTextControlPrivate::extendWordwiseSelection(int suggestedNewPosition, qreal mouseXPosition) | - | ||||||||||||||||||||||||
| 416 | { | - | ||||||||||||||||||||||||
| 417 | QQuickTextControl * const q = q_func(); | - | ||||||||||||||||||||||||
| 418 | - | |||||||||||||||||||||||||
| 419 | - | |||||||||||||||||||||||||
| 420 | if (suggestedNewPosition >= selectedWordOnDoubleClick.selectionStart()
| 32-50 | ||||||||||||||||||||||||
| 421 | && suggestedNewPosition <= selectedWordOnDoubleClick.selectionEnd()
| 18-32 | ||||||||||||||||||||||||
| 422 | q->setTextCursor(selectedWordOnDoubleClick); | - | ||||||||||||||||||||||||
| 423 | return; executed 18 times by 1 test: return;Executed by:
| 18 | ||||||||||||||||||||||||
| 424 | } | - | ||||||||||||||||||||||||
| 425 | - | |||||||||||||||||||||||||
| 426 | QTextCursor curs = selectedWordOnDoubleClick; | - | ||||||||||||||||||||||||
| 427 | curs.setPosition(suggestedNewPosition, QTextCursor::KeepAnchor); | - | ||||||||||||||||||||||||
| 428 | - | |||||||||||||||||||||||||
| 429 | if (!curs.movePosition(QTextCursor::StartOfWord)
| 0-64 | ||||||||||||||||||||||||
| 430 | return; never executed: return; | 0 | ||||||||||||||||||||||||
| 431 | const int wordStartPos = curs.position(); | - | ||||||||||||||||||||||||
| 432 | - | |||||||||||||||||||||||||
| 433 | const int blockPos = curs.block().position(); | - | ||||||||||||||||||||||||
| 434 | const QPointF blockCoordinates = q->blockBoundingRect(curs.block()).topLeft(); | - | ||||||||||||||||||||||||
| 435 | - | |||||||||||||||||||||||||
| 436 | QTextLine line = currentTextLine(curs); | - | ||||||||||||||||||||||||
| 437 | if (!line.isValid()
| 0-64 | ||||||||||||||||||||||||
| 438 | return; never executed: return; | 0 | ||||||||||||||||||||||||
| 439 | - | |||||||||||||||||||||||||
| 440 | const qreal wordStartX = line.cursorToX(curs.position() - blockPos) + blockCoordinates.x(); | - | ||||||||||||||||||||||||
| 441 | - | |||||||||||||||||||||||||
| 442 | if (!curs.movePosition(QTextCursor::EndOfWord)
| 0-64 | ||||||||||||||||||||||||
| 443 | return; never executed: return; | 0 | ||||||||||||||||||||||||
| 444 | const int wordEndPos = curs.position(); | - | ||||||||||||||||||||||||
| 445 | - | |||||||||||||||||||||||||
| 446 | const QTextLine otherLine = currentTextLine(curs); | - | ||||||||||||||||||||||||
| 447 | if (otherLine.textStart() != line.textStart()
| 0-64 | ||||||||||||||||||||||||
| 448 | || wordEndPos == wordStartPos
| 0-64 | ||||||||||||||||||||||||
| 449 | return; never executed: return; | 0 | ||||||||||||||||||||||||
| 450 | - | |||||||||||||||||||||||||
| 451 | const qreal wordEndX = line.cursorToX(curs.position() - blockPos) + blockCoordinates.x(); | - | ||||||||||||||||||||||||
| 452 | - | |||||||||||||||||||||||||
| 453 | if (!wordSelectionEnabled
| 0-32 | ||||||||||||||||||||||||
| 454 | return; never executed: return; | 0 | ||||||||||||||||||||||||
| 455 | - | |||||||||||||||||||||||||
| 456 | if (suggestedNewPosition < selectedWordOnDoubleClick.position()
| 32 | ||||||||||||||||||||||||
| 457 | cursor.setPosition(selectedWordOnDoubleClick.selectionEnd()); | - | ||||||||||||||||||||||||
| 458 | setCursorPosition(wordStartPos, QTextCursor::KeepAnchor); | - | ||||||||||||||||||||||||
| 459 | } executed 32 times by 1 test: else {end of blockExecuted by:
| 32 | ||||||||||||||||||||||||
| 460 | cursor.setPosition(selectedWordOnDoubleClick.selectionStart()); | - | ||||||||||||||||||||||||
| 461 | setCursorPosition(wordEndPos, QTextCursor::KeepAnchor); | - | ||||||||||||||||||||||||
| 462 | } executed 32 times by 1 test: end of blockExecuted by:
| 32 | ||||||||||||||||||||||||
| 463 | - | |||||||||||||||||||||||||
| 464 | if (interactionFlags & Qt::TextSelectableByMouse
| 0-64 | ||||||||||||||||||||||||
| 465 | - | |||||||||||||||||||||||||
| 466 | setClipboardSelection(); | - | ||||||||||||||||||||||||
| 467 | - | |||||||||||||||||||||||||
| 468 | selectionChanged(true); | - | ||||||||||||||||||||||||
| 469 | } executed 64 times by 1 test: end of blockExecuted by:
| 64 | ||||||||||||||||||||||||
| 470 | } executed 64 times by 1 test: end of blockExecuted by:
| 64 | ||||||||||||||||||||||||
| 471 | - | |||||||||||||||||||||||||
| 472 | void QQuickTextControlPrivate::extendBlockwiseSelection(int suggestedNewPosition) | - | ||||||||||||||||||||||||
| 473 | { | - | ||||||||||||||||||||||||
| 474 | QQuickTextControl * const q = q_func(); | - | ||||||||||||||||||||||||
| 475 | - | |||||||||||||||||||||||||
| 476 | - | |||||||||||||||||||||||||
| 477 | if (suggestedNewPosition >= selectedBlockOnTripleClick.selectionStart()
| 12-56 | ||||||||||||||||||||||||
| 478 | && suggestedNewPosition <= selectedBlockOnTripleClick.selectionEnd()
| 20-36 | ||||||||||||||||||||||||
| 479 | q->setTextCursor(selectedBlockOnTripleClick); | - | ||||||||||||||||||||||||
| 480 | return; executed 36 times by 1 test: return;Executed by:
| 36 | ||||||||||||||||||||||||
| 481 | } | - | ||||||||||||||||||||||||
| 482 | - | |||||||||||||||||||||||||
| 483 | if (suggestedNewPosition < selectedBlockOnTripleClick.position()
| 12-20 | ||||||||||||||||||||||||
| 484 | cursor.setPosition(selectedBlockOnTripleClick.selectionEnd()); | - | ||||||||||||||||||||||||
| 485 | cursor.setPosition(suggestedNewPosition, QTextCursor::KeepAnchor); | - | ||||||||||||||||||||||||
| 486 | cursor.movePosition(QTextCursor::StartOfBlock, QTextCursor::KeepAnchor); | - | ||||||||||||||||||||||||
| 487 | } executed 12 times by 1 test: else {end of blockExecuted by:
| 12 | ||||||||||||||||||||||||
| 488 | cursor.setPosition(selectedBlockOnTripleClick.selectionStart()); | - | ||||||||||||||||||||||||
| 489 | cursor.setPosition(suggestedNewPosition, QTextCursor::KeepAnchor); | - | ||||||||||||||||||||||||
| 490 | cursor.movePosition(QTextCursor::EndOfBlock, QTextCursor::KeepAnchor); | - | ||||||||||||||||||||||||
| 491 | cursor.movePosition(QTextCursor::NextCharacter, QTextCursor::KeepAnchor); | - | ||||||||||||||||||||||||
| 492 | } executed 20 times by 1 test: end of blockExecuted by:
| 20 | ||||||||||||||||||||||||
| 493 | - | |||||||||||||||||||||||||
| 494 | if (interactionFlags & Qt::TextSelectableByMouse
| 0-32 | ||||||||||||||||||||||||
| 495 | - | |||||||||||||||||||||||||
| 496 | setClipboardSelection(); | - | ||||||||||||||||||||||||
| 497 | - | |||||||||||||||||||||||||
| 498 | selectionChanged(true); | - | ||||||||||||||||||||||||
| 499 | } executed 32 times by 1 test: end of blockExecuted by:
| 32 | ||||||||||||||||||||||||
| 500 | } executed 32 times by 1 test: end of blockExecuted by:
| 32 | ||||||||||||||||||||||||
| 501 | - | |||||||||||||||||||||||||
| 502 | void QQuickTextControl::undo() | - | ||||||||||||||||||||||||
| 503 | { | - | ||||||||||||||||||||||||
| 504 | QQuickTextControlPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 505 | d->repaintSelection(); | - | ||||||||||||||||||||||||
| 506 | const int oldCursorPos = d->cursor.position(); | - | ||||||||||||||||||||||||
| 507 | d->doc->undo(&d->cursor); | - | ||||||||||||||||||||||||
| 508 | if (d->cursor.position() != oldCursorPos
| 24-88 | ||||||||||||||||||||||||
| 509 | cursorPositionChanged(); executed 88 times by 1 test: cursorPositionChanged();Executed by:
| 88 | ||||||||||||||||||||||||
| 510 | updateCursorRectangle(true); | - | ||||||||||||||||||||||||
| 511 | } executed 112 times by 1 test: end of blockExecuted by:
| 112 | ||||||||||||||||||||||||
| 512 | - | |||||||||||||||||||||||||
| 513 | void QQuickTextControl::redo() | - | ||||||||||||||||||||||||
| 514 | { | - | ||||||||||||||||||||||||
| 515 | QQuickTextControlPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 516 | d->repaintSelection(); | - | ||||||||||||||||||||||||
| 517 | const int oldCursorPos = d->cursor.position(); | - | ||||||||||||||||||||||||
| 518 | d->doc->redo(&d->cursor); | - | ||||||||||||||||||||||||
| 519 | if (d->cursor.position() != oldCursorPos
| 2-6 | ||||||||||||||||||||||||
| 520 | cursorPositionChanged(); executed 6 times by 1 test: cursorPositionChanged();Executed by:
| 6 | ||||||||||||||||||||||||
| 521 | updateCursorRectangle(true); | - | ||||||||||||||||||||||||
| 522 | } executed 8 times by 1 test: end of blockExecuted by:
| 8 | ||||||||||||||||||||||||
| 523 | - | |||||||||||||||||||||||||
| 524 | void QQuickTextControl::clear() | - | ||||||||||||||||||||||||
| 525 | { | - | ||||||||||||||||||||||||
| 526 | QQuickTextControlPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 527 | d->cursor.select(QTextCursor::Document); | - | ||||||||||||||||||||||||
| 528 | d->cursor.removeSelectedText(); | - | ||||||||||||||||||||||||
| 529 | } executed 6 times by 1 test: end of blockExecuted by:
| 6 | ||||||||||||||||||||||||
| 530 | - | |||||||||||||||||||||||||
| 531 | QQuickTextControl::QQuickTextControl(QTextDocument *doc, QObject *parent) | - | ||||||||||||||||||||||||
| 532 | : QInputControl(TextEdit, *new QQuickTextControlPrivate, parent) | - | ||||||||||||||||||||||||
| 533 | { | - | ||||||||||||||||||||||||
| 534 | QQuickTextControlPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 535 | ((doc) ? static_cast<void>(0) : qt_assert("doc", __FILE__, 614)); | - | ||||||||||||||||||||||||
| 536 | - | |||||||||||||||||||||||||
| 537 | QAbstractTextDocumentLayout *layout = doc->documentLayout(); | - | ||||||||||||||||||||||||
| 538 | { QAbstractTextDocumentLayout *sender = (layout); QQuickTextControl *receiver = (this); const char *signal = (qFlagLocation("2""update(QRectF)" "\0" __FILE__ ":" "617")); const char *method = (qFlagLocation("2""updateRequest()" "\0" __FILE__ ":" "617")); 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 = QQuickTextControl::staticMetaObject.indexOfSignal(method+1);methodIdx = QQuickTextControl::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__, 617)); QMetaObject::connect(sender, signalIdx, receiver, methodIdx, Qt::DirectConnection); };methodIdx = QQuickTextControl::staticMetaObject.indexOfSignal(method+1);Executed by:
| 0-1068 | ||||||||||||||||||||||||
| 539 | { QAbstractTextDocumentLayout *sender = (layout); QQuickTextControl *receiver = (this); const char *signal = (qFlagLocation("2""updateBlock(QTextBlock)" "\0" __FILE__ ":" "618")); const char *method = (qFlagLocation("2""updateRequest()" "\0" __FILE__ ":" "618")); 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 = QQuickTextControl::staticMetaObject.indexOfSignal(method+1);methodIdx = QQuickTextControl::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__, 618)); QMetaObject::connect(sender, signalIdx, receiver, methodIdx, Qt::DirectConnection); };methodIdx = QQuickTextControl::staticMetaObject.indexOfSignal(method+1);Executed by:
| 0-1068 | ||||||||||||||||||||||||
| 540 | { QTextDocument *sender = (doc); QQuickTextControl *receiver = (this); const char *signal = (qFlagLocation("2""contentsChanged()" "\0" __FILE__ ":" "619")); const char *method = (qFlagLocation("2""textChanged()" "\0" __FILE__ ":" "619")); 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 = QQuickTextControl::staticMetaObject.indexOfSignal(method+1);methodIdx = QQuickTextControl::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__, 619)); QMetaObject::connect(sender, signalIdx, receiver, methodIdx, Qt::DirectConnection); };methodIdx = QQuickTextControl::staticMetaObject.indexOfSignal(method+1);Executed by:
| 0-1068 | ||||||||||||||||||||||||
| 541 | { QTextDocument *sender = (doc); QQuickTextControl *receiver = (this); const char *signal = (qFlagLocation("2""contentsChanged()" "\0" __FILE__ ":" "620")); const char *method = (qFlagLocation("1""_q_updateCurrentCharFormatAndSelection()" "\0" __FILE__ ":" "620")); 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 = QQuickTextControl::staticMetaObject.indexOfSignal(method+1);methodIdx = QQuickTextControl::staticMetaObject.indexOfSlot(method+1);Executed by:
never executed: } ((signalIdx != -1 && methodIdx != -1) ? static_cast<void>(0) : qt_assert("signalIdx != -1 && methodIdx != -1", __FILE__, 620)); QMetaObject::connect(sender, signalIdx, receiver, methodIdx, Qt::DirectConnection); };methodIdx = QQuickTextControl::staticMetaObject.indexOfSignal(method+1); | 0-1068 | ||||||||||||||||||||||||
| 542 | { QTextDocument *sender = (doc); QQuickTextControl *receiver = (this); const char *signal = (qFlagLocation("2""cursorPositionChanged(QTextCursor)" "\0" __FILE__ ":" "621")); const char *method = (qFlagLocation("1""_q_updateCursorPosChanged(QTextCursor)" "\0" __FILE__ ":" "621")); 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 = QQuickTextControl::staticMetaObject.indexOfSignal(method+1);methodIdx = QQuickTextControl::staticMetaObject.indexOfSlot(method+1);Executed by:
never executed: } ((signalIdx != -1 && methodIdx != -1) ? static_cast<void>(0) : qt_assert("signalIdx != -1 && methodIdx != -1", __FILE__, 621)); QMetaObject::connect(sender, signalIdx, receiver, methodIdx, Qt::DirectConnection); };methodIdx = QQuickTextControl::staticMetaObject.indexOfSignal(method+1); | 0-1068 | ||||||||||||||||||||||||
| 543 | connect(doc, &QTextDocument::contentsChange, this, &QQuickTextControl::contentsChange); | - | ||||||||||||||||||||||||
| 544 | - | |||||||||||||||||||||||||
| 545 | layout->setProperty("cursorWidth", textCursorWidth); | - | ||||||||||||||||||||||||
| 546 | - | |||||||||||||||||||||||||
| 547 | d->doc = doc; | - | ||||||||||||||||||||||||
| 548 | d->cursor = QTextCursor(doc); | - | ||||||||||||||||||||||||
| 549 | d->lastCharFormat = d->cursor.charFormat(); | - | ||||||||||||||||||||||||
| 550 | doc->setPageSize(QSizeF(0, 0)); | - | ||||||||||||||||||||||||
| 551 | doc->setModified(false); | - | ||||||||||||||||||||||||
| 552 | doc->setUndoRedoEnabled(true); | - | ||||||||||||||||||||||||
| 553 | } executed 1080 times by 6 tests: end of blockExecuted by:
| 1080 | ||||||||||||||||||||||||
| 554 | - | |||||||||||||||||||||||||
| 555 | QQuickTextControl::~QQuickTextControl() | - | ||||||||||||||||||||||||
| 556 | { | - | ||||||||||||||||||||||||
| 557 | } | - | ||||||||||||||||||||||||
| 558 | - | |||||||||||||||||||||||||
| 559 | QTextDocument *QQuickTextControl::document() const | - | ||||||||||||||||||||||||
| 560 | { | - | ||||||||||||||||||||||||
| 561 | const QQuickTextControlPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 562 | return executed 548 times by 2 tests: d->doc;return d->doc;Executed by:
executed 548 times by 2 tests: return d->doc;Executed by:
| 548 | ||||||||||||||||||||||||
| 563 | } | - | ||||||||||||||||||||||||
| 564 | - | |||||||||||||||||||||||||
| 565 | void QQuickTextControl::updateCursorRectangle(bool force) | - | ||||||||||||||||||||||||
| 566 | { | - | ||||||||||||||||||||||||
| 567 | QQuickTextControlPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 568 | const bool update = d->cursorRectangleChanged
| 8-7102 | ||||||||||||||||||||||||
| 569 | d->cursorRectangleChanged = false; | - | ||||||||||||||||||||||||
| 570 | if (update
| 108-7002 | ||||||||||||||||||||||||
| 571 | cursorRectangleChanged(); executed 7002 times by 5 tests: cursorRectangleChanged();Executed by:
| 7002 | ||||||||||||||||||||||||
| 572 | } executed 7110 times by 5 tests: end of blockExecuted by:
| 7110 | ||||||||||||||||||||||||
| 573 | - | |||||||||||||||||||||||||
| 574 | void QQuickTextControl::setTextCursor(const QTextCursor &cursor) | - | ||||||||||||||||||||||||
| 575 | { | - | ||||||||||||||||||||||||
| 576 | QQuickTextControlPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 577 | - | |||||||||||||||||||||||||
| 578 | d->commitPreedit(); | - | ||||||||||||||||||||||||
| 579 | - | |||||||||||||||||||||||||
| 580 | d->cursorIsFocusIndicator = false; | - | ||||||||||||||||||||||||
| 581 | const bool posChanged = cursor.position() != d->cursor.position(); | - | ||||||||||||||||||||||||
| 582 | const QTextCursor oldSelection = d->cursor; | - | ||||||||||||||||||||||||
| 583 | d->cursor = cursor; | - | ||||||||||||||||||||||||
| 584 | d->cursorOn = d->hasFocus
| 358-866 | ||||||||||||||||||||||||
| 585 | d->_q_updateCurrentCharFormatAndSelection(); | - | ||||||||||||||||||||||||
| 586 | updateCursorRectangle(true); | - | ||||||||||||||||||||||||
| 587 | d->repaintOldAndNewSelection(oldSelection); | - | ||||||||||||||||||||||||
| 588 | if (posChanged
| 240-984 | ||||||||||||||||||||||||
| 589 | cursorPositionChanged(); executed 984 times by 1 test: cursorPositionChanged();Executed by:
| 984 | ||||||||||||||||||||||||
| 590 | } executed 1224 times by 1 test: end of blockExecuted by:
| 1224 | ||||||||||||||||||||||||
| 591 | - | |||||||||||||||||||||||||
| 592 | QTextCursor QQuickTextControl::textCursor() const | - | ||||||||||||||||||||||||
| 593 | { | - | ||||||||||||||||||||||||
| 594 | const QQuickTextControlPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 595 | return executed 37450 times by 6 tests: d->cursor;return d->cursor;Executed by:
executed 37450 times by 6 tests: return d->cursor;Executed by:
| 37450 | ||||||||||||||||||||||||
| 596 | } | - | ||||||||||||||||||||||||
| 597 | - | |||||||||||||||||||||||||
| 598 | - | |||||||||||||||||||||||||
| 599 | - | |||||||||||||||||||||||||
| 600 | void QQuickTextControl::cut() | - | ||||||||||||||||||||||||
| 601 | { | - | ||||||||||||||||||||||||
| 602 | QQuickTextControlPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 603 | if (!(d->interactionFlags & Qt::TextEditable)
| 2-6 | ||||||||||||||||||||||||
| 604 | return; executed 4 times by 1 test: return;Executed by:
| 4 | ||||||||||||||||||||||||
| 605 | copy(); | - | ||||||||||||||||||||||||
| 606 | d->cursor.removeSelectedText(); | - | ||||||||||||||||||||||||
| 607 | } executed 4 times by 1 test: end of blockExecuted by:
| 4 | ||||||||||||||||||||||||
| 608 | - | |||||||||||||||||||||||||
| 609 | void QQuickTextControl::copy() | - | ||||||||||||||||||||||||
| 610 | { | - | ||||||||||||||||||||||||
| 611 | QQuickTextControlPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 612 | if (!d->cursor.hasSelection()
| 2-10 | ||||||||||||||||||||||||
| 613 | return; executed 2 times by 1 test: return;Executed by:
| 2 | ||||||||||||||||||||||||
| 614 | QMimeData *data = createMimeDataFromSelection(); | - | ||||||||||||||||||||||||
| 615 | QGuiApplication::clipboard()->setMimeData(data); | - | ||||||||||||||||||||||||
| 616 | } executed 10 times by 1 test: end of blockExecuted by:
| 10 | ||||||||||||||||||||||||
| 617 | - | |||||||||||||||||||||||||
| 618 | void QQuickTextControl::paste(QClipboard::Mode mode) | - | ||||||||||||||||||||||||
| 619 | { | - | ||||||||||||||||||||||||
| 620 | const QMimeData *md = QGuiApplication::clipboard()->mimeData(mode); | - | ||||||||||||||||||||||||
| 621 | if (md
| 0-14 | ||||||||||||||||||||||||
| 622 | insertFromMimeData(md); executed 14 times by 1 test: insertFromMimeData(md);Executed by:
| 14 | ||||||||||||||||||||||||
| 623 | } executed 14 times by 1 test: end of blockExecuted by:
| 14 | ||||||||||||||||||||||||
| 624 | - | |||||||||||||||||||||||||
| 625 | - | |||||||||||||||||||||||||
| 626 | void QQuickTextControl::selectAll() | - | ||||||||||||||||||||||||
| 627 | { | - | ||||||||||||||||||||||||
| 628 | QQuickTextControlPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 629 | const int selectionLength = qAbs(d->cursor.position() - d->cursor.anchor()); | - | ||||||||||||||||||||||||
| 630 | d->cursor.select(QTextCursor::Document); | - | ||||||||||||||||||||||||
| 631 | d->selectionChanged(selectionLength != qAbs(d->cursor.position() - d->cursor.anchor())); | - | ||||||||||||||||||||||||
| 632 | d->cursorIsFocusIndicator = false; | - | ||||||||||||||||||||||||
| 633 | updateRequest(); | - | ||||||||||||||||||||||||
| 634 | } executed 16 times by 1 test: end of blockExecuted by:
| 16 | ||||||||||||||||||||||||
| 635 | - | |||||||||||||||||||||||||
| 636 | void QQuickTextControl::processEvent(QEvent *e, const QPointF &coordinateOffset) | - | ||||||||||||||||||||||||
| 637 | { | - | ||||||||||||||||||||||||
| 638 | QMatrix m; | - | ||||||||||||||||||||||||
| 639 | m.translate(coordinateOffset.x(), coordinateOffset.y()); | - | ||||||||||||||||||||||||
| 640 | processEvent(e, m); | - | ||||||||||||||||||||||||
| 641 | } executed 4734 times by 3 tests: end of blockExecuted by:
| 4734 | ||||||||||||||||||||||||
| 642 | - | |||||||||||||||||||||||||
| 643 | void QQuickTextControl::processEvent(QEvent *e, const QMatrix &matrix) | - | ||||||||||||||||||||||||
| 644 | { | - | ||||||||||||||||||||||||
| 645 | QQuickTextControlPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 646 | if (d->interactionFlags == Qt::NoTextInteraction
| 0-4734 | ||||||||||||||||||||||||
| 647 | e->ignore(); | - | ||||||||||||||||||||||||
| 648 | return; never executed: return; | 0 | ||||||||||||||||||||||||
| 649 | } | - | ||||||||||||||||||||||||
| 650 | - | |||||||||||||||||||||||||
| 651 | switch (e->type()) { | - | ||||||||||||||||||||||||
| 652 | case executed 1028 times by 3 tests: QEvent::KeyPress:case QEvent::KeyPress:Executed by:
executed 1028 times by 3 tests: case QEvent::KeyPress:Executed by:
| 1028 | ||||||||||||||||||||||||
| 653 | d->keyPressEvent(static_cast<QKeyEvent *>(e)); | - | ||||||||||||||||||||||||
| 654 | break; executed 1028 times by 3 tests: break;Executed by:
| 1028 | ||||||||||||||||||||||||
| 655 | case executed 1012 times by 2 tests: QEvent::KeyRelease:case QEvent::KeyRelease:Executed by:
executed 1012 times by 2 tests: case QEvent::KeyRelease:Executed by:
| 1012 | ||||||||||||||||||||||||
| 656 | d->keyReleaseEvent(static_cast<QKeyEvent *>(e)); | - | ||||||||||||||||||||||||
| 657 | break; executed 1012 times by 2 tests: break;Executed by:
| 1012 | ||||||||||||||||||||||||
| 658 | case executed 514 times by 1 test: QEvent::MouseButtonPress:case QEvent::MouseButtonPress:Executed by:
executed 514 times by 1 test: {case QEvent::MouseButtonPress:Executed by:
| 514 | ||||||||||||||||||||||||
| 659 | QMouseEvent *ev = static_cast<QMouseEvent *>(e); | - | ||||||||||||||||||||||||
| 660 | d->mousePressEvent(ev, matrix.map(ev->localPos())); | - | ||||||||||||||||||||||||
| 661 | break; executed 514 times by 1 test: }break;Executed by:
| 514 | ||||||||||||||||||||||||
| 662 | case executed 138 times by 1 test: QEvent::MouseMove:case QEvent::MouseMove:Executed by:
executed 138 times by 1 test: {case QEvent::MouseMove:Executed by:
| 138 | ||||||||||||||||||||||||
| 663 | QMouseEvent *ev = static_cast<QMouseEvent *>(e); | - | ||||||||||||||||||||||||
| 664 | d->mouseMoveEvent(ev, matrix.map(ev->localPos())); | - | ||||||||||||||||||||||||
| 665 | break; executed 138 times by 1 test: }break;Executed by:
| 138 | ||||||||||||||||||||||||
| 666 | case executed 514 times by 1 test: QEvent::MouseButtonRelease:case QEvent::MouseButtonRelease:Executed by:
executed 514 times by 1 test: {case QEvent::MouseButtonRelease:Executed by:
| 514 | ||||||||||||||||||||||||
| 667 | QMouseEvent *ev = static_cast<QMouseEvent *>(e); | - | ||||||||||||||||||||||||
| 668 | d->mouseReleaseEvent(ev, matrix.map(ev->localPos())); | - | ||||||||||||||||||||||||
| 669 | break; executed 514 times by 1 test: }break;Executed by:
| 514 | ||||||||||||||||||||||||
| 670 | case executed 104 times by 1 test: QEvent::MouseButtonDblClick:case QEvent::MouseButtonDblClick:Executed by:
executed 104 times by 1 test: {case QEvent::MouseButtonDblClick:Executed by:
| 104 | ||||||||||||||||||||||||
| 671 | QMouseEvent *ev = static_cast<QMouseEvent *>(e); | - | ||||||||||||||||||||||||
| 672 | d->mouseDoubleClickEvent(ev, matrix.map(ev->localPos())); | - | ||||||||||||||||||||||||
| 673 | break; executed 104 times by 1 test: }break;Executed by:
| 104 | ||||||||||||||||||||||||
| 674 | case executed 2 times by 1 test: QEvent::HoverEnter:case QEvent::HoverEnter:Executed by:
executed 2 times by 1 test: case QEvent::HoverEnter:Executed by:
| 2 | ||||||||||||||||||||||||
| 675 | case executed 6 times by 1 test: QEvent::HoverMove:case QEvent::HoverMove:Executed by:
executed 6 times by 1 test: case QEvent::HoverMove:Executed by:
| 6 | ||||||||||||||||||||||||
| 676 | case never executed: QEvent::HoverLeave:case QEvent::HoverLeave:never executed: {case QEvent::HoverLeave: | 0 | ||||||||||||||||||||||||
| 677 | QHoverEvent *ev = static_cast<QHoverEvent *>(e); | - | ||||||||||||||||||||||||
| 678 | d->hoverEvent(ev, matrix.map(ev->posF())); | - | ||||||||||||||||||||||||
| 679 | break; executed 8 times by 1 test: }break;Executed by:
| 8 | ||||||||||||||||||||||||
| 680 | - | |||||||||||||||||||||||||
| 681 | case executed 324 times by 1 test: QEvent::InputMethod:case QEvent::InputMethod:Executed by:
executed 324 times by 1 test: case QEvent::InputMethod:Executed by:
| 324 | ||||||||||||||||||||||||
| 682 | d->inputMethodEvent(static_cast<QInputMethodEvent *>(e)); | - | ||||||||||||||||||||||||
| 683 | break; executed 324 times by 1 test: break;Executed by:
| 324 | ||||||||||||||||||||||||
| 684 | - | |||||||||||||||||||||||||
| 685 | case executed 338 times by 3 tests: QEvent::FocusIn:case QEvent::FocusIn:Executed by:
executed 338 times by 3 tests: case QEvent::FocusIn:Executed by:
| 338 | ||||||||||||||||||||||||
| 686 | case executed 94 times by 3 tests: QEvent::FocusOut:case QEvent::FocusOut:Executed by:
executed 94 times by 3 tests: case QEvent::FocusOut:Executed by:
| 94 | ||||||||||||||||||||||||
| 687 | d->focusEvent(static_cast<QFocusEvent *>(e)); | - | ||||||||||||||||||||||||
| 688 | break; executed 432 times by 3 tests: break;Executed by:
| 432 | ||||||||||||||||||||||||
| 689 | - | |||||||||||||||||||||||||
| 690 | case executed 660 times by 2 tests: QEvent::ShortcutOverride:case QEvent::ShortcutOverride:Executed by:
executed 660 times by 2 tests: case QEvent::ShortcutOverride:Executed by:
| 660 | ||||||||||||||||||||||||
| 691 | if (d->interactionFlags & Qt::TextEditable
| 40-620 | ||||||||||||||||||||||||
| 692 | QKeyEvent* ke = static_cast<QKeyEvent *>(e); | - | ||||||||||||||||||||||||
| 693 | if (isCommonTextEditShortcut(ke)
| 70-550 | ||||||||||||||||||||||||
| 694 | ke->accept(); executed 550 times by 2 tests: ke->accept();Executed by:
| 550 | ||||||||||||||||||||||||
| 695 | } executed 620 times by 2 tests: end of blockExecuted by:
| 620 | ||||||||||||||||||||||||
| 696 | break; executed 660 times by 2 tests: break;Executed by:
| 660 | ||||||||||||||||||||||||
| 697 | default never executed: :default:never executed: default: | 0 | ||||||||||||||||||||||||
| 698 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 699 | } | - | ||||||||||||||||||||||||
| 700 | } | - | ||||||||||||||||||||||||
| 701 | - | |||||||||||||||||||||||||
| 702 | bool QQuickTextControl::event(QEvent *e) | - | ||||||||||||||||||||||||
| 703 | { | - | ||||||||||||||||||||||||
| 704 | return executed 346 times by 1 test: QObject::event(e);return QObject::event(e);Executed by:
executed 346 times by 1 test: return QObject::event(e);Executed by:
| 346 | ||||||||||||||||||||||||
| 705 | } | - | ||||||||||||||||||||||||
| 706 | - | |||||||||||||||||||||||||
| 707 | void QQuickTextControl::timerEvent(QTimerEvent *e) | - | ||||||||||||||||||||||||
| 708 | { | - | ||||||||||||||||||||||||
| 709 | QQuickTextControlPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 710 | if (e->timerId() == d->cursorBlinkTimer.timerId()
| 0-346 | ||||||||||||||||||||||||
| 711 | d->cursorOn = !d->cursorOn; | - | ||||||||||||||||||||||||
| 712 | - | |||||||||||||||||||||||||
| 713 | d->repaintCursor(); | - | ||||||||||||||||||||||||
| 714 | } executed 346 times by 1 test: else if (e->timerId() == d->tripleClickTimer.timerId()end of blockExecuted by:
| 0-346 | ||||||||||||||||||||||||
| 715 | d->tripleClickTimer.stop(); | - | ||||||||||||||||||||||||
| 716 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 717 | } executed 346 times by 1 test: end of blockExecuted by:
| 346 | ||||||||||||||||||||||||
| 718 | - | |||||||||||||||||||||||||
| 719 | void QQuickTextControl::setPlainText(const QString &text) | - | ||||||||||||||||||||||||
| 720 | { | - | ||||||||||||||||||||||||
| 721 | QQuickTextControlPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 722 | d->setContent(Qt::PlainText, text); | - | ||||||||||||||||||||||||
| 723 | } executed 968 times by 5 tests: end of blockExecuted by:
| 968 | ||||||||||||||||||||||||
| 724 | - | |||||||||||||||||||||||||
| 725 | void QQuickTextControl::setHtml(const QString &text) | - | ||||||||||||||||||||||||
| 726 | { | - | ||||||||||||||||||||||||
| 727 | QQuickTextControlPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 728 | d->setContent(Qt::RichText, text); | - | ||||||||||||||||||||||||
| 729 | } executed 100 times by 3 tests: end of blockExecuted by:
| 100 | ||||||||||||||||||||||||
| 730 | - | |||||||||||||||||||||||||
| 731 | - | |||||||||||||||||||||||||
| 732 | void QQuickTextControlPrivate::keyReleaseEvent(QKeyEvent *e) | - | ||||||||||||||||||||||||
| 733 | { | - | ||||||||||||||||||||||||
| 734 | if (e->key() == Qt::Key_Back
| 0-1012 | ||||||||||||||||||||||||
| 735 | e->ignore(); | - | ||||||||||||||||||||||||
| 736 | return; never executed: return; | 0 | ||||||||||||||||||||||||
| 737 | } | - | ||||||||||||||||||||||||
| 738 | return; executed 1012 times by 2 tests: return;Executed by:
| 1012 | ||||||||||||||||||||||||
| 739 | } | - | ||||||||||||||||||||||||
| 740 | - | |||||||||||||||||||||||||
| 741 | void QQuickTextControlPrivate::keyPressEvent(QKeyEvent *e) | - | ||||||||||||||||||||||||
| 742 | { | - | ||||||||||||||||||||||||
| 743 | QQuickTextControl * const q = q_func(); | - | ||||||||||||||||||||||||
| 744 | - | |||||||||||||||||||||||||
| 745 | if (e->key() == Qt::Key_Back
| 0-1028 | ||||||||||||||||||||||||
| 746 | e->ignore(); | - | ||||||||||||||||||||||||
| 747 | return; never executed: return; | 0 | ||||||||||||||||||||||||
| 748 | } | - | ||||||||||||||||||||||||
| 749 | - | |||||||||||||||||||||||||
| 750 | - | |||||||||||||||||||||||||
| 751 | if (e == QKeySequence::SelectAll
| 2-1026 | ||||||||||||||||||||||||
| 752 | e->accept(); | - | ||||||||||||||||||||||||
| 753 | q->selectAll(); | - | ||||||||||||||||||||||||
| 754 | - | |||||||||||||||||||||||||
| 755 | setClipboardSelection(); | - | ||||||||||||||||||||||||
| 756 | - | |||||||||||||||||||||||||
| 757 | return; executed 2 times by 1 test: return;Executed by:
| 2 | ||||||||||||||||||||||||
| 758 | } | - | ||||||||||||||||||||||||
| 759 | - | |||||||||||||||||||||||||
| 760 | else if (e == QKeySequence::Copy
| 2-1024 | ||||||||||||||||||||||||
| 761 | e->accept(); | - | ||||||||||||||||||||||||
| 762 | q->copy(); | - | ||||||||||||||||||||||||
| 763 | return; executed 2 times by 1 test: return;Executed by:
| 2 | ||||||||||||||||||||||||
| 764 | } | - | ||||||||||||||||||||||||
| 765 | - | |||||||||||||||||||||||||
| 766 | - | |||||||||||||||||||||||||
| 767 | - | |||||||||||||||||||||||||
| 768 | if (interactionFlags & Qt::TextSelectableByKeyboard | - | ||||||||||||||||||||||||
| 769 | && cursorMoveKeyEvent(e)
| 132-758 | ||||||||||||||||||||||||
| 770 | goto executed 132 times by 2 tests: accept;goto accept;Executed by:
executed 132 times by 2 tests: goto accept;Executed by:
| 132 | ||||||||||||||||||||||||
| 771 | - | |||||||||||||||||||||||||
| 772 | if (!(interactionFlags & Qt::TextEditable)
| 126-766 | ||||||||||||||||||||||||
| 773 | e->ignore(); | - | ||||||||||||||||||||||||
| 774 | return; executed 126 times by 2 tests: return;Executed by:
| 126 | ||||||||||||||||||||||||
| 775 | } | - | ||||||||||||||||||||||||
| 776 | - | |||||||||||||||||||||||||
| 777 | if (e->key() == Qt::Key_Direction_L
| 10-728 | ||||||||||||||||||||||||
| 778 | QTextBlockFormat fmt; | - | ||||||||||||||||||||||||
| 779 | fmt.setLayoutDirection((e->key() == Qt::Key_Direction_L) ? Qt::LeftToRight : Qt::RightToLeft); | - | ||||||||||||||||||||||||
| 780 | cursor.mergeBlockFormat(fmt); | - | ||||||||||||||||||||||||
| 781 | goto executed 48 times by 1 test: accept;goto accept;Executed by:
executed 48 times by 1 test: goto accept;Executed by:
| 48 | ||||||||||||||||||||||||
| 782 | } | - | ||||||||||||||||||||||||
| 783 | - | |||||||||||||||||||||||||
| 784 | - | |||||||||||||||||||||||||
| 785 | - | |||||||||||||||||||||||||
| 786 | - | |||||||||||||||||||||||||
| 787 | - | |||||||||||||||||||||||||
| 788 | repaintSelection(); | - | ||||||||||||||||||||||||
| 789 | - | |||||||||||||||||||||||||
| 790 | if (e->key() == Qt::Key_Backspace
| 2-710 | ||||||||||||||||||||||||
| 791 | QTextBlockFormat blockFmt = cursor.blockFormat(); | - | ||||||||||||||||||||||||
| 792 | QTextList *list = cursor.currentList(); | - | ||||||||||||||||||||||||
| 793 | if (list
| 0-6 | ||||||||||||||||||||||||
| 794 | list->remove(cursor.block()); | - | ||||||||||||||||||||||||
| 795 | } never executed: else if (cursor.atBlockStart()end of block
| 0-6 | ||||||||||||||||||||||||
| 796 | blockFmt.setIndent(blockFmt.indent() - 1); | - | ||||||||||||||||||||||||
| 797 | cursor.setBlockFormat(blockFmt); | - | ||||||||||||||||||||||||
| 798 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||
| 799 | QTextCursor localCursor = cursor; | - | ||||||||||||||||||||||||
| 800 | localCursor.deletePreviousChar(); | - | ||||||||||||||||||||||||
| 801 | } executed 6 times by 1 test: end of blockExecuted by:
| 6 | ||||||||||||||||||||||||
| 802 | goto executed 6 times by 1 test: accept;goto accept;Executed by:
executed 6 times by 1 test: goto accept;Executed by:
| 6 | ||||||||||||||||||||||||
| 803 | } | - | ||||||||||||||||||||||||
| 804 | - | |||||||||||||||||||||||||
| 805 | else if (e == QKeySequence::InsertParagraphSeparator
| 2-710 | ||||||||||||||||||||||||
| 806 | cursor.insertBlock(); | - | ||||||||||||||||||||||||
| 807 | e->accept(); | - | ||||||||||||||||||||||||
| 808 | goto executed 2 times by 1 test: accept;goto accept;Executed by:
executed 2 times by 1 test: goto accept;Executed by:
| 2 | ||||||||||||||||||||||||
| 809 | } else if (e == QKeySequence::InsertLineSeparator
| 0-710 | ||||||||||||||||||||||||
| 810 | cursor.insertText(QString(QChar::LineSeparator)); | - | ||||||||||||||||||||||||
| 811 | e->accept(); | - | ||||||||||||||||||||||||
| 812 | goto never executed: accept;goto accept;never executed: goto accept; | 0 | ||||||||||||||||||||||||
| 813 | } | - | ||||||||||||||||||||||||
| 814 | - | |||||||||||||||||||||||||
| 815 | if (false) { dead code: { } | - | ||||||||||||||||||||||||
| 816 | } dead code: { } | - | ||||||||||||||||||||||||
| 817 | - | |||||||||||||||||||||||||
| 818 | else if (e == QKeySequence::Undo
| 4-706 | ||||||||||||||||||||||||
| 819 | q->undo(); | - | ||||||||||||||||||||||||
| 820 | } executed 4 times by 1 test: end of blockExecuted by:
| 4 | ||||||||||||||||||||||||
| 821 | else if (e == QKeySequence::Redo
| 0-706 | ||||||||||||||||||||||||
| 822 | q->redo(); | - | ||||||||||||||||||||||||
| 823 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 824 | - | |||||||||||||||||||||||||
| 825 | else if (e == QKeySequence::Cut
| 2-704 | ||||||||||||||||||||||||
| 826 | q->cut(); | - | ||||||||||||||||||||||||
| 827 | } executed 2 times by 1 test: end of blockExecuted by:
| 2 | ||||||||||||||||||||||||
| 828 | else if (e == QKeySequence::Paste
| 4-700 | ||||||||||||||||||||||||
| 829 | QClipboard::Mode mode = QClipboard::Clipboard; | - | ||||||||||||||||||||||||
| 830 | q->paste(mode); | - | ||||||||||||||||||||||||
| 831 | } executed 4 times by 1 test: end of blockExecuted by:
| 4 | ||||||||||||||||||||||||
| 832 | - | |||||||||||||||||||||||||
| 833 | else if (e == QKeySequence::Delete
| 10-690 | ||||||||||||||||||||||||
| 834 | QTextCursor localCursor = cursor; | - | ||||||||||||||||||||||||
| 835 | localCursor.deleteChar(); | - | ||||||||||||||||||||||||
| 836 | } executed 10 times by 1 test: end of blockExecuted by:
| 10 | ||||||||||||||||||||||||
| 837 | else if (e == QKeySequence::DeleteEndOfWord
| 2-688 | ||||||||||||||||||||||||
| 838 | if (!cursor.hasSelection()
| 0-2 | ||||||||||||||||||||||||
| 839 | cursor.movePosition(QTextCursor::NextWord, QTextCursor::KeepAnchor); executed 2 times by 1 test: cursor.movePosition(QTextCursor::NextWord, QTextCursor::KeepAnchor);Executed by:
| 2 | ||||||||||||||||||||||||
| 840 | cursor.removeSelectedText(); | - | ||||||||||||||||||||||||
| 841 | } executed 2 times by 1 test: end of blockExecuted by:
| 2 | ||||||||||||||||||||||||
| 842 | else if (e == QKeySequence::DeleteStartOfWord
| 2-686 | ||||||||||||||||||||||||
| 843 | if (!cursor.hasSelection()
| 0-2 | ||||||||||||||||||||||||
| 844 | cursor.movePosition(QTextCursor::PreviousWord, QTextCursor::KeepAnchor); executed 2 times by 1 test: cursor.movePosition(QTextCursor::PreviousWord, QTextCursor::KeepAnchor);Executed by:
| 2 | ||||||||||||||||||||||||
| 845 | cursor.removeSelectedText(); | - | ||||||||||||||||||||||||
| 846 | } executed 2 times by 1 test: end of blockExecuted by:
| 2 | ||||||||||||||||||||||||
| 847 | else if (e == QKeySequence::DeleteEndOfLine
| 2-684 | ||||||||||||||||||||||||
| 848 | QTextBlock block = cursor.block(); | - | ||||||||||||||||||||||||
| 849 | if (cursor.position() == block.position() + block.length() - 2
| 0-2 | ||||||||||||||||||||||||
| 850 | cursor.movePosition(QTextCursor::Right, QTextCursor::KeepAnchor); never executed: cursor.movePosition(QTextCursor::Right, QTextCursor::KeepAnchor); | 0 | ||||||||||||||||||||||||
| 851 | else | - | ||||||||||||||||||||||||
| 852 | cursor.movePosition(QTextCursor::EndOfBlock, QTextCursor::KeepAnchor); executed 2 times by 1 test: cursor.movePosition(QTextCursor::EndOfBlock, QTextCursor::KeepAnchor);Executed by:
| 2 | ||||||||||||||||||||||||
| 853 | cursor.removeSelectedText(); | - | ||||||||||||||||||||||||
| 854 | } executed 2 times by 1 test: end of blockExecuted by:
| 2 | ||||||||||||||||||||||||
| 855 | - | |||||||||||||||||||||||||
| 856 | else { | - | ||||||||||||||||||||||||
| 857 | goto executed 684 times by 3 tests: process;goto process;Executed by:
executed 684 times by 3 tests: goto process;Executed by:
| 684 | ||||||||||||||||||||||||
| 858 | } | - | ||||||||||||||||||||||||
| 859 | goto executed 26 times by 1 test: accept;goto accept;Executed by:
executed 26 times by 1 test: goto accept;Executed by:
| 26 | ||||||||||||||||||||||||
| 860 | - | |||||||||||||||||||||||||
| 861 | process: | - | ||||||||||||||||||||||||
| 862 | { | - | ||||||||||||||||||||||||
| 863 | if (q->isAcceptableInput(e)
| 96-588 | ||||||||||||||||||||||||
| 864 | if (overwriteMode
| 20-568 | ||||||||||||||||||||||||
| 865 | - | |||||||||||||||||||||||||
| 866 | - | |||||||||||||||||||||||||
| 867 | && !cursor.hasSelection()
| 0-20 | ||||||||||||||||||||||||
| 868 | && !cursor.atBlockEnd()
| 10 | ||||||||||||||||||||||||
| 869 | cursor.deleteChar(); | - | ||||||||||||||||||||||||
| 870 | } executed 10 times by 1 test: end of blockExecuted by:
| 10 | ||||||||||||||||||||||||
| 871 | - | |||||||||||||||||||||||||
| 872 | cursor.insertText(e->text()); | - | ||||||||||||||||||||||||
| 873 | selectionChanged(); | - | ||||||||||||||||||||||||
| 874 | } executed 588 times by 1 test: else {end of blockExecuted by:
| 588 | ||||||||||||||||||||||||
| 875 | e->ignore(); | - | ||||||||||||||||||||||||
| 876 | return; executed 96 times by 3 tests: return;Executed by:
| 96 | ||||||||||||||||||||||||
| 877 | } | - | ||||||||||||||||||||||||
| 878 | } | - | ||||||||||||||||||||||||
| 879 | - | |||||||||||||||||||||||||
| 880 | accept: code before this statement executed 588 times by 1 test: accept:Executed by:
| 588 | ||||||||||||||||||||||||
| 881 | - | |||||||||||||||||||||||||
| 882 | - | |||||||||||||||||||||||||
| 883 | setClipboardSelection(); | - | ||||||||||||||||||||||||
| 884 | - | |||||||||||||||||||||||||
| 885 | - | |||||||||||||||||||||||||
| 886 | e->accept(); | - | ||||||||||||||||||||||||
| 887 | cursorOn = true; | - | ||||||||||||||||||||||||
| 888 | - | |||||||||||||||||||||||||
| 889 | q->updateCursorRectangle(true); | - | ||||||||||||||||||||||||
| 890 | updateCurrentCharFormat(); | - | ||||||||||||||||||||||||
| 891 | } executed 802 times by 2 tests: end of blockExecuted by:
| 802 | ||||||||||||||||||||||||
| 892 | - | |||||||||||||||||||||||||
| 893 | QRectF QQuickTextControlPrivate::rectForPosition(int position) const | - | ||||||||||||||||||||||||
| 894 | { | - | ||||||||||||||||||||||||
| 895 | const QQuickTextControl * const q = q_func(); | - | ||||||||||||||||||||||||
| 896 | const QTextBlock block = doc->findBlock(position); | - | ||||||||||||||||||||||||
| 897 | if (!block.isValid()
| 0-2696 | ||||||||||||||||||||||||
| 898 | return never executed: QRectF();return QRectF();never executed: return QRectF(); | 0 | ||||||||||||||||||||||||
| 899 | const QTextLayout *layout = block.layout(); | - | ||||||||||||||||||||||||
| 900 | const QPointF layoutPos = q->blockBoundingRect(block).topLeft(); | - | ||||||||||||||||||||||||
| 901 | int relativePos = position - block.position(); | - | ||||||||||||||||||||||||
| 902 | - | |||||||||||||||||||||||||
| 903 | if (preeditCursor != 0
| 58-2638 | ||||||||||||||||||||||||
| 904 | int preeditPos = layout->preeditAreaPosition(); | - | ||||||||||||||||||||||||
| 905 | if (relativePos == preeditPos
| 12-46 | ||||||||||||||||||||||||
| 906 | relativePos += preeditCursor; executed 46 times by 1 test: relativePos += preeditCursor;Executed by:
| 46 | ||||||||||||||||||||||||
| 907 | else if (relativePos > preeditPos
| 0-12 | ||||||||||||||||||||||||
| 908 | relativePos += layout->preeditAreaText().length(); executed 12 times by 1 test: relativePos += layout->preeditAreaText().length();Executed by:
| 12 | ||||||||||||||||||||||||
| 909 | } executed 58 times by 1 test: end of blockExecuted by:
| 58 | ||||||||||||||||||||||||
| 910 | - | |||||||||||||||||||||||||
| 911 | QTextLine line = layout->lineForTextPosition(relativePos); | - | ||||||||||||||||||||||||
| 912 | - | |||||||||||||||||||||||||
| 913 | QRectF r; | - | ||||||||||||||||||||||||
| 914 | - | |||||||||||||||||||||||||
| 915 | if (line.isValid()
| 0-2696 | ||||||||||||||||||||||||
| 916 | qreal x = line.cursorToX(relativePos); | - | ||||||||||||||||||||||||
| 917 | qreal w = 0; | - | ||||||||||||||||||||||||
| 918 | if (overwriteMode
| 0-2696 | ||||||||||||||||||||||||
| 919 | if (relativePos < line.textLength() - line.textStart()
| 0 | ||||||||||||||||||||||||
| 920 | w = line.cursorToX(relativePos + 1) - x; never executed: w = line.cursorToX(relativePos + 1) - x; | 0 | ||||||||||||||||||||||||
| 921 | else | - | ||||||||||||||||||||||||
| 922 | w = QFontMetrics(block.layout()->font()).width(QLatin1Char(' ')); never executed: w = QFontMetrics(block.layout()->font()).width(QLatin1Char(' ')); | 0 | ||||||||||||||||||||||||
| 923 | } | - | ||||||||||||||||||||||||
| 924 | r = QRectF(layoutPos.x() + x, layoutPos.y() + line.y(), textCursorWidth + w, line.height()); | - | ||||||||||||||||||||||||
| 925 | } executed 2696 times by 3 tests: else {end of blockExecuted by:
| 2696 | ||||||||||||||||||||||||
| 926 | r = QRectF(layoutPos.x(), layoutPos.y(), textCursorWidth, 10); | - | ||||||||||||||||||||||||
| 927 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 928 | - | |||||||||||||||||||||||||
| 929 | return executed 2696 times by 3 tests: r;return r;Executed by:
executed 2696 times by 3 tests: return r;Executed by:
| 2696 | ||||||||||||||||||||||||
| 930 | } | - | ||||||||||||||||||||||||
| 931 | - | |||||||||||||||||||||||||
| 932 | void QQuickTextControlPrivate::mousePressEvent(QMouseEvent *e, const QPointF &pos) | - | ||||||||||||||||||||||||
| 933 | { | - | ||||||||||||||||||||||||
| 934 | QQuickTextControl * const q = q_func(); | - | ||||||||||||||||||||||||
| 935 | - | |||||||||||||||||||||||||
| 936 | mousePressed = (interactionFlags & Qt::TextSelectableByMouse) && (
| 2-472 | ||||||||||||||||||||||||
| 937 | mousePressPos = pos.toPoint(); | - | ||||||||||||||||||||||||
| 938 | - | |||||||||||||||||||||||||
| 939 | if (sendMouseEventToInputContext(e, pos)
| 0-514 | ||||||||||||||||||||||||
| 940 | return; never executed: return; | 0 | ||||||||||||||||||||||||
| 941 | - | |||||||||||||||||||||||||
| 942 | if (interactionFlags & Qt::LinksAccessibleByMouse
| 0-514 | ||||||||||||||||||||||||
| 943 | anchorOnMousePress = q->anchorAt(pos); | - | ||||||||||||||||||||||||
| 944 | - | |||||||||||||||||||||||||
| 945 | if (cursorIsFocusIndicator
| 124-390 | ||||||||||||||||||||||||
| 946 | cursorIsFocusIndicator = false; | - | ||||||||||||||||||||||||
| 947 | repaintSelection(); | - | ||||||||||||||||||||||||
| 948 | cursor.clearSelection(); | - | ||||||||||||||||||||||||
| 949 | } executed 124 times by 1 test: end of blockExecuted by:
| 124 | ||||||||||||||||||||||||
| 950 | } executed 514 times by 1 test: end of blockExecuted by:
| 514 | ||||||||||||||||||||||||
| 951 | if (e->button() & Qt::MiddleButton
| 2-512 | ||||||||||||||||||||||||
| 952 | return; executed 2 times by 1 test: return;Executed by:
| 2 | ||||||||||||||||||||||||
| 953 | } else if (!(e->button() & Qt::LeftButton)
| 0-512 | ||||||||||||||||||||||||
| 954 | e->ignore(); | - | ||||||||||||||||||||||||
| 955 | return; never executed: return; | 0 | ||||||||||||||||||||||||
| 956 | } else if (!(interactionFlags & (Qt::TextSelectableByMouse | Qt::TextEditable))
| 8-504 | ||||||||||||||||||||||||
| 957 | if (!(interactionFlags & Qt::LinksAccessibleByMouse)
| 0-8 | ||||||||||||||||||||||||
| 958 | e->ignore(); never executed: e->ignore(); | 0 | ||||||||||||||||||||||||
| 959 | return; executed 8 times by 1 test: return;Executed by:
| 8 | ||||||||||||||||||||||||
| 960 | } | - | ||||||||||||||||||||||||
| 961 | - | |||||||||||||||||||||||||
| 962 | cursorIsFocusIndicator = false; | - | ||||||||||||||||||||||||
| 963 | const QTextCursor oldSelection = cursor; | - | ||||||||||||||||||||||||
| 964 | const int oldCursorPos = cursor.position(); | - | ||||||||||||||||||||||||
| 965 | - | |||||||||||||||||||||||||
| 966 | - | |||||||||||||||||||||||||
| 967 | commitPreedit(); | - | ||||||||||||||||||||||||
| 968 | - | |||||||||||||||||||||||||
| 969 | - | |||||||||||||||||||||||||
| 970 | if (tripleClickTimer.isActive()
| 104-400 | ||||||||||||||||||||||||
| 971 | && ((
| 18-86 | ||||||||||||||||||||||||
| 972 | - | |||||||||||||||||||||||||
| 973 | cursor.movePosition(QTextCursor::StartOfBlock); | - | ||||||||||||||||||||||||
| 974 | cursor.movePosition(QTextCursor::EndOfBlock, QTextCursor::KeepAnchor); | - | ||||||||||||||||||||||||
| 975 | cursor.movePosition(QTextCursor::NextCharacter, QTextCursor::KeepAnchor); | - | ||||||||||||||||||||||||
| 976 | selectedBlockOnTripleClick = cursor; | - | ||||||||||||||||||||||||
| 977 | - | |||||||||||||||||||||||||
| 978 | anchorOnMousePress = QString(); | - | ||||||||||||||||||||||||
| 979 | - | |||||||||||||||||||||||||
| 980 | tripleClickTimer.stop(); | - | ||||||||||||||||||||||||
| 981 | } executed 86 times by 1 test: else {end of blockExecuted by:
| 86 | ||||||||||||||||||||||||
| 982 | int cursorPos = q->hitTest(pos, Qt::FuzzyHit); | - | ||||||||||||||||||||||||
| 983 | if (cursorPos == -1
| 0-418 | ||||||||||||||||||||||||
| 984 | e->ignore(); | - | ||||||||||||||||||||||||
| 985 | return; never executed: return; | 0 | ||||||||||||||||||||||||
| 986 | } | - | ||||||||||||||||||||||||
| 987 | - | |||||||||||||||||||||||||
| 988 | if (e->modifiers() == Qt::ShiftModifier
| 92-326 | ||||||||||||||||||||||||
| 989 | if (wordSelectionEnabled
| 0-64 | ||||||||||||||||||||||||
| 990 | selectedWordOnDoubleClick = cursor; | - | ||||||||||||||||||||||||
| 991 | selectedWordOnDoubleClick.select(QTextCursor::WordUnderCursor); | - | ||||||||||||||||||||||||
| 992 | } executed 22 times by 1 test: end of blockExecuted by:
| 22 | ||||||||||||||||||||||||
| 993 | - | |||||||||||||||||||||||||
| 994 | if (selectedBlockOnTripleClick.hasSelection()
| 34-52 | ||||||||||||||||||||||||
| 995 | extendBlockwiseSelection(cursorPos); executed 34 times by 1 test: extendBlockwiseSelection(cursorPos);Executed by:
| 34 | ||||||||||||||||||||||||
| 996 | else if (selectedWordOnDoubleClick.hasSelection()
| 12-40 | ||||||||||||||||||||||||
| 997 | extendWordwiseSelection(cursorPos, pos.x()); executed 40 times by 1 test: extendWordwiseSelection(cursorPos, pos.x());Executed by:
| 40 | ||||||||||||||||||||||||
| 998 | else if (!wordSelectionEnabled
| 0-12 | ||||||||||||||||||||||||
| 999 | setCursorPosition(cursorPos, QTextCursor::KeepAnchor); executed 12 times by 1 test: setCursorPosition(cursorPos, QTextCursor::KeepAnchor);Executed by:
| 12 | ||||||||||||||||||||||||
| 1000 | } executed 86 times by 1 test: else {end of blockExecuted by:
| 86 | ||||||||||||||||||||||||
| 1001 | setCursorPosition(cursorPos); | - | ||||||||||||||||||||||||
| 1002 | } executed 332 times by 1 test: end of blockExecuted by:
| 332 | ||||||||||||||||||||||||
| 1003 | } | - | ||||||||||||||||||||||||
| 1004 | - | |||||||||||||||||||||||||
| 1005 | if (cursor.position() != oldCursorPos
| 114-390 | ||||||||||||||||||||||||
| 1006 | q->updateCursorRectangle(true); | - | ||||||||||||||||||||||||
| 1007 | q->cursorPositionChanged(); | - | ||||||||||||||||||||||||
| 1008 | } executed 390 times by 1 test: end of blockExecuted by:
| 390 | ||||||||||||||||||||||||
| 1009 | if (interactionFlags & Qt::TextEditable
| 12-492 | ||||||||||||||||||||||||
| 1010 | _q_updateCurrentCharFormatAndSelection(); executed 492 times by 1 test: _q_updateCurrentCharFormatAndSelection();Executed by:
| 492 | ||||||||||||||||||||||||
| 1011 | else | - | ||||||||||||||||||||||||
| 1012 | selectionChanged(); executed 12 times by 1 test: selectionChanged();Executed by:
| 12 | ||||||||||||||||||||||||
| 1013 | repaintOldAndNewSelection(oldSelection); | - | ||||||||||||||||||||||||
| 1014 | hadSelectionOnMousePress = cursor.hasSelection(); | - | ||||||||||||||||||||||||
| 1015 | } executed 504 times by 1 test: end of blockExecuted by:
| 504 | ||||||||||||||||||||||||
| 1016 | - | |||||||||||||||||||||||||
| 1017 | void QQuickTextControlPrivate::mouseMoveEvent(QMouseEvent *e, const QPointF &mousePos) | - | ||||||||||||||||||||||||
| 1018 | { | - | ||||||||||||||||||||||||
| 1019 | QQuickTextControl * const q = q_func(); | - | ||||||||||||||||||||||||
| 1020 | - | |||||||||||||||||||||||||
| 1021 | if ((
| 0-138 | ||||||||||||||||||||||||
| 1022 | const bool editable = interactionFlags & Qt::TextEditable; | - | ||||||||||||||||||||||||
| 1023 | - | |||||||||||||||||||||||||
| 1024 | if (!(mousePressed
| 6-132 | ||||||||||||||||||||||||
| 1025 | || editable
| 0-6 | ||||||||||||||||||||||||
| 1026 | || selectedWordOnDoubleClick.hasSelection()
| 0 | ||||||||||||||||||||||||
| 1027 | || selectedBlockOnTripleClick.hasSelection()
| 0 | ||||||||||||||||||||||||
| 1028 | return; never executed: return; | 0 | ||||||||||||||||||||||||
| 1029 | - | |||||||||||||||||||||||||
| 1030 | const QTextCursor oldSelection = cursor; | - | ||||||||||||||||||||||||
| 1031 | const int oldCursorPos = cursor.position(); | - | ||||||||||||||||||||||||
| 1032 | - | |||||||||||||||||||||||||
| 1033 | if (!mousePressed
| 6-132 | ||||||||||||||||||||||||
| 1034 | return; executed 6 times by 1 test: return;Executed by:
| 6 | ||||||||||||||||||||||||
| 1035 | - | |||||||||||||||||||||||||
| 1036 | const qreal mouseX = qreal(mousePos.x()); | - | ||||||||||||||||||||||||
| 1037 | - | |||||||||||||||||||||||||
| 1038 | int newCursorPos = q->hitTest(mousePos, Qt::FuzzyHit); | - | ||||||||||||||||||||||||
| 1039 | - | |||||||||||||||||||||||||
| 1040 | - | |||||||||||||||||||||||||
| 1041 | if (isPreediting()
| 0-132 | ||||||||||||||||||||||||
| 1042 | - | |||||||||||||||||||||||||
| 1043 | int selectionStartPos = q->hitTest(mousePressPos, Qt::FuzzyHit); | - | ||||||||||||||||||||||||
| 1044 | if (newCursorPos != selectionStartPos
| 0 | ||||||||||||||||||||||||
| 1045 | commitPreedit(); | - | ||||||||||||||||||||||||
| 1046 | - | |||||||||||||||||||||||||
| 1047 | newCursorPos = q->hitTest(mousePos, Qt::FuzzyHit); | - | ||||||||||||||||||||||||
| 1048 | selectionStartPos = q->hitTest(mousePressPos, Qt::FuzzyHit); | - | ||||||||||||||||||||||||
| 1049 | setCursorPosition(selectionStartPos); | - | ||||||||||||||||||||||||
| 1050 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 1051 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 1052 | - | |||||||||||||||||||||||||
| 1053 | - | |||||||||||||||||||||||||
| 1054 | if (newCursorPos == -1
| 0-132 | ||||||||||||||||||||||||
| 1055 | return; never executed: return; | 0 | ||||||||||||||||||||||||
| 1056 | - | |||||||||||||||||||||||||
| 1057 | if (wordSelectionEnabled
| 0-108 | ||||||||||||||||||||||||
| 1058 | selectedWordOnDoubleClick = cursor; | - | ||||||||||||||||||||||||
| 1059 | selectedWordOnDoubleClick.select(QTextCursor::WordUnderCursor); | - | ||||||||||||||||||||||||
| 1060 | } executed 24 times by 1 test: end of blockExecuted by:
| 24 | ||||||||||||||||||||||||
| 1061 | - | |||||||||||||||||||||||||
| 1062 | if (selectedBlockOnTripleClick.hasSelection()
| 34-98 | ||||||||||||||||||||||||
| 1063 | extendBlockwiseSelection(newCursorPos); executed 34 times by 1 test: extendBlockwiseSelection(newCursorPos);Executed by:
| 34 | ||||||||||||||||||||||||
| 1064 | else if (selectedWordOnDoubleClick.hasSelection()
| 42-56 | ||||||||||||||||||||||||
| 1065 | extendWordwiseSelection(newCursorPos, mouseX); executed 42 times by 1 test: extendWordwiseSelection(newCursorPos, mouseX);Executed by:
| 42 | ||||||||||||||||||||||||
| 1066 | - | |||||||||||||||||||||||||
| 1067 | else if (!isPreediting()
| 0-56 | ||||||||||||||||||||||||
| 1068 | setCursorPosition(newCursorPos, QTextCursor::KeepAnchor); executed 56 times by 1 test: setCursorPosition(newCursorPos, QTextCursor::KeepAnchor);Executed by:
| 56 | ||||||||||||||||||||||||
| 1069 | - | |||||||||||||||||||||||||
| 1070 | - | |||||||||||||||||||||||||
| 1071 | if (interactionFlags & Qt::TextEditable
| 0-132 | ||||||||||||||||||||||||
| 1072 | if (cursor.position() != oldCursorPos
| 26-106 | ||||||||||||||||||||||||
| 1073 | q->cursorPositionChanged(); | - | ||||||||||||||||||||||||
| 1074 | } executed 106 times by 1 test: end of blockExecuted by:
| 106 | ||||||||||||||||||||||||
| 1075 | _q_updateCurrentCharFormatAndSelection(); | - | ||||||||||||||||||||||||
| 1076 | - | |||||||||||||||||||||||||
| 1077 | if ((static_cast<
| 0-132 | ||||||||||||||||||||||||
| 1078 | (static_cast< executed 132 times by 1 test: QGuiApplication *>(QCoreApplication::instance()))->inputMethod()->update(Qt::ImQueryInput);(static_cast<QGuiApplication *>(QCoreApplication::instance()))->inputMethod()->update(Qt::ImQueryInput);Executed by:
executed 132 times by 1 test: (static_cast<QGuiApplication *>(QCoreApplication::instance()))->inputMethod()->update(Qt::ImQueryInput);Executed by:
| 132 | ||||||||||||||||||||||||
| 1079 | - | |||||||||||||||||||||||||
| 1080 | } executed 132 times by 1 test: else if (cursor.position() != oldCursorPosend of blockExecuted by:
| 0-132 | ||||||||||||||||||||||||
| 1081 | q->cursorPositionChanged(); | - | ||||||||||||||||||||||||
| 1082 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 1083 | selectionChanged(true); | - | ||||||||||||||||||||||||
| 1084 | repaintOldAndNewSelection(oldSelection); | - | ||||||||||||||||||||||||
| 1085 | } executed 132 times by 1 test: end of blockExecuted by:
| 132 | ||||||||||||||||||||||||
| 1086 | - | |||||||||||||||||||||||||
| 1087 | sendMouseEventToInputContext(e, mousePos); | - | ||||||||||||||||||||||||
| 1088 | } executed 132 times by 1 test: end of blockExecuted by:
| 132 | ||||||||||||||||||||||||
| 1089 | - | |||||||||||||||||||||||||
| 1090 | void QQuickTextControlPrivate::mouseReleaseEvent(QMouseEvent *e, const QPointF &pos) | - | ||||||||||||||||||||||||
| 1091 | { | - | ||||||||||||||||||||||||
| 1092 | QQuickTextControl * const q = q_func(); | - | ||||||||||||||||||||||||
| 1093 | - | |||||||||||||||||||||||||
| 1094 | if (sendMouseEventToInputContext(e, pos)
| 0-514 | ||||||||||||||||||||||||
| 1095 | return; never executed: return; | 0 | ||||||||||||||||||||||||
| 1096 | - | |||||||||||||||||||||||||
| 1097 | const QTextCursor oldSelection = cursor; | - | ||||||||||||||||||||||||
| 1098 | const int oldCursorPos = cursor.position(); | - | ||||||||||||||||||||||||
| 1099 | - | |||||||||||||||||||||||||
| 1100 | if (mousePressed
| 42-472 | ||||||||||||||||||||||||
| 1101 | mousePressed = false; | - | ||||||||||||||||||||||||
| 1102 | - | |||||||||||||||||||||||||
| 1103 | setClipboardSelection(); | - | ||||||||||||||||||||||||
| 1104 | selectionChanged(true); | - | ||||||||||||||||||||||||
| 1105 | } executed 472 times by 1 test: else if (e->button() == Qt::MidButtonend of blockExecuted by:
| 2-472 | ||||||||||||||||||||||||
| 1106 | && (interactionFlags & Qt::TextEditable) | - | ||||||||||||||||||||||||
| 1107 | && QGuiApplication::clipboard()->supportsSelection()
| 0-2 | ||||||||||||||||||||||||
| 1108 | setCursorPosition(pos); | - | ||||||||||||||||||||||||
| 1109 | const QMimeData *md = QGuiApplication::clipboard()->mimeData(QClipboard::Selection); | - | ||||||||||||||||||||||||
| 1110 | if (md
| 0-2 | ||||||||||||||||||||||||
| 1111 | q->insertFromMimeData(md); executed 2 times by 1 test: q->insertFromMimeData(md);Executed by:
| 2 | ||||||||||||||||||||||||
| 1112 | - | |||||||||||||||||||||||||
| 1113 | } executed 2 times by 1 test: end of blockExecuted by:
| 2 | ||||||||||||||||||||||||
| 1114 | - | |||||||||||||||||||||||||
| 1115 | repaintOldAndNewSelection(oldSelection); | - | ||||||||||||||||||||||||
| 1116 | - | |||||||||||||||||||||||||
| 1117 | if (cursor.position() != oldCursorPos
| 2-512 | ||||||||||||||||||||||||
| 1118 | q->cursorPositionChanged(); | - | ||||||||||||||||||||||||
| 1119 | q->updateCursorRectangle(true); | - | ||||||||||||||||||||||||
| 1120 | } executed 2 times by 1 test: end of blockExecuted by:
| 2 | ||||||||||||||||||||||||
| 1121 | - | |||||||||||||||||||||||||
| 1122 | if (interactionFlags & Qt::LinksAccessibleByMouse
| 0-514 | ||||||||||||||||||||||||
| 1123 | if (!(e->button() & Qt::LeftButton)
| 2-512 | ||||||||||||||||||||||||
| 1124 | return; executed 2 times by 1 test: return;Executed by:
| 2 | ||||||||||||||||||||||||
| 1125 | - | |||||||||||||||||||||||||
| 1126 | const QString anchor = q->anchorAt(pos); | - | ||||||||||||||||||||||||
| 1127 | - | |||||||||||||||||||||||||
| 1128 | if (anchor.isEmpty()
| 4-508 | ||||||||||||||||||||||||
| 1129 | return; executed 508 times by 1 test: return;Executed by:
| 508 | ||||||||||||||||||||||||
| 1130 | - | |||||||||||||||||||||||||
| 1131 | if (!cursor.hasSelection()
| 0-4 | ||||||||||||||||||||||||
| 1132 | || (anchor == anchorOnMousePress
| 0 | ||||||||||||||||||||||||
| 1133 | - | |||||||||||||||||||||||||
| 1134 | const int anchorPos = q->hitTest(pos, Qt::ExactHit); | - | ||||||||||||||||||||||||
| 1135 | if (anchorPos != -1
| 0-4 | ||||||||||||||||||||||||
| 1136 | cursor.setPosition(anchorPos); | - | ||||||||||||||||||||||||
| 1137 | - | |||||||||||||||||||||||||
| 1138 | QString anchor = anchorOnMousePress; | - | ||||||||||||||||||||||||
| 1139 | anchorOnMousePress = QString(); | - | ||||||||||||||||||||||||
| 1140 | activateLinkUnderCursor(anchor); | - | ||||||||||||||||||||||||
| 1141 | } executed 4 times by 1 test: end of blockExecuted by:
| 4 | ||||||||||||||||||||||||
| 1142 | } executed 4 times by 1 test: end of blockExecuted by:
| 4 | ||||||||||||||||||||||||
| 1143 | } executed 4 times by 1 test: end of blockExecuted by:
| 4 | ||||||||||||||||||||||||
| 1144 | } executed 4 times by 1 test: end of blockExecuted by:
| 4 | ||||||||||||||||||||||||
| 1145 | - | |||||||||||||||||||||||||
| 1146 | void QQuickTextControlPrivate::mouseDoubleClickEvent(QMouseEvent *e, const QPointF &pos) | - | ||||||||||||||||||||||||
| 1147 | { | - | ||||||||||||||||||||||||
| 1148 | QQuickTextControl * const q = q_func(); | - | ||||||||||||||||||||||||
| 1149 | - | |||||||||||||||||||||||||
| 1150 | if (e->button() == Qt::LeftButton
| 0-104 | ||||||||||||||||||||||||
| 1151 | - | |||||||||||||||||||||||||
| 1152 | commitPreedit(); | - | ||||||||||||||||||||||||
| 1153 | - | |||||||||||||||||||||||||
| 1154 | - | |||||||||||||||||||||||||
| 1155 | const QTextCursor oldSelection = cursor; | - | ||||||||||||||||||||||||
| 1156 | setCursorPosition(pos); | - | ||||||||||||||||||||||||
| 1157 | QTextLine line = currentTextLine(cursor); | - | ||||||||||||||||||||||||
| 1158 | bool doEmit = false; | - | ||||||||||||||||||||||||
| 1159 | if (line.isValid()
| 0-104 | ||||||||||||||||||||||||
| 1160 | cursor.select(QTextCursor::WordUnderCursor); | - | ||||||||||||||||||||||||
| 1161 | doEmit = true; | - | ||||||||||||||||||||||||
| 1162 | } executed 104 times by 1 test: end of blockExecuted by:
| 104 | ||||||||||||||||||||||||
| 1163 | repaintOldAndNewSelection(oldSelection); | - | ||||||||||||||||||||||||
| 1164 | - | |||||||||||||||||||||||||
| 1165 | cursorIsFocusIndicator = false; | - | ||||||||||||||||||||||||
| 1166 | selectedWordOnDoubleClick = cursor; | - | ||||||||||||||||||||||||
| 1167 | - | |||||||||||||||||||||||||
| 1168 | tripleClickPoint = pos; | - | ||||||||||||||||||||||||
| 1169 | tripleClickTimer.start(QGuiApplication::styleHints()->mouseDoubleClickInterval(), q); | - | ||||||||||||||||||||||||
| 1170 | if (doEmit
| 0-104 | ||||||||||||||||||||||||
| 1171 | selectionChanged(); | - | ||||||||||||||||||||||||
| 1172 | - | |||||||||||||||||||||||||
| 1173 | setClipboardSelection(); | - | ||||||||||||||||||||||||
| 1174 | - | |||||||||||||||||||||||||
| 1175 | q->cursorPositionChanged(); | - | ||||||||||||||||||||||||
| 1176 | q->updateCursorRectangle(true); | - | ||||||||||||||||||||||||
| 1177 | } executed 104 times by 1 test: end of blockExecuted by:
| 104 | ||||||||||||||||||||||||
| 1178 | } executed 104 times by 1 test: else if (!sendMouseEventToInputContext(e, pos)end of blockExecuted by:
| 0-104 | ||||||||||||||||||||||||
| 1179 | e->ignore(); | - | ||||||||||||||||||||||||
| 1180 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 1181 | } executed 104 times by 1 test: end of blockExecuted by:
| 104 | ||||||||||||||||||||||||
| 1182 | - | |||||||||||||||||||||||||
| 1183 | bool QQuickTextControlPrivate::sendMouseEventToInputContext(QMouseEvent *e, const QPointF &pos) | - | ||||||||||||||||||||||||
| 1184 | { | - | ||||||||||||||||||||||||
| 1185 | - | |||||||||||||||||||||||||
| 1186 | QQuickTextControl * const q = q_func(); | - | ||||||||||||||||||||||||
| 1187 | - | |||||||||||||||||||||||||
| 1188 | (void)e;; | - | ||||||||||||||||||||||||
| 1189 | - | |||||||||||||||||||||||||
| 1190 | if (isPreediting()
| 0-1160 | ||||||||||||||||||||||||
| 1191 | QTextLayout *layout = cursor.block().layout(); | - | ||||||||||||||||||||||||
| 1192 | int cursorPos = q->hitTest(pos, Qt::FuzzyHit) - cursor.position(); | - | ||||||||||||||||||||||||
| 1193 | - | |||||||||||||||||||||||||
| 1194 | if (cursorPos >= 0
| 0 | ||||||||||||||||||||||||
| 1195 | if (e->type() == QEvent::MouseButtonRelease
| 0 | ||||||||||||||||||||||||
| 1196 | QGuiApplication::inputMethod()->invokeAction(QInputMethod::Click, cursorPos); | - | ||||||||||||||||||||||||
| 1197 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 1198 | - | |||||||||||||||||||||||||
| 1199 | return never executed: true;return true;never executed: return true; | 0 | ||||||||||||||||||||||||
| 1200 | } | - | ||||||||||||||||||||||||
| 1201 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 1202 | - | |||||||||||||||||||||||||
| 1203 | - | |||||||||||||||||||||||||
| 1204 | - | |||||||||||||||||||||||||
| 1205 | - | |||||||||||||||||||||||||
| 1206 | return executed 1160 times by 1 test: false;return false;Executed by:
executed 1160 times by 1 test: return false;Executed by:
| 1160 | ||||||||||||||||||||||||
| 1207 | } | - | ||||||||||||||||||||||||
| 1208 | - | |||||||||||||||||||||||||
| 1209 | - | |||||||||||||||||||||||||
| 1210 | void QQuickTextControlPrivate::inputMethodEvent(QInputMethodEvent *e) | - | ||||||||||||||||||||||||
| 1211 | { | - | ||||||||||||||||||||||||
| 1212 | QQuickTextControl * const q = q_func(); | - | ||||||||||||||||||||||||
| 1213 | if (!(interactionFlags & Qt::TextEditable)
| 0-324 | ||||||||||||||||||||||||
| 1214 | e->ignore(); | - | ||||||||||||||||||||||||
| 1215 | return; never executed: return; | 0 | ||||||||||||||||||||||||
| 1216 | } | - | ||||||||||||||||||||||||
| 1217 | bool isGettingInput = !e->commitString().isEmpty()
| 136-188 | ||||||||||||||||||||||||
| 1218 | || e->preeditString() != cursor.block().layout()->preeditAreaText()
| 44-144 | ||||||||||||||||||||||||
| 1219 | || e->replacementLength() > 0
| 36-108 | ||||||||||||||||||||||||
| 1220 | bool forceSelectionChanged = false; | - | ||||||||||||||||||||||||
| 1221 | - | |||||||||||||||||||||||||
| 1222 | cursor.beginEditBlock(); | - | ||||||||||||||||||||||||
| 1223 | if (isGettingInput
| 36-288 | ||||||||||||||||||||||||
| 1224 | cursor.removeSelectedText(); | - | ||||||||||||||||||||||||
| 1225 | } executed 288 times by 1 test: end of blockExecuted by:
| 288 | ||||||||||||||||||||||||
| 1226 | - | |||||||||||||||||||||||||
| 1227 | QTextBlock block; | - | ||||||||||||||||||||||||
| 1228 | - | |||||||||||||||||||||||||
| 1229 | - | |||||||||||||||||||||||||
| 1230 | if (!e->commitString().isEmpty()
| 80-188 | ||||||||||||||||||||||||
| 1231 | if (e->commitString().endsWith(QChar::LineFeed)
| 0-244 | ||||||||||||||||||||||||
| 1232 | block = cursor.block(); never executed: block = cursor.block(); | 0 | ||||||||||||||||||||||||
| 1233 | QTextCursor c = cursor; | - | ||||||||||||||||||||||||
| 1234 | c.setPosition(c.position() + e->replacementStart()); | - | ||||||||||||||||||||||||
| 1235 | c.setPosition(c.position() + e->replacementLength(), QTextCursor::KeepAnchor); | - | ||||||||||||||||||||||||
| 1236 | c.insertText(e->commitString()); | - | ||||||||||||||||||||||||
| 1237 | } executed 244 times by 1 test: end of blockExecuted by:
| 244 | ||||||||||||||||||||||||
| 1238 | - | |||||||||||||||||||||||||
| 1239 | for (int i = 0; i < e->attributes().size()
| 34-324 | ||||||||||||||||||||||||
| 1240 | const QInputMethodEvent::Attribute &a = e->attributes().at(i); | - | ||||||||||||||||||||||||
| 1241 | if (a.type == QInputMethodEvent::Selection
| 4-30 | ||||||||||||||||||||||||
| 1242 | QTextCursor oldCursor = cursor; | - | ||||||||||||||||||||||||
| 1243 | int blockStart = a.start + cursor.block().position(); | - | ||||||||||||||||||||||||
| 1244 | cursor.setPosition(blockStart, QTextCursor::MoveAnchor); | - | ||||||||||||||||||||||||
| 1245 | cursor.setPosition(blockStart + a.length, QTextCursor::KeepAnchor); | - | ||||||||||||||||||||||||
| 1246 | repaintOldAndNewSelection(oldCursor); | - | ||||||||||||||||||||||||
| 1247 | forceSelectionChanged = true; | - | ||||||||||||||||||||||||
| 1248 | } executed 4 times by 1 test: end of blockExecuted by:
| 4 | ||||||||||||||||||||||||
| 1249 | } executed 34 times by 1 test: end of blockExecuted by:
| 34 | ||||||||||||||||||||||||
| 1250 | - | |||||||||||||||||||||||||
| 1251 | if (!block.isValid()
| 0-324 | ||||||||||||||||||||||||
| 1252 | block = cursor.block(); executed 324 times by 1 test: block = cursor.block();Executed by:
| 324 | ||||||||||||||||||||||||
| 1253 | - | |||||||||||||||||||||||||
| 1254 | QTextLayout *layout = block.layout(); | - | ||||||||||||||||||||||||
| 1255 | if (isGettingInput
| 36-288 | ||||||||||||||||||||||||
| 1256 | layout->setPreeditArea(cursor.position() - block.position(), e->preeditString()); | - | ||||||||||||||||||||||||
| 1257 | q->preeditTextChanged(); | - | ||||||||||||||||||||||||
| 1258 | } executed 288 times by 1 test: end of blockExecuted by:
| 288 | ||||||||||||||||||||||||
| 1259 | QVector<QTextLayout::FormatRange> overrides; | - | ||||||||||||||||||||||||
| 1260 | const int oldPreeditCursor = preeditCursor; | - | ||||||||||||||||||||||||
| 1261 | preeditCursor = e->preeditString().length(); | - | ||||||||||||||||||||||||
| 1262 | hasImState = !e->preeditString().isEmpty(); | - | ||||||||||||||||||||||||
| 1263 | cursorVisible = true; | - | ||||||||||||||||||||||||
| 1264 | for (int i = 0; i < e->attributes().size()
| 34-324 | ||||||||||||||||||||||||
| 1265 | const QInputMethodEvent::Attribute &a = e->attributes().at(i); | - | ||||||||||||||||||||||||
| 1266 | if (a.type == QInputMethodEvent::Cursor
| 6-28 | ||||||||||||||||||||||||
| 1267 | hasImState = true; | - | ||||||||||||||||||||||||
| 1268 | preeditCursor = a.start; | - | ||||||||||||||||||||||||
| 1269 | cursorVisible = a.length != 0; | - | ||||||||||||||||||||||||
| 1270 | } executed 28 times by 1 test: else if (a.type == QInputMethodEvent::TextFormatend of blockExecuted by:
| 2-28 | ||||||||||||||||||||||||
| 1271 | hasImState = true; | - | ||||||||||||||||||||||||
| 1272 | QTextCharFormat f = qvariant_cast<QTextFormat>(a.value).toCharFormat(); | - | ||||||||||||||||||||||||
| 1273 | if (f.isValid()
| 0-2 | ||||||||||||||||||||||||
| 1274 | QTextLayout::FormatRange o; | - | ||||||||||||||||||||||||
| 1275 | o.start = a.start + cursor.position() - block.position(); | - | ||||||||||||||||||||||||
| 1276 | o.length = a.length; | - | ||||||||||||||||||||||||
| 1277 | o.format = f; | - | ||||||||||||||||||||||||
| 1278 | overrides.append(o); | - | ||||||||||||||||||||||||
| 1279 | } executed 2 times by 1 test: end of blockExecuted by:
| 2 | ||||||||||||||||||||||||
| 1280 | } executed 2 times by 1 test: end of blockExecuted by:
| 2 | ||||||||||||||||||||||||
| 1281 | } executed 34 times by 1 test: end of blockExecuted by:
| 34 | ||||||||||||||||||||||||
| 1282 | layout->setFormats(overrides); | - | ||||||||||||||||||||||||
| 1283 | - | |||||||||||||||||||||||||
| 1284 | cursor.endEditBlock(); | - | ||||||||||||||||||||||||
| 1285 | - | |||||||||||||||||||||||||
| 1286 | QTextCursorPrivate *cursor_d = QTextCursorPrivate::getPrivate(&cursor); | - | ||||||||||||||||||||||||
| 1287 | if (cursor_d
| 0-324 | ||||||||||||||||||||||||
| 1288 | cursor_d->setX(); executed 324 times by 1 test: cursor_d->setX();Executed by:
| 324 | ||||||||||||||||||||||||
| 1289 | q->updateCursorRectangle(oldPreeditCursor != preeditCursor || forceSelectionChanged || isGettingInput); | - | ||||||||||||||||||||||||
| 1290 | selectionChanged(forceSelectionChanged); | - | ||||||||||||||||||||||||
| 1291 | } executed 324 times by 1 test: end of blockExecuted by:
| 324 | ||||||||||||||||||||||||
| 1292 | - | |||||||||||||||||||||||||
| 1293 | QVariant QQuickTextControl::inputMethodQuery(Qt::InputMethodQuery property) const | - | ||||||||||||||||||||||||
| 1294 | { | - | ||||||||||||||||||||||||
| 1295 | return never executed: inputMethodQuery(property, QVariant());return inputMethodQuery(property, QVariant());never executed: return inputMethodQuery(property, QVariant()); | 0 | ||||||||||||||||||||||||
| 1296 | } | - | ||||||||||||||||||||||||
| 1297 | - | |||||||||||||||||||||||||
| 1298 | QVariant QQuickTextControl::inputMethodQuery(Qt::InputMethodQuery property, QVariant argument) const | - | ||||||||||||||||||||||||
| 1299 | { | - | ||||||||||||||||||||||||
| 1300 | const QQuickTextControlPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 1301 | QTextBlock block = d->cursor.block(); | - | ||||||||||||||||||||||||
| 1302 | switch (property) { | - | ||||||||||||||||||||||||
| 1303 | case executed 26 times by 1 test: Qt::ImCursorRectangle:case Qt::ImCursorRectangle:Executed by:
executed 26 times by 1 test: case Qt::ImCursorRectangle:Executed by:
| 26 | ||||||||||||||||||||||||
| 1304 | return executed 26 times by 1 test: cursorRect();return cursorRect();Executed by:
executed 26 times by 1 test: return cursorRect();Executed by:
| 26 | ||||||||||||||||||||||||
| 1305 | case never executed: Qt::ImAnchorRectangle:case Qt::ImAnchorRectangle:never executed: case Qt::ImAnchorRectangle: | 0 | ||||||||||||||||||||||||
| 1306 | return never executed: anchorRect();return anchorRect();never executed: return anchorRect(); | 0 | ||||||||||||||||||||||||
| 1307 | case never executed: Qt::ImFont:case Qt::ImFont:never executed: case Qt::ImFont: | 0 | ||||||||||||||||||||||||
| 1308 | return never executed: QVariant(d->cursor.charFormat().font());return QVariant(d->cursor.charFormat().font());never executed: return QVariant(d->cursor.charFormat().font()); | 0 | ||||||||||||||||||||||||
| 1309 | case never executed: Qt::ImCursorPosition:case Qt::ImCursorPosition:never executed: {case Qt::ImCursorPosition: | 0 | ||||||||||||||||||||||||
| 1310 | const QPointF pt = argument.toPointF(); | - | ||||||||||||||||||||||||
| 1311 | if (!pt.isNull()
| 0 | ||||||||||||||||||||||||
| 1312 | return never executed: QVariant(d->doc->documentLayout()->hitTest(pt, Qt::FuzzyHit) - block.position());return QVariant(d->doc->documentLayout()->hitTest(pt, Qt::FuzzyHit) - block.position());never executed: return QVariant(d->doc->documentLayout()->hitTest(pt, Qt::FuzzyHit) - block.position()); | 0 | ||||||||||||||||||||||||
| 1313 | return never executed: QVariant(d->cursor.position() - block.position());return QVariant(d->cursor.position() - block.position());never executed: return QVariant(d->cursor.position() - block.position()); | 0 | ||||||||||||||||||||||||
| 1314 | } | - | ||||||||||||||||||||||||
| 1315 | case never executed: Qt::ImSurroundingText:case Qt::ImSurroundingText:never executed: case Qt::ImSurroundingText: | 0 | ||||||||||||||||||||||||
| 1316 | return never executed: QVariant(block.text());return QVariant(block.text());never executed: return QVariant(block.text()); | 0 | ||||||||||||||||||||||||
| 1317 | case never executed: Qt::ImCurrentSelection:case Qt::ImCurrentSelection:never executed: case Qt::ImCurrentSelection: | 0 | ||||||||||||||||||||||||
| 1318 | return never executed: QVariant(d->cursor.selectedText());return QVariant(d->cursor.selectedText());never executed: return QVariant(d->cursor.selectedText()); | 0 | ||||||||||||||||||||||||
| 1319 | case never executed: Qt::ImMaximumTextLength:case Qt::ImMaximumTextLength:never executed: case Qt::ImMaximumTextLength: | 0 | ||||||||||||||||||||||||
| 1320 | return never executed: QVariant();return QVariant();never executed: return QVariant(); | 0 | ||||||||||||||||||||||||
| 1321 | case never executed: Qt::ImAnchorPosition:case Qt::ImAnchorPosition:never executed: case Qt::ImAnchorPosition: | 0 | ||||||||||||||||||||||||
| 1322 | return never executed: QVariant(d->cursor.anchor() - block.position());return QVariant(d->cursor.anchor() - block.position());never executed: return QVariant(d->cursor.anchor() - block.position()); | 0 | ||||||||||||||||||||||||
| 1323 | case never executed: Qt::ImAbsolutePosition:case Qt::ImAbsolutePosition:never executed: case Qt::ImAbsolutePosition: | 0 | ||||||||||||||||||||||||
| 1324 | return never executed: QVariant(d->cursor.anchor());return QVariant(d->cursor.anchor());never executed: return QVariant(d->cursor.anchor()); | 0 | ||||||||||||||||||||||||
| 1325 | case never executed: Qt::ImTextAfterCursor:case Qt::ImTextAfterCursor:never executed: case Qt::ImTextAfterCursor: | 0 | ||||||||||||||||||||||||
| 1326 | { | - | ||||||||||||||||||||||||
| 1327 | int maxLength = argument.isValid()
| 0 | ||||||||||||||||||||||||
| 1328 | QTextCursor tmpCursor = d->cursor; | - | ||||||||||||||||||||||||
| 1329 | int localPos = d->cursor.position() - block.position(); | - | ||||||||||||||||||||||||
| 1330 | QString result = block.text().mid(localPos); | - | ||||||||||||||||||||||||
| 1331 | while (result.length() < maxLength
| 0 | ||||||||||||||||||||||||
| 1332 | int currentBlock = tmpCursor.blockNumber(); | - | ||||||||||||||||||||||||
| 1333 | tmpCursor.movePosition(QTextCursor::NextBlock); | - | ||||||||||||||||||||||||
| 1334 | if (tmpCursor.blockNumber() == currentBlock
| 0 | ||||||||||||||||||||||||
| 1335 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 1336 | result += QLatin1Char('\n') + tmpCursor.block().text(); | - | ||||||||||||||||||||||||
| 1337 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 1338 | return never executed: QVariant(result);return QVariant(result);never executed: return QVariant(result); | 0 | ||||||||||||||||||||||||
| 1339 | } | - | ||||||||||||||||||||||||
| 1340 | case never executed: Qt::ImTextBeforeCursor:case Qt::ImTextBeforeCursor:never executed: case Qt::ImTextBeforeCursor: | 0 | ||||||||||||||||||||||||
| 1341 | { | - | ||||||||||||||||||||||||
| 1342 | int maxLength = argument.isValid()
| 0 | ||||||||||||||||||||||||
| 1343 | QTextCursor tmpCursor = d->cursor; | - | ||||||||||||||||||||||||
| 1344 | int localPos = d->cursor.position() - block.position(); | - | ||||||||||||||||||||||||
| 1345 | int numBlocks = 0; | - | ||||||||||||||||||||||||
| 1346 | int resultLen = localPos; | - | ||||||||||||||||||||||||
| 1347 | while (resultLen < maxLength
| 0 | ||||||||||||||||||||||||
| 1348 | int currentBlock = tmpCursor.blockNumber(); | - | ||||||||||||||||||||||||
| 1349 | tmpCursor.movePosition(QTextCursor::PreviousBlock); | - | ||||||||||||||||||||||||
| 1350 | if (tmpCursor.blockNumber() == currentBlock
| 0 | ||||||||||||||||||||||||
| 1351 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 1352 | numBlocks++; | - | ||||||||||||||||||||||||
| 1353 | resultLen += tmpCursor.block().length(); | - | ||||||||||||||||||||||||
| 1354 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 1355 | QString result; | - | ||||||||||||||||||||||||
| 1356 | while (numBlocks
| 0 | ||||||||||||||||||||||||
| 1357 | result += tmpCursor.block().text() + QLatin1Char('\n'); | - | ||||||||||||||||||||||||
| 1358 | tmpCursor.movePosition(QTextCursor::NextBlock); | - | ||||||||||||||||||||||||
| 1359 | --numBlocks; | - | ||||||||||||||||||||||||
| 1360 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 1361 | result += block.text().midRef(0,localPos); | - | ||||||||||||||||||||||||
| 1362 | return never executed: QVariant(result);return QVariant(result);never executed: return QVariant(result); | 0 | ||||||||||||||||||||||||
| 1363 | } | - | ||||||||||||||||||||||||
| 1364 | default never executed: :default:never executed: default: | 0 | ||||||||||||||||||||||||
| 1365 | return never executed: QVariant();return QVariant();never executed: return QVariant(); | 0 | ||||||||||||||||||||||||
| 1366 | } | - | ||||||||||||||||||||||||
| 1367 | } | - | ||||||||||||||||||||||||
| 1368 | - | |||||||||||||||||||||||||
| 1369 | - | |||||||||||||||||||||||||
| 1370 | void QQuickTextControlPrivate::focusEvent(QFocusEvent *e) | - | ||||||||||||||||||||||||
| 1371 | { | - | ||||||||||||||||||||||||
| 1372 | QQuickTextControl * const q = q_func(); | - | ||||||||||||||||||||||||
| 1373 | q->updateRequest(); | - | ||||||||||||||||||||||||
| 1374 | hasFocus = e->gotFocus(); | - | ||||||||||||||||||||||||
| 1375 | if (e->gotFocus()
| 94-338 | ||||||||||||||||||||||||
| 1376 | setBlinkingCursorEnabled(interactionFlags & (Qt::TextEditable | Qt::TextSelectableByKeyboard)); | - | ||||||||||||||||||||||||
| 1377 | } executed 338 times by 3 tests: else {end of blockExecuted by:
| 338 | ||||||||||||||||||||||||
| 1378 | setBlinkingCursorEnabled(false); | - | ||||||||||||||||||||||||
| 1379 | - | |||||||||||||||||||||||||
| 1380 | if (cursorIsFocusIndicator
| 4-90 | ||||||||||||||||||||||||
| 1381 | && e->reason() != Qt::ActiveWindowFocusReason
| 6-84 | ||||||||||||||||||||||||
| 1382 | && e->reason() != Qt::PopupFocusReason
| 0-84 | ||||||||||||||||||||||||
| 1383 | && cursor.hasSelection()
| 8-76 | ||||||||||||||||||||||||
| 1384 | cursor.clearSelection(); | - | ||||||||||||||||||||||||
| 1385 | q->selectionChanged(); | - | ||||||||||||||||||||||||
| 1386 | } executed 8 times by 1 test: end of blockExecuted by:
| 8 | ||||||||||||||||||||||||
| 1387 | } executed 94 times by 3 tests: end of blockExecuted by:
| 94 | ||||||||||||||||||||||||
| 1388 | } | - | ||||||||||||||||||||||||
| 1389 | - | |||||||||||||||||||||||||
| 1390 | void QQuickTextControlPrivate::hoverEvent(QHoverEvent *e, const QPointF &pos) | - | ||||||||||||||||||||||||
| 1391 | { | - | ||||||||||||||||||||||||
| 1392 | QQuickTextControl * const q = q_func(); | - | ||||||||||||||||||||||||
| 1393 | - | |||||||||||||||||||||||||
| 1394 | QString link; | - | ||||||||||||||||||||||||
| 1395 | if (e->type() != QEvent::HoverLeave
| 0-8 | ||||||||||||||||||||||||
| 1396 | link = q->anchorAt(pos); executed 8 times by 1 test: link = q->anchorAt(pos);Executed by:
| 8 | ||||||||||||||||||||||||
| 1397 | - | |||||||||||||||||||||||||
| 1398 | if (hoveredLink != link
| 0-8 | ||||||||||||||||||||||||
| 1399 | hoveredLink = link; | - | ||||||||||||||||||||||||
| 1400 | q->linkHovered(link); | - | ||||||||||||||||||||||||
| 1401 | } executed 8 times by 1 test: end of blockExecuted by:
| 8 | ||||||||||||||||||||||||
| 1402 | for (bool qt_category_enabled = DBG_HOVER_TRACE().isDebugEnabled(); qt_category_enabled
never executed: QMessageLogger(__FILE__, 1481, __PRETTY_FUNCTION__, DBG_HOVER_TRACE().categoryName()).debug() << q << e->type() << pos << "hoveredLink" << hoveredLink; | 0-8 | ||||||||||||||||||||||||
| 1403 | } executed 8 times by 1 test: end of blockExecuted by:
| 8 | ||||||||||||||||||||||||
| 1404 | - | |||||||||||||||||||||||||
| 1405 | bool QQuickTextControl::hasImState() const | - | ||||||||||||||||||||||||
| 1406 | { | - | ||||||||||||||||||||||||
| 1407 | const QQuickTextControlPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 1408 | return executed 672 times by 1 test: d->hasImState;return d->hasImState;Executed by:
executed 672 times by 1 test: return d->hasImState;Executed by:
| 672 | ||||||||||||||||||||||||
| 1409 | } | - | ||||||||||||||||||||||||
| 1410 | - | |||||||||||||||||||||||||
| 1411 | bool QQuickTextControl::overwriteMode() const | - | ||||||||||||||||||||||||
| 1412 | { | - | ||||||||||||||||||||||||
| 1413 | const QQuickTextControlPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 1414 | return executed 6 times by 1 test: d->overwriteMode;return d->overwriteMode;Executed by:
executed 6 times by 1 test: return d->overwriteMode;Executed by:
| 6 | ||||||||||||||||||||||||
| 1415 | } | - | ||||||||||||||||||||||||
| 1416 | - | |||||||||||||||||||||||||
| 1417 | void QQuickTextControl::setOverwriteMode(bool overwrite) | - | ||||||||||||||||||||||||
| 1418 | { | - | ||||||||||||||||||||||||
| 1419 | QQuickTextControlPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 1420 | if (d->overwriteMode == overwrite
| 0-10 | ||||||||||||||||||||||||
| 1421 | return; never executed: return; | 0 | ||||||||||||||||||||||||
| 1422 | d->overwriteMode = overwrite; | - | ||||||||||||||||||||||||
| 1423 | overwriteModeChanged(overwrite); | - | ||||||||||||||||||||||||
| 1424 | } executed 10 times by 1 test: end of blockExecuted by:
| 10 | ||||||||||||||||||||||||
| 1425 | - | |||||||||||||||||||||||||
| 1426 | bool QQuickTextControl::cursorVisible() const | - | ||||||||||||||||||||||||
| 1427 | { | - | ||||||||||||||||||||||||
| 1428 | const QQuickTextControlPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 1429 | return executed 324 times by 1 test: d->cursorVisible;return d->cursorVisible;Executed by:
executed 324 times by 1 test: return d->cursorVisible;Executed by:
| 324 | ||||||||||||||||||||||||
| 1430 | } | - | ||||||||||||||||||||||||
| 1431 | - | |||||||||||||||||||||||||
| 1432 | void QQuickTextControl::setCursorVisible(bool visible) | - | ||||||||||||||||||||||||
| 1433 | { | - | ||||||||||||||||||||||||
| 1434 | QQuickTextControlPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 1435 | d->cursorVisible = visible; | - | ||||||||||||||||||||||||
| 1436 | d->setBlinkingCursorEnabled(d->cursorVisible | - | ||||||||||||||||||||||||
| 1437 | && (d->interactionFlags & (Qt::TextEditable | Qt::TextSelectableByKeyboard))); | - | ||||||||||||||||||||||||
| 1438 | } executed 482 times by 4 tests: end of blockExecuted by:
| 482 | ||||||||||||||||||||||||
| 1439 | - | |||||||||||||||||||||||||
| 1440 | QRectF QQuickTextControl::anchorRect() const | - | ||||||||||||||||||||||||
| 1441 | { | - | ||||||||||||||||||||||||
| 1442 | const QQuickTextControlPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 1443 | QRectF rect; | - | ||||||||||||||||||||||||
| 1444 | QTextCursor cursor = d->cursor; | - | ||||||||||||||||||||||||
| 1445 | if (!cursor.isNull()
| 0 | ||||||||||||||||||||||||
| 1446 | rect = d->rectForPosition(cursor.anchor()); | - | ||||||||||||||||||||||||
| 1447 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 1448 | return never executed: rect;return rect;never executed: return rect; | 0 | ||||||||||||||||||||||||
| 1449 | } | - | ||||||||||||||||||||||||
| 1450 | - | |||||||||||||||||||||||||
| 1451 | QRectF QQuickTextControl::cursorRect(const QTextCursor &cursor) const | - | ||||||||||||||||||||||||
| 1452 | { | - | ||||||||||||||||||||||||
| 1453 | const QQuickTextControlPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 1454 | if (cursor.isNull()
| 0-2696 | ||||||||||||||||||||||||
| 1455 | return never executed: QRectF();return QRectF();never executed: return QRectF(); | 0 | ||||||||||||||||||||||||
| 1456 | - | |||||||||||||||||||||||||
| 1457 | return executed 2696 times by 3 tests: d->rectForPosition(cursor.position());return d->rectForPosition(cursor.position());Executed by:
executed 2696 times by 3 tests: return d->rectForPosition(cursor.position());Executed by:
| 2696 | ||||||||||||||||||||||||
| 1458 | } | - | ||||||||||||||||||||||||
| 1459 | - | |||||||||||||||||||||||||
| 1460 | QRectF QQuickTextControl::cursorRect() const | - | ||||||||||||||||||||||||
| 1461 | { | - | ||||||||||||||||||||||||
| 1462 | const QQuickTextControlPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 1463 | return executed 2356 times by 3 tests: cursorRect(d->cursor);return cursorRect(d->cursor);Executed by:
executed 2356 times by 3 tests: return cursorRect(d->cursor);Executed by:
| 2356 | ||||||||||||||||||||||||
| 1464 | } | - | ||||||||||||||||||||||||
| 1465 | - | |||||||||||||||||||||||||
| 1466 | QString QQuickTextControl::hoveredLink() const | - | ||||||||||||||||||||||||
| 1467 | { | - | ||||||||||||||||||||||||
| 1468 | const QQuickTextControlPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 1469 | return executed 8 times by 1 test: d->hoveredLink;return d->hoveredLink;Executed by:
executed 8 times by 1 test: return d->hoveredLink;Executed by:
| 8 | ||||||||||||||||||||||||
| 1470 | } | - | ||||||||||||||||||||||||
| 1471 | - | |||||||||||||||||||||||||
| 1472 | QString QQuickTextControl::anchorAt(const QPointF &pos) const | - | ||||||||||||||||||||||||
| 1473 | { | - | ||||||||||||||||||||||||
| 1474 | const QQuickTextControlPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 1475 | return executed 1042 times by 1 test: d->doc->documentLayout()->anchorAt(pos);return d->doc->documentLayout()->anchorAt(pos);Executed by:
executed 1042 times by 1 test: return d->doc->documentLayout()->anchorAt(pos);Executed by:
| 1042 | ||||||||||||||||||||||||
| 1476 | } | - | ||||||||||||||||||||||||
| 1477 | - | |||||||||||||||||||||||||
| 1478 | void QQuickTextControl::setAcceptRichText(bool accept) | - | ||||||||||||||||||||||||
| 1479 | { | - | ||||||||||||||||||||||||
| 1480 | QQuickTextControlPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 1481 | d->acceptRichText = accept; | - | ||||||||||||||||||||||||
| 1482 | } executed 1212 times by 6 tests: end of blockExecuted by:
| 1212 | ||||||||||||||||||||||||
| 1483 | - | |||||||||||||||||||||||||
| 1484 | void QQuickTextControl::moveCursor(QTextCursor::MoveOperation op, QTextCursor::MoveMode mode) | - | ||||||||||||||||||||||||
| 1485 | { | - | ||||||||||||||||||||||||
| 1486 | QQuickTextControlPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 1487 | const QTextCursor oldSelection = d->cursor; | - | ||||||||||||||||||||||||
| 1488 | const bool moved = d->cursor.movePosition(op, mode); | - | ||||||||||||||||||||||||
| 1489 | d->_q_updateCurrentCharFormatAndSelection(); | - | ||||||||||||||||||||||||
| 1490 | updateCursorRectangle(true); | - | ||||||||||||||||||||||||
| 1491 | d->repaintOldAndNewSelection(oldSelection); | - | ||||||||||||||||||||||||
| 1492 | if (moved
| 26-36 | ||||||||||||||||||||||||
| 1493 | cursorPositionChanged(); executed 36 times by 1 test: cursorPositionChanged();Executed by:
| 36 | ||||||||||||||||||||||||
| 1494 | } executed 62 times by 2 tests: end of blockExecuted by:
| 62 | ||||||||||||||||||||||||
| 1495 | - | |||||||||||||||||||||||||
| 1496 | bool QQuickTextControl::canPaste() const | - | ||||||||||||||||||||||||
| 1497 | { | - | ||||||||||||||||||||||||
| 1498 | - | |||||||||||||||||||||||||
| 1499 | const QQuickTextControlPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 1500 | if (d->interactionFlags & Qt::TextEditable
| 44-4992 | ||||||||||||||||||||||||
| 1501 | const QMimeData *md = QGuiApplication::clipboard()->mimeData(); | - | ||||||||||||||||||||||||
| 1502 | return executed 4992 times by 1 test: md && canInsertFromMimeData(md);return md && canInsertFromMimeData(md);Executed by:
executed 4992 times by 1 test: return md && canInsertFromMimeData(md);Executed by:
| 4992 | ||||||||||||||||||||||||
| 1503 | } | - | ||||||||||||||||||||||||
| 1504 | - | |||||||||||||||||||||||||
| 1505 | return executed 44 times by 2 tests: false;return false;Executed by:
executed 44 times by 2 tests: return false;Executed by:
| 44 | ||||||||||||||||||||||||
| 1506 | } | - | ||||||||||||||||||||||||
| 1507 | - | |||||||||||||||||||||||||
| 1508 | void QQuickTextControl::setCursorIsFocusIndicator(bool b) | - | ||||||||||||||||||||||||
| 1509 | { | - | ||||||||||||||||||||||||
| 1510 | QQuickTextControlPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 1511 | d->cursorIsFocusIndicator = b; | - | ||||||||||||||||||||||||
| 1512 | d->repaintCursor(); | - | ||||||||||||||||||||||||
| 1513 | } executed 1186 times by 6 tests: end of blockExecuted by:
| 1186 | ||||||||||||||||||||||||
| 1514 | - | |||||||||||||||||||||||||
| 1515 | void QQuickTextControl::setWordSelectionEnabled(bool enabled) | - | ||||||||||||||||||||||||
| 1516 | { | - | ||||||||||||||||||||||||
| 1517 | QQuickTextControlPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 1518 | d->wordSelectionEnabled = enabled; | - | ||||||||||||||||||||||||
| 1519 | } executed 30 times by 1 test: end of blockExecuted by:
| 30 | ||||||||||||||||||||||||
| 1520 | - | |||||||||||||||||||||||||
| 1521 | QMimeData *QQuickTextControl::createMimeDataFromSelection() const | - | ||||||||||||||||||||||||
| 1522 | { | - | ||||||||||||||||||||||||
| 1523 | const QQuickTextControlPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 1524 | const QTextDocumentFragment fragment(d->cursor); | - | ||||||||||||||||||||||||
| 1525 | return executed 614 times by 1 test: new QQuickTextEditMimeData(fragment);return new QQuickTextEditMimeData(fragment);Executed by:
executed 614 times by 1 test: return new QQuickTextEditMimeData(fragment);Executed by:
| 614 | ||||||||||||||||||||||||
| 1526 | } | - | ||||||||||||||||||||||||
| 1527 | - | |||||||||||||||||||||||||
| 1528 | bool QQuickTextControl::canInsertFromMimeData(const QMimeData *source) const | - | ||||||||||||||||||||||||
| 1529 | { | - | ||||||||||||||||||||||||
| 1530 | const QQuickTextControlPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 1531 | if (d->acceptRichText
| 386-4606 | ||||||||||||||||||||||||
| 1532 | return executed 386 times by 1 test: source->hasText()return source->hasText() || source->hasHtml() || source->hasFormat(QLatin1String("application/x-qrichtext")) || source->hasFormat(QLatin1String("application/x-qt-richtext"));Executed by:
executed 386 times by 1 test: return source->hasText() || source->hasHtml() || source->hasFormat(QLatin1String("application/x-qrichtext")) || source->hasFormat(QLatin1String("application/x-qt-richtext"));Executed by:
| 386 | ||||||||||||||||||||||||
| 1533 | || source->hasHtml() executed 386 times by 1 test: return source->hasText() || source->hasHtml() || source->hasFormat(QLatin1String("application/x-qrichtext")) || source->hasFormat(QLatin1String("application/x-qt-richtext"));Executed by:
| 386 | ||||||||||||||||||||||||
| 1534 | || source->hasFormat(QLatin1String("application/x-qrichtext")) executed 386 times by 1 test: return source->hasText() || source->hasHtml() || source->hasFormat(QLatin1String("application/x-qrichtext")) || source->hasFormat(QLatin1String("application/x-qt-richtext"));Executed by:
| 386 | ||||||||||||||||||||||||
| 1535 | || source->hasFormat(QLatin1String("application/x-qt-richtext")); executed 386 times by 1 test: return source->hasText() || source->hasHtml() || source->hasFormat(QLatin1String("application/x-qrichtext")) || source->hasFormat(QLatin1String("application/x-qt-richtext"));Executed by:
| 386 | ||||||||||||||||||||||||
| 1536 | else | - | ||||||||||||||||||||||||
| 1537 | return executed 4606 times by 1 test: source->hasText();return source->hasText();Executed by:
executed 4606 times by 1 test: return source->hasText();Executed by:
| 4606 | ||||||||||||||||||||||||
| 1538 | } | - | ||||||||||||||||||||||||
| 1539 | - | |||||||||||||||||||||||||
| 1540 | void QQuickTextControl::insertFromMimeData(const QMimeData *source) | - | ||||||||||||||||||||||||
| 1541 | { | - | ||||||||||||||||||||||||
| 1542 | QQuickTextControlPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 1543 | if (!(d->interactionFlags & Qt::TextEditable)
| 0-14 | ||||||||||||||||||||||||
| 1544 | return; executed 2 times by 1 test: return;Executed by:
| 2 | ||||||||||||||||||||||||
| 1545 | - | |||||||||||||||||||||||||
| 1546 | bool hasData = false; | - | ||||||||||||||||||||||||
| 1547 | QTextDocumentFragment fragment; | - | ||||||||||||||||||||||||
| 1548 | - | |||||||||||||||||||||||||
| 1549 | if (source->hasFormat(QLatin1String("application/x-qrichtext"))
| 0-14 | ||||||||||||||||||||||||
| 1550 | - | |||||||||||||||||||||||||
| 1551 | const QString richtext = QLatin1String("<meta name=\"qrichtext\" content=\"1\" />") | - | ||||||||||||||||||||||||
| 1552 | + QString::fromUtf8(source->data(QLatin1String("application/x-qrichtext"))); | - | ||||||||||||||||||||||||
| 1553 | fragment = QTextDocumentFragment::fromHtml(richtext, d->doc); | - | ||||||||||||||||||||||||
| 1554 | hasData = true; | - | ||||||||||||||||||||||||
| 1555 | } never executed: else if (source->hasHtml()end of block
| 0-14 | ||||||||||||||||||||||||
| 1556 | fragment = QTextDocumentFragment::fromHtml(source->html(), d->doc); | - | ||||||||||||||||||||||||
| 1557 | hasData = true; | - | ||||||||||||||||||||||||
| 1558 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||
| 1559 | QString text = source->text(); | - | ||||||||||||||||||||||||
| 1560 | if (!text.isNull()
| 2-12 | ||||||||||||||||||||||||
| 1561 | fragment = QTextDocumentFragment::fromPlainText(text); | - | ||||||||||||||||||||||||
| 1562 | hasData = true; | - | ||||||||||||||||||||||||
| 1563 | } executed 12 times by 1 test: end of blockExecuted by:
| 12 | ||||||||||||||||||||||||
| 1564 | } executed 14 times by 1 test: end of blockExecuted by:
| 14 | ||||||||||||||||||||||||
| 1565 | - | |||||||||||||||||||||||||
| 1566 | - | |||||||||||||||||||||||||
| 1567 | - | |||||||||||||||||||||||||
| 1568 | - | |||||||||||||||||||||||||
| 1569 | if (hasData
| 2-12 | ||||||||||||||||||||||||
| 1570 | d->cursor.insertFragment(fragment); executed 12 times by 1 test: d->cursor.insertFragment(fragment);Executed by:
| 12 | ||||||||||||||||||||||||
| 1571 | updateCursorRectangle(true); | - | ||||||||||||||||||||||||
| 1572 | } executed 14 times by 1 test: end of blockExecuted by:
| 14 | ||||||||||||||||||||||||
| 1573 | - | |||||||||||||||||||||||||
| 1574 | void QQuickTextControlPrivate::activateLinkUnderCursor(QString href) | - | ||||||||||||||||||||||||
| 1575 | { | - | ||||||||||||||||||||||||
| 1576 | QTextCursor oldCursor = cursor; | - | ||||||||||||||||||||||||
| 1577 | - | |||||||||||||||||||||||||
| 1578 | if (href.isEmpty()
| 0-4 | ||||||||||||||||||||||||
| 1579 | QTextCursor tmp = cursor; | - | ||||||||||||||||||||||||
| 1580 | if (tmp.selectionStart() != tmp.position()
| 0 | ||||||||||||||||||||||||
| 1581 | tmp.setPosition(tmp.selectionStart()); never executed: tmp.setPosition(tmp.selectionStart()); | 0 | ||||||||||||||||||||||||
| 1582 | tmp.movePosition(QTextCursor::NextCharacter); | - | ||||||||||||||||||||||||
| 1583 | href = tmp.charFormat().anchorHref(); | - | ||||||||||||||||||||||||
| 1584 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 1585 | if (href.isEmpty()
| 0-4 | ||||||||||||||||||||||||
| 1586 | return; never executed: return; | 0 | ||||||||||||||||||||||||
| 1587 | - | |||||||||||||||||||||||||
| 1588 | if (!cursor.hasSelection()
| 0-4 | ||||||||||||||||||||||||
| 1589 | QTextBlock block = cursor.block(); | - | ||||||||||||||||||||||||
| 1590 | const int cursorPos = cursor.position(); | - | ||||||||||||||||||||||||
| 1591 | - | |||||||||||||||||||||||||
| 1592 | QTextBlock::Iterator it = block.begin(); | - | ||||||||||||||||||||||||
| 1593 | QTextBlock::Iterator linkFragment; | - | ||||||||||||||||||||||||
| 1594 | - | |||||||||||||||||||||||||
| 1595 | for (; !it.atEnd()
| 0-8 | ||||||||||||||||||||||||
| 1596 | QTextFragment fragment = it.fragment(); | - | ||||||||||||||||||||||||
| 1597 | const int fragmentPos = fragment.position(); | - | ||||||||||||||||||||||||
| 1598 | if (fragmentPos <= cursorPos
| 0-8 | ||||||||||||||||||||||||
| 1599 | fragmentPos + fragment.length() > cursorPos
| 4 | ||||||||||||||||||||||||
| 1600 | linkFragment = it; | - | ||||||||||||||||||||||||
| 1601 | break; executed 4 times by 1 test: break;Executed by:
| 4 | ||||||||||||||||||||||||
| 1602 | } | - | ||||||||||||||||||||||||
| 1603 | } executed 4 times by 1 test: end of blockExecuted by:
| 4 | ||||||||||||||||||||||||
| 1604 | - | |||||||||||||||||||||||||
| 1605 | if (!linkFragment.atEnd()
| 0-4 | ||||||||||||||||||||||||
| 1606 | it = linkFragment; | - | ||||||||||||||||||||||||
| 1607 | cursor.setPosition(it.fragment().position()); | - | ||||||||||||||||||||||||
| 1608 | if (it != block.begin()
| 0-4 | ||||||||||||||||||||||||
| 1609 | do { | - | ||||||||||||||||||||||||
| 1610 | --it; | - | ||||||||||||||||||||||||
| 1611 | QTextFragment fragment = it.fragment(); | - | ||||||||||||||||||||||||
| 1612 | if (fragment.charFormat().anchorHref() != href
| 0-4 | ||||||||||||||||||||||||
| 1613 | break; executed 4 times by 1 test: break;Executed by:
| 4 | ||||||||||||||||||||||||
| 1614 | cursor.setPosition(fragment.position()); | - | ||||||||||||||||||||||||
| 1615 | } never executed: while (it != block.begin()end of block
| 0 | ||||||||||||||||||||||||
| 1616 | } executed 4 times by 1 test: end of blockExecuted by:
| 4 | ||||||||||||||||||||||||
| 1617 | - | |||||||||||||||||||||||||
| 1618 | for (it = linkFragment; !it.atEnd()
| 4 | ||||||||||||||||||||||||
| 1619 | QTextFragment fragment = it.fragment(); | - | ||||||||||||||||||||||||
| 1620 | if (fragment.charFormat().anchorHref() != href
| 0-4 | ||||||||||||||||||||||||
| 1621 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 1622 | cursor.setPosition(fragment.position() + fragment.length(), QTextCursor::KeepAnchor); | - | ||||||||||||||||||||||||
| 1623 | } executed 4 times by 1 test: end of blockExecuted by:
| 4 | ||||||||||||||||||||||||
| 1624 | } executed 4 times by 1 test: end of blockExecuted by:
| 4 | ||||||||||||||||||||||||
| 1625 | } executed 4 times by 1 test: end of blockExecuted by:
| 4 | ||||||||||||||||||||||||
| 1626 | - | |||||||||||||||||||||||||
| 1627 | if (hasFocus
| 0-4 | ||||||||||||||||||||||||
| 1628 | cursorIsFocusIndicator = true; | - | ||||||||||||||||||||||||
| 1629 | } executed 4 times by 1 test: else {end of blockExecuted by:
| 4 | ||||||||||||||||||||||||
| 1630 | cursorIsFocusIndicator = false; | - | ||||||||||||||||||||||||
| 1631 | cursor.clearSelection(); | - | ||||||||||||||||||||||||
| 1632 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 1633 | repaintOldAndNewSelection(oldCursor); | - | ||||||||||||||||||||||||
| 1634 | - | |||||||||||||||||||||||||
| 1635 | q_func()->linkActivated(href); | - | ||||||||||||||||||||||||
| 1636 | } executed 4 times by 1 test: end of blockExecuted by:
| 4 | ||||||||||||||||||||||||
| 1637 | - | |||||||||||||||||||||||||
| 1638 | - | |||||||||||||||||||||||||
| 1639 | bool QQuickTextControlPrivate::isPreediting() const | - | ||||||||||||||||||||||||
| 1640 | { | - | ||||||||||||||||||||||||
| 1641 | QTextLayout *layout = cursor.block().layout(); | - | ||||||||||||||||||||||||
| 1642 | if (layout
| 0-1348 | ||||||||||||||||||||||||
| 1643 | return never executed: true;return true;never executed: return true; | 0 | ||||||||||||||||||||||||
| 1644 | - | |||||||||||||||||||||||||
| 1645 | return executed 1348 times by 1 test: false;return false;Executed by:
executed 1348 times by 1 test: return false;Executed by:
| 1348 | ||||||||||||||||||||||||
| 1646 | } | - | ||||||||||||||||||||||||
| 1647 | - | |||||||||||||||||||||||||
| 1648 | void QQuickTextControlPrivate::commitPreedit() | - | ||||||||||||||||||||||||
| 1649 | { | - | ||||||||||||||||||||||||
| 1650 | QQuickTextControl * const q = q_func(); | - | ||||||||||||||||||||||||
| 1651 | - | |||||||||||||||||||||||||
| 1652 | if (!hasImState
| 2-1830 | ||||||||||||||||||||||||
| 1653 | return; executed 1830 times by 1 test: return;Executed by:
| 1830 | ||||||||||||||||||||||||
| 1654 | - | |||||||||||||||||||||||||
| 1655 | QGuiApplication::inputMethod()->commit(); | - | ||||||||||||||||||||||||
| 1656 | - | |||||||||||||||||||||||||
| 1657 | if (!hasImState
| 0-2 | ||||||||||||||||||||||||
| 1658 | return; never executed: return; | 0 | ||||||||||||||||||||||||
| 1659 | - | |||||||||||||||||||||||||
| 1660 | QInputMethodEvent event; | - | ||||||||||||||||||||||||
| 1661 | QCoreApplication::sendEvent(q->parent(), &event); | - | ||||||||||||||||||||||||
| 1662 | } executed 2 times by 1 test: end of blockExecuted by:
| 2 | ||||||||||||||||||||||||
| 1663 | - | |||||||||||||||||||||||||
| 1664 | void QQuickTextControlPrivate::cancelPreedit() | - | ||||||||||||||||||||||||
| 1665 | { | - | ||||||||||||||||||||||||
| 1666 | QQuickTextControl * const q = q_func(); | - | ||||||||||||||||||||||||
| 1667 | - | |||||||||||||||||||||||||
| 1668 | if (!hasImState
| 6-1062 | ||||||||||||||||||||||||
| 1669 | return; executed 1062 times by 5 tests: return;Executed by:
| 1062 | ||||||||||||||||||||||||
| 1670 | - | |||||||||||||||||||||||||
| 1671 | QGuiApplication::inputMethod()->reset(); | - | ||||||||||||||||||||||||
| 1672 | - | |||||||||||||||||||||||||
| 1673 | QInputMethodEvent event; | - | ||||||||||||||||||||||||
| 1674 | QCoreApplication::sendEvent(q->parent(), &event); | - | ||||||||||||||||||||||||
| 1675 | } executed 6 times by 1 test: end of blockExecuted by:
| 6 | ||||||||||||||||||||||||
| 1676 | - | |||||||||||||||||||||||||
| 1677 | - | |||||||||||||||||||||||||
| 1678 | void QQuickTextControl::setTextInteractionFlags(Qt::TextInteractionFlags flags) | - | ||||||||||||||||||||||||
| 1679 | { | - | ||||||||||||||||||||||||
| 1680 | QQuickTextControlPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 1681 | if (flags == d->interactionFlags
| 16-1272 | ||||||||||||||||||||||||
| 1682 | return; executed 16 times by 1 test: return;Executed by:
| 16 | ||||||||||||||||||||||||
| 1683 | d->interactionFlags = flags; | - | ||||||||||||||||||||||||
| 1684 | - | |||||||||||||||||||||||||
| 1685 | if (d->hasFocus
| 30-1242 | ||||||||||||||||||||||||
| 1686 | d->setBlinkingCursorEnabled(flags & (Qt::TextEditable | Qt::TextSelectableByKeyboard)); executed 30 times by 1 test: d->setBlinkingCursorEnabled(flags & (Qt::TextEditable | Qt::TextSelectableByKeyboard));Executed by:
| 30 | ||||||||||||||||||||||||
| 1687 | } executed 1272 times by 6 tests: end of blockExecuted by:
| 1272 | ||||||||||||||||||||||||
| 1688 | - | |||||||||||||||||||||||||
| 1689 | Qt::TextInteractionFlags QQuickTextControl::textInteractionFlags() const | - | ||||||||||||||||||||||||
| 1690 | { | - | ||||||||||||||||||||||||
| 1691 | const QQuickTextControlPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 1692 | return executed 1882 times by 4 tests: d->interactionFlags;return d->interactionFlags;Executed by:
executed 1882 times by 4 tests: return d->interactionFlags;Executed by:
| 1882 | ||||||||||||||||||||||||
| 1693 | } | - | ||||||||||||||||||||||||
| 1694 | - | |||||||||||||||||||||||||
| 1695 | QString QQuickTextControl::toPlainText() const | - | ||||||||||||||||||||||||
| 1696 | { | - | ||||||||||||||||||||||||
| 1697 | return executed 524 times by 2 tests: document()->toPlainText();return document()->toPlainText();Executed by:
executed 524 times by 2 tests: return document()->toPlainText();Executed by:
| 524 | ||||||||||||||||||||||||
| 1698 | } | - | ||||||||||||||||||||||||
| 1699 | - | |||||||||||||||||||||||||
| 1700 | - | |||||||||||||||||||||||||
| 1701 | QString QQuickTextControl::toHtml() const | - | ||||||||||||||||||||||||
| 1702 | { | - | ||||||||||||||||||||||||
| 1703 | return executed 24 times by 1 test: document()->toHtml();return document()->toHtml();Executed by:
executed 24 times by 1 test: return document()->toHtml();Executed by:
| 24 | ||||||||||||||||||||||||
| 1704 | } | - | ||||||||||||||||||||||||
| 1705 | - | |||||||||||||||||||||||||
| 1706 | - | |||||||||||||||||||||||||
| 1707 | bool QQuickTextControl::cursorOn() const | - | ||||||||||||||||||||||||
| 1708 | { | - | ||||||||||||||||||||||||
| 1709 | const QQuickTextControlPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 1710 | return executed 142 times by 3 tests: d->cursorOn;return d->cursorOn;Executed by:
executed 142 times by 3 tests: return d->cursorOn;Executed by:
| 142 | ||||||||||||||||||||||||
| 1711 | } | - | ||||||||||||||||||||||||
| 1712 | - | |||||||||||||||||||||||||
| 1713 | int QQuickTextControl::hitTest(const QPointF &point, Qt::HitTestAccuracy accuracy) const | - | ||||||||||||||||||||||||
| 1714 | { | - | ||||||||||||||||||||||||
| 1715 | const QQuickTextControlPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 1716 | return executed 660 times by 1 test: d->doc->documentLayout()->hitTest(point, accuracy);return d->doc->documentLayout()->hitTest(point, accuracy);Executed by:
executed 660 times by 1 test: return d->doc->documentLayout()->hitTest(point, accuracy);Executed by:
| 660 | ||||||||||||||||||||||||
| 1717 | } | - | ||||||||||||||||||||||||
| 1718 | - | |||||||||||||||||||||||||
| 1719 | QRectF QQuickTextControl::blockBoundingRect(const QTextBlock &block) const | - | ||||||||||||||||||||||||
| 1720 | { | - | ||||||||||||||||||||||||
| 1721 | const QQuickTextControlPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 1722 | return executed 2760 times by 3 tests: d->doc->documentLayout()->blockBoundingRect(block);return d->doc->documentLayout()->blockBoundingRect(block);Executed by:
executed 2760 times by 3 tests: return d->doc->documentLayout()->blockBoundingRect(block);Executed by:
| 2760 | ||||||||||||||||||||||||
| 1723 | } | - | ||||||||||||||||||||||||
| 1724 | - | |||||||||||||||||||||||||
| 1725 | QString QQuickTextControl::preeditText() const | - | ||||||||||||||||||||||||
| 1726 | { | - | ||||||||||||||||||||||||
| 1727 | - | |||||||||||||||||||||||||
| 1728 | const QQuickTextControlPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 1729 | QTextLayout *layout = d->cursor.block().layout(); | - | ||||||||||||||||||||||||
| 1730 | if (!layout
| 0-8 | ||||||||||||||||||||||||
| 1731 | return never executed: QString();return QString();never executed: return QString(); | 0 | ||||||||||||||||||||||||
| 1732 | - | |||||||||||||||||||||||||
| 1733 | return executed 8 times by 1 test: layout->preeditAreaText();return layout->preeditAreaText();Executed by:
executed 8 times by 1 test: return layout->preeditAreaText();Executed by:
| 8 | ||||||||||||||||||||||||
| 1734 | - | |||||||||||||||||||||||||
| 1735 | - | |||||||||||||||||||||||||
| 1736 | - | |||||||||||||||||||||||||
| 1737 | } | - | ||||||||||||||||||||||||
| 1738 | - | |||||||||||||||||||||||||
| 1739 | - | |||||||||||||||||||||||||
| 1740 | QStringList QQuickTextEditMimeData::formats() const | - | ||||||||||||||||||||||||
| 1741 | { | - | ||||||||||||||||||||||||
| 1742 | if (!fragment.isEmpty()
| 4-3000 | ||||||||||||||||||||||||
| 1743 | return executed 3000 times by 1 test: QStringList() << QString::fromLatin1("text/plain") << QString::fromLatin1("text/html")return QStringList() << QString::fromLatin1("text/plain") << QString::fromLatin1("text/html") << QString::fromLatin1("application/vnd.oasis.opendocument.text") ;Executed by:
executed 3000 times by 1 test: return QStringList() << QString::fromLatin1("text/plain") << QString::fromLatin1("text/html") << QString::fromLatin1("application/vnd.oasis.opendocument.text") ;Executed by:
| 3000 | ||||||||||||||||||||||||
| 1744 | 3000 | |||||||||||||||||||||||||
| 1745 | << QString::fromLatin1("application/vnd.oasis.opendocument.text") executed 3000 times by 1 test: return QStringList() << QString::fromLatin1("text/plain") << QString::fromLatin1("text/html") << QString::fromLatin1("application/vnd.oasis.opendocument.text") ;Executed by:
| 3000 | ||||||||||||||||||||||||
| 1746 | 3000 | |||||||||||||||||||||||||
| 1747 | ; executed 3000 times by 1 test: return QStringList() << QString::fromLatin1("text/plain") << QString::fromLatin1("text/html") << QString::fromLatin1("application/vnd.oasis.opendocument.text") ;Executed by:
| 3000 | ||||||||||||||||||||||||
| 1748 | else | - | ||||||||||||||||||||||||
| 1749 | return executed 4 times by 1 test: QMimeData::formats();return QMimeData::formats();Executed by:
executed 4 times by 1 test: return QMimeData::formats();Executed by:
| 4 | ||||||||||||||||||||||||
| 1750 | } | - | ||||||||||||||||||||||||
| 1751 | - | |||||||||||||||||||||||||
| 1752 | QVariant QQuickTextEditMimeData::retrieveData(const QString &mimeType, QVariant::Type type) const | - | ||||||||||||||||||||||||
| 1753 | { | - | ||||||||||||||||||||||||
| 1754 | if (!fragment.isEmpty()
| 0-12 | ||||||||||||||||||||||||
| 1755 | setup(); executed 12 times by 1 test: setup();Executed by:
| 12 | ||||||||||||||||||||||||
| 1756 | return executed 12 times by 1 test: QMimeData::retrieveData(mimeType, type);return QMimeData::retrieveData(mimeType, type);Executed by:
executed 12 times by 1 test: return QMimeData::retrieveData(mimeType, type);Executed by:
| 12 | ||||||||||||||||||||||||
| 1757 | } | - | ||||||||||||||||||||||||
| 1758 | - | |||||||||||||||||||||||||
| 1759 | void QQuickTextEditMimeData::setup() const | - | ||||||||||||||||||||||||
| 1760 | { | - | ||||||||||||||||||||||||
| 1761 | QQuickTextEditMimeData *that = const_cast<QQuickTextEditMimeData *>(this); | - | ||||||||||||||||||||||||
| 1762 | - | |||||||||||||||||||||||||
| 1763 | that->setData(QLatin1String("text/html"), fragment.toHtml("utf-8").toUtf8()); | - | ||||||||||||||||||||||||
| 1764 | - | |||||||||||||||||||||||||
| 1765 | - | |||||||||||||||||||||||||
| 1766 | { | - | ||||||||||||||||||||||||
| 1767 | QBuffer buffer; | - | ||||||||||||||||||||||||
| 1768 | QTextDocumentWriter writer(&buffer, "ODF"); | - | ||||||||||||||||||||||||
| 1769 | writer.write(fragment); | - | ||||||||||||||||||||||||
| 1770 | buffer.close(); | - | ||||||||||||||||||||||||
| 1771 | that->setData(QLatin1String("application/vnd.oasis.opendocument.text"), buffer.data()); | - | ||||||||||||||||||||||||
| 1772 | } | - | ||||||||||||||||||||||||
| 1773 | - | |||||||||||||||||||||||||
| 1774 | that->setText(fragment.toPlainText()); | - | ||||||||||||||||||||||||
| 1775 | fragment = QTextDocumentFragment(); | - | ||||||||||||||||||||||||
| 1776 | } executed 12 times by 1 test: end of blockExecuted by:
| 12 | ||||||||||||||||||||||||
| 1777 | - | |||||||||||||||||||||||||
| 1778 | - | |||||||||||||||||||||||||
| 1779 | - | |||||||||||||||||||||||||
| 1780 | - | |||||||||||||||||||||||||
| Switch to Source code | Preprocessed file |