diff --git a/avogadro/qtopengl/glwidget.cpp b/avogadro/qtopengl/glwidget.cpp index bfd7eb3da1..3dcee7a3cc 100644 --- a/avogadro/qtopengl/glwidget.cpp +++ b/avogadro/qtopengl/glwidget.cpp @@ -15,13 +15,13 @@ #include +#include #include #include #include #include -#include -#include #include +#include namespace Avogadro::QtOpenGL { @@ -169,7 +169,9 @@ void GLWidget::setDefaultTool(const QString& name) { foreach (QtGui::ToolPlugin* tool, m_tools) { QAction* toolAction = tool->activateAction(); - if (tool->name() == name || (toolAction && toolAction->text() == name)) { + + if (tool->objectName() == name || tool->name() == name || + (toolAction && toolAction->text() == name)) { setDefaultTool(tool); return; } @@ -332,4 +334,4 @@ void GLWidget::keyReleaseEvent(QKeyEvent* e) QOpenGLWidget::keyReleaseEvent(e); } -} // namespace Avogadro +} // namespace Avogadro::QtOpenGL