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
Definition at line 2107 of file qabstractitemmodel.cpp. References QAbstractItemModel::rowsAboutToBeRemoved(). Referenced by QScriptBreakpointsModel::removeBreakpoint(), TreeModel::removeRows(), TableModel::removeRows(), QStringListModel::removeRows(), HistoryFilterModel::removeRows(), StringListModel::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); }
|