diff options
author | Giuseppe D'Angelo <giuseppe.dangelo@kdab.com> | 2020-07-03 23:51:58 +0200 |
---|---|---|
committer | Giuseppe D'Angelo <giuseppe.dangelo@kdab.com> | 2020-08-07 15:01:26 +0200 |
commit | 3f6afac6b115b74c7d7946082ff2c0771cc3ccce (patch) | |
tree | 55803142947cee23017415b3049d4722a7386301 /src/gui/painting/qpolygon.h | |
parent | 096e268764397f781e72619e3b5f546d5786cae1 (diff) |
QPolygon: streamline constructors and special member functions
Employ RO0; inherit the constructors from the base class; and
do some code tidies as a drive by.
The inherited constructors bring in goodies like initializer_list
support.
Change-Id: Ia00a3f9b0ccbf182bf837bc65ba2305110c8dc60
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Diffstat (limited to 'src/gui/painting/qpolygon.h')
-rw-r--r-- | src/gui/painting/qpolygon.h | 34 |
1 files changed, 10 insertions, 24 deletions
diff --git a/src/gui/painting/qpolygon.h b/src/gui/painting/qpolygon.h index 5b3cd79c8c..80edd8d387 100644 --- a/src/gui/painting/qpolygon.h +++ b/src/gui/painting/qpolygon.h @@ -56,17 +56,12 @@ class QVariant; class QPolygon : public QList<QPoint> { public: - inline QPolygon() {} - inline ~QPolygon() {} - inline explicit QPolygon(int size); - inline /*implicit*/ QPolygon(const QList<QPoint> &v) : QList<QPoint>(v) { } - /*implicit*/ QPolygon(QList<QPoint> &&v) noexcept : QList<QPoint>(std::move(v)) { } - Q_GUI_EXPORT QPolygon(const QRect &r, bool closed=false); + using QList<QPoint>::QList; + QPolygon() = default; + /* implicit */ QPolygon(const QList<QPoint> &v) : QList<QPoint>(v) { } + /* implicit */ QPolygon(QList<QPoint> &&v) noexcept : QList<QPoint>(std::move(v)) { } + /* implicit */ Q_GUI_EXPORT QPolygon(const QRect &r, bool closed=false); Q_GUI_EXPORT QPolygon(int nPoints, const int *points); - QPolygon(const QPolygon &other) : QList<QPoint>(other) { } - QPolygon(QPolygon &&other) noexcept : QList<QPoint>(std::move(other)) { } - QPolygon &operator=(QPolygon &&other) noexcept { swap(other); return *this; } - QPolygon &operator=(const QPolygon &other) { QList<QPoint>::operator=(other); return *this; } void swap(QPolygon &other) noexcept { QList<QPoint>::swap(other); } // prevent QList<QPoint><->QPolygon swaps Q_GUI_EXPORT operator QVariant() const; @@ -99,8 +94,6 @@ public: }; Q_DECLARE_SHARED(QPolygon) -inline QPolygon::QPolygon(int size) : QList<QPoint>(size) { } - #ifndef QT_NO_DEBUG_STREAM Q_GUI_EXPORT QDebug operator<<(QDebug, const QPolygon &); #endif @@ -137,17 +130,12 @@ class QRectF; class QPolygonF : public QList<QPointF> { public: - inline QPolygonF() {} - inline ~QPolygonF() {} - inline explicit QPolygonF(int size); - inline /*implicit*/ QPolygonF(const QList<QPointF> &v) : QList<QPointF>(v) { } + using QList<QPointF>::QList; + QPolygonF() = default; + /* implicit */ QPolygonF(const QList<QPointF> &v) : QList<QPointF>(v) { } /* implicit */ QPolygonF(QList<QPointF> &&v) noexcept : QList<QPointF>(std::move(v)) { } - Q_GUI_EXPORT QPolygonF(const QRectF &r); - /*implicit*/ Q_GUI_EXPORT QPolygonF(const QPolygon &a); - inline QPolygonF(const QPolygonF &a) : QList<QPointF>(a) { } - QPolygonF(QPolygonF &&other) noexcept : QList<QPointF>(std::move(other)) { } - QPolygonF &operator=(QPolygonF &&other) noexcept { swap(other); return *this; } - QPolygonF &operator=(const QPolygonF &other) { QList<QPointF>::operator=(other); return *this; } + /* implicit */ Q_GUI_EXPORT QPolygonF(const QRectF &r); + /* implicit */ Q_GUI_EXPORT QPolygonF(const QPolygon &a); inline void swap(QPolygonF &other) { QList<QPointF>::swap(other); } // prevent QList<QPointF><->QPolygonF swaps Q_GUI_EXPORT operator QVariant() const; @@ -174,8 +162,6 @@ public: }; Q_DECLARE_SHARED(QPolygonF) -inline QPolygonF::QPolygonF(int size) : QList<QPointF>(size) { } - #ifndef QT_NO_DEBUG_STREAM Q_GUI_EXPORT QDebug operator<<(QDebug, const QPolygonF &); #endif |