Fix QDataStream compatibility for QTextFormat::TextUnderlineColor
The enum value of that property changed. Use the same mapping trick as with two other properties to ensure backwards compatibility in QDataStream. Change-Id: I01b36f9ecbcaf40e7c8523da33ea4c8f12821a63 Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
This commit is contained in:
parent
801e703a79
commit
d5e913cc60
@ -455,6 +455,12 @@ Q_GUI_EXPORT QDataStream &operator<<(QDataStream &stream, const QTextFormat &fmt
|
||||
properties[QTextFormat::OldFontStretch] = it.value();
|
||||
properties.erase(it);
|
||||
}
|
||||
|
||||
it = properties.find(QTextFormat::TextUnderlineColor);
|
||||
if (it != properties.end()) {
|
||||
properties[QTextFormat::OldTextUnderlineColor] = it.value();
|
||||
properties.erase(it);
|
||||
}
|
||||
}
|
||||
|
||||
stream << fmt.format_type << properties;
|
||||
@ -478,6 +484,8 @@ Q_GUI_EXPORT QDataStream &operator>>(QDataStream &stream, QTextFormat &fmt)
|
||||
key = QTextFormat::FontLetterSpacingType;
|
||||
else if (key == QTextFormat::OldFontStretch)
|
||||
key = QTextFormat::FontStretch;
|
||||
else if (key == QTextFormat::OldTextUnderlineColor)
|
||||
key = QTextFormat::TextUnderlineColor;
|
||||
fmt.d->insertProperty(key, it.value());
|
||||
}
|
||||
|
||||
|
@ -222,6 +222,7 @@ public:
|
||||
// Should not be referenced in user code.
|
||||
OldFontLetterSpacingType = 0x2033,
|
||||
OldFontStretch = 0x2034,
|
||||
OldTextUnderlineColor = 0x2010,
|
||||
|
||||
ObjectType = 0x2f00,
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user