diff options
author | Thiago Macieira <thiago.macieira@intel.com> | 2016-12-16 12:48:18 -0800 |
---|---|---|
committer | Jani Heikkinen <jani.heikkinen@qt.io> | 2017-01-03 15:01:32 +0000 |
commit | 39e80062d0cf0c25b456bd89be827e50a6077efa (patch) | |
tree | 9030b766fdf474239af57c2c9f2be39fe819117a /src | |
parent | f55db6738bb5a14ba6ebcfe840225fe9d2ae98c2 (diff) |
Work around MSVC ABI stupidity in exporting inline members of base class
In this case, the issue was ICC, when compiling QtQml:
qv4sequenceobject.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: void __cdecl QList<class QItemSelectionRange>::replace(int,class QItemSelectionRange const &)" (__imp_?replace@?$QList@VQItemSelectionRange@@@@QEAAXHAEBVQItemSelectionRange@@@Z)
referenced in function "public: static bool __cdecl QV4::QQmlSequence<class QItemSelection>::deleteIndexedProperty(struct QV4::Managed *,unsigned int)" (?deleteIndexedProperty@?$QQmlSequence@VQItemSelection@@@QV4@@SA_NPEAUManaged@2@I@Z)
This applies the same fix as qvector.h has had for ages due to QPolygon.
Change-Id: I15b62e0f9cec482fbb40fffd1490d791db5056bc
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Diffstat (limited to 'src')
-rw-r--r-- | src/corelib/itemmodels/qitemselectionmodel.h | 18 | ||||
-rw-r--r-- | src/corelib/tools/qvector.h | 2 |
2 files changed, 20 insertions, 0 deletions
diff --git a/src/corelib/itemmodels/qitemselectionmodel.h b/src/corelib/itemmodels/qitemselectionmodel.h index 3d3cb00750..c22ac6dbe5 100644 --- a/src/corelib/itemmodels/qitemselectionmodel.h +++ b/src/corelib/itemmodels/qitemselectionmodel.h @@ -251,6 +251,24 @@ Q_DECLARE_OPERATORS_FOR_FLAGS(QItemSelectionModel::SelectionFlags) // dummy implentation of qHash() necessary for instantiating QList<QItemSelectionRange>::toSet() with MSVC inline uint qHash(const QItemSelectionRange &) { return 0; } +#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> { public: diff --git a/src/corelib/tools/qvector.h b/src/corelib/tools/qvector.h index 4dbf95c315..5225b68d40 100644 --- a/src/corelib/tools/qvector.h +++ b/src/corelib/tools/qvector.h @@ -982,11 +982,13 @@ QT_BEGIN_INCLUDE_NAMESPACE #include <QtCore/qpoint.h> QT_END_INCLUDE_NAMESPACE +#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 QVector<QPointF>; Q_TEMPLATE_EXTERN template class Q_CORE_EXPORT QVector<QPoint>; #endif |