diff options
author | Joerg Bornemann <joerg.bornemann@trolltech.com> | 2009-08-11 09:53:41 (GMT) |
---|---|---|
committer | Joerg Bornemann <joerg.bornemann@trolltech.com> | 2009-08-12 11:00:21 (GMT) |
commit | 70ad574793adf908f3aae96a58cda229dceb8cf8 (patch) | |
tree | 77762173ee4e1db67b866d9276a6a4ccd82a4c1e /src | |
parent | 7e0c7fada2b3e4c451be406489f5bcdaf985250e (diff) | |
download | Qt-70ad574793adf908f3aae96a58cda229dceb8cf8.zip Qt-70ad574793adf908f3aae96a58cda229dceb8cf8.tar.gz Qt-70ad574793adf908f3aae96a58cda229dceb8cf8.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')
-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 3e127b7..909a4e8 100644 --- a/src/gui/text/qtextformat.cpp +++ b/src/gui/text/qtextformat.cpp @@ -844,7 +844,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 */ @@ -853,9 +854,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); } /*! |