src/gui/itemviews/qitemdelegate.cpp
branchGCC_SURGE
changeset 31 5daf16870df6
parent 30 5dc02b23752f
child 33 3e2da88830cd
--- a/src/gui/itemviews/qitemdelegate.cpp	Mon Jun 21 22:38:13 2010 +0100
+++ b/src/gui/itemviews/qitemdelegate.cpp	Thu Jul 22 16:41:55 2010 +0100
@@ -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());