summaryrefslogtreecommitdiffstats
path: root/src/widgets/styles/qcommonstyle.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/widgets/styles/qcommonstyle.cpp')
-rw-r--r--src/widgets/styles/qcommonstyle.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/widgets/styles/qcommonstyle.cpp b/src/widgets/styles/qcommonstyle.cpp
index 9f51a6b9d6..4a83cdd4a6 100644
--- a/src/widgets/styles/qcommonstyle.cpp
+++ b/src/widgets/styles/qcommonstyle.cpp
@@ -889,6 +889,13 @@ QSize QCommonStylePrivate::viewItemSize(const QStyleOptionViewItem *option, int
break;
}
+ if (wrapText) {
+ if (option->features & QStyleOptionViewItem::HasCheckIndicator)
+ bounds.setWidth(bounds.width() - proxyStyle->pixelMetric(QStyle::PM_IndicatorWidth) - 2 * textMargin);
+ if (option->features & QStyleOptionViewItem::HasDecoration)
+ bounds.setWidth(bounds.width() - option->decorationSize.width() - 2 * textMargin);
+ }
+
const int lineWidth = bounds.width();
const QSizeF size = viewItemTextLayout(textLayout, lineWidth);
return QSize(qCeil(size.width()) + 2 * textMargin, qCeil(size.height()));