Skip to content

Commit

Permalink
First pass at singleton with active objects
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
cryos committed Aug 12, 2018
1 parent 2194cc1 commit 79e0351
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions avogadro/mainwindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
#include <avogadro/qtgui/sceneplugin.h>
#include <avogadro/qtgui/scenepluginmodel.h>
#include <avogadro/qtgui/toolplugin.h>
#include <avogadro/qtopengl/activeobjects.h>
#include <avogadro/qtopengl/glwidget.h>
#include <avogadro/qtplugins/pluginmanager.h>
#include <avogadro/rendering/glrenderer.h>
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit 79e0351

Please sign in to comment.