diff options
Diffstat (limited to 'src/gui/itemviews/qitemdelegate.cpp')
-rw-r--r-- | src/gui/itemviews/qitemdelegate.cpp | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/gui/itemviews/qitemdelegate.cpp b/src/gui/itemviews/qitemdelegate.cpp index 75d48a4..1e36f72 100644 --- a/src/gui/itemviews/qitemdelegate.cpp +++ b/src/gui/itemviews/qitemdelegate.cpp @@ -352,7 +352,10 @@ void QItemDelegate::setClipping(bool clip) QString QItemDelegatePrivate::valueToText(const QVariant &value, const QStyleOptionViewItemV4 &option) { QString text; - switch (value.type()) { + switch (value.userType()) { + case QMetaType::Float: + text = option.locale.toString(value.toFloat(), 'g'); + break; case QVariant::Double: text = option.locale.toString(value.toDouble(), 'g', DBL_DIG); break; @@ -719,8 +722,6 @@ void QItemDelegate::drawDisplay(QPainter *painter, const QStyleOptionViewItem &o //let's add the last line (after the last QChar::LineSeparator) elided += option.fontMetrics.elidedText(text.mid(start), option.textElideMode, textRect.width()); - if (end != -1) - elided += QChar::LineSeparator; } d->textLayout.setText(elided); textLayoutSize = d->doTextLayout(textRect.width()); |