diff options
author | Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io> | 2016-11-11 10:22:33 +0100 |
---|---|---|
committer | Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io> | 2016-11-14 11:48:46 +0000 |
commit | 47847bebcacef2bbf3b5627ca18966d7d34d6762 (patch) | |
tree | f8dc2e57e94262074705602cd69227e76021e5ea /src/quick/items/qquicktextnodeengine.cpp | |
parent | cf63d8fc8f2006df2211c33ad077c2dcd95349e9 (diff) |
Fix flow text objects in beginning of RTL block
If the block is right-to-left and starts with a text object, it
should be aligned to the right edge of the QTextLine instead
of the left one.
[ChangeLog][QtQuick][Text] Fixed placement of flowing text objects
in the start of a right-to-left block.
Task-number: QTBUG-43133
Change-Id: Id790e88f3464280f124c38b4260386b84cac8826
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Diffstat (limited to 'src/quick/items/qquicktextnodeengine.cpp')
-rw-r--r-- | src/quick/items/qquicktextnodeengine.cpp | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/quick/items/qquicktextnodeengine.cpp b/src/quick/items/qquicktextnodeengine.cpp index 4631b2e724..538356e679 100644 --- a/src/quick/items/qquicktextnodeengine.cpp +++ b/src/quick/items/qquicktextnodeengine.cpp @@ -423,7 +423,10 @@ void QQuickTextNodeEngine::addImage(const QRectF &rect, const QImage &image, qre QRectF searchRect = rect; if (layoutPosition == QTextFrameFormat::InFlow) { if (m_currentLineTree.isEmpty()) { - searchRect.moveTopLeft(m_position + m_currentLine.position() + QPointF(0,1)); + if (m_currentTextDirection == Qt::RightToLeft) + searchRect.moveTopRight(m_position + m_currentLine.rect().topRight() + QPointF(0, 1)); + else + searchRect.moveTopLeft(m_position + m_currentLine.position() + QPointF(0,1)); } else { const BinaryTreeNode *lastNode = m_currentLineTree.data() + m_currentLineTree.size() - 1; if (lastNode->glyphRun.isRightToLeft()) { @@ -952,6 +955,8 @@ void QQuickTextNodeEngine::addTextBlock(QTextDocument *textDocument, const QText int preeditPosition = block.isValid() ? block.layout()->preeditAreaPosition() : -1; #endif + setCurrentTextDirection(block.textDirection()); + QVarLengthArray<QTextLayout::FormatRange> colorChanges; mergeFormats(block.layout(), &colorChanges); |