Пример #1
0
  ZMatrixDialog::ZMatrixDialog(QWidget *parent, Qt::WindowFlags) :
      QDialog(parent), m_zMatrixModel(new ZMatrixModel), m_molecule(0)
  {
    setWindowFlags(Qt::Dialog | Qt::Tool);
    ui.setupUi(this);
    ui.tableView->setModel(m_zMatrixModel);

    QHeaderView *horizontal = ui.tableView->horizontalHeader();
    horizontal->setResizeMode(QHeaderView::Stretch);
    QHeaderView *vertical = ui.tableView->verticalHeader();
    vertical->setResizeMode(QHeaderView::Stretch);

    // Connect our signals and slots...
    connect(ui.addButton, SIGNAL(clicked()), this, SLOT(addAtom()));
    connect(ui.removeButton, SIGNAL(clicked()), this, SLOT(removeAtom()));
  }
Пример #2
0
void Molecule::removeHydrogens(Atom *atom)
{
    if (atom) {
        // Delete any connected hydrogen atoms
        QList<unsigned long> neighbors = atom->neighbors();

        foreach (unsigned long a, neighbors) {
            Atom *nbrAtom = atomById(a);
            // we need to check if the atom still exists
            if (nbrAtom) {
                if (nbrAtom->isHydrogen()) {
                    removeAtom(a);
                }
            }
            else {
                qDebug() << "Error, atom advertising deleted neighbor" << atom->id()
                         << a;
            }
        }
    }
Пример #3
0
void Molecule::removeAtom(unsigned long id)
{
    removeAtom(atomById(id));
}