-
Bug
-
Resolution: Unresolved
-
P2: Important
-
None
-
5.15.2, 6.2.4, 6.5.3, 6.8.3, 6.10.0, dev
-
None
QTextDocument: calling setTextWidth(-1) breaks RTL text alignment.
This is old Qt bug, that is here for a decade at least (I believe since Qt 4) and
we still have to work around in high-level code, for instance in QQuickTextEdit
(see QQuickTextEdit::updateSize())
The test snippet looks like this:
QTextDocument doc;
doc.documentLayout(); // create default doc layout
doc.setPlainText("טֶקסט\nשדגשגשגשגדוגמא\nטֶקסט");
doc.setTextWidth(-1);
QRectF firstLineRect;
for (auto block = doc.begin(); block != doc.end(); block = block.next()) {
auto *blockLayout = block.layout();
for (int i = 0; i < blockLayout->lineCount(); ++i) {
const auto textLine = blockLayout->lineAt(i);
if (firstLineRect.isNull()) {
firstLineRect = textLine.rect();
} else {
Q_ASSERT(qFuzzyCompare(textLine.rect().right(), firstLineRect.right()));
}
}
}
See full example TextDocBug.zip
- relates to
-
QTBUG-112858 [Windows] Quick TextEdit with RTL text placed into a ColumnLayout has wrong alignment
-
- Closed
-