src/corelib/kernel/qabstractitemmodel.cpp
changeset 33 3e2da88830cd
parent 30 5dc02b23752f
--- a/src/corelib/kernel/qabstractitemmodel.cpp	Tue Jul 06 15:10:48 2010 +0300
+++ b/src/corelib/kernel/qabstractitemmodel.cpp	Wed Aug 18 10:37:55 2010 +0300
@@ -1197,7 +1197,7 @@
     \l{QAbstractItemModel::}{endInsertRows()} must be called.
 
     \sa {Model Classes}, {Model Subclassing Reference}, QModelIndex,
-        QAbstractItemView, {Using Drag and Drop with Item Views},
+        QAbstractItemView, {Using drag & drop with item views},
         {Simple DOM Model Example}, {Simple Tree Model Example},
         {Editable Tree Model Example}, {Fetch More Example}
 */
@@ -1761,7 +1761,7 @@
     where to place the data. This can occur in a tree when data is dropped on
     a parent. Models will usually append the data to the parent in this case.
 
-    \sa supportedDropActions(), {Using Drag and Drop with Item Views}
+    \sa supportedDropActions(), {Using drag & drop with item views}
 */
 bool QAbstractItemModel::dropMimeData(const QMimeData *data, Qt::DropAction action,
                                       int row, int column, const QModelIndex &parent)
@@ -1798,8 +1798,8 @@
     reimplement the dropMimeData() function to handle the additional
     operations.
 
-    \sa dropMimeData(), Qt::DropActions, {Using Drag and Drop with Item
-    Views}
+    \sa dropMimeData(), Qt::DropActions, {Using drag & drop with item
+    views}
 */
 Qt::DropActions QAbstractItemModel::supportedDropActions() const
 {
@@ -1815,7 +1815,7 @@
     supportedDragActions() is used by QAbstractItemView::startDrag() as the
     default values when a drag occurs.
 
-    \sa Qt::DropActions, {Using Drag and Drop with Item Views}
+    \sa Qt::DropActions, {Using drag & drop with item views}
 */
 Qt::DropActions QAbstractItemModel::supportedDragActions() const
 {
@@ -1831,7 +1831,7 @@
 
     Sets the supported drag \a actions for the items in the model.
 
-    \sa supportedDragActions(), {Using Drag and Drop with Item Views}
+    \sa supportedDragActions(), {Using drag & drop with item views}
 */
 void QAbstractItemModel::setSupportedDragActions(Qt::DropActions actions)
 {
@@ -2501,34 +2501,42 @@
 }
 
 /*!
+    \since 4.6
+
     Begins a row move operation.
 
     When reimplementing a subclass, this method simplifies moving
     entities in your model. This method is responsible for moving
     persistent indexes in the model, which you would otherwise be
-    required to do yourself.
-
-    Using beginMoveRows and endMoveRows is an alternative to emitting
-    layoutAboutToBeChanged and layoutChanged directly along with
-    changePersistentIndexes.  layoutAboutToBeChanged is emitted by
-    this method for compatibility reasons.
+    required to do yourself. Using beginMoveRows and endMoveRows
+    is an alternative to emitting layoutAboutToBeChanged and
+    layoutChanged directly along with changePersistentIndexes.
+    layoutAboutToBeChanged is emitted by this method for compatibility
+    reasons.
 
     The \a sourceParent index corresponds to the parent from which the
-    rows are moved; \a sourceFirst and \a sourceLast are the row
-    numbers of the rows to be moved. The \a destinationParent index
-    corresponds to the parent into which the rows are moved. The \a
+    rows are moved; \a sourceFirst and \a sourceLast are the first and last
+    row numbers of the rows to be moved. The \a destinationParent index
+    corresponds to the parent into which those rows are moved. The \a
     destinationChild is the row to which the rows will be moved.  That
     is, the index at row \a sourceFirst in \a sourceParent will become
-    row \a destinationChild in \a destinationParent. Its siblings will
-    be moved correspondingly.
-
-    Note that \a sourceParent and \a destinationParent may be the
-    same, in which case you must ensure that the \a destinationChild is
-    not within the range of \a sourceFirst and \a sourceLast.  You
-    must also ensure that you do not attempt to move a row to one of
-    its own chilren or ancestors.  This method returns false if either
-    condition is true, in which case you should abort your move
-    operation.
+    row \a destinationChild in \a destinationParent, followed by all other
+    rows up to \a sourceLast.
+
+    However, when moving rows down in the same parent (\a sourceParent
+    and \a destinationParent are equal), the rows will be placed before the
+    \a destinationChild index. That is, if you wish to move rows 0 and 1 so
+    they will become rows 1 and 2, \a destinationChild should be 3. In this
+    case, the new index for the source row \c i (which is between
+    \a sourceFirst and \a sourceLast) is equal to
+    \c {(destinationChild-sourceLast-1+i)}.
+
+    Note that if \a sourceParent and \a destinationParent are the same,
+    you must ensure that the \a destinationChild is not within the range
+    of \a sourceFirst and \a sourceLast + 1.  You must also ensure that you
+    do not attempt to move a row to one of its own children or ancestors.
+    This method returns false if either condition is true, in which case you
+    should abort your move operation.
 
     \table 80%
     \row
@@ -2539,7 +2547,7 @@
 
             For example, as shown in the diagram, we move three rows from
             row 2 to 4 in the source, so \a sourceFirst is 2 and \a sourceLast is 4.
-            We move those items to above row 2 in the destination, so \a destinationRow is 2.
+            We move those items to above row 2 in the destination, so \a destinationChild is 2.
 
             \snippet doc/src/snippets/code/src_corelib_kernel_qabstractitemmodel.cpp 6
 
@@ -2550,7 +2558,7 @@
         \o  To append rows to another parent, move them to after the last row.
 
             For example, as shown in the diagram, we move three rows to a
-            collection of 6 existing rows (ending in row 5), so \a destinationStart is 6:
+            collection of 6 existing rows (ending in row 5), so \a destinationChild is 6:
 
             \snippet doc/src/snippets/code/src_corelib_kernel_qabstractitemmodel.cpp 7
 
@@ -2582,13 +2590,7 @@
             Note that other rows may be displaced accordingly.
     \endtable
 
-    \note This function emits the rowsAboutToBeInserted() signal which
-    connected views (or proxies) must handle before the data is inserted.
-    Otherwise, the views may end up in an invalid state.
-
     \sa endMoveRows()
-
-    \since 4.6
 */
 bool QAbstractItemModel::beginMoveRows(const QModelIndex &sourceParent, int sourceFirst, int sourceLast, const QModelIndex &destinationParent, int destinationChild)
 {
@@ -2765,29 +2767,35 @@
     When reimplementing a subclass, this method simplifies moving
     entities in your model. This method is responsible for moving
     persistent indexes in the model, which you would otherwise be
-    required to do yourself.
-
-    Using beginMoveColumns and endMoveColumns is an alternative to
-    emitting layoutAboutToBeChanged and layoutChanged directly along
-    with changePersistentIndexes.  layoutAboutToBeChanged is emitted
-    by this method for compatibility reasons.
+    required to do yourself. Using beginMoveRows and endMoveRows
+    is an alternative to emitting layoutAboutToBeChanged and
+    layoutChanged directly along with changePersistentIndexes.
+    layoutAboutToBeChanged is emitted by this method for compatibility
+    reasons.
 
     The \a sourceParent index corresponds to the parent from which the
-    columns are moved; \a sourceFirst and \a sourceLast are the column
-    numbers of the columns to be moved. The \a destinationParent index
-    corresponds to the parent into which the columns are moved. The \a
-    destinationChild is the column to which the columns will be
-    moved.  That is, the index at column \a sourceFirst in \a
-    sourceParent will become column \a destinationChild in \a
-    destinationParent. Its siblings will be moved correspondingly.
-
-    Note that \a sourceParent and \a destinationParent may be the
-    same, in which case you must ensure that the \a destinationChild
-    is not within the range of \a sourceFirst and \a sourceLast.  You
-    must also ensure that you do not attempt to move a row to one of
-    its own chilren or ancestors.  This method returns false if either
-    condition is true, in which case you should abort your move
-    operation.
+    columns are moved; \a sourceFirst and \a sourceLast are the first and last
+    column numbers of the columns to be moved. The \a destinationParent index
+    corresponds to the parent into which those columns are moved. The \a
+    destinationChild is the column to which the columns will be moved.  That
+    is, the index at column \a sourceFirst in \a sourceParent will become
+    column \a destinationChild in \a destinationParent, followed by all other
+    columns up to \a sourceLast.
+
+    However, when moving columns down in the same parent (\a sourceParent
+    and \a destinationParent are equal), the columnss will be placed before the
+    \a destinationChild index. That is, if you wish to move columns 0 and 1 so
+    they will become columns 1 and 2, \a destinationChild should be 3. In this
+    case, the new index for the source column \c i (which is between
+    \a sourceFirst and \a sourceLast) is equal to
+    \c {(destinationChild-sourceLast-1+i)}.
+
+    Note that if \a sourceParent and \a destinationParent are the same,
+    you must ensure that the \a destinationChild is not within the range
+    of \a sourceFirst and \a sourceLast + 1.  You must also ensure that you
+    do not attempt to move a column to one of its own children or ancestors.
+    This method returns false if either condition is true, in which case you
+    should abort your move operation.
 
     \sa endMoveColumns()
 
@@ -2846,7 +2854,7 @@
 
     \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 unexcpected behaviour, especially when used with proxy models.
+    Otherwise it could lead to unexpected behaviour, especially when used with proxy models.
 */
 void QAbstractItemModel::reset()
 {