QText*Format: future-proof by adding own QDataStream stream operators
These five classes add no members to QTextFormat, so their streaming must, by all means, be identical to QTextFormat. But should that change in the future, we don't want to accidentally slice the objects by calling the parent operators. Required by "Cause compilation errors if you forget to declare QDataStream operators" Pick-to: 6.3 Change-Id: Ic15405335d804bdea761fffd16d4a4193db28bc4 Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
This commit is contained in:
parent
38e6b637b7
commit
0335755e52
@ -1,6 +1,6 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2016 The Qt Company Ltd.
|
||||
** Copyright (C) 2021 The Qt Company Ltd.
|
||||
** Contact: https://www.qt.io/licensing/
|
||||
**
|
||||
** This file is part of the QtGui module of the Qt Toolkit.
|
||||
@ -496,6 +496,56 @@ Q_GUI_EXPORT QDataStream &operator>>(QDataStream &stream, QTextFormat &fmt)
|
||||
|
||||
return stream;
|
||||
}
|
||||
|
||||
Q_GUI_EXPORT QDataStream &operator<<(QDataStream &stream, const QTextCharFormat &fmt)
|
||||
{
|
||||
return stream << static_cast<const QTextFormat &>(fmt);
|
||||
}
|
||||
|
||||
Q_GUI_EXPORT QDataStream &operator>>(QDataStream &stream, QTextCharFormat &fmt)
|
||||
{
|
||||
return stream >> static_cast<QTextFormat &>(fmt);
|
||||
}
|
||||
|
||||
Q_GUI_EXPORT QDataStream &operator<<(QDataStream &stream, const QTextBlockFormat &fmt)
|
||||
{
|
||||
return stream << static_cast<const QTextFormat &>(fmt);
|
||||
}
|
||||
|
||||
Q_GUI_EXPORT QDataStream &operator>>(QDataStream &stream, QTextBlockFormat &fmt)
|
||||
{
|
||||
return stream >> static_cast<QTextFormat &>(fmt);
|
||||
}
|
||||
|
||||
Q_GUI_EXPORT QDataStream &operator<<(QDataStream &stream, const QTextListFormat &fmt)
|
||||
{
|
||||
return stream << static_cast<const QTextFormat &>(fmt);
|
||||
}
|
||||
|
||||
Q_GUI_EXPORT QDataStream &operator>>(QDataStream &stream, QTextListFormat &fmt)
|
||||
{
|
||||
return stream >> static_cast<QTextFormat &>(fmt);
|
||||
}
|
||||
|
||||
Q_GUI_EXPORT QDataStream &operator<<(QDataStream &stream, const QTextFrameFormat &fmt)
|
||||
{
|
||||
return stream << static_cast<const QTextFormat &>(fmt);
|
||||
}
|
||||
|
||||
Q_GUI_EXPORT QDataStream &operator>>(QDataStream &stream, QTextFrameFormat &fmt)
|
||||
{
|
||||
return stream >> static_cast<QTextFormat &>(fmt);
|
||||
}
|
||||
|
||||
Q_GUI_EXPORT QDataStream &operator<<(QDataStream &stream, const QTextTableCellFormat &fmt)
|
||||
{
|
||||
return stream << static_cast<const QTextFormat &>(fmt);
|
||||
}
|
||||
|
||||
Q_GUI_EXPORT QDataStream &operator>>(QDataStream &stream, QTextTableCellFormat &fmt)
|
||||
{
|
||||
return stream >> static_cast<QTextFormat &>(fmt);
|
||||
}
|
||||
#endif // QT_NO_DATASTREAM
|
||||
|
||||
/*!
|
||||
|
@ -1,6 +1,6 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2016 The Qt Company Ltd.
|
||||
** Copyright (C) 2021 The Qt Company Ltd.
|
||||
** Contact: https://www.qt.io/licensing/
|
||||
**
|
||||
** This file is part of the QtGui module of the Qt Toolkit.
|
||||
@ -614,6 +614,8 @@ public:
|
||||
protected:
|
||||
explicit QTextCharFormat(const QTextFormat &fmt);
|
||||
friend class QTextFormat;
|
||||
friend Q_GUI_EXPORT QDataStream &operator<<(QDataStream &, const QTextCharFormat &);
|
||||
friend Q_GUI_EXPORT QDataStream &operator>>(QDataStream &, QTextCharFormat &);
|
||||
};
|
||||
|
||||
Q_DECLARE_SHARED(QTextCharFormat)
|
||||
@ -722,6 +724,8 @@ public:
|
||||
protected:
|
||||
explicit QTextBlockFormat(const QTextFormat &fmt);
|
||||
friend class QTextFormat;
|
||||
friend Q_GUI_EXPORT QDataStream &operator<<(QDataStream &, const QTextBlockFormat &);
|
||||
friend Q_GUI_EXPORT QDataStream &operator>>(QDataStream &, QTextBlockFormat &);
|
||||
};
|
||||
|
||||
Q_DECLARE_SHARED(QTextBlockFormat)
|
||||
@ -833,6 +837,8 @@ public:
|
||||
protected:
|
||||
explicit QTextImageFormat(const QTextFormat &format);
|
||||
friend class QTextFormat;
|
||||
friend Q_GUI_EXPORT QDataStream &operator<<(QDataStream &, const QTextListFormat &);
|
||||
friend Q_GUI_EXPORT QDataStream &operator>>(QDataStream &, QTextListFormat &);
|
||||
};
|
||||
|
||||
Q_DECLARE_SHARED(QTextImageFormat)
|
||||
@ -936,6 +942,8 @@ public:
|
||||
protected:
|
||||
explicit QTextFrameFormat(const QTextFormat &fmt);
|
||||
friend class QTextFormat;
|
||||
friend Q_GUI_EXPORT QDataStream &operator<<(QDataStream &, const QTextFrameFormat &);
|
||||
friend Q_GUI_EXPORT QDataStream &operator>>(QDataStream &, QTextFrameFormat &);
|
||||
};
|
||||
|
||||
Q_DECLARE_SHARED(QTextFrameFormat)
|
||||
@ -1118,6 +1126,8 @@ public:
|
||||
|
||||
protected:
|
||||
explicit QTextTableCellFormat(const QTextFormat &fmt);
|
||||
friend Q_GUI_EXPORT QDataStream &operator<<(QDataStream &, const QTextTableCellFormat &);
|
||||
friend Q_GUI_EXPORT QDataStream &operator>>(QDataStream &, QTextTableCellFormat &);
|
||||
friend class QTextFormat;
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user