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

bool PiecesModel::removeRows ( int  row,
int  count,
const QModelIndex parent 
) [virtual]

On models that support this, removes count rows starting with the given row under parent parent from the model. Returns true if the rows were successfully removed; otherwise returns false.

The base class implementation does nothing and returns false.

If you implement your own model, you can reimplement this function if you want to support removing. Alternatively, you can provide you own API for altering the data.

See also:
removeRow(), removeColumns(), insertColumns(), beginRemoveRows(), endRemoveRows()

Reimplemented from QAbstractItemModel.

Definition at line 89 of file piecesmodel.cpp.

References QAbstractItemModel::beginRemoveRows(), QAbstractItemModel::endRemoveRows(), QModelIndex::isValid(), QList< T >::removeAt(), and QList< T >::size().

{
    if (parent.isValid())
        return false;

    if (row >= pixmaps.size() || row + count <= 0)
        return false;

    int beginRow = qMax(0, row);
    int endRow = qMin(row + count - 1, pixmaps.size() - 1);

    beginRemoveRows(parent, beginRow, endRow);

    while (beginRow <= endRow) {
        pixmaps.removeAt(beginRow);
        locations.removeAt(beginRow);
        ++beginRow;
    }

    endRemoveRows();
    return true;
}

Here is the call graph for this function:


Generated by  Doxygen 1.6.0   Back to index