summaryrefslogtreecommitdiffstats
path: root/src/widgets/styles
diff options
context:
space:
mode:
authorSamuel Gaist <samuel.gaist@edeltech.ch>2013-11-23 00:15:30 +0100
committerThe Qt Project <gerrit-noreply@qt-project.org>2014-01-14 15:10:21 +0100
commita761be2fb2191215426f904cb03df0e966214531 (patch)
tree6022331f8e260311a860d1b6188968f154401376 /src/widgets/styles
parent7fab8eb56b9309734d1b34d3d935d6a4cf14ce6e (diff)
Correct wordwrapped text handling in QListView icon mode
Currently a QListView with wordwrapping activated will wrap the text only to the width of the icon even if the grid size is bigger. With this patch the option rect is now updated to match the grid size if valid and the style uses it to determine the correct size when wrapping [ChangeLog][QtWidgets][QTBUG-4714] Use the grid size for wordwrapping when available in icon mode Task-number: QTBUG-4714 Change-Id: I2cb63809d3ee8bd262f38bc11de91df9ff5cf237 Reviewed-by: Stephen Kelly <stephen.kelly@kdab.com>
Diffstat (limited to 'src/widgets/styles')
-rw-r--r--src/widgets/styles/qcommonstyle.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/widgets/styles/qcommonstyle.cpp b/src/widgets/styles/qcommonstyle.cpp
index a9f1c3bbbc..2d7107598f 100644
--- a/src/widgets/styles/qcommonstyle.cpp
+++ b/src/widgets/styles/qcommonstyle.cpp
@@ -838,7 +838,10 @@ QSize QCommonStylePrivate::viewItemSize(const QStyleOptionViewItem *option, int
break;
case QStyleOptionViewItem::Top:
case QStyleOptionViewItem::Bottom:
- bounds.setWidth(wrapText ? option->decorationSize.width() : QFIXED_MAX);
+ if (wrapText)
+ bounds.setWidth(bounds.isValid() ? bounds.width() - 2 * textMargin : option->decorationSize.width());
+ else
+ bounds.setWidth(QFIXED_MAX);
break;
default:
break;