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>
bb10
Sona Kurazyan 2020-02-03 11:50:57 +01:00
parent f8e39a6656
commit a20dbcf7c7
4 changed files with 37 additions and 5 deletions

View File

@ -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;

View File

@ -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.

View File

@ -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

View File

@ -55,10 +55,22 @@
#include <iterator>
#include <list>
#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
QT_BEGIN_NAMESPACE
struct Q_CORE_EXPORT QLinkedListData
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