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

QModelIndex TreeModel::parent ( const QModelIndex index  )  const [virtual]

[7]

[6]

[7]

Implements QAbstractItemModel.

Definition at line 153 of file treemodel.cpp.

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

{
    if (!index.isValid())
        return QModelIndex();

    TreeItem *childItem = static_cast<TreeItem*>(index.internalPointer());
    TreeItem *parentItem = childItem->parent();

    if (parentItem == rootItem)
        return QModelIndex();

    return createIndex(parentItem->row(), 0, parentItem);
}


Generated by  Doxygen 1.6.0   Back to index