From 79e0351a977e67439787670cc585153739b6b0b3 Mon Sep 17 00:00:00 2001 From: "Marcus D. Hanwell" Date: Thu, 9 Aug 2018 13:09:21 -0400 Subject: [PATCH] First pass at singleton with active objects Uses new class from the Avogadro libraries to manage active objects. There is more detail in the avogadrolibs repository, but this is a very limited first use to track global active objects in a running application. The use of a singleton with active render widgets, etc, enables the plugins to have a minimal API, and use the singleton API if they need to gain access to things such as the active render widget to grab the frame buffer to generate an image, etc. Signed-off-by: Marcus D. Hanwell --- avogadro/mainwindow.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/avogadro/mainwindow.cpp b/avogadro/mainwindow.cpp index 93fb9840..9301eaee 100644 --- a/avogadro/mainwindow.cpp +++ b/avogadro/mainwindow.cpp @@ -38,6 +38,7 @@ #include #include #include +#include #include #include #include @@ -200,6 +201,7 @@ using QtGui::ScenePluginFactory; using QtGui::ScenePluginModel; using QtGui::ToolPlugin; using QtGui::ToolPluginFactory; +using QtOpenGL::ActiveObjects; using QtOpenGL::GLWidget; using QtPlugins::PluginManager; using std::string; @@ -310,6 +312,7 @@ void MainWindow::setupInterface() setCentralWidget(m_multiViewWidget); GLWidget* glWidget = new GLWidget(this); m_multiViewWidget->addWidget(glWidget); + ActiveObjects::instance().setActiveGLWidget(glWidget); // Our tool dock. m_toolDock = new QDockWidget(tr("Tool"), this);