diff options
-rw-r--r-- | src/quick/items/qquicktextedit.cpp | 11 | ||||
-rw-r--r-- | tests/manual/scenegraph_lancelot/data/text/textedit_table.qml | 21 |
2 files changed, 28 insertions, 4 deletions
diff --git a/src/quick/items/qquicktextedit.cpp b/src/quick/items/qquicktextedit.cpp index 03efbd0aa0..c3315878f2 100644 --- a/src/quick/items/qquicktextedit.cpp +++ b/src/quick/items/qquicktextedit.cpp @@ -1834,6 +1834,10 @@ QSGNode *QQuickTextEdit::updatePaintNode(QSGNode *oldNode, UpdatePaintNodeData * int currentNodeSize = 0; int nodeStart = firstDirtyPos; QPointF basePosition(d->xoff, d->yoff); + QMatrix4x4 basePositionMatrix; + basePositionMatrix.translate(basePosition.x(), basePosition.y()); + rootNode->setMatrix(basePositionMatrix); + QPointF nodeOffset; TextNode *firstCleanNode = (nodeIterator != d->textNodeMap.end()) ? *nodeIterator : 0; @@ -1845,7 +1849,6 @@ QSGNode *QQuickTextEdit::updatePaintNode(QSGNode *oldNode, UpdatePaintNodeData * frames.append(textFrame->childFrames()); rootNode->frameDecorationsNode->m_engine->addFrameDecorations(d->document, textFrame); - if (textFrame->lastPosition() < firstDirtyPos || (firstCleanNode && textFrame->firstPosition() >= firstCleanNode->startPos())) continue; node = d->createTextNode(); @@ -1866,7 +1869,7 @@ QSGNode *QQuickTextEdit::updatePaintNode(QSGNode *oldNode, UpdatePaintNodeData * nodeOffset = d->document->documentLayout()->frameBoundingRect(textFrame).topLeft(); updateNodeTransform(node, nodeOffset); while (!it.atEnd()) - node->m_engine->addTextBlock(d->document, (it++).currentBlock(), basePosition - nodeOffset, d->color, QColor(), selectionStart(), selectionEnd() - 1); + node->m_engine->addTextBlock(d->document, (it++).currentBlock(), -nodeOffset, d->color, QColor(), selectionStart(), selectionEnd() - 1); nodeStart = textFrame->firstPosition(); } else { // Having nodes spanning across frame boundaries will break the current bookkeeping mechanism. We need to prevent that. @@ -1889,7 +1892,7 @@ QSGNode *QQuickTextEdit::updatePaintNode(QSGNode *oldNode, UpdatePaintNodeData * nodeStart = block.position(); } - node->m_engine->addTextBlock(d->document, block, basePosition - nodeOffset, d->color, QColor(), selectionStart(), selectionEnd() - 1); + node->m_engine->addTextBlock(d->document, block, -nodeOffset, d->color, QColor(), selectionStart(), selectionEnd() - 1); currentNodeSize += block.length(); if ((it.atEnd()) || (firstCleanNode && block.next().position() >= firstCleanNode->startPos())) // last node that needed replacing or last block of the frame @@ -1933,7 +1936,7 @@ QSGNode *QQuickTextEdit::updatePaintNode(QSGNode *oldNode, UpdatePaintNodeData * if (d->cursorComponent == 0 && !isReadOnly()) { QSGRectangleNode* cursor = 0; if (d->cursorVisible && d->control->cursorOn()) - cursor = d->sceneGraphContext()->createRectangleNode(cursorRectangle(), d->color); + cursor = d->sceneGraphContext()->createRectangleNode(d->control->cursorRect(), d->color); rootNode->resetCursorNode(cursor); } diff --git a/tests/manual/scenegraph_lancelot/data/text/textedit_table.qml b/tests/manual/scenegraph_lancelot/data/text/textedit_table.qml new file mode 100644 index 0000000000..b16472eca6 --- /dev/null +++ b/tests/manual/scenegraph_lancelot/data/text/textedit_table.qml @@ -0,0 +1,21 @@ +import QtQuick 2.0 + +Item { + width: 320 + height: 480 + + TextEdit { + anchors.fill: parent + verticalAlignment: Text.AlignBottom + font.family: "Arial" + font.pixelSize: 16 + textFormat: Text.RichText + text: "A table: <table border=2>" + + "<tr><th>Header 1</th><th>Header 2</th></tr>" + + "<tr><td>Cell 1</td><td>Cell 2</td></tr>" + + "<tr><td>Cell 3</td><td>Cell 4</td></tr>" + + "<tr><td colspan=2>Cell 5</td></tr>" + + "<tr><td rowspan=2>Cell 6</td><td>Cell 7</tr>" + + "<tr><td>Cell 8</td></tr>" + } +} |