diff options
author | Christian Ehrlicher <ch.ehrlicher@gmx.de> | 2020-06-05 21:44:10 +0200 |
---|---|---|
committer | Christian Ehrlicher <ch.ehrlicher@gmx.de> | 2020-06-07 19:02:47 +0200 |
commit | e0fc998e87dcf4acfb06cc5ff840498e4cbc3f6b (patch) | |
tree | 85d24a318fefbf31a20e16b0621eda7f659499db /src/corelib | |
parent | 50ccd35fbdc1bd890f577616ee306573999cddb5 (diff) |
ItemModels: remove deprecated functions
Change-Id: Id3430493a62b11977f64e146f7668ca30935b959
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Diffstat (limited to 'src/corelib')
-rw-r--r-- | src/corelib/itemmodels/qabstractitemmodel.cpp | 91 | ||||
-rw-r--r-- | src/corelib/itemmodels/qabstractitemmodel.h | 34 | ||||
-rw-r--r-- | src/corelib/itemmodels/qabstractitemmodel_p.h | 2 | ||||
-rw-r--r-- | src/corelib/itemmodels/qabstractproxymodel.cpp | 2 | ||||
-rw-r--r-- | src/corelib/itemmodels/qabstractproxymodel.h | 2 |
5 files changed, 2 insertions, 129 deletions
diff --git a/src/corelib/itemmodels/qabstractitemmodel.cpp b/src/corelib/itemmodels/qabstractitemmodel.cpp index 95bfb109eb..5c6cc7b587 100644 --- a/src/corelib/itemmodels/qabstractitemmodel.cpp +++ b/src/corelib/itemmodels/qabstractitemmodel.cpp @@ -410,26 +410,6 @@ QModelIndex QPersistentModelIndex::sibling(int row, int column) const return QModelIndex(); } -#if QT_DEPRECATED_SINCE(5, 8) -/*! - \obsolete - - Use QAbstractItemModel::index() instead. - - Returns the child of the model index that is stored in the given \a row - and \a column. - - \sa parent(), sibling() -*/ - -QModelIndex QPersistentModelIndex::child(int row, int column) const -{ - if (d) - return d->index.model()->index(row, column, d->index); - return QModelIndex(); -} -#endif - /*! Returns the data for the given \a role for the item referred to by the index. @@ -517,8 +497,7 @@ Q_GLOBAL_STATIC(QEmptyItemModel, qEmptyModel) QAbstractItemModelPrivate::QAbstractItemModelPrivate() - : QObjectPrivate(), - supportedDragActions(-1) + : QObjectPrivate() { } @@ -1149,22 +1128,6 @@ void QAbstractItemModel::resetInternalData() */ /*! - \fn QModelIndex QModelIndex::child(int row, int column) const - - \obsolete - - Use QAbstractItemModel::index() instead. - - Returns the child of the model index that is stored in the given \a row and - \a column. - - \note This function does not work for an invalid model index which is often - used as the root index. - - \sa parent(), sibling() -*/ - -/*! \fn QVariant QModelIndex::data(int role) const Returns the data for the given \a role for the item referred to by the @@ -1885,7 +1848,6 @@ bool QAbstractItemModel::setData(const QModelIndex &index, const QVariant &value return false; } -#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) /*! \since 6.0 Removes the data stored in all the roles for the given \a index. @@ -1900,7 +1862,6 @@ bool QAbstractItemModel::clearItemData(const QModelIndex &index) Q_UNUSED(index); return false; } -#endif /*! \fn QVariant QAbstractItemModel::data(const QModelIndex &index, int role) const = 0 @@ -2107,34 +2068,10 @@ Qt::DropActions QAbstractItemModel::supportedDropActions() const */ Qt::DropActions QAbstractItemModel::supportedDragActions() const { - Q_D(const QAbstractItemModel); - if (int(d->supportedDragActions) != -1) - return d->supportedDragActions; return supportedDropActions(); } /*! - \internal - */ -void QAbstractItemModel::doSetSupportedDragActions(Qt::DropActions actions) -{ - Q_D(QAbstractItemModel); - d->supportedDragActions = actions; -} - -/*! - \since 4.2 - \obsolete - \fn void QAbstractItemModel::setSupportedDragActions(Qt::DropActions actions) - - This function is obsolete. Reimplement supportedDragActions() instead. - - Sets the supported drag \a actions for the items in the model. - - \sa supportedDragActions(), {Using drag and drop with item views} -*/ - -/*! \note The base class implementation of this function does nothing and returns \c{false}. @@ -3233,28 +3170,6 @@ void QAbstractItemModel::endMoveColumns() } /*! - \fn void QAbstractItemModel::reset() - \obsolete - - Resets the model to its original state in any attached views. - - This function emits the signals modelAboutToBeReset() and modelReset(). - - \note Use beginResetModel() and endResetModel() instead whenever possible. - Use this method only if there is no way to call beginResetModel() before invalidating the model. - Otherwise it could lead to unexpected behaviour, especially when used with proxy models. - - For example, in this code both signals modelAboutToBeReset() and modelReset() - are emitted \e after the data changes: - - \snippet code/src_corelib_kernel_qabstractitemmodel.cpp 10 - - Instead you should use: - - \snippet code/src_corelib_kernel_qabstractitemmodel.cpp 11 -*/ - -/*! Begins a model reset operation. A reset operation resets the model to its current state in any attached views. @@ -3297,11 +3212,7 @@ void QAbstractItemModel::endResetModel() { Q_D(QAbstractItemModel); d->invalidatePersistentIndexes(); -#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) resetInternalData(); -#else - QMetaObject::invokeMethod(this, "resetInternalData"); -#endif emit modelReset(QPrivateSignal()); } diff --git a/src/corelib/itemmodels/qabstractitemmodel.h b/src/corelib/itemmodels/qabstractitemmodel.h index ff413c7542..ddebf835c8 100644 --- a/src/corelib/itemmodels/qabstractitemmodel.h +++ b/src/corelib/itemmodels/qabstractitemmodel.h @@ -68,9 +68,6 @@ public: inline QModelIndex sibling(int row, int column) const; inline QModelIndex siblingAtColumn(int column) const; inline QModelIndex siblingAtRow(int row) const; -#if QT_DEPRECATED_SINCE(5, 8) - QT_DEPRECATED_X("Use QAbstractItemModel::index") inline QModelIndex child(int row, int column) const; -#endif inline QVariant data(int role = Qt::DisplayRole) const; inline Qt::ItemFlags flags() const; Q_DECL_CONSTEXPR inline const QAbstractItemModel *model() const noexcept { return m; } @@ -134,9 +131,6 @@ public: quintptr internalId() const; QModelIndex parent() const; QModelIndex sibling(int row, int column) const; -#if QT_DEPRECATED_SINCE(5, 8) - QT_DEPRECATED_X("Use QAbstractItemModel::index") QModelIndex child(int row, int column) const; -#endif QVariant data(int role = Qt::DisplayRole) const; Qt::ItemFlags flags() const; const QAbstractItemModel *model() const; @@ -199,9 +193,7 @@ public: virtual QMap<int, QVariant> itemData(const QModelIndex &index) const; virtual bool setItemData(const QModelIndex &index, const QMap<int, QVariant> &roles); -#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) virtual bool clearItemData(const QModelIndex &index); -#endif virtual QStringList mimeTypes() const; virtual QMimeData *mimeData(const QModelIndexList &indexes) const; @@ -210,12 +202,7 @@ public: virtual bool dropMimeData(const QMimeData *data, Qt::DropAction action, int row, int column, const QModelIndex &parent); virtual Qt::DropActions supportedDropActions() const; - virtual Qt::DropActions supportedDragActions() const; -#if QT_DEPRECATED_SINCE(5, 0) - QT_DEPRECATED void setSupportedDragActions(Qt::DropActions actions) - { doSetSupportedDragActions(actions); } -#endif virtual bool insertRows(int row, int count, const QModelIndex &parent = QModelIndex()); virtual bool insertColumns(int column, int count, const QModelIndex &parent = QModelIndex()); @@ -301,10 +288,7 @@ public Q_SLOTS: virtual void revert(); protected Q_SLOTS: -#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) - virtual -#endif - void resetInternalData(); + virtual void resetInternalData(); protected: QAbstractItemModel(QAbstractItemModelPrivate &dd, QObject *parent = nullptr); @@ -333,15 +317,6 @@ protected: bool beginMoveColumns(const QModelIndex &sourceParent, int sourceFirst, int sourceLast, const QModelIndex &destinationParent, int destinationColumn); void endMoveColumns(); - -#if QT_DEPRECATED_SINCE(5,0) - QT_DEPRECATED void reset() - { - beginResetModel(); - endResetModel(); - } -#endif - void beginResetModel(); void endResetModel(); @@ -350,8 +325,6 @@ protected: QModelIndexList persistentIndexList() const; private: - void doSetSupportedDragActions(Qt::DropActions actions); - Q_DECLARE_PRIVATE(QAbstractItemModel) Q_DISABLE_COPY(QAbstractItemModel) }; @@ -444,11 +417,6 @@ inline QModelIndex QModelIndex::siblingAtColumn(int acolumn) const inline QModelIndex QModelIndex::siblingAtRow(int arow) const { return m ? (r == arow) ? *this : m->sibling(arow, c, *this) : QModelIndex(); } -#if QT_DEPRECATED_SINCE(5, 8) -inline QModelIndex QModelIndex::child(int arow, int acolumn) const -{ return m ? m->index(arow, acolumn, *this) : QModelIndex(); } -#endif - inline QVariant QModelIndex::data(int arole) const { return m ? m->data(*this, arole) : QVariant(); } diff --git a/src/corelib/itemmodels/qabstractitemmodel_p.h b/src/corelib/itemmodels/qabstractitemmodel_p.h index e7d68ef3c4..fca5f76200 100644 --- a/src/corelib/itemmodels/qabstractitemmodel_p.h +++ b/src/corelib/itemmodels/qabstractitemmodel_p.h @@ -147,8 +147,6 @@ public: void insertMultiAtEnd(const QModelIndex& key, QPersistentModelIndexData *data); } persistent; - Qt::DropActions supportedDragActions; - static const QHash<int,QByteArray> &defaultRoleNames(); static bool isVariantLessThan(const QVariant &left, const QVariant &right, Qt::CaseSensitivity cs = Qt::CaseSensitive, bool isLocaleAware = false); diff --git a/src/corelib/itemmodels/qabstractproxymodel.cpp b/src/corelib/itemmodels/qabstractproxymodel.cpp index 90b2d1f6bf..e5d8c68e72 100644 --- a/src/corelib/itemmodels/qabstractproxymodel.cpp +++ b/src/corelib/itemmodels/qabstractproxymodel.cpp @@ -303,7 +303,6 @@ bool QAbstractProxyModel::setHeaderData(int section, Qt::Orientation orientation return d->model->setHeaderData(sourceSection, orientation, value, role); } -#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) /*! \reimp \since 6.0 @@ -313,7 +312,6 @@ bool QAbstractProxyModel::clearItemData(const QModelIndex &index) Q_D(QAbstractProxyModel); return d->model->clearItemData(mapToSource(index)); } -#endif /*! \reimp diff --git a/src/corelib/itemmodels/qabstractproxymodel.h b/src/corelib/itemmodels/qabstractproxymodel.h index 8eef0551ca..ef4feb5564 100644 --- a/src/corelib/itemmodels/qabstractproxymodel.h +++ b/src/corelib/itemmodels/qabstractproxymodel.h @@ -78,9 +78,7 @@ public: bool setData(const QModelIndex &index, const QVariant &value, int role = Qt::EditRole) override; bool setItemData(const QModelIndex& index, const QMap<int, QVariant> &roles) override; bool setHeaderData(int section, Qt::Orientation orientation, const QVariant &value, int role = Qt::EditRole) override; -#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) bool clearItemData(const QModelIndex &index) override; -#endif QModelIndex buddy(const QModelIndex &index) const override; bool canFetchMore(const QModelIndex &parent) const override; |