summaryrefslogtreecommitdiffstats
path: root/src/gui/text
diff options
context:
space:
mode:
authorJoerg Bornemann <joerg.bornemann@trolltech.com>2009-08-11 09:53:41 (GMT)
committerJoerg Bornemann <joerg.bornemann@trolltech.com>2009-08-11 16:03:17 (GMT)
commitee7d7a4f3016e8ca94bde5c2328676e31bf4eba2 (patch)
tree151f05492ddbc23c3f45cad68001442a63304641 /src/gui/text
parentd45b0ee01402c2474652f6afd2cd1e8564d8071c (diff)
downloadQt-ee7d7a4f3016e8ca94bde5c2328676e31bf4eba2.zip
Qt-ee7d7a4f3016e8ca94bde5c2328676e31bf4eba2.tar.gz
Qt-ee7d7a4f3016e8ca94bde5c2328676e31bf4eba2.tar.bz2
fix QTextFormat::doubleProperty where qreal is float
This function was too strict. It returned 0 if the property wasn't of type QVariant::Double. Now it tests for QMetaType::Float too. Reviewed-by: kh1 Reviewed-by: mauricek
Diffstat (limited to 'src/gui/text')
-rw-r--r--src/gui/text/qtextformat.cpp7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/gui/text/qtextformat.cpp b/src/gui/text/qtextformat.cpp
index a3dd83e..fd0c17f 100644
--- a/src/gui/text/qtextformat.cpp
+++ b/src/gui/text/qtextformat.cpp
@@ -875,7 +875,8 @@ int QTextFormat::intProperty(int propertyId) const
/*!
Returns the value of the property specified by \a propertyId. If the
- property isn't of QVariant::Double type, 0 is returned instead.
+ property isn't of QVariant::Double or QMetaType::Float type, 0 is
+ returned instead.
\sa setProperty() boolProperty() intProperty() stringProperty() colorProperty() lengthProperty() lengthVectorProperty() Property
*/
@@ -884,9 +885,9 @@ qreal QTextFormat::doubleProperty(int propertyId) const
if (!d)
return 0.;
const QVariant prop = d->property(propertyId);
- if (prop.type() != QVariant::Double)
+ if (prop.type() != QVariant::Double && prop.type() != QMetaType::Float)
return 0.;
- return prop.toDouble(); // ####
+ return qVariantValue<qreal>(prop);
}
/*!