summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLars Knoll <lars.knoll@nokia.com>2010-06-05 20:11:57 (GMT)
committerLars Knoll <lars.knoll@nokia.com>2010-06-09 22:07:58 (GMT)
commit7b0f00e8c8a4ec541dba510debcf786c7edb7fae (patch)
tree4185569c55d8c53a3ee76782fb95759cc0c27327
parentfee7f7d67f780b798a63994a1125f9ca3ade1bd3 (diff)
downloadQt-7b0f00e8c8a4ec541dba510debcf786c7edb7fae.zip
Qt-7b0f00e8c8a4ec541dba510debcf786c7edb7fae.tar.gz
Qt-7b0f00e8c8a4ec541dba510debcf786c7edb7fae.tar.bz2
Use the textDirection() of blocks correctly.
Task-number: Part of QT-3292 Reviewed-by: Simon Hausmann
-rw-r--r--src/gui/text/qtextcursor.cpp2
-rw-r--r--src/gui/text/qtextdocument.cpp9
-rw-r--r--src/gui/text/qtextdocumentlayout.cpp8
-rw-r--r--src/gui/text/qtextlist.cpp2
4 files changed, 7 insertions, 14 deletions
diff --git a/src/gui/text/qtextcursor.cpp b/src/gui/text/qtextcursor.cpp
index d6ac3aa..23849bc 100644
--- a/src/gui/text/qtextcursor.cpp
+++ b/src/gui/text/qtextcursor.cpp
@@ -362,7 +362,7 @@ bool QTextCursorPrivate::movePosition(QTextCursor::MoveOperation op, QTextCursor
QTextBlock blockIt = block();
if (op >= QTextCursor::Left && op <= QTextCursor::WordRight
- && blockIt.blockFormat().layoutDirection() == Qt::RightToLeft) {
+ && blockIt.textDirection() == Qt::RightToLeft) {
if (op == QTextCursor::Left)
op = QTextCursor::NextCharacter;
else if (op == QTextCursor::Right)
diff --git a/src/gui/text/qtextdocument.cpp b/src/gui/text/qtextdocument.cpp
index c7a9756..48aee8f 100644
--- a/src/gui/text/qtextdocument.cpp
+++ b/src/gui/text/qtextdocument.cpp
@@ -2496,13 +2496,10 @@ void QTextHtmlExporter::emitBlockAttributes(const QTextBlock &block)
QTextBlockFormat format = block.blockFormat();
emitAlignment(format.alignment());
- Qt::LayoutDirection dir = format.layoutDirection();
- if (dir == Qt::LeftToRight) {
- // assume default to not bloat the html too much
- // html += QLatin1String(" dir='ltr'");
- } else {
+ // assume default to not bloat the html too much
+ // html += QLatin1String(" dir='ltr'");
+ if (block.textDirection() == Qt::RightToLeft)
html += QLatin1String(" dir='rtl'");
- }
QLatin1String style(" style=\"");
html += style;
diff --git a/src/gui/text/qtextdocumentlayout.cpp b/src/gui/text/qtextdocumentlayout.cpp
index eeb66ce..ff14490 100644
--- a/src/gui/text/qtextdocumentlayout.cpp
+++ b/src/gui/text/qtextdocumentlayout.cpp
@@ -1369,9 +1369,7 @@ void QTextDocumentLayoutPrivate::drawListItem(const QPointF &offset, QPainter *p
QTextLine firstLine = layout->lineAt(0);
Q_ASSERT(firstLine.isValid());
QPointF pos = (offset + layout->position()).toPoint();
- Qt::LayoutDirection dir = docPrivate->defaultTextOption.textDirection();
- if (blockFormat.hasProperty(QTextFormat::LayoutDirection))
- dir = blockFormat.layoutDirection();
+ Qt::LayoutDirection dir = bl.textDirection();
{
QRectF textRect = firstLine.naturalTextRect();
pos += textRect.topLeft().toPoint();
@@ -2530,9 +2528,7 @@ void QTextDocumentLayoutPrivate::layoutBlock(const QTextBlock &bl, int blockPosi
//QTextFrameData *fd = data(layoutStruct->frame);
- Qt::LayoutDirection dir = docPrivate->defaultTextOption.textDirection();
- if (blockFormat.hasProperty(QTextFormat::LayoutDirection))
- dir = blockFormat.layoutDirection();
+ Qt::LayoutDirection dir = bl.textDirection();
QFixed extraMargin;
if (docPrivate->defaultTextOption.flags() & QTextOption::AddSpaceForLineAndParagraphSeparators) {
diff --git a/src/gui/text/qtextlist.cpp b/src/gui/text/qtextlist.cpp
index 2986ee7..a0ff520 100644
--- a/src/gui/text/qtextlist.cpp
+++ b/src/gui/text/qtextlist.cpp
@@ -262,7 +262,7 @@ QString QTextList::itemText(const QTextBlock &blockIt) const
default:
Q_ASSERT(false);
}
- if (blockFormat.layoutDirection() == Qt::RightToLeft)
+ if (blockIt.textDirection() == Qt::RightToLeft)
return result.prepend(QLatin1Char('.'));
return result + QLatin1Char('.');
}