AvogadroLibs  1.90.0
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Pages
Public Slots | Signals | Public Member Functions | Protected Slots | Protected Member Functions | List of all members
GLWidget Class Reference

QGLWidget derived object for displaying 3D molecular geometry. More...

#include <avogadro/qtopengl/glwidget.h>

Inheritance diagram for GLWidget:

Public Slots

void updateScene ()
 
void clearScene ()
 
void resetCamera ()
 
void resetGeometry ()
 
void setTools (const QList< QtGui::ToolPlugin * > &toolList)
 
void addTool (QtGui::ToolPlugin *tool)
 
void requestUpdate ()
 
void setActiveTool (const QString &name)
 
void setActiveTool (QtGui::ToolPlugin *tool)
 
void setDefaultTool (const QString &name)
 
void setDefaultTool (QtGui::ToolPlugin *tool)
 

Signals

void rendererInvalid ()
 

Public Member Functions

 GLWidget (QWidget *parent=0)
 
void setMolecule (QtGui::Molecule *molecule)
 
Rendering::GLRendererrenderer ()
 
QList< QtGui::ToolPlugin * > tools () const
 
QtGui::ToolPluginactiveTool () const
 
QtGui::ToolPlugindefaultTool () const
 
bool isValid () const
 
QString error () const
 
QtGui::Moleculemolecule ()
 
const QtGui::Moleculemolecule () const
 
QtGui::ScenePluginModelsceneModel ()
 
const QtGui::ScenePluginModelsceneModel () const
 

Protected Slots

void updateTimeout ()
 

Protected Member Functions

void initializeGL ()
 
void resizeGL (int width, int height)
 
void paintGL ()
 
void mouseDoubleClickEvent (QMouseEvent *)
 
void mousePressEvent (QMouseEvent *)
 
void mouseMoveEvent (QMouseEvent *)
 
void mouseReleaseEvent (QMouseEvent *)
 
void wheelEvent (QWheelEvent *)
 
void keyPressEvent (QKeyEvent *)
 
void keyReleaseEvent (QKeyEvent *)
 

Detailed Description

Author
Marcus D. Hanwell

This class creates the GL context, and contains a renderer to render the 3D molecular geometry.

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 QGLWidget's handlers.

Member Function Documentation

void setMolecule ( QtGui::Molecule molecule)

Set the molecule the widget will render.

QtGui::Molecule* molecule ( )

Get the molecule being rendered by the widget.

const QtGui::Molecule* molecule ( ) const

Get the molecule being rendered by the widget.

Rendering::GLRenderer& renderer ( )

Get a reference to the renderer for the widget.

QList<QtGui::ToolPlugin*> tools ( ) const
Returns
A list of the ToolPlugins owned by the GLWidget.
QtGui::ToolPlugin* activeTool ( ) const
Returns
The active tool.
QtGui::ToolPlugin* defaultTool ( ) const
Returns
The default tool.
QtGui::ScenePluginModel& sceneModel ( )

Get the GLWidget's ScenePluginModel, used to add, delete and modify the scene plugin items.

const QtGui::ScenePluginModel& sceneModel ( ) const

Get the GLWidget's ScenePluginModel, used to add, delete and modify the scene plugin items.

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.
QString error ( ) const

Get the error(s), if any, encountered when setting up the GLWidget.

Returns
A free form string containing errors encountered.
void updateScene ( )
slot

Update the scene plugins for the widget, this will generate geeometry in the scene etc.

void clearScene ( )
slot

Clear the contents of the scene.

void resetCamera ( )
slot

Reset the view to fit the entire scene.

void resetGeometry ( )
slot

Reset the geometry when the molecule etc changes.

void setTools ( const QList< QtGui::ToolPlugin * > &  toolList)
slot

Make the tools in toolList available to the GLWidget. The GLWidget takes ownership of the tools.

void addTool ( QtGui::ToolPlugin tool)
slot

Make tool available to the GLWidget. The GLWidget takes ownership of the tool.

void setActiveTool ( const QString &  name)
slot

Set the active tool. This is the tool that will be used to handle input events first.

void setActiveTool ( QtGui::ToolPlugin tool)
slot

Set the active tool. This is the tool that will be used to handle input events first.

void setDefaultTool ( const QString &  name)
slot

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)
slot

Set the default tool. This is the tool that will be used to handle input events that are ignored by the active tool.

void requestUpdate ( )
slot

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.

void updateTimeout ( )
protectedslot

Perform the update of the render, this should only be called by the timer.

void initializeGL ( )
protected

This is where the GL context is initialized.

void resizeGL ( int  width,
int  height 
)
protected

Take care of resizing the context.

void paintGL ( )
protected

Main entry point for all GL rendering.

void mouseDoubleClickEvent ( QMouseEvent *  )
protected

Reimplemented from QGLWidget

void mousePressEvent ( QMouseEvent *  )
protected

Reimplemented from QGLWidget

void mouseMoveEvent ( QMouseEvent *  )
protected

Reimplemented from QGLWidget

void mouseReleaseEvent ( QMouseEvent *  )
protected

Reimplemented from QGLWidget

void wheelEvent ( QWheelEvent *  )
protected

Reimplemented from QGLWidget

void keyPressEvent ( QKeyEvent *  )
protected

Reimplemented from QGLWidget

void keyReleaseEvent ( QKeyEvent *  )
protected

Reimplemented from QGLWidget


The documentation for this class was generated from the following file: