示例#1
0
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
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 );
}