summaryrefslogtreecommitdiffstats
path: root/src/corelib/itemmodels/qitemselectionmodel.h
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/itemmodels/qitemselectionmodel.h
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/itemmodels/qitemselectionmodel.h')
-rw-r--r--src/corelib/itemmodels/qitemselectionmodel.h34
1 files changed, 9 insertions, 25 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);
};