Serialize the capitalization value of QFont
By serializing the capitalization value of QFont, it ensures that it is correctly preserved when QPicture streams it and later plays it back. Subsequently the QDataStream version has been bumped up to account for the change of the data format for serializing QFont. [ChangeLog][QtGui][QFont] QFont now serializes the capitalization setting. [ChangeLog][Important Behavior Changes] QDataStream version bumped up to 17 to account for changes in the serialization of QFont. Task-number: QTBUG-15214 Change-Id: I042680760e5a69d18d41e786b7500a3eebbe562f Reviewed-by: Mitch Curtis <mitch.curtis@theqtcompany.com>
This commit is contained in:
parent
45bf434cdc
commit
d36a1dfb51
@ -526,7 +526,7 @@ void QDataStream::setByteOrder(ByteOrder bo)
|
||||
\value Qt_5_3 Same as Qt_5_2
|
||||
\value Qt_5_4 Version 16 (Qt 5.4)
|
||||
\value Qt_5_5 Same as Qt_5_4
|
||||
\value Qt_5_6 Same as Qt_5_4
|
||||
\value Qt_5_6 Version 17 (Qt 5.6)
|
||||
\omitvalue Qt_DefaultCompiledVersion
|
||||
|
||||
\sa setVersion(), version()
|
||||
|
@ -83,7 +83,7 @@ public:
|
||||
Qt_5_3 = Qt_5_2,
|
||||
Qt_5_4 = 16,
|
||||
Qt_5_5 = Qt_5_4,
|
||||
Qt_5_6 = Qt_5_5,
|
||||
Qt_5_6 = 17,
|
||||
#if QT_VERSION >= 0x050700
|
||||
#error Add the datastream version for this Qt version and update Qt_DefaultCompiledVersion
|
||||
#endif
|
||||
|
@ -2218,6 +2218,8 @@ QDataStream &operator<<(QDataStream &s, const QFont &font)
|
||||
}
|
||||
if (s.version() >= QDataStream::Qt_5_4)
|
||||
s << (quint8)font.d->request.hintingPreference;
|
||||
if (s.version() >= QDataStream::Qt_5_6)
|
||||
s << (quint8)font.d->capital;
|
||||
return s;
|
||||
}
|
||||
|
||||
@ -2308,7 +2310,11 @@ QDataStream &operator>>(QDataStream &s, QFont &font)
|
||||
s >> value;
|
||||
font.d->request.hintingPreference = QFont::HintingPreference(value);
|
||||
}
|
||||
|
||||
if (s.version() >= QDataStream::Qt_5_6) {
|
||||
quint8 value;
|
||||
s >> value;
|
||||
font.d->capital = QFont::Capitalization(value);
|
||||
}
|
||||
return s;
|
||||
}
|
||||
|
||||
|
@ -264,7 +264,9 @@ static int NColorRoles[] = {
|
||||
QPalette::ToolTipText + 1, // Qt_5_2
|
||||
QPalette::ToolTipText + 1, // Qt_5_3
|
||||
QPalette::ToolTipText + 1, // Qt_5_4
|
||||
0 // add the correct value for Qt_5_5 here later
|
||||
QPalette::ToolTipText + 1, // Qt_5_5
|
||||
QPalette::ToolTipText + 1, // Qt_5_6
|
||||
0 // add the correct value for Qt_5_7 here later
|
||||
};
|
||||
|
||||
// Testing get/set functions
|
||||
|
@ -608,6 +608,11 @@ void tst_QFont::serialize_data()
|
||||
font.setStyleName("Regular Black Condensed");
|
||||
// This wasn't read until 5.4.
|
||||
QTest::newRow("styleName") << font << QDataStream::Qt_5_4;
|
||||
|
||||
font = basicFont;
|
||||
font.setCapitalization(QFont::AllUppercase);
|
||||
// This wasn't read until 5.6.
|
||||
QTest::newRow("capitalization") << font << QDataStream::Qt_5_6;
|
||||
}
|
||||
|
||||
void tst_QFont::serialize()
|
||||
|
Loading…
Reference in New Issue
Block a user