diff options
author | Lars Knoll <lars.knoll@qt.io> | 2019-05-06 14:00:53 +0200 |
---|---|---|
committer | Lars Knoll <lars.knoll@qt.io> | 2019-05-07 14:15:44 +0000 |
commit | 92f984273262531f909ede17a324f546fe502b5c (patch) | |
tree | ac4d4cb8796d9838607084629cf127e1641c28c0 /src/corelib/tools/qlist.h | |
parent | d510e1e7f919e01a3b875ff5a575b818e5ee03e8 (diff) |
Deprecate conversion functions between QList and QSet
Users should use range constructors instead to do the conversion.
Keep conversion methods between QList and QVector as these will turn
into a no-op in Qt 6, whereas forcing people to use range constructors
would lead to deep copies of the data.
Change-Id: Id9fc9e4d007044e019826da523e8418857c91283
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Diffstat (limited to 'src/corelib/tools/qlist.h')
-rw-r--r-- | src/corelib/tools/qlist.h | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/src/corelib/tools/qlist.h b/src/corelib/tools/qlist.h index 25380d45ec..04c1f12f5f 100644 --- a/src/corelib/tools/qlist.h +++ b/src/corelib/tools/qlist.h @@ -403,13 +403,15 @@ public: inline QList<T> &operator<<(const QList<T> &l) { *this += l; return *this; } + static QList<T> fromVector(const QVector<T> &vector); QVector<T> toVector() const; - QSet<T> toSet() const; - static QList<T> fromVector(const QVector<T> &vector); +#if QT_VERSION < QT_VERSION_CHECK(6,0,0) + Q_DECL_DEPRECATED_X("Use QList<T>(set.begin(), set.end()) instead.") static QList<T> fromSet(const QSet<T> &set); + Q_DECL_DEPRECATED_X("Use QSet<T>(list.begin(), list.end()) instead.") + QSet<T> toSet() const; -#if QT_VERSION < QT_VERSION_CHECK(6,0,0) Q_DECL_DEPRECATED_X("Use QList<T>(list.begin(), list.end()) instead.") static inline QList<T> fromStdList(const std::list<T> &list) { QList<T> tmp; std::copy(list.begin(), list.end(), std::back_inserter(tmp)); return tmp; } |