diff options
-rw-r--r-- | src/gui/itemviews/qlistview.cpp | 5 | ||||
-rw-r--r-- | src/gui/styles/qcommonstyle.cpp | 5 |
2 files changed, 9 insertions, 1 deletions
diff --git a/src/gui/itemviews/qlistview.cpp b/src/gui/itemviews/qlistview.cpp index 06b977a..cd88314 100644 --- a/src/gui/itemviews/qlistview.cpp +++ b/src/gui/itemviews/qlistview.cpp @@ -939,6 +939,11 @@ QStyleOptionViewItem QListView::viewOptions() const } else { option.decorationPosition = QStyleOptionViewItem::Left; } + + if (d->gridSize().isValid()) { + option.rect.setSize(d->gridSize()); + } + return option; } diff --git a/src/gui/styles/qcommonstyle.cpp b/src/gui/styles/qcommonstyle.cpp index 1e5b7a9..1645152 100644 --- a/src/gui/styles/qcommonstyle.cpp +++ b/src/gui/styles/qcommonstyle.cpp @@ -862,7 +862,10 @@ QSize QCommonStylePrivate::viewItemSize(const QStyleOptionViewItemV4 *option, in 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; |