diff options
Diffstat (limited to 'src/gui/painting/qpen.h')
-rw-r--r-- | src/gui/painting/qpen.h | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/src/gui/painting/qpen.h b/src/gui/painting/qpen.h index d8f13df388..3367b96c35 100644 --- a/src/gui/painting/qpen.h +++ b/src/gui/painting/qpen.h @@ -4,6 +4,7 @@ #ifndef QPEN_H #define QPEN_H +#include <QtCore/qshareddata.h> #include <QtGui/qtguiglobal.h> #include <QtGui/qcolor.h> #include <QtGui/qbrush.h> @@ -21,6 +22,8 @@ Q_GUI_EXPORT QDataStream &operator<<(QDataStream &, const QPen &); Q_GUI_EXPORT QDataStream &operator>>(QDataStream &, QPen &); #endif +QT_DECLARE_QESDP_SPECIALIZATION_DTOR_WITH_EXPORT(QPenPrivate, Q_GUI_EXPORT) + class Q_GUI_EXPORT QPen { public: @@ -34,10 +37,9 @@ public: ~QPen(); QPen &operator=(const QPen &pen) noexcept; - QPen(QPen &&other) noexcept - : d(qExchange(other.d, nullptr)) {} + QPen(QPen &&other) noexcept = default; QT_MOVE_ASSIGNMENT_OPERATOR_IMPL_VIA_PURE_SWAP(QPen) - void swap(QPen &other) noexcept { qt_ptr_swap(d, other.d); } + void swap(QPen &other) noexcept { d.swap(other.d); } Qt::PenStyle style() const; void setStyle(Qt::PenStyle); @@ -79,15 +81,19 @@ public: operator QVariant() const; bool isDetached(); + private: friend Q_GUI_EXPORT QDataStream &operator>>(QDataStream &, QPen &); friend Q_GUI_EXPORT QDataStream &operator<<(QDataStream &, const QPen &); +public: + using DataPtr = QExplicitlySharedDataPointer<QPenPrivate>; + +private: void detach(); - class QPenPrivate *d; + DataPtr d; public: - typedef QPenPrivate * DataPtr; inline DataPtr &data_ptr() { return d; } }; |