summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSeokha Ko <[email protected]>2026-09-15 10:37:18 +0900
committerSeokha Ko <[email protected]>2026-09-17 04:09:56 +0000
commit7a5fdee09b1c96c7b34e0765c7fe9f7f93129ec6 (patch)
treee6382fc45ad95dc61c8a74d6ddbcd8826e9f6331
parenta0892ed80575afa29640c4db5cc12371140a85ae (diff)
QTableView: don't subtract the grid line twice for spanned cellsHEADdev
Take the spanned columns' total width from columnSpanWidth() instead of visualSpanRect(), which already has the grid line subtracted. The width is reduced by the grid line once afterwards, so the wrap width used for the row height hint was 1 pixel narrower than the width the cell is painted with. Fixes: QTBUG-149738 Pick-to: 6.12 Change-Id: I637107bd10862972d727aa24c094577f6bb2ffc5 Reviewed-by: Axel Spoerl <[email protected]>
-rw-r--r--src/widgets/itemviews/qtableview.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/widgets/itemviews/qtableview.cpp b/src/widgets/itemviews/qtableview.cpp
index af552952f4e..1d795d5a4fd 100644
--- a/src/widgets/itemviews/qtableview.cpp
+++ b/src/widgets/itemviews/qtableview.cpp
@@ -1141,8 +1141,10 @@ int QTableViewPrivate::heightHintForIndex(const QModelIndex &index, int hint, QS
option.rect.setWidth(q->columnWidth(index.column()));
if (hasSpans()) {
auto span = spans.spanAt(index.column(), index.row());
- if (span && span->m_left == index.column() && span->m_top == index.row())
- option.rect.setWidth(std::max(option.rect.width(), visualSpanRect(*span).width()));
+ if (span && span->m_left == index.column() && span->m_top == index.row()) {
+ option.rect.setWidth(std::max(option.rect.width(),
+ columnSpanWidth(span->m_left, span->width())));
+ }
}
// 1px less space when grid is shown (see drawCell)
if (showGrid)