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/text/qtextformat.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/text/qtextformat.cpp')
-rw-r--r-- | src/gui/text/qtextformat.cpp | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/gui/text/qtextformat.cpp b/src/gui/text/qtextformat.cpp index 8e9b892..075f2ff 100644 --- a/src/gui/text/qtextformat.cpp +++ b/src/gui/text/qtextformat.cpp @@ -271,6 +271,7 @@ static uint variantHash(const QVariant &variant) case QVariant::Invalid: return 0; case QVariant::Bool: return variant.toBool(); case QVariant::Int: return variant.toInt(); + case QMetaType::Float: return static_cast<int>(variant.toFloat()); case QVariant::Double: return static_cast<int>(variant.toDouble()); case QVariant::String: return qHash(variant.toString()); case QVariant::Color: return qHash(qvariant_cast<QColor>(variant).rgb()); @@ -325,7 +326,7 @@ void QTextFormatPrivate::recalcFont() const f.setFamily(props.at(i).value.toString()); break; case QTextFormat::FontPointSize: - f.setPointSizeF(props.at(i).value.toDouble()); + f.setPointSizeF(props.at(i).value.toReal()); break; case QTextFormat::FontPixelSize: f.setPixelSize(props.at(i).value.toInt()); @@ -352,10 +353,10 @@ void QTextFormatPrivate::recalcFont() const f.setStrikeOut(props.at(i).value.toBool()); break; case QTextFormat::FontLetterSpacing: - f.setLetterSpacing(QFont::PercentageSpacing, props.at(i).value.toDouble()); + f.setLetterSpacing(QFont::PercentageSpacing, props.at(i).value.toReal()); break; case QTextFormat::FontWordSpacing: - f.setWordSpacing(props.at(i).value.toDouble()); + f.setWordSpacing(props.at(i).value.toReal()); break; case QTextFormat::FontCapitalization: f.setCapitalization(static_cast<QFont::Capitalization> (props.at(i).value.toInt())); |