summaryrefslogtreecommitdiffstats
path: root/src/corelib
diff options
context:
space:
mode:
authorThiago Macieira <thiago.macieira@intel.com>2017-10-11 09:47:32 -0700
committerThiago Macieira <thiago.macieira@intel.com>2020-08-05 21:51:24 -0700
commit9f4c9529f609d947e2884af527208ac4c76a12d6 (patch)
tree420ebddacc4436a0546049bd41ef6770aba88c4e /src/corelib
parente80767d1fc45cfca96694937289712f0278f4945 (diff)
MSVC: remove the extern template
The problem was that QtCore exported those classes deriving from containers, which caused applications to try and import those same functions from QtCore, depending on whether they saw the #include or not. Now we don't need the hack anymore. Change-Id: I0a103569c81b4711a649fffd14ec9282454a1fdc Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Diffstat (limited to 'src/corelib')
-rw-r--r--src/corelib/itemmodels/qitemselectionmodel.h34
-rw-r--r--src/corelib/serialization/qxmlstream.h18
-rw-r--r--src/corelib/tools/qlist.h15
3 files changed, 19 insertions, 48 deletions
diff --git a/src/corelib/itemmodels/qitemselectionmodel.h b/src/corelib/itemmodels/qitemselectionmodel.h
index f735bf85a8..cf6b004f7e 100644
--- a/src/corelib/itemmodels/qitemselectionmodel.h
+++ b/src/corelib/itemmodels/qitemselectionmodel.h
@@ -207,37 +207,21 @@ private:
Q_DECLARE_OPERATORS_FOR_FLAGS(QItemSelectionModel::SelectionFlags)
-#ifdef Q_CC_MSVC
-
-/*
- ### Qt 6:
- ### This needs to be removed for next releases of Qt. It is a workaround for vc++ because
- ### Qt exports QItemSelection that inherits QList<QItemSelectionRange>.
-*/
-
-# ifndef Q_TEMPLATE_EXTERN
-# 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 QList<QItemSelectionRange>;
-#endif // Q_CC_MSVC
-
-class Q_CORE_EXPORT QItemSelection : public QList<QItemSelectionRange>
+// We export each out-of-line method invidually to prevent MSVC from
+// exporting the whole QList class.
+class QItemSelection : public QList<QItemSelectionRange>
{
public:
QItemSelection() noexcept : QList<QItemSelectionRange>() {}
- QItemSelection(const QModelIndex &topLeft, const QModelIndex &bottomRight);
+ Q_CORE_EXPORT QItemSelection(const QModelIndex &topLeft, const QModelIndex &bottomRight);
// reusing QList::swap() here is OK!
- void select(const QModelIndex &topLeft, const QModelIndex &bottomRight);
- bool contains(const QModelIndex &index) const;
- QModelIndexList indexes() const;
- void merge(const QItemSelection &other, QItemSelectionModel::SelectionFlags command);
- static void split(const QItemSelectionRange &range,
+ Q_CORE_EXPORT void select(const QModelIndex &topLeft, const QModelIndex &bottomRight);
+ Q_CORE_EXPORT bool contains(const QModelIndex &index) const;
+ Q_CORE_EXPORT QModelIndexList indexes() const;
+ Q_CORE_EXPORT void merge(const QItemSelection &other, QItemSelectionModel::SelectionFlags command);
+ Q_CORE_EXPORT static void split(const QItemSelectionRange &range,
const QItemSelectionRange &other,
QItemSelection *result);
};
diff --git a/src/corelib/serialization/qxmlstream.h b/src/corelib/serialization/qxmlstream.h
index e197a0f999..31c605c981 100644
--- a/src/corelib/serialization/qxmlstream.h
+++ b/src/corelib/serialization/qxmlstream.h
@@ -110,17 +110,19 @@ public:
Q_DECLARE_TYPEINFO(QXmlStreamAttribute, Q_MOVABLE_TYPE);
-class Q_CORE_EXPORT QXmlStreamAttributes : public QList<QXmlStreamAttribute>
+// We export each out-of-line method invidually to prevent MSVC from
+// exporting the whole QList class.
+class QXmlStreamAttributes : public QList<QXmlStreamAttribute>
{
public:
inline QXmlStreamAttributes() {}
- QStringRef value(const QString &namespaceUri, const QString &name) const;
- QStringRef value(const QString &namespaceUri, QLatin1String name) const;
- QStringRef value(QLatin1String namespaceUri, QLatin1String name) const;
- QStringRef value(const QString &qualifiedName) const;
- QStringRef value(QLatin1String qualifiedName) const;
- void append(const QString &namespaceUri, const QString &name, const QString &value);
- void append(const QString &qualifiedName, const QString &value);
+ Q_CORE_EXPORT QStringRef value(const QString &namespaceUri, const QString &name) const;
+ Q_CORE_EXPORT QStringRef value(const QString &namespaceUri, QLatin1String name) const;
+ Q_CORE_EXPORT QStringRef value(QLatin1String namespaceUri, QLatin1String name) const;
+ Q_CORE_EXPORT QStringRef value(const QString &qualifiedName) const;
+ Q_CORE_EXPORT QStringRef value(QLatin1String qualifiedName) const;
+ Q_CORE_EXPORT void append(const QString &namespaceUri, const QString &name, const QString &value);
+ Q_CORE_EXPORT void append(const QString &qualifiedName, const QString &value);
inline bool hasAttribute(const QString &qualifiedName) const
{
diff --git a/src/corelib/tools/qlist.h b/src/corelib/tools/qlist.h
index 35dc286191..fad61bf8e6 100644
--- a/src/corelib/tools/qlist.h
+++ b/src/corelib/tools/qlist.h
@@ -832,21 +832,6 @@ auto operator>=(const QList<T> &lhs, const QList<T> &rhs)
return !(lhs < rhs);
}
-/*
- ### 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 QList<QPoint> and
- ### QList<QPointF> respectively.
-*/
-
-#if defined(Q_CC_MSVC) && !defined(QT_BUILD_CORE_LIB)
-QT_BEGIN_INCLUDE_NAMESPACE
-#include <QtCore/qpoint.h>
-QT_END_INCLUDE_NAMESPACE
-extern template class Q_CORE_EXPORT QList<QPointF>;
-extern template class Q_CORE_EXPORT QList<QPoint>;
-#endif
-
QList<uint> QStringView::toUcs4() const { return QtPrivate::convertToUcs4(*this); }
QT_END_NAMESPACE