diff options
author | Marc Mutz <marc.mutz@kdab.com> | 2013-11-13 12:35:54 +0100 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2013-11-14 19:26:20 +0100 |
commit | 4abf5fd3ea21501f8caf06ff7e3fcd01084e1d2e (patch) | |
tree | b7b2221dea0dcc513a4d4e380854bf08506aacb9 /src | |
parent | 3ebcbdd322c070c9bada31eceea1ea3c6ac2c0de (diff) |
QOpenGLPixelTransferOptions: declare as shared, add move assignment operator
A move constructor cannot be added because the class uses
a smart pointer to hold its pImpl, so the move ctor would
have to be out-of-line, destroying BC between C++11 and C++98
versions of Qt.
Member-swap is required for Q_DECLARED_SHARED, which in turn
enables efficient use of the class in Qt containers by marking
it movable.
Change-Id: I1aaa5bf3343a92e621d9464d8e4352f4e5ceff1f
Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/gui/opengl/qopenglpixeltransferoptions.h | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/gui/opengl/qopenglpixeltransferoptions.h b/src/gui/opengl/qopenglpixeltransferoptions.h index 1a5d3f00e2..c150e8aff4 100644 --- a/src/gui/opengl/qopenglpixeltransferoptions.h +++ b/src/gui/opengl/qopenglpixeltransferoptions.h @@ -60,6 +60,14 @@ public: QOpenGLPixelTransferOptions &operator=(const QOpenGLPixelTransferOptions &); ~QOpenGLPixelTransferOptions(); +#ifdef Q_COMPILER_RVALUE_REFS + QOpenGLPixelTransferOptions &operator=(QOpenGLPixelTransferOptions &&other) + { swap(other); return *this; } +#endif + + void swap(QOpenGLPixelTransferOptions &other) + { data.swap(other.data); } + void setAlignment(int alignment); int alignment() const; @@ -88,6 +96,8 @@ private: QSharedDataPointer<QOpenGLPixelTransferOptionsData> data; }; +Q_DECLARE_SHARED(QOpenGLPixelTransferOptions) + QT_END_NAMESPACE #endif // QT_NO_OPENGL |