diff options
author | Marc Mutz <marc.mutz@kdab.com> | 2010-11-02 14:20:37 (GMT) |
---|---|---|
committer | Olivier Goffart <olivier.goffart@nokia.com> | 2010-11-03 10:50:48 (GMT) |
commit | d12681a4cf1227d0e92fc7cf12aa3977e6ffe3fe (patch) | |
tree | 32306cd47731503f85a3d88881a5e28901506432 /src/gui | |
parent | 9ff533aa0ddf944b73b0c29193fc9936c644142e (diff) | |
download | Qt-d12681a4cf1227d0e92fc7cf12aa3977e6ffe3fe.zip Qt-d12681a4cf1227d0e92fc7cf12aa3977e6ffe3fe.tar.gz Qt-d12681a4cf1227d0e92fc7cf12aa3977e6ffe3fe.tar.bz2 |
Containers: add member-swap
Member-swap is required by the STL Sequence concept, but is also needed to write exception-safe code.
Merge-request: 871
Reviewed-by: Olivier Goffart <olivier.goffart@nokia.com>
Diffstat (limited to 'src/gui')
-rw-r--r-- | src/gui/painting/qpolygon.cpp | 14 | ||||
-rw-r--r-- | src/gui/painting/qpolygon.h | 3 |
2 files changed, 17 insertions, 0 deletions
diff --git a/src/gui/painting/qpolygon.cpp b/src/gui/painting/qpolygon.cpp index 2fb52b5..76b11d7 100644 --- a/src/gui/painting/qpolygon.cpp +++ b/src/gui/painting/qpolygon.cpp @@ -700,6 +700,20 @@ QPolygon QPolygonF::toPolygon() const } /*! + \fn void QPolygon::swap(QPolygon &other) + \since 4.8 + + Swaps polygon \a other with this polygon. This operation is very + fast and never fails. +*/ + +/*! + \fn void QPolygonF::swap(QPolygonF &other) + Swaps polygon \a other with this polygon. This operation is very + fast and never fails. +*/ + +/*! Returns the polygon as a QVariant */ QPolygon::operator QVariant() const diff --git a/src/gui/painting/qpolygon.h b/src/gui/painting/qpolygon.h index 7a49e29..5baffc8 100644 --- a/src/gui/painting/qpolygon.h +++ b/src/gui/painting/qpolygon.h @@ -67,6 +67,8 @@ public: inline QPolygon(const QVector<QPoint> &v) : QVector<QPoint>(v) {} QPolygon(const QRect &r, bool closed=false); QPolygon(int nPoints, const int *points); + inline void swap(QPolygon &other) { QVector<QPoint>::swap(other); } // prevent QVector<QPoint><->QPolygon swaps + operator QVariant() const; void translate(int dx, int dy); @@ -139,6 +141,7 @@ public: inline QPolygonF(const QVector<QPointF> &v) : QVector<QPointF>(v) {} QPolygonF(const QRectF &r); QPolygonF(const QPolygon &a); + inline void swap(QPolygonF &other) { QVector<QPointF>::swap(other); } // prevent QVector<QPointF><->QPolygonF swaps inline void translate(qreal dx, qreal dy); void translate(const QPointF &offset); |