diff --git a/src/gui/rhi/qshader.cpp b/src/gui/rhi/qshader.cpp index 14e33d2d43e..d5fb53e7e6a 100644 --- a/src/gui/rhi/qshader.cpp +++ b/src/gui/rhi/qshader.cpp @@ -298,6 +298,28 @@ QShader &QShader::operator=(const QShader &other) return *this; } +/*! + \fn QShader::QShader(QShader &&other) noexcept + \since 6.7 + + Move-constructs a new QShader from \a other. + + \note The moved-from object \a other is placed in a + partially-formed state, in which the only valid operations are + destruction and assignment of a new value. +*/ + +/*! + \fn QShader &QShader::operator=(QShader &&other) + \since 6.7 + + Move-assigns \a other to this QShader instance. + + \note The moved-from object \a other is placed in a + partially-formed state, in which the only valid operations are + destruction and assignment of a new value. +*/ + /*! Destructor. */ @@ -307,6 +329,14 @@ QShader::~QShader() delete d; } +/*! + \fn void QShader::swap(QShader &other) + \since 6.7 + + Swaps shader \a other with this shader. This operation is very fast and + never fails. +*/ + /*! \return true if the QShader contains at least one shader version. */ diff --git a/src/gui/rhi/qshader.h b/src/gui/rhi/qshader.h index 0b52022596c..24650813667 100644 --- a/src/gui/rhi/qshader.h +++ b/src/gui/rhi/qshader.h @@ -117,7 +117,11 @@ public: QShader(); QShader(const QShader &other); QShader &operator=(const QShader &other); + QShader(QShader &&other) noexcept : d(std::exchange(other.d, nullptr)) {} + QT_MOVE_ASSIGNMENT_OPERATOR_IMPL_VIA_PURE_SWAP(QShader) ~QShader(); + + void swap(QShader &other) noexcept { qt_ptr_swap(d, other.d); } void detach(); bool isValid() const;