コード例 #1
0
ファイル: TreeModel.cpp プロジェクト: ErrAza/amarok
void
APG::TreeModel::slotConstraintDataChanged()
{
    ConstraintNode* n = static_cast<ConstraintNode*>( sender() );
    if ( n ) {
        QModelIndex idx = createIndex( n->row(), 0, n );
        emit dataChanged( idx, idx );
    }
}
コード例 #2
0
ファイル: TreeModel.cpp プロジェクト: ErrAza/amarok
QModelIndex
APG::TreeModel::parent( const QModelIndex& child ) const
{
    if ( !child.isValid() )
        return QModelIndex();

    ConstraintNode* childItem = static_cast<ConstraintNode*>( child.internalPointer() );
    ConstraintNode* parentItem = static_cast<ConstraintNode*>( childItem->parent() );

    if ( !parentItem || parentItem == m_rootNode )
        return QModelIndex();

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