From 4abf5fd3ea21501f8caf06ff7e3fcd01084e1d2e Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Wed, 13 Nov 2013 12:35:54 +0100 Subject: 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 --- src/gui/opengl/qopenglpixeltransferoptions.h | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'src') 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 data; }; +Q_DECLARE_SHARED(QOpenGLPixelTransferOptions) + QT_END_NAMESPACE #endif // QT_NO_OPENGL -- cgit v1.2.3