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>
This commit is contained in:
Carl Schwan 2024-04-10 18:03:51 +02:00 committed by Shawn Rutledge
parent 6f7deef6d5
commit e7ac69eebf
1 changed files with 9 additions and 5 deletions

View File

@ -660,10 +660,14 @@ void QQuickTextNodeEngine::addFrameDecorations(QTextDocument *document, QTextFra
if (borderStyle == QTextFrameFormat::BorderStyle_None)
return;
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);
}
}