diff options
author | Carl Schwan <carl@carlschwan.eu> | 2024-04-10 18:03:51 +0200 |
---|---|---|
committer | Shawn Rutledge <shawn.rutledge@qt.io> | 2024-04-30 21:09:20 +0000 |
commit | e7ac69eebf505337ec60311727d3fc0915f7ed33 (patch) | |
tree | 08244cb41d6c3b3c503409949263d87cbb33d406 /src/quick | |
parent | 6f7deef6d54dea7e033f5bf2c3ba0ee54ab562ed (diff) |
QQuickTextNodeEnding: Fix borderCollapse in rendering
Handle the border collapse attribute from QTextTableFormat
Task-number: QTBUG-120986
Fixes: QTBUG-124569
Pick-to: 6.7
Change-Id: I41a5231adf8878b798f527fbab35994063eac1f1
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
Diffstat (limited to 'src/quick')
-rw-r--r-- | src/quick/items/qquicktextnodeengine.cpp | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/src/quick/items/qquicktextnodeengine.cpp b/src/quick/items/qquicktextnodeengine.cpp index fd33fa86e2..c486fece40 100644 --- a/src/quick/items/qquicktextnodeengine.cpp +++ b/src/quick/items/qquicktextnodeengine.cpp @@ -660,10 +660,14 @@ void QQuickTextNodeEngine::addFrameDecorations(QTextDocument *document, QTextFra if (borderStyle == QTextFrameFormat::BorderStyle_None) return; - addBorder(boundingRect.adjusted(frameFormat.leftMargin(), frameFormat.topMargin(), - -frameFormat.rightMargin() - borderWidth, - -frameFormat.bottomMargin() - borderWidth), - borderWidth, borderStyle, borderBrush); + const auto collapsed = table->format().borderCollapse(); + + if (!collapsed) { + addBorder(boundingRect.adjusted(frameFormat.leftMargin(), frameFormat.topMargin(), + -frameFormat.rightMargin() - borderWidth, + -frameFormat.bottomMargin() - borderWidth), + borderWidth, borderStyle, borderBrush); + } if (table != nullptr) { int rows = table->rows(); int columns = table->columns(); @@ -673,7 +677,7 @@ void QQuickTextNodeEngine::addFrameDecorations(QTextDocument *document, QTextFra QTextTableCell cell = table->cellAt(row, column); QRectF cellRect = documentLayout->tableCellBoundingRect(table, cell); - addBorder(cellRect.adjusted(-borderWidth, -borderWidth, 0, 0), borderWidth, + addBorder(cellRect.adjusted(-borderWidth, -borderWidth, collapsed ? -borderWidth : 0, collapsed ? -borderWidth : 0), borderWidth, borderStyle, borderBrush); } } |