From ae8c2ce87ac34fbafbb8bfd9403e32d78dfd9749 Mon Sep 17 00:00:00 2001 From: Geoff Hutchison Date: Fri, 6 Dec 2024 18:09:34 -0500 Subject: [PATCH] Handle molecule switching with a delay update request Signed-off-by: Geoff Hutchison --- avogadro/qtopengl/glwidget.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/avogadro/qtopengl/glwidget.cpp b/avogadro/qtopengl/glwidget.cpp index 3dcee7a3cc..b76fb3edb1 100644 --- a/avogadro/qtopengl/glwidget.cpp +++ b/avogadro/qtopengl/glwidget.cpp @@ -47,6 +47,12 @@ void GLWidget::setMolecule(QtGui::Molecule* mol) m_molecule = mol; foreach (QtGui::ToolPlugin* tool, m_tools) tool->setMolecule(m_molecule); + + if (m_molecule) { + // update properties like dipole rendering + QTimer::singleShot(500, m_molecule, &QtGui::Molecule::update); + } + connect(m_molecule, SIGNAL(changed(unsigned int)), SLOT(updateScene())); }