From f31a7b2d7f08c39dbe2e987ec53bff56ca89c3d1 Mon Sep 17 00:00:00 2001 From: Benjamin Poulain Date: Fri, 21 Aug 2009 14:36:35 +0200 Subject: Fix the size returned by QCommonStylePrivate::viewItemSize() for text MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The size of the text, computed in qreal, was rounded. If the decimal part of the size was < 0.5, a pixel was missing in the size returned. Reviewed-by: Samuel Rødal Reviewed-by: Olivier Goffart --- src/gui/styles/qcommonstyle.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gui/styles/qcommonstyle.cpp b/src/gui/styles/qcommonstyle.cpp index 80acab7..208c4af 100644 --- a/src/gui/styles/qcommonstyle.cpp +++ b/src/gui/styles/qcommonstyle.cpp @@ -1047,7 +1047,7 @@ QSize QCommonStylePrivate::viewItemSize(const QStyleOptionViewItemV4 *option, in widthUsed = qMax(widthUsed, line.naturalTextWidth()); } textLayout.endLayout(); - const QSize size = QSizeF(widthUsed, height).toSize(); + const QSize size(qCeil(widthUsed), qCeil(height)); return QSize(size.width() + 2 * textMargin, size.height()); } break; -- cgit v0.12