diff options
author | Sona Kurazyan <sona.kurazyan@qt.io> | 2020-02-03 11:50:57 +0100 |
---|---|---|
committer | Sona Kurazyan <sona.kurazyan@qt.io> | 2020-02-04 20:01:18 +0100 |
commit | a20dbcf7c77c9bc92cce87eed7bada4ab202f2af (patch) | |
tree | c71211e00b0c55ddead7e4ef7c7db016e92e03f2 /src/corelib/tools | |
parent | f8e39a66569b27bb45cc7a49508dba29038122a4 (diff) |
Deprecate QLinkedList
[ChangeLog][Deprecation Notice] QLinkedList is deprecated and will be
moved to Qt5Compat in Qt 6. It is recommended to use std::list instead.
Task-number: QTBUG-81630
Task-number: QTBUG-80312
Change-Id: I2c2b64e51d1cc2fd305aee6a11e9a89788f51eb4
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Diffstat (limited to 'src/corelib/tools')
-rw-r--r-- | src/corelib/tools/qcontainerfwd.h | 2 | ||||
-rw-r--r-- | src/corelib/tools/qiterator.qdoc | 2 | ||||
-rw-r--r-- | src/corelib/tools/qlinkedlist.cpp | 14 | ||||
-rw-r--r-- | src/corelib/tools/qlinkedlist.h | 24 |
4 files changed, 37 insertions, 5 deletions
diff --git a/src/corelib/tools/qcontainerfwd.h b/src/corelib/tools/qcontainerfwd.h index 532b4c95ce..00a8c85b66 100644 --- a/src/corelib/tools/qcontainerfwd.h +++ b/src/corelib/tools/qcontainerfwd.h @@ -47,7 +47,7 @@ QT_BEGIN_NAMESPACE template <class Key, class T> class QCache; template <class Key, class T> class QHash; -#ifndef QT_NO_LINKED_LIST +#if !defined(QT_NO_LINKED_LIST) && QT_DEPRECATED_SINCE(5, 15) template <class T> class QLinkedList; #endif template <class T> class QList; diff --git a/src/corelib/tools/qiterator.qdoc b/src/corelib/tools/qiterator.qdoc index b4d332b7b1..3531fb202c 100644 --- a/src/corelib/tools/qiterator.qdoc +++ b/src/corelib/tools/qiterator.qdoc @@ -203,6 +203,7 @@ /*! \class QLinkedListIterator \inmodule QtCore + \obsolete \brief The QLinkedListIterator class provides a Java-style const iterator for QLinkedList. @@ -416,6 +417,7 @@ /*! \class QMutableLinkedListIterator \inmodule QtCore + \obsolete \brief The QMutableLinkedListIterator class provides a Java-style non-const iterator for QLinkedList. diff --git a/src/corelib/tools/qlinkedlist.cpp b/src/corelib/tools/qlinkedlist.cpp index 3b1bc8aab1..6a423545da 100644 --- a/src/corelib/tools/qlinkedlist.cpp +++ b/src/corelib/tools/qlinkedlist.cpp @@ -45,6 +45,11 @@ QT_BEGIN_NAMESPACE +#if QT_DEPRECATED_SINCE(5, 15) + +QT_WARNING_PUSH +QT_WARNING_DISABLE_DEPRECATED + const QLinkedListData QLinkedListData::shared_null = { const_cast<QLinkedListData *>(&QLinkedListData::shared_null), const_cast<QLinkedListData *>(&QLinkedListData::shared_null), @@ -53,6 +58,7 @@ const QLinkedListData QLinkedListData::shared_null = { /*! \class QLinkedList \inmodule QtCore + \obsolete \brief The QLinkedList class is a template class that provides linked lists. \ingroup tools @@ -60,6 +66,8 @@ const QLinkedListData QLinkedListData::shared_null = { \reentrant + \note This class is obsolete, please use std::list instead. + QLinkedList\<T\> is one of Qt's generic \l{container classes}. It stores a list of values and provides iterator-based access as well as \l{constant time} insertions and removals. @@ -720,6 +728,7 @@ const QLinkedListData QLinkedListData::shared_null = { /*! \class QLinkedList::iterator \inmodule QtCore + \obsolete \brief The QLinkedList::iterator class provides an STL-style non-const iterator for QLinkedList. QLinkedList features both \l{STL-style iterators} and @@ -965,6 +974,7 @@ const QLinkedListData QLinkedListData::shared_null = { /*! \class QLinkedList::const_iterator \inmodule QtCore + \obsolete \brief The QLinkedList::const_iterator class provides an STL-style const iterator for QLinkedList. QLinkedList features both \l{STL-style iterators} and @@ -1221,4 +1231,8 @@ const QLinkedListData QLinkedListData::shared_null = { \sa fromStdList() */ +QT_WARNING_POP + +#endif // QT_DEPRECATED_SINCE(5, 15) + QT_END_NAMESPACE diff --git a/src/corelib/tools/qlinkedlist.h b/src/corelib/tools/qlinkedlist.h index 8970d39be0..64c6b4d326 100644 --- a/src/corelib/tools/qlinkedlist.h +++ b/src/corelib/tools/qlinkedlist.h @@ -55,10 +55,22 @@ #include <iterator> #include <list> -QT_BEGIN_NAMESPACE +#if 0 +// This is needed because of QTBUG-80347 +#pragma qt_class(QLinkedList) +#pragma qt_class(QLinkedListData) +#pragma qt_class(QLinkedListNode) +#endif + +#if QT_DEPRECATED_SINCE(5, 15) + +QT_WARNING_PUSH +QT_WARNING_DISABLE_DEPRECATED -struct Q_CORE_EXPORT QLinkedListData +QT_BEGIN_NAMESPACE + +struct QT_DEPRECATED_VERSION_5_15 Q_CORE_EXPORT QLinkedListData { QLinkedListData *n, *p; QtPrivate::RefCount ref; @@ -69,7 +81,7 @@ struct Q_CORE_EXPORT QLinkedListData }; template <typename T> -struct QLinkedListNode +struct QT_DEPRECATED_VERSION_5_15 QLinkedListNode { inline QLinkedListNode(const T &arg): t(arg) { } QLinkedListNode *n, *p; @@ -77,7 +89,7 @@ struct QLinkedListNode }; template <class T> -class QLinkedList +class QT_DEPRECATED_VERSION_X_5_15("Use std::list instead") QLinkedList { typedef QLinkedListNode<T> Node; union { QLinkedListData *d; QLinkedListNode<T> *e; }; @@ -594,6 +606,10 @@ QT_END_NAMESPACE Q_DECLARE_SEQUENTIAL_CONTAINER_METATYPE(QLinkedList) +QT_WARNING_POP + +#endif // QT_DEPRECATED_SINCE(5, 15) + #endif // QT_NO_LINKED_LIST #endif // QLINKEDLIST_H |