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

QModelIndex TreeModel::index ( int  row,
int  column,
const QModelIndex parent = QModelIndex() 
) const [virtual]

[5]

[6]

[5]

[6]

Implements QAbstractItemModel.

Definition at line 108 of file treemodel.cpp.

References TreeItem::child(), QAbstractItemModel::createIndex(), QModelIndex::internalPointer(), and QModelIndex::isValid().

{
    TreeItem *parentItem;

    if (!parent.isValid())
        parentItem = rootItem;
    else
        parentItem = static_cast<TreeItem*>(parent.internalPointer());

    TreeItem *childItem = parentItem->child(row);
    if (childItem)
        return createIndex(row, column, childItem);
    else
        return QModelIndex();
}


Generated by  Doxygen 1.6.0   Back to index