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.
-
inline bool isValid() const#
Check if the GLWidget was able to acquire a context, and set up the renderer correctly. If not valid, the error method may provide more information.
- Returns:
true if value, false if not.
-
inline QString error() const#
Get the error(s), if any, encountered when setting up the GLWidget.
- Returns:
A free form string containing errors encountered.
Modifier reserved for camera navigation.
A mouse gesture carrying this modifier is routed to the default (navigation) tool regardless of which tool is currently active. Defaults to Qt::AltModifier and is persisted in QSettings.
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 a repaint. Multiple requests before the next frame are compressed into one, so camera moves stay interactive.
Signals
-
void rendererInvalid()#