Invert include dependencies between QList and QVector
This is a very slight source incompatibility, but required as a preparation for Qt 6, where QList should inherit QVector or share the implementation with it. This requires some special work to correctly instantiate and export QVector<QPoint> from Qt Core on MSVC. Change-Id: I1d042c5fafdde7afe59409eda2580871d4832fcd Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
This commit is contained in:
parent
4b1ce72c23
commit
972f8845a8
@ -47,6 +47,23 @@
|
|||||||
|
|
||||||
QT_BEGIN_NAMESPACE
|
QT_BEGIN_NAMESPACE
|
||||||
|
|
||||||
|
/*
|
||||||
|
### Qt 5:
|
||||||
|
### This needs to be removed for next releases of Qt. It is a workaround for vc++ because
|
||||||
|
### Qt exports QPolygon and QPolygonF that inherit QVector<QPoint> and
|
||||||
|
### QVector<QPointF> respectively.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#if defined(Q_CC_MSVC) && defined(QT_BUILD_CORE_LIB)
|
||||||
|
QT_BEGIN_INCLUDE_NAMESPACE
|
||||||
|
#include <QtCore/qpoint.h>
|
||||||
|
QT_END_INCLUDE_NAMESPACE
|
||||||
|
|
||||||
|
template class Q_CORE_EXPORT QVector<QPointF>;
|
||||||
|
template class Q_CORE_EXPORT QVector<QPoint>;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
QList as an array-list combines the easy-of-use of a random
|
QList as an array-list combines the easy-of-use of a random
|
||||||
access interface with fast list operations and the low memory
|
access interface with fast list operations and the low memory
|
||||||
|
@ -45,6 +45,7 @@
|
|||||||
#include <QtCore/qrefcount.h>
|
#include <QtCore/qrefcount.h>
|
||||||
#include <QtCore/qarraydata.h>
|
#include <QtCore/qarraydata.h>
|
||||||
#include <QtCore/qhashfunctions.h>
|
#include <QtCore/qhashfunctions.h>
|
||||||
|
#include <QtCore/qvector.h>
|
||||||
|
|
||||||
#include <iterator>
|
#include <iterator>
|
||||||
#include <list>
|
#include <list>
|
||||||
@ -1051,6 +1052,37 @@ inline int QList<T>::count_impl(const T &t, QListData::ArrayCompatibleLayout) co
|
|||||||
t));
|
t));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template <typename T>
|
||||||
|
Q_OUTOFLINE_TEMPLATE QVector<T> QList<T>::toVector() const
|
||||||
|
{
|
||||||
|
QVector<T> result(size());
|
||||||
|
for (int i = 0; i < size(); ++i)
|
||||||
|
result[i] = at(i);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
template <typename T>
|
||||||
|
QList<T> QList<T>::fromVector(const QVector<T> &vector)
|
||||||
|
{
|
||||||
|
return vector.toList();
|
||||||
|
}
|
||||||
|
|
||||||
|
template <typename T>
|
||||||
|
Q_OUTOFLINE_TEMPLATE QList<T> QVector<T>::toList() const
|
||||||
|
{
|
||||||
|
QList<T> result;
|
||||||
|
result.reserve(size());
|
||||||
|
for (int i = 0; i < size(); ++i)
|
||||||
|
result.append(at(i));
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
template <typename T>
|
||||||
|
QVector<T> QVector<T>::fromList(const QList<T> &list)
|
||||||
|
{
|
||||||
|
return list.toVector();
|
||||||
|
}
|
||||||
|
|
||||||
Q_DECLARE_SEQUENTIAL_ITERATOR(List)
|
Q_DECLARE_SEQUENTIAL_ITERATOR(List)
|
||||||
Q_DECLARE_MUTABLE_SEQUENTIAL_ITERATOR(List)
|
Q_DECLARE_MUTABLE_SEQUENTIAL_ITERATOR(List)
|
||||||
|
|
||||||
|
@ -42,7 +42,6 @@
|
|||||||
|
|
||||||
#include <QtCore/qalgorithms.h>
|
#include <QtCore/qalgorithms.h>
|
||||||
#include <QtCore/qiterator.h>
|
#include <QtCore/qiterator.h>
|
||||||
#include <QtCore/qlist.h>
|
|
||||||
#include <QtCore/qrefcount.h>
|
#include <QtCore/qrefcount.h>
|
||||||
#include <QtCore/qarraydata.h>
|
#include <QtCore/qarraydata.h>
|
||||||
#include <QtCore/qhashfunctions.h>
|
#include <QtCore/qhashfunctions.h>
|
||||||
@ -968,37 +967,6 @@ Q_OUTOFLINE_TEMPLATE QVector<T> QVector<T>::mid(int pos, int len) const
|
|||||||
return midResult;
|
return midResult;
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename T>
|
|
||||||
Q_OUTOFLINE_TEMPLATE QList<T> QVector<T>::toList() const
|
|
||||||
{
|
|
||||||
QList<T> result;
|
|
||||||
result.reserve(size());
|
|
||||||
for (int i = 0; i < size(); ++i)
|
|
||||||
result.append(at(i));
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
template <typename T>
|
|
||||||
Q_OUTOFLINE_TEMPLATE QVector<T> QList<T>::toVector() const
|
|
||||||
{
|
|
||||||
QVector<T> result(size());
|
|
||||||
for (int i = 0; i < size(); ++i)
|
|
||||||
result[i] = at(i);
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
template <typename T>
|
|
||||||
QVector<T> QVector<T>::fromList(const QList<T> &list)
|
|
||||||
{
|
|
||||||
return list.toVector();
|
|
||||||
}
|
|
||||||
|
|
||||||
template <typename T>
|
|
||||||
QList<T> QList<T>::fromVector(const QVector<T> &vector)
|
|
||||||
{
|
|
||||||
return vector.toList();
|
|
||||||
}
|
|
||||||
|
|
||||||
Q_DECLARE_SEQUENTIAL_ITERATOR(Vector)
|
Q_DECLARE_SEQUENTIAL_ITERATOR(Vector)
|
||||||
Q_DECLARE_MUTABLE_SEQUENTIAL_ITERATOR(Vector)
|
Q_DECLARE_MUTABLE_SEQUENTIAL_ITERATOR(Vector)
|
||||||
|
|
||||||
@ -1046,20 +1014,12 @@ inline bool operator>=(const QVector<T> &lhs, const QVector<T> &rhs)
|
|||||||
### QVector<QPointF> respectively.
|
### QVector<QPointF> respectively.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifdef Q_CC_MSVC
|
#if defined(Q_CC_MSVC) && !defined(QT_BUILD_CORE_LIB)
|
||||||
QT_BEGIN_INCLUDE_NAMESPACE
|
QT_BEGIN_INCLUDE_NAMESPACE
|
||||||
#include <QtCore/qpoint.h>
|
#include <QtCore/qpoint.h>
|
||||||
QT_END_INCLUDE_NAMESPACE
|
QT_END_INCLUDE_NAMESPACE
|
||||||
|
extern template class Q_CORE_EXPORT QVector<QPointF>;
|
||||||
#ifndef Q_TEMPLATE_EXTERN
|
extern template class Q_CORE_EXPORT QVector<QPoint>;
|
||||||
#if defined(QT_BUILD_CORE_LIB)
|
|
||||||
#define Q_TEMPLATE_EXTERN
|
|
||||||
#else
|
|
||||||
#define Q_TEMPLATE_EXTERN extern
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
Q_TEMPLATE_EXTERN template class Q_CORE_EXPORT QVector<QPointF>;
|
|
||||||
Q_TEMPLATE_EXTERN template class Q_CORE_EXPORT QVector<QPoint>;
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
QVector<uint> QStringView::toUcs4() const { return QtPrivate::convertToUcs4(*this); }
|
QVector<uint> QStringView::toUcs4() const { return QtPrivate::convertToUcs4(*this); }
|
||||||
|
Loading…
x
Reference in New Issue
Block a user