QDirListing: make the class move-only

Define both move SMF out-of-line, otherwise MSVC complains that the
private class isn't fully defined at the point of destruction of
std::unique_ptr<QDirListingPrivate>.

Both move SMF are = default'ed; GCC didn't show a warning about this
issue... different implementations, I guess.

"partially-formed" docs boilerplate borrowed from other existing
classes.

Found in API review.

Task-number: QTBUG-125859
Change-Id: I98b57a14bd94e407d9bfafa9ef32cf40c978d7df
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 4e32a45d492fb057cc996efc6791030f3dd525d5)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
Ahmad Samir 2024-06-07 03:22:27 +03:00 committed by Qt Cherry-pick Bot
parent d69e73b9f9
commit 3242676cd0
2 changed files with 21 additions and 0 deletions

View File

@ -479,6 +479,24 @@ QDirListing::QDirListing(const QString &path, const QStringList &nameFilters, QD
d->init(); d->init();
} }
/*!
Move constructor. Moves \a other into this QDirListing.
//! [partially-formed]
\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.
//! [partially-formed]
*/
QDirListing::QDirListing(QDirListing &&other) = default;
/*!
Move-assigns \a other to this QDirListing.
\include qdirlisting.cpp partially-formed
*/
QDirListing &QDirListing::operator=(QDirListing &&other) = default;
/*! /*!
Destroys the QDirListing. Destroys the QDirListing.
*/ */

View File

@ -32,6 +32,9 @@ public:
QDir::Filters filters = QDir::NoFilter, QDir::Filters filters = QDir::NoFilter,
IteratorFlags flags = IteratorFlag::NoFlag); IteratorFlags flags = IteratorFlag::NoFlag);
QDirListing(QDirListing &&);
QDirListing &operator=(QDirListing &&);
~QDirListing(); ~QDirListing();
QString iteratorPath() const; QString iteratorPath() const;