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>bb10
parent
3ebcbdd322
commit
4abf5fd3ea
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Reference in New Issue