summaryrefslogtreecommitdiffstats
path: root/src/gui/itemviews/qitemdelegate.cpp
diff options
context:
space:
mode:
authorThierry Bastian <thierry.bastian@nokia.com>2009-08-14 11:01:37 (GMT)
committerThierry Bastian <thierry.bastian@nokia.com>2009-08-14 11:03:51 (GMT)
commitb770651f19741907cd415ea9ad6e087cb32cc948 (patch)
treeecc163e8b33af66454b84ca7f9159d11d6f0cd91 /src/gui/itemviews/qitemdelegate.cpp
parent51ce8a80acebc67ef09d506d89a2ee1972377877 (diff)
downloadQt-b770651f19741907cd415ea9ad6e087cb32cc948.zip
Qt-b770651f19741907cd415ea9ad6e087cb32cc948.tar.gz
Qt-b770651f19741907cd415ea9ad6e087cb32cc948.tar.bz2
QVariant: added toFloat and toReal
Made better use of qreal all over the place. We were previously using QVariant::toDouble a lot. That is triggering unnecessary conversions between float and double on embedded. Reviewed-by: ogoffart
Diffstat (limited to 'src/gui/itemviews/qitemdelegate.cpp')
-rw-r--r--src/gui/itemviews/qitemdelegate.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/gui/itemviews/qitemdelegate.cpp b/src/gui/itemviews/qitemdelegate.cpp
index 75d48a4..2cbde51 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;