Avogadro::QtOpenGL::GLWidget#
-
class GLWidget : public QOpenGLWidget#
QOpenGLGLWidget derived object for displaying 3D molecular geometry.
This class creates the GL context, and contains a renderer to render the 3D molecular geometry.
- Author
Marcus D. Hanwell
The GLWidget also manages a collection of ToolPlugins that are used to respond to user input events. Use setTools() or addTool() to add tools to the widget. Use setActiveTool() to indicate which tool is active. The active tool will be given the opportunity to handle input events first. If the active tool does not handle the event, the default tool will be used. If the default tool also ignores the event, it will be passed to QOpenGLWidget’s handlers.
Unnamed Group
Unnamed Group
-
inline QtGui::ScenePluginModel &sceneModel()#
Get the GLWidget’s ScenePluginModel, used to add, delete and modify the scene plugin items.
-
inline const QtGui::ScenePluginModel &sceneModel() const#
Get the GLWidget’s ScenePluginModel, used to add, delete and modify the scene plugin items.
Unnamed Group
-
void setActiveTool(const QString &name)#
Set the active tool. This is the tool that will be used to handle input events first.
-
void setActiveTool(QtGui::ToolPlugin *tool)#
Set the active tool. This is the tool that will be used to handle input events first.
Unnamed Group
-
void setDefaultTool(const QString &name)#
Set the default tool. This is the tool that will be used to handle input events that are ignored by the active tool.
-
void setDefaultTool(QtGui::ToolPlugin *tool)#
Set the default tool. This is the tool that will be used to handle input events that are ignored by the active tool.
Unnamed Group
-
void mouseDoubleClickEvent(QMouseEvent*) override#
Reimplemented from QOpenGLWidget
-
void mousePressEvent(QMouseEvent*) override#
Reimplemented from QOpenGLWidget
-
void mouseMoveEvent(QMouseEvent*) override#
Reimplemented from QOpenGLWidget
-
void mouseReleaseEvent(QMouseEvent*) override#
Reimplemented from QOpenGLWidget
-
void wheelEvent(QWheelEvent*) override#
Reimplemented from QOpenGLWidget
-
void keyPressEvent(QKeyEvent*) override#
Reimplemented from QOpenGLWidget
-
void keyReleaseEvent(QKeyEvent*) override#
Reimplemented from QOpenGLWidget
Public Functions
-
explicit GLWidget(QWidget *parent = nullptr)#
-
~GLWidget() override#
-
inline Rendering::GLRenderer &renderer()#
Get a reference to the renderer for the widget.
-
inline QList<QtGui::ToolPlugin*> tools() const#
- Returns:
A list of the ToolPlugins owned by the GLWidget.
-
inline QtGui::ToolPlugin *activeTool() const#
- Returns:
The active tool.
-
inline QtGui::ToolPlugin *defaultTool() const#
- Returns:
The default tool.
Public Slots
-
void updateScene()#
Update the scene plugins for the widget, this will generate geometry in the scene etc.
-
void updateMolecule()#
Request update of molecule properties (e.g., dipole moment)
-
void clearScene()#
Clear the contents of the scene.
-
void resetCamera()#
Reset the view to fit the entire scene.
-
void resetGeometry()#
Reset the geometry when the molecule etc changes.
-
void setTools(const QList<QtGui::ToolPlugin*> &toolList)#
Make the tools in toolList available to the GLWidget. The GLWidget takes ownership of the tools.
-
void addTool(QtGui::ToolPlugin *tool)#
Make tool available to the GLWidget. The GLWidget takes ownership of the tool.
-
void requestUpdate()#
Request an update, this will by default initiate a timer that will trigger in a specified time, enabling us to compress multiple events such as camera moves to maintain interactivity.
Signals
-
void rendererInvalid()#
Protected Functions
-
void initializeGL() override#
This is where the GL context is initialized.
-
void resizeGL(int width, int height) override#
Take care of resizing the context.
-
void paintGL() override#
Main entry point for all GL rendering.
Protected Slots
-
void updateTimeout()#
Perform the update of the render, this should only be called by the timer.