diff options
author | Thomas Zander <t.zander@nokia.com> | 2009-11-27 10:32:41 (GMT) |
---|---|---|
committer | Thomas Zander <t.zander@nokia.com> | 2009-11-27 11:24:43 (GMT) |
commit | c91ccab6f4ae1f7dd8c2c7103d6d63e7725b9eeb (patch) | |
tree | 49592d120a8536f89828194d6598debef0876823 /src/gui | |
parent | c6b577b941aa216903ff99a9fe743a9c37b92fce (diff) | |
download | Qt-c91ccab6f4ae1f7dd8c2c7103d6d63e7725b9eeb.zip Qt-c91ccab6f4ae1f7dd8c2c7103d6d63e7725b9eeb.tar.gz Qt-c91ccab6f4ae1f7dd8c2c7103d6d63e7725b9eeb.tar.bz2 |
Correctly export the horizontal part of a mixed alignment in text.
Task-number: QTBUG-5542
Reviewed-by: Trust-me
We should not assume that the alignment only has a horizontal part so
the export should take care to fish out the relevant bits from the flags
only.
Diffstat (limited to 'src/gui')
-rw-r--r-- | src/gui/text/qtextodfwriter.cpp | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/src/gui/text/qtextodfwriter.cpp b/src/gui/text/qtextodfwriter.cpp index 9b7e8de..1bd4dd6 100644 --- a/src/gui/text/qtextodfwriter.cpp +++ b/src/gui/text/qtextodfwriter.cpp @@ -447,18 +447,19 @@ void QTextOdfWriter::writeBlockFormat(QXmlStreamWriter &writer, QTextBlockFormat writer.writeStartElement(styleNS, QString::fromLatin1("paragraph-properties")); if (format.hasProperty(QTextFormat::BlockAlignment)) { + const Qt::Alignment alignment = format.alignment() & Qt::AlignHorizontal_Mask; QString value; - if (format.alignment() == Qt::AlignLeading) + if (alignment == Qt::AlignLeading) value = QString::fromLatin1("start"); - else if (format.alignment() == Qt::AlignTrailing) + else if (alignment == Qt::AlignTrailing) value = QString::fromLatin1("end"); - else if (format.alignment() == (Qt::AlignLeft | Qt::AlignAbsolute)) + else if (alignment == (Qt::AlignLeft | Qt::AlignAbsolute)) value = QString::fromLatin1("left"); - else if (format.alignment() == (Qt::AlignRight | Qt::AlignAbsolute)) + else if (alignment == (Qt::AlignRight | Qt::AlignAbsolute)) value = QString::fromLatin1("right"); - else if (format.alignment() == Qt::AlignHCenter) + else if (alignment == Qt::AlignHCenter) value = QString::fromLatin1("center"); - else if (format.alignment() == Qt::AlignJustify) + else if (alignment == Qt::AlignJustify) value = QString::fromLatin1("justify"); else qWarning() << "QTextOdfWriter: unsupported paragraph alignment; " << format.alignment(); |