Fix regression in drawing table cell border when border-collapse enabled

The patch 732962d604e7469f9a9f02fe0cd3d1fd04caddb8 enables drawing a
border around cells within the table when set through CSS styling. But
this caused a regression when border-collapse is enabled without setting
the cell border. This patch enables drawing borders for table cells
when either of those conditions is satisfied.

Fixes: QTBUG-136590
Pick-to: 6.8
Change-Id: Ibf43c404439c9fee1cfd2b40789150edb76c6971
Reviewed-by: Nils Jeisecke <nils.jeisecke@saltation.com>
Reviewed-by: Christian Ehrlicher <ch.ehrlicher@gmx.de>
(cherry picked from commit 2e0dc22bdb46f94a516e834ad4fda2b93aada352)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
(cherry picked from commit 999dbe5734278cf4df062eea6b640287a4c2f5e7)
This commit is contained in:
Santhosh Kumar 2025-06-04 12:33:30 +02:00 committed by Qt Cherry-pick Bot
parent e39fa57f6b
commit 2dd3637c80

View File

@ -1894,7 +1894,7 @@ void QTextDocumentLayoutPrivate::drawTableCell(const QRectF &cellRect, QPainter
}
// paint over the background - otherwise we would have to adjust the background paint cellRect for the border values
if (cellBorderConfigured)
if (cellBorderConfigured || (td->borderCollapse && td->border != 0))
drawTableCellBorder(cellRect, painter, table, td, cell);
const QFixed verticalOffset = td->cellVerticalOffsets.at(c + r * table->columns());