Esempio n. 1
0
void MoleculeWatcher::bondChanged(const Bond *bond, Molecule::ChangeType changeType)
{
    switch(changeType){
        case Molecule::BondAdded:
            Q_EMIT bondAdded(bond);
            break;
        case Molecule::BondRemoved:
            Q_EMIT bondRemoved(bond);
            break;
        case Molecule::BondOrderChanged:
            Q_EMIT bondOrderChanged(bond);
        default:
            break;
    }
}
Esempio n. 2
0
Bond *Molecule::addBond(unsigned long id)
{
    Q_D(Molecule);
    Bond *bond = new Bond(this);

    d->invalidRings = true;
    m_invalidPartialCharges = true;
    m_invalidAromaticity = true;
    if(id >= m_bonds.size())
        m_bonds.resize(id+1,0);
    m_bonds[id] = bond;
    m_bondList.push_back(bond);

    bond->setId(id);
    bond->setIndex(m_bondList.size()-1);
    // now that the id is correct, emit the signal
    connect(bond, SIGNAL(updated()), this, SLOT(updateBond()));
    emit bondAdded(bond);
    return(bond);
}