Logo Search packages:      
Sourcecode: qt4-x11 version File versions  Download package

void QAbstractItemModel::beginRemoveRows ( const QModelIndex parent,
int  first,
int  last 
) [protected, inherited]

Begins a row removal operation.

When reimplementing removeRows() in a subclass, you must call this function before removing data from the model's underlying data store.

The parent index corresponds to the parent from which the new rows are removed; first and last are the row numbers of the rows to be removed.

80% modelview-begin-remove-rows.png Removing rows Specify the first and last row numbers for the span of rows you want to remove from an item in a model.

For example, as shown in the diagram, we remove the two rows from row 2 to row 3, so first is 2 and last is 3: doc/src/snippets/code/src_corelib_kernel_qabstractitemmodel.cpp 2

See also:
endRemoveRows()

Definition at line 2107 of file qabstractitemmodel.cpp.

References QAbstractItemModel::rowsAboutToBeRemoved().

Referenced by QScriptBreakpointsModel::removeBreakpoint(), DownloadModel::removeRows(), HistoryModel::removeRows(), TreeModel::removeRows(), TableModel::removeRows(), LinearModel::removeRows(), PiecesModel::removeRows(), CookieModel::removeRows(), qdesigner_internal::WidgetBoxCategoryModel::removeRows(), QTreeModel::removeRows(), QStringListModel::removeRows(), QTableModel::removeRows(), QListModel::removeRows(), HistoryFilterModel::removeRows(), StringListModel::removeRows(), CookieExceptionsModel::removeRows(), and QSqlQueryModel::setQuery().

{
    Q_ASSERT(first >= 0);
    Q_ASSERT(last >= first);
    Q_D(QAbstractItemModel);
    d->changes.push(QAbstractItemModelPrivate::Change(parent, first, last));
    emit rowsAboutToBeRemoved(parent, first, last);
    d->rowsAboutToBeRemoved(parent, first, last);
}

Here is the call graph for this function:

Here is the caller graph for this function:


Generated by  Doxygen 1.6.0   Back to index