From eb0e960e74da6b799c4d8f95cb6a22412c4c9466 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Thu, 16 Aug 2012 14:55:29 +0200 Subject: [PATCH] Fix the doc errors in itemmodels and itemviews. Other errors remain, but they appear to be due to missing links to QtCore documentation (a generic error not specific to itemviews). Change-Id: I7b83380c3754c26d3d42be9ef0c0721ce3127562 Reviewed-by: Shawn Rutledge Reviewed-by: Stephen Kelly --- src/corelib/itemmodels/qabstractitemmodel.cpp | 36 ++++++++++++++++++++++--- src/corelib/itemmodels/qabstractproxymodel.cpp | 6 +++++ src/corelib/itemmodels/qitemselectionmodel.cpp | 12 +++++++++ src/widgets/itemviews/qabstractitemdelegate.cpp | 5 ++-- src/widgets/itemviews/qabstractitemview.cpp | 6 ++++- src/widgets/itemviews/qdirmodel.cpp | 2 ++ src/widgets/itemviews/qheaderview.cpp | 6 ++--- 7 files changed, 64 insertions(+), 9 deletions(-) diff --git a/src/corelib/itemmodels/qabstractitemmodel.cpp b/src/corelib/itemmodels/qabstractitemmodel.cpp index 9a63038..4b82b2b 100644 --- a/src/corelib/itemmodels/qabstractitemmodel.cpp +++ b/src/corelib/itemmodels/qabstractitemmodel.cpp @@ -1276,6 +1276,31 @@ void QAbstractItemModelPrivate::columnsRemoved(const QModelIndex &parent, */ /*! + \fn bool QAbstractItemModel::moveRow(const QModelIndex &sourceParent, int sourceColumn, const QModelIndex &destinationParent, int destinationChild) + + On models that support this, moves \a sourceColumn from \a sourceParent to \a destinationChild under + \a destinationParent. + + Returns true if the columns were successfully moved; otherwise returns + false. + + \sa moveRows(), moveColumn() +*/ + +/*! + \fn bool QAbstractItemModel::moveColumn(const QModelIndex &sourceParent, int sourceColumn, const QModelIndex &destinationParent, int destinationChild) + + On models that support this, moves \a sourceColumn from \a sourceParent to \a destinationChild under + \a destinationParent. + + Returns true if the columns were successfully moved; otherwise returns + false. + + \sa moveColumns(), moveRow() +*/ + + +/*! \fn void QAbstractItemModel::headerDataChanged(Qt::Orientation orientation, int first, int last) This signal is emitted whenever a header is changed. The \a orientation @@ -1303,7 +1328,7 @@ void QAbstractItemModelPrivate::columnsRemoved(const QModelIndex &parent, Subclasses should update any persistent model indexes after emitting layoutAboutToBeChanged(). - The optional @p parents parameter is used to give a more specific notification + The optional \a parents parameter is used to give a more specific notification about what parts of the layout of the model are changing. An empty list indicates a change to the layout of the entire model. @@ -1323,7 +1348,7 @@ void QAbstractItemModelPrivate::columnsRemoved(const QModelIndex &parent, altering the structure of the data you expose to views, and emit layoutChanged() after changing the layout. - The optional @p parents parameter is used to give a more specific notification + The optional \a parents parameter is used to give a more specific notification about what parts of the layout of the model are changing. An empty list indicates a change to the layout of the entire model. @@ -1746,7 +1771,8 @@ QMimeData *QAbstractItemModel::mimeData(const QModelIndexList &indexes) const This can be used to indicate whether a drop of certain data is allowed, for example by using a 'forbidden' emblem on a mouse cursor during a drag operation. - This method returns true by default. + This method returns true by default. Reimplementations can return whether the + \a data can be dropped at \a row, \a column, \a parent with \a action. \sa dropMimeData(), {Using drag and drop with item views} */ @@ -3501,6 +3527,10 @@ bool QAbstractListModel::dropMimeData(const QMimeData *data, Qt::DropAction acti Returns true if this model index is smaller than the \a other model index; otherwise returns false. + + The less than calculation is not directly useful to developers - the way that indexes + with different parents compare is not defined. This operator only exists so that the + class can be used with QMap. */ /*! diff --git a/src/corelib/itemmodels/qabstractproxymodel.cpp b/src/corelib/itemmodels/qabstractproxymodel.cpp index 063bb0d..61ad3b0 100644 --- a/src/corelib/itemmodels/qabstractproxymodel.cpp +++ b/src/corelib/itemmodels/qabstractproxymodel.cpp @@ -82,6 +82,12 @@ QT_BEGIN_NAMESPACE \sa QSortFilterProxyModel, QAbstractItemModel, {Model/View Programming} */ +/*! + \property QAbstractProxyModel::sourceModel + + \brief the source model this proxy model. +*/ + //detects the deletion of the source model void QAbstractProxyModelPrivate::_q_sourceModelDestroyed() { diff --git a/src/corelib/itemmodels/qitemselectionmodel.cpp b/src/corelib/itemmodels/qitemselectionmodel.cpp index a7aa404..f5bfff0 100644 --- a/src/corelib/itemmodels/qitemselectionmodel.cpp +++ b/src/corelib/itemmodels/qitemselectionmodel.cpp @@ -266,6 +266,18 @@ QItemSelectionRange QItemSelectionRange::intersected(const QItemSelectionRange & */ /*! + \fn bool QItemSelectionRange::operator<(const QItemSelectionRange &other) const + + Returns true if the selection range is less than the \a other + range given; otherwise returns false. + + The less than calculation is not directly useful to developers - the way that ranges + with different parents compare is not defined. This operator only exists so that the + class can be used with QMap. + +*/ + +/*! \fn bool QItemSelectionRange::isValid() const Returns true if the selection range is valid; otherwise returns false. diff --git a/src/widgets/itemviews/qabstractitemdelegate.cpp b/src/widgets/itemviews/qabstractitemdelegate.cpp index 92cf0b0..6c02147 100644 --- a/src/widgets/itemviews/qabstractitemdelegate.cpp +++ b/src/widgets/itemviews/qabstractitemdelegate.cpp @@ -245,14 +245,15 @@ QWidget *QAbstractItemDelegate::createEditor(QWidget *, /*! \since 5.0 - A function called when the editor is no longer needed and should be + A function called when the \a editor is no longer needed for \a index and should be destroyed. The default behavior is a call to deleteLater on the editor. It possible e.g. to avoid this delete by reimplementing this function. \sa createEditor() */ -void QAbstractItemDelegate::destroyEditor(QWidget *editor, const QModelIndex &) const +void QAbstractItemDelegate::destroyEditor(QWidget *editor, const QModelIndex &index) const { + Q_UNUSED(index); editor->deleteLater(); } diff --git a/src/widgets/itemviews/qabstractitemview.cpp b/src/widgets/itemviews/qabstractitemview.cpp index 929f7db..3402b4f 100644 --- a/src/widgets/itemviews/qabstractitemview.cpp +++ b/src/widgets/itemviews/qabstractitemview.cpp @@ -3222,9 +3222,13 @@ void QAbstractItemView::update(const QModelIndex &index) changed items are those from \a topLeft to \a bottomRight inclusive. If just one item is changed \a topLeft == \a bottomRight. + + The \a roles which have been changed can either be an empty container (meaning everything + has changed), or a non-empty container with the subset of roles which have changed. */ -void QAbstractItemView::dataChanged(const QModelIndex &topLeft, const QModelIndex &bottomRight, const QVector &) +void QAbstractItemView::dataChanged(const QModelIndex &topLeft, const QModelIndex &bottomRight, const QVector &roles) { + Q_UNUSED(roles); // Single item changed Q_D(QAbstractItemView); if (topLeft == bottomRight && topLeft.isValid()) { diff --git a/src/widgets/itemviews/qdirmodel.cpp b/src/widgets/itemviews/qdirmodel.cpp index db2f437..d96fa3f 100644 --- a/src/widgets/itemviews/qdirmodel.cpp +++ b/src/widgets/itemviews/qdirmodel.cpp @@ -566,6 +566,8 @@ QMimeData *QDirModel::mimeData(const QModelIndexList &indexes) const the given \a action over the row in the model specified by the \a row and \a column and by the \a parent index. + Returns true if the drop was successful, and false otherwise. + \sa supportedDropActions() */ diff --git a/src/widgets/itemviews/qheaderview.cpp b/src/widgets/itemviews/qheaderview.cpp index 8ba5d74..2f20bdd 100644 --- a/src/widgets/itemviews/qheaderview.cpp +++ b/src/widgets/itemviews/qheaderview.cpp @@ -471,7 +471,7 @@ void QHeaderView::setOffset(int newOffset) \since 4.2 Sets the offset to the start of the section at the given \a visualSectionNumber. \a visualSectionNumber is the actual visible section when hiddenSections are - not considered. That is not always the same as \a visualIndex. + not considered. That is not always the same as visualIndex(). \sa setOffset(), sectionPosition() */ @@ -1081,7 +1081,7 @@ int QHeaderView::logicalIndex(int visualIndex) const } /*! - If \a sectionsMovable is true, the header may be moved by the user; otherwise it + If \a movable is true, the header may be moved by the user; otherwise it is fixed in place. \sa sectionsMovable(), sectionMoved() @@ -1119,7 +1119,7 @@ bool QHeaderView::sectionsMovable() const // ### Qt 6 - remove this obsolete function /*! \obsolete - \fn bool QHeaderView::isMovable(bool movable) + \fn bool QHeaderView::isMovable(bool movable) const Use sectionsMovable instead. -- 2.7.4