From 7358af18674f6dbd9abf67f6e02809f43e2cfc3e Mon Sep 17 00:00:00 2001 From: Lars Knoll Date: Sat, 5 Jun 2010 21:45:25 +0200 Subject: Make sure LayoutDirectionAuto is the default text direction QTextFormat::intProperty requires a small change to ensure we return the right value for layoutDirection. No need to change QTextFormat::property, as an invalid QVariant will be returned if the layoutDirection is not explicitly set. Reviewed-by: Simon Hausmann --- src/gui/text/qtextformat.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/gui/text/qtextformat.cpp b/src/gui/text/qtextformat.cpp index 140cf43..46db253 100644 --- a/src/gui/text/qtextformat.cpp +++ b/src/gui/text/qtextformat.cpp @@ -900,11 +900,14 @@ bool QTextFormat::boolProperty(int propertyId) const */ int QTextFormat::intProperty(int propertyId) const { + // required, since the default layout direction has to be LayoutDirectionAuto, which is not integer 0 + int def = (propertyId == QTextFormat::LayoutDirection) ? int(Qt::LayoutDirectionAuto) : 0; + if (!d) - return 0; + return def; const QVariant prop = d->property(propertyId); if (prop.userType() != QVariant::Int) - return 0; + return def; return prop.toInt(); } -- cgit v0.12