Skip to content

Commit

Permalink
Fix compile and get property to work
Browse files Browse the repository at this point in the history
Signed-off-by: Geoff Hutchison <[email protected]>
  • Loading branch information
ghutchis committed Nov 20, 2024
1 parent 13d03c8 commit f593562
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions avogadro/qtplugins/molecularproperties/molecularmodel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,8 @@ void MolecularModel::setMolecule(QtGui::Molecule* molecule)
}

// make sure we know if the molecule changed
connect(m_molecule, SIGNAL(changed(uint)), SLOT(updateTable(uint)));
connect(m_molecule, &QtGui::Molecule::changed, this,
&MolecularModel::updateTable);
updateTable(QtGui::Molecule::Added);
}

Expand Down Expand Up @@ -241,10 +242,6 @@ QVariant MolecularModel::data(const QModelIndex& index, int role) const
return QVariant::fromValue(m_molecule->totalCharge());
else if (key == " 10totalSpinMultiplicity")
return QVariant::fromValue(m_molecule->totalSpinMultiplicity());
else if (key == "dipoleMoment") {
auto dipole = m_molecule->data("dipoleMoment").toVector3();
return QString::fromValue(dipole.norm());
}

return QString::fromStdString(it->second.toString());
}
Expand Down Expand Up @@ -395,6 +392,10 @@ void MolecularModel::updateTable(unsigned int flags)
if (m_molecule->totalSpinMultiplicity() != 1)
m_propertiesCache.setValue(" 10totalSpinMultiplicity",
m_molecule->totalSpinMultiplicity());
if (m_molecule->hasData("dipoleMoment")) {
auto dipole = m_molecule->data("dipoleMoment").toVector3();
m_propertiesCache.setValue("dipoleMoment", dipole.norm());
}

// TODO check for homo, lumo, or somo energies
// m_propertiesCache.setValue("homoEnergy", energy);
Expand Down

0 comments on commit f593562

Please sign in to comment.