src/gui/itemviews/qitemdelegate.cpp
changeset 30 5dc02b23752f
parent 19 fcece45ef507
child 33 3e2da88830cd
--- a/src/gui/itemviews/qitemdelegate.cpp	Wed Jun 23 19:07:03 2010 +0300
+++ b/src/gui/itemviews/qitemdelegate.cpp	Tue Jul 06 15:10:48 2010 +0300
@@ -69,6 +69,7 @@
 #include <qdebug.h>
 #include <qlocale.h>
 #include <qdialog.h>
+#include <qmath.h>
 
 #include <limits.h>
 
@@ -1023,7 +1024,7 @@
 // hacky but faster version of "QString::sprintf("%d-%d", i, enabled)"
 static QString qPixmapSerial(quint64 i, bool enabled)
 {
-    ushort arr[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, '-', '0' + enabled };
+    ushort arr[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, '-', ushort('0' + enabled) };
     ushort *ptr = &arr[16];
 
     while (i > 0) {
@@ -1148,7 +1149,8 @@
     d->textLayout.setTextOption(d->textOption);
     d->textLayout.setFont(font);
     d->textLayout.setText(QItemDelegatePrivate::replaceNewLine(text));
-    const QSize size = d->doTextLayout(rect.width()).toSize();
+    QSizeF fpSize = d->doTextLayout(rect.width());
+    const QSize size = QSize(qCeil(fpSize.width()), qCeil(fpSize.height()));
     // ###: textRectangle should take style option as argument
     const int textMargin = QApplication::style()->pixelMetric(QStyle::PM_FocusFrameHMargin) + 1;
     return QRect(0, 0, size.width() + 2 * textMargin, size.height());