diff options
author | Thierry Bastian <thierry.bastian@nokia.com> | 2009-08-14 11:01:37 (GMT) |
---|---|---|
committer | Thierry Bastian <thierry.bastian@nokia.com> | 2009-08-14 11:03:51 (GMT) |
commit | b770651f19741907cd415ea9ad6e087cb32cc948 (patch) | |
tree | ecc163e8b33af66454b84ca7f9159d11d6f0cd91 /src/gui/itemviews/qstandarditemmodel.cpp | |
parent | 51ce8a80acebc67ef09d506d89a2ee1972377877 (diff) | |
download | Qt-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/qstandarditemmodel.cpp')
-rw-r--r-- | src/gui/itemviews/qstandarditemmodel.cpp | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/gui/itemviews/qstandarditemmodel.cpp b/src/gui/itemviews/qstandarditemmodel.cpp index 7505ccc..168d423 100644 --- a/src/gui/itemviews/qstandarditemmodel.cpp +++ b/src/gui/itemviews/qstandarditemmodel.cpp @@ -1809,7 +1809,7 @@ bool QStandardItem::operator<(const QStandardItem &other) const const int role = model() ? model()->sortRole() : Qt::DisplayRole; const QVariant l = data(role), r = other.data(role); // this code is copied from QSortFilterProxyModel::lessThan() - switch (l.type()) { + switch (l.userType()) { case QVariant::Invalid: return (r.type() == QVariant::Invalid); case QVariant::Int: @@ -1820,6 +1820,8 @@ bool QStandardItem::operator<(const QStandardItem &other) const return l.toLongLong() < r.toLongLong(); case QVariant::ULongLong: return l.toULongLong() < r.toULongLong(); + case QMetaType::Float: + return l.toFloat() < r.toFloat(); case QVariant::Double: return l.toDouble() < r.toDouble(); case QVariant::Char: |