summaryrefslogtreecommitdiffstats
path: root/src/gui/painting
diff options
context:
space:
mode:
authorThiago Macieira <thiago.macieira@intel.com>2024-02-23 19:41:30 +0100
committerThiago Macieira <thiago.macieira@intel.com>2024-03-26 15:20:31 -0700
commit1ebee8980ba31514079a01989168914bfd1e9f4f (patch)
treebb787b5be8799e9e895f6122bdcb92d127f50c4e /src/gui/painting
parente7667357712fe35b66a140916c18d8616b2e4f9c (diff)
QPolygonF: delegate QDataStream marshalling to QList
Like the QPolygon code. This fixes a mistake in failing to clear the list before de-marshalling in operator>>. Updated most of the QDataStream tests to have data in the objects they're streaming into, to ensure that the stream overwrites everything. Fixes: QTBUG-122684 Task-number: QTBUG-122704 Pick-to: 5.15 6.5 6.6 6.7 Change-Id: I01ec3c774d9943adb903fffd17b6920c72f5042b Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
Diffstat (limited to 'src/gui/painting')
-rw-r--r--src/gui/painting/qpolygon.cpp20
1 files changed, 2 insertions, 18 deletions
diff --git a/src/gui/painting/qpolygon.cpp b/src/gui/painting/qpolygon.cpp
index 7795e9dc5a..d615245eb4 100644
--- a/src/gui/painting/qpolygon.cpp
+++ b/src/gui/painting/qpolygon.cpp
@@ -697,13 +697,7 @@ QDataStream &operator>>(QDataStream &s, QPolygon &a)
QDataStream &operator<<(QDataStream &s, const QPolygonF &a)
{
- quint32 len = a.size();
- uint i;
-
- s << len;
- for (i = 0; i < len; ++i)
- s << a.at(i);
- return s;
+ return s << static_cast<const QList<QPointF> &>(a);
}
/*!
@@ -718,17 +712,7 @@ QDataStream &operator<<(QDataStream &s, const QPolygonF &a)
QDataStream &operator>>(QDataStream &s, QPolygonF &a)
{
- quint32 len;
- uint i;
-
- s >> len;
- a.reserve(a.size() + (int)len);
- QPointF p;
- for (i = 0; i < len; ++i) {
- s >> p;
- a.insert(i, p);
- }
- return s;
+ return s >> static_cast<QList<QPointF> &>(a);
}
#endif //QT_NO_DATASTREAM