diff --git a/src/gui/text/qtextformat.cpp b/src/gui/text/qtextformat.cpp index fa83212033..be38aba368 100644 --- a/src/gui/text/qtextformat.cpp +++ b/src/gui/text/qtextformat.cpp @@ -425,7 +425,7 @@ Q_GUI_EXPORT QDataStream &operator<<(QDataStream &stream, const QTextFormat &fmt it = properties.find(QTextFormat::FontFamilies); if (it != properties.end()) { - properties[QTextFormat::FontFamily] = QVariant(it.value().toStringList().first()); + properties[QTextFormat::OldFontFamily] = QVariant(it.value().toStringList().first()); properties.erase(it); } } @@ -453,7 +453,7 @@ Q_GUI_EXPORT QDataStream &operator>>(QDataStream &stream, QTextFormat &fmt) key = QTextFormat::FontStretch; else if (key == QTextFormat::OldTextUnderlineColor) key = QTextFormat::TextUnderlineColor; - else if (key == QTextFormat::FontFamily) + else if (key == QTextFormat::OldFontFamily) key = QTextFormat::FontFamilies; fmt.d->insertProperty(key, it.value()); } @@ -625,6 +625,7 @@ Q_GUI_EXPORT QDataStream &operator>>(QDataStream &stream, QTextTableCellFormat & Character properties \value FontFamily e{This property has been deprecated.} Use QTextFormat::FontFamilies instead. + \omitvalue OldFontFamily \value FontFamilies \value FontStyleName \value FontPointSize diff --git a/src/gui/text/qtextformat.h b/src/gui/text/qtextformat.h index 95bc9da334..02c66279e2 100644 --- a/src/gui/text/qtextformat.h +++ b/src/gui/text/qtextformat.h @@ -179,6 +179,7 @@ public: OldFontLetterSpacingType = 0x2033, OldFontStretch = 0x2034, OldTextUnderlineColor = 0x2010, + OldFontFamily = 0x2000, // same as FontFamily ObjectType = 0x2f00, diff --git a/src/gui/text/qtextodfwriter.cpp b/src/gui/text/qtextodfwriter.cpp index 4214dd11dc..af1015883a 100644 --- a/src/gui/text/qtextodfwriter.cpp +++ b/src/gui/text/qtextodfwriter.cpp @@ -644,7 +644,7 @@ void QTextOdfWriter::writeCharacterFormat(QXmlStreamWriter &writer, QTextCharFor value = QString::number(format.fontWeight()); writer.writeAttribute(foNS, QString::fromLatin1("font-weight"), value); } - if (format.hasProperty(QTextFormat::FontFamily)) + if (format.hasProperty(QTextFormat::OldFontFamily)) writer.writeAttribute(foNS, QString::fromLatin1("font-family"), format.fontFamilies().toStringList().value(0, QString())); else writer.writeAttribute(foNS, QString::fromLatin1("font-family"), QString::fromLatin1("Sans")); // Qt default diff --git a/tests/auto/gui/text/qtextformat/tst_qtextformat.cpp b/tests/auto/gui/text/qtextformat/tst_qtextformat.cpp index a998bbd482..9ef5842803 100644 --- a/tests/auto/gui/text/qtextformat/tst_qtextformat.cpp +++ b/tests/auto/gui/text/qtextformat/tst_qtextformat.cpp @@ -679,7 +679,7 @@ void tst_QTextFormat::dataStreamCompatibility() QVERIFY(properties.contains(QTextFormat::FontFamilies)); QVERIFY(!properties.contains(QTextFormat::OldFontLetterSpacingType)); QVERIFY(!properties.contains(QTextFormat::OldFontStretch)); - QVERIFY(!properties.contains(QTextFormat::FontFamily)); + QVERIFY(!properties.contains(QTextFormat::OldFontFamily)); } QByteArray memory; @@ -710,7 +710,7 @@ void tst_QTextFormat::dataStreamCompatibility() QVERIFY(properties.contains(QTextFormat::FontFamilies)); QVERIFY(!properties.contains(QTextFormat::OldFontLetterSpacingType)); QVERIFY(!properties.contains(QTextFormat::OldFontStretch)); - QVERIFY(!properties.contains(QTextFormat::FontFamily)); + QVERIFY(!properties.contains(QTextFormat::OldFontFamily)); } } @@ -730,7 +730,7 @@ void tst_QTextFormat::dataStreamCompatibility() QVERIFY(properties.contains(QTextFormat::FontFamilies)); QVERIFY(!properties.contains(QTextFormat::OldFontLetterSpacingType)); QVERIFY(!properties.contains(QTextFormat::OldFontStretch)); - QVERIFY(!properties.contains(QTextFormat::FontFamily)); + QVERIFY(!properties.contains(QTextFormat::OldFontFamily)); } } @@ -763,7 +763,7 @@ void tst_QTextFormat::dataStreamCompatibility() QVERIFY(properties.contains(QTextFormat::FontFamilies)); QVERIFY(!properties.contains(QTextFormat::OldFontLetterSpacingType)); QVERIFY(!properties.contains(QTextFormat::OldFontStretch)); - QVERIFY(!properties.contains(QTextFormat::FontFamily)); + QVERIFY(!properties.contains(QTextFormat::OldFontFamily)); } } @@ -785,7 +785,7 @@ void tst_QTextFormat::dataStreamCompatibility() QVERIFY(!properties.contains(QTextFormat::FontFamilies)); QVERIFY(properties.contains(QTextFormat::OldFontLetterSpacingType)); QVERIFY(properties.contains(QTextFormat::OldFontStretch)); - QVERIFY(properties.contains(QTextFormat::FontFamily)); + QVERIFY(properties.contains(QTextFormat::OldFontFamily)); } }