Avogadro  1.1.0
Public Types | Public Slots | Signals | Public Member Functions | Static Public Member Functions | Static Public Attributes | Protected Member Functions | Properties
Avogadro::GLWidget Class Reference

GL widget class for rendering molecules. More...

#include <avogadro/glwidget.h>

Inheritance diagram for Avogadro::GLWidget:
Inheritance graph
[legend]

List of all members.

Public Types

enum  ProjectionType { Perspective = 1, Orthographic = 2 }

Public Slots

void setTool (Tool *tool)
 NavigateTool is a super tool.
void setBackground (const QColor &background)
void setMolecule (Molecule *molecule)
void unselectPrimitive (Primitive *)
void unselectAtom (Atom *)
void unselectBond (Bond *)
void addEngine (Engine *engine)
void removeEngine (Engine *engine)
void loadDefaultEngines ()
void reloadEngines ()
void invalidateDLs ()
void updateGeometry ()
void toolsDestroyed ()
void addTextOverlay (QLabel *label)
void addTextOverlay (const QList< QLabel * > &labels)

Signals

void mousePress (QMouseEvent *event)
void mouseRelease (QMouseEvent *event)
void mouseMove (QMouseEvent *event)
void mouseDoubleClick (QMouseEvent *event)
void wheel (QWheelEvent *event)
void moleculeChanged (Molecule *newMolecule)
void engineAdded (Engine *engine)
void engineRemoved (Engine *engine)
void resized ()
void namedSelectionsChanged ()
void activated (GLWidget *)
void unitCellAxesRenderChanged (bool enabled)

Public Member Functions

 GLWidget (QWidget *parent=0)
 GLWidget (const QGLFormat &format, QWidget *parent=0, const GLWidget *shareWidget=0)
 GLWidget (Molecule *molecule, const QGLFormat &format, QWidget *parent=0, const GLWidget *shareWidget=0)
 ~GLWidget ()
void renderText (double x, double y, double z, const QString &str, const QFont &font, int listBase=2000)
void setQuickRender (bool enabled)
bool quickRender () const
void setRenderUnitCellAxes (bool enabled)
bool renderUnitCellAxes () const
int deviceWidth ()
int deviceHeight ()
QSize sizeHint () const
QSize minimumSizeHint () const
double radius (const Primitive *p) const
Tooltool () const
QColor background () const
void setColorMap (Color *)
ColorcolorMap () const
void setUndoStack (QUndoStack *undoStack)
QUndoStackundoStack () const
const Moleculemolecule () const
Moleculemolecule ()
Cameracamera () const
QList< Engine * > engines () const
QList< GLHithits (int x, int y, int w, int h)
PrimitivecomputeClickedPrimitive (const QPoint &p)
AtomcomputeClickedAtom (const QPoint &p)
BondcomputeClickedBond (const QPoint &p)
const Eigen::Vector3d & center () const
const Eigen::Vector3d & normalVector () const
double radius () const
const AtomfarthestAtom () const
void setQuality (int quality)
int quality () const
void setFogLevel (int level)
int fogLevel () const
void setRenderAxes (bool renderAxes)
bool renderAxes ()
void setRenderDebug (bool renderDebug)
bool renderDebug ()
void setToolGroup (ToolGroup *toolGroup)
ToolGrouptoolGroup () const
void setExtensions (QList< Extension * > extensions)
Painterpainter () const
void setUnitCells (int a, int b, int c)
void setUnitCellColor (const QColor c)
void clearUnitCell ()
int aCells ()
int bCells ()
int cCells ()
void setProjection (ProjectionType type)
ProjectionType projection () const
void renderNow ()
virtual void writeSettings (QSettings &settings) const
virtual void readSettings (QSettings &settings)
Selection Methods

These methods are used to manipulate user-selected primitives. Each view tracks a list of selected objects (e.g., atoms) which can be passed to engines, tools, or used for tasks like copying selected atoms, etc.

PrimitiveList selectedPrimitives () const
void toggleSelected (PrimitiveList primitives)
void toggleSelected ()
void setSelected (PrimitiveList primitives, bool select=true)
void clearSelected ()
bool isSelected (const Primitive *p) const
bool addNamedSelection (const QString &name, PrimitiveList &primitives)
void removeNamedSelection (const QString &name)
void removeNamedSelection (int index)
void renameNamedSelection (int index, const QString &name)
QList< QStringnamedSelections ()
PrimitiveList namedSelectionPrimitives (const QString &name)
PrimitiveList namedSelectionPrimitives (int index)

Static Public Member Functions

static GLWidgetcurrent ()
static void setCurrent (GLWidget *current)

Static Public Attributes

static GLWidgetm_current = 0

Protected Member Functions

virtual void initializeGL ()
virtual void paintGL ()
virtual void paintGL2 ()
virtual void resizeGL (int, int)
virtual void paintEvent (QPaintEvent *event)
virtual void resizeEvent (QResizeEvent *event)
virtual bool event (QEvent *event)
virtual void mousePressEvent (QMouseEvent *event)
virtual void mouseReleaseEvent (QMouseEvent *event)
virtual void mouseMoveEvent (QMouseEvent *event)
virtual void wheelEvent (QWheelEvent *event)
virtual void mouseDoubleClickEvent (QMouseEvent *event)
virtual void keyPressEvent (QKeyEvent *event)
virtual void keyReleaseEvent (QKeyEvent *event)
virtual void render ()
virtual void renderCrystal (GLuint displayList)
virtual void renderCrystalAxes ()
virtual bool renderClippedBox (const Eigen::Vector3d &offset, const Eigen::Vector3d &v1, const Eigen::Vector3d &v2, const Eigen::Vector3d &v3, double lineWidth)
virtual void renderAxesOverlay ()
virtual void renderDebugOverlay ()
virtual void renderTextOverlay ()

Properties

QColor background

Detailed Description

GL widget class for rendering molecules.

Author:
Donald Ephraim Curtis
Marcus D. Hanwell

This widget provides a 3D graphical view of a molecule. In terms of the Model-View architecture we consider the Molecule the model and GLWidget a view of this model. The widget relies on various Engine subclasses to handle the rendering of the 3d objects.

Each engine is allocated a PrimitiveList object. This queue contains all primitivew which that engine is responsible for rendering for this GLWidget. Thus, we can have one queue containing only the bonds, and one queue containing only the atoms which would allow bonds and atoms to be rendered by two different engines.


Member Enumeration Documentation

The type of projection


Constructor & Destructor Documentation

Constructor.

Parameters:
parentthe widget parent.
Avogadro::GLWidget::GLWidget ( const QGLFormat format,
QWidget parent = 0,
const GLWidget shareWidget = 0 
) [explicit]

Constructor.

Parameters:
formatthe QGLFormat information.
parentthe widget parent.
shareWidgeta widget to share the same graphics -- i.e., the underlying GLPainterDevice
Avogadro::GLWidget::GLWidget ( Molecule molecule,
const QGLFormat format,
QWidget parent = 0,
const GLWidget shareWidget = 0 
)

Constructor.

Parameters:
moleculethe molecule to view.
formatthe QGLFormat information.
parentthe widget parent.
shareWidgeta widget to share the same graphics -- i.e., the underlying GLPainterDevice

References setMolecule().

Destructor.


Member Function Documentation

Returns:
The number of unit cells to display along the a axis.
void Avogadro::GLWidget::activated ( GLWidget ) [signal]

Signal that this GLWidget was activated.

Referenced by mousePressEvent().

void Avogadro::GLWidget::addEngine ( Engine engine) [slot]

Add an engine to the GLWidget.

Parameters:
engineEngine to add to this widget.

References QObject::connect(), engineAdded(), invalidateDLs(), moleculeChanged(), setMolecule(), Avogadro::Engine::setPainterDevice(), and QWidget::update().

Referenced by loadDefaultEngines().

bool Avogadro::GLWidget::addNamedSelection ( const QString name,
PrimitiveList primitives 
)

Add a new named selection.

Parameters:
namename of the new selection.
primitivesthe primitives ids.
Returns:
true if the name is not taken

References QList::append(), Avogadro::Primitive::AtomType, Avogadro::Primitive::BondType, Avogadro::Primitive::id(), QObject::name(), and namedSelectionsChanged().

void Avogadro::GLWidget::addTextOverlay ( QLabel label) [slot]

Adds the QLabel label to the list of text drawn in the text overlay.

Note:
The GLWidget does not take ownership of the label, but retains a QPointer to it. When the QLabel's text should no longer be rendered, simply delete the QLabel elsewhere and call render().
See also:
renderTextOverlay
void Avogadro::GLWidget::addTextOverlay ( const QList< QLabel * > &  labels) [slot]

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. Adds the QLabels in labels to the list of strings drawn in the text overlay.

Note:
The GLWidget does not take ownership of the string, but retains a QPointer to it. When the QLabel's text should no longer be rendered, simply delete the QLabel elsewhere and call render().
Call this functions instead of repeatedly calling addTextOverlay(QLabel*) guarantees that all the strings will be drawn consecutively.
See also:
renderTextOverlay

References QList::constBegin(), and QList::constEnd().

QColor Avogadro::GLWidget::background ( ) const
Returns:
the current background color of the rendering area.

Referenced by setBackground().

Returns:
The number of unit cells to display along the b axis.
Returns:
a pointer to the Camera of this widget.

Referenced by render(), Avogadro::Navigate::rotate(), Avogadro::Navigate::translate(), and Avogadro::Navigate::zoom().

Returns:
The number of unit cells to display along the c axis.
const Vector3d & Avogadro::GLWidget::center ( ) const
Returns:
the point at the center of the Molecule.

Deselect all objects.

Clear the unit cell data.

References QWidget::update(), and updateGeometry().

Returns:
the current global color map for Primitives.

References Avogadro::PluginManager::factories(), and Avogadro::PluginManager::instance().

Referenced by setColorMap().

Take a point and figure out which is the closest Atom under that point.

Parameters:
pthe point on the widget that was clicked.
Returns:
the closest Atom that was clicked or 0 if nothing.

References Avogadro::Molecule::atom(), Avogadro::Primitive::AtomType, hits(), molecule(), Avogadro::GLHit::name(), Avogadro::GLHit::type(), QPoint::x(), and QPoint::y().

Take a point and figure out which is the closest Bond under that point.

Parameters:
pthe point on the widget that was clicked.
Returns:
the closest Bond that was clicked or 0 if nothing.

References Avogadro::Molecule::bond(), Avogadro::Primitive::BondType, hits(), molecule(), Avogadro::GLHit::name(), Avogadro::GLHit::type(), QPoint::x(), and QPoint::y().

Take a point and figure out which is the closest Primitive under that point.

Parameters:
pthe point on the widget that was clicked.
Returns:
the closest Primitive that was clicked or 0 if nothing.

References Avogadro::Molecule::atom(), Avogadro::Primitive::AtomType, Avogadro::Molecule::bond(), Avogadro::Primitive::BondType, hits(), molecule(), Avogadro::GLHit::name(), Avogadro::GLHit::type(), QPoint::x(), and QPoint::y().

Returns:
a pointer to the current GLWidget.

References m_current.

Referenced by setCurrent().

Returns:
the height of the widget in pixels.
Returns:
the width of the widget in pixels.
void Avogadro::GLWidget::engineAdded ( Engine engine) [signal]

Signal that an Engine has been added to the GLWidget.

Referenced by addEngine().

void Avogadro::GLWidget::engineRemoved ( Engine engine) [signal]

Signal that an Engine has been removed from the GLWidget.

Referenced by removeEngine().

Returns:
a list of engines.

Referenced by loadDefaultEngines().

bool Avogadro::GLWidget::event ( QEvent event) [protected, virtual]

Focus Event

Reimplemented from QGLWidget.

References setCurrent(), and QEvent::type().

Returns:
the Atom farthest away from the camera.
Returns:
The global fog level of the widget.
QList< GLHit > Avogadro::GLWidget::hits ( int  x,
int  y,
int  w,
int  h 
)
void Avogadro::GLWidget::initializeGL ( ) [protected, virtual]

Virtual function called by QGLWidget on initialization of the GL area.

Reimplemented from QGLWidget.

References QGLWidget::context(), QMessageBox::critical(), QGLWidget::isValid(), QGLWidget::qglClearColor(), and QObject::tr().

Referenced by paintEvent(), and resizeEvent().

Signal that something changed and the display lists should be invalidated.

Referenced by addEngine(), setMolecule(), and setQuality().

bool Avogadro::GLWidget::isSelected ( const Primitive p) const
Returns:
true if the Primitive is selected.
void Avogadro::GLWidget::keyPressEvent ( QKeyEvent event) [protected, virtual]

Response to key press events.

Parameters:
eventthe key event information

Reimplemented from QWidget.

References QEvent::isAccepted(), Avogadro::Tool::keyPressEvent(), and QWidget::update().

void Avogadro::GLWidget::keyReleaseEvent ( QKeyEvent event) [protected, virtual]

Response to key release events.

Parameters:
eventthe key event information

Reimplemented from QWidget.

References QEvent::isAccepted(), and Avogadro::Tool::keyReleaseEvent().

Virtual function setting the minimum size hit for this widget.

Returns:
the minimum size the widget can take without causing unspecified behaviour.

Reimplemented from QWidget.

Referenced by sizeHint().

Returns:
the current Molecule being viewed.

Referenced by computeClickedAtom(), computeClickedBond(), computeClickedPrimitive(), hits(), and setMolecule().

Returns:
the current Molecule being viewed.
void Avogadro::GLWidget::moleculeChanged ( Molecule newMolecule) [signal]

Signal that the Molecule has changed.

Referenced by addEngine(), and setMolecule().

Signal for the mouse double-click event which is passed to the tools.

Referenced by mouseDoubleClickEvent().

void Avogadro::GLWidget::mouseDoubleClickEvent ( QMouseEvent event) [protected, virtual]

Virtual function reaction to a mouse double-click while in the GL rendering area.

Since:
version 1.1

Reimplemented from QWidget.

References QEvent::isAccepted(), mouseDoubleClick(), Avogadro::Tool::mouseDoubleClickEvent(), and QWidget::update().

void Avogadro::GLWidget::mouseMove ( QMouseEvent event) [signal]

Signal for the mouse move event which is passed to the tools.

Referenced by mouseMoveEvent().

void Avogadro::GLWidget::mouseMoveEvent ( QMouseEvent event) [protected, virtual]

Virtual function reaction to mouse being moved in the GL rendering area.

Reimplemented from QWidget.

References QEvent::isAccepted(), mouseMove(), and Avogadro::Tool::mouseMoveEvent().

void Avogadro::GLWidget::mousePress ( QMouseEvent event) [signal]

Signal for the mouse press event which is passed to the tools.

Referenced by mousePressEvent().

void Avogadro::GLWidget::mousePressEvent ( QMouseEvent event) [protected, virtual]

Virtual function reaction to mouse press in the GL rendering area.

Reimplemented from QWidget.

References activated(), QEvent::isAccepted(), mousePress(), and Avogadro::Tool::mousePressEvent().

void Avogadro::GLWidget::mouseRelease ( QMouseEvent event) [signal]

Signal for the mouse release event which is passed to the tools.

Referenced by mouseReleaseEvent().

void Avogadro::GLWidget::mouseReleaseEvent ( QMouseEvent event) [protected, virtual]

Virtual function reaction to mouse release in the GL rendering area.

Reimplemented from QWidget.

References QEvent::isAccepted(), mouseRelease(), Avogadro::Tool::mouseReleaseEvent(), and QWidget::update().

Get the primitives of a named selections by name.

Parameters:
namename of the selection.
Returns:
the primitives for this named selection.

References QObject::name().

Get the primitives of a named selections by index. Using the index is useful in Models.

Parameters:
indexindex of the selection.
Returns:
the primitives for this named selection.

References Avogadro::PrimitiveList::append().

Get the names of all named selections.

Returns:
a list with all the named selections.

References QList::append().

Named selections have changed.

Referenced by addNamedSelection(), removeNamedSelection(), and renameNamedSelection().

const Vector3d & Avogadro::GLWidget::normalVector ( ) const
Returns:
the normalVector for the entire Molecule.

Returns the Painter of this widget. For instance, to draw a sphere in this widget, you could do:

See also:
class Painter

Referenced by renderAxesOverlay().

void Avogadro::GLWidget::paintEvent ( QPaintEvent event) [protected, virtual]

Virtual function called when the GL area needs repainting.

Reimplemented from QGLWidget.

References initializeGL(), QGLWidget::makeCurrent(), paintGL(), QGLWidget::qglClearColor(), QGLWidget::swapBuffers(), and QWidget::updatesEnabled().

void Avogadro::GLWidget::paintGL ( ) [protected, virtual]

Virtual function called by GLWidget before render() to set up the display correctly.

Reimplemented from QGLWidget.

References QWidget::height(), render(), resizeGL(), and QWidget::width().

Referenced by paintEvent(), and renderNow().

void Avogadro::GLWidget::paintGL2 ( ) [protected, virtual]

Virtual function called by GLGraphicsView before render() to set up the display correctly and leave it in an appropriate state after.

References render().

Get the type of projection

Returns:
type of projection

Referenced by Avogadro::Navigate::zoom().

Returns:
the global quality of the widget.
Returns:
True if quick rendering is being used.
double Avogadro::GLWidget::radius ( const Primitive p) const
Returns:
the radius of the primitive object for this glwidget.

References Avogadro::Engine::isEnabled(), radius(), and Avogadro::Engine::radius().

double Avogadro::GLWidget::radius ( ) const
Returns:
the radius of the Molecule.

Referenced by radius().

void Avogadro::GLWidget::readSettings ( QSettings settings) [virtual]

Read the settings of the GLWidget and restore them.

References loadDefaultEngines(), setFogLevel(), setQuality(), QVariant::toInt(), QSettings::value(), and QVariant::value().

void Avogadro::GLWidget::removeEngine ( Engine engine) [slot]

Remove an engine from the GLWidget.

Parameters:
engineEngine to remove from this widget.

References QObject::deleteLater(), QObject::disconnect(), engineRemoved(), and QWidget::update().

Referenced by loadDefaultEngines().

Remove a named selection by name.

Parameters:
namename of the selection to remove.

References QObject::name(), and namedSelectionsChanged().

Remove a named selection by index. Using the index is useful in Models.

Parameters:
indexindex of the selection to remove.
void Avogadro::GLWidget::renameNamedSelection ( int  index,
const QString name 
)

Rename a named selection by index. Using the index is useful in Models.

Parameters:
indexindex of the selection to rename.

References QString::isEmpty(), QObject::name(), and namedSelectionsChanged().

void Avogadro::GLWidget::render ( ) [protected, virtual]

Render the scene. To be used in both modes GL_RENDER and GL_SELECT. This function calls the render functions of the engines as well as the paint events of the tools and is where everything drawn onto the widget is called from.

References camera(), QMetaObject::invokeMethod(), Avogadro::Engine::isEnabled(), Avogadro::Engine::layers(), Avogadro::Camera::modelview(), Avogadro::Tool::paint(), renderAxesOverlay(), renderCrystal(), Avogadro::Engine::renderOpaque(), renderTextOverlay(), Avogadro::Engine::renderTransparent(), Avogadro::Engine::shader(), tool(), and Avogadro::Engine::Transparent.

Referenced by paintGL(), and paintGL2().

Returns:
true if the x, y, z axes are being rendered.

Referenced by setRenderAxes().

void Avogadro::GLWidget::renderAxesOverlay ( ) [protected, virtual]

Render x, y, z axes as an overlay on the bottom left of the widget.

References Avogadro::Painter::drawCone(), Avogadro::Painter::drawCylinder(), Avogadro::Painter::drawSphere(), painter(), and Avogadro::Painter::setColor().

Referenced by render().

bool Avogadro::GLWidget::renderClippedBox ( const Eigen::Vector3d &  offset,
const Eigen::Vector3d &  v1,
const Eigen::Vector3d &  v2,
const Eigen::Vector3d &  v3,
double  lineWidth 
) [protected, virtual]

Renders a parallelepiped with defining edge vectors v1, v2, v3, with offset offset. If the cube intersects the viewing volume's near-plane, an appropriate line-loop is rendered at the intersection to prevent "missing corners" that are visually disturbing.

See http://davidlonie.blogspot.com/2011/04/gracefully-clipping-parallelepiped-in.html for pictures of what this does.

Parameters:
offsetOrigin for edge vectors
v1Vector defining one edge starting from offset
v2Vector defining a second edge starting from offset
v3Vector defining a third edge starting from offset
lineWidthWidth of the lines used to draw the edges
Returns:
True if the parallelepiped is clipped, false otherwise.

Referenced by renderCrystalAxes().

void Avogadro::GLWidget::renderCrystal ( GLuint  displayList) [protected, virtual]

Render a full crystal cell Called by render() automatically

Parameters:
displayListthe display list of the primitive unit cell

References renderCrystalAxes(), QWidget::x(), and QWidget::y().

Referenced by render().

void Avogadro::GLWidget::renderCrystalAxes ( ) [protected, virtual]

Render crystal unit cell axes called by renderCrystal() automatically

References renderClippedBox().

Referenced by renderCrystal().

Returns:
true if the debug panel is being drawn

Referenced by setRenderDebug().

void Avogadro::GLWidget::renderDebugOverlay ( ) [protected, virtual]
Deprecated:
Use renderTextOverlay instead.
See also:
addTextOverlay
setRenderDebug

References renderTextOverlay().

Trigger a render for GL2PS.

References paintGL().

void Avogadro::GLWidget::renderTextOverlay ( ) [protected, virtual]

Render a text overlay. This renders all valid strings added by addTextOverlay, as well as debug info if needed.

See also:
addTextOverlay
setRenderDebug

References QList::append(), QList::size(), QObject::tr(), and QWidget::y().

Referenced by render(), and renderDebugOverlay().

Returns:
True if unit cell axes are being rendered.
void Avogadro::GLWidget::resized ( ) [signal]

Signal that the GLWidget has resized. Can be used to update child widgets, see overlay extension for example.

Referenced by resizeEvent().

void Avogadro::GLWidget::resizeEvent ( QResizeEvent event) [protected, virtual]

Called on resize of the GLWidget to perform resizing of the display.

Reimplemented from QGLWidget.

References initializeGL(), QGLWidget::isValid(), QGLWidget::makeCurrent(), resized(), resizeGL(), QResizeEvent::size(), and QSize::width().

void Avogadro::GLWidget::resizeGL ( int  width,
int  height 
) [protected, virtual]

Virtual function called whn the GL area is resized

Reimplemented from QGLWidget.

Referenced by paintGL(), and resizeEvent().

Returns:
the current selected primitives (all Primitive types)
void Avogadro::GLWidget::setBackground ( const QColor background) [slot]

Set the background color of the rendering area (the default is black).

Parameters:
backgroundthe new background color.

References background().

void Avogadro::GLWidget::setColorMap ( Color colorMap)

Set the current global color map for Primitives.

References colorMap().

void Avogadro::GLWidget::setCurrent ( GLWidget current) [static]

Set this instance of the GLWidget as the current GLWidget instance.

References current(), and m_current.

Referenced by event().

Set the extensions.

void Avogadro::GLWidget::setFogLevel ( int  level)
Parameters:
levelSet the global fog level of the widget.

Referenced by readSettings().

void Avogadro::GLWidget::setMolecule ( Molecule molecule) [slot]

Set the molecule model for this view.

Parameters:
moleculethe molecule to view.

References QObject::connect(), QObject::disconnect(), invalidateDLs(), molecule(), moleculeChanged(), unselectAtom(), unselectBond(), unselectPrimitive(), QWidget::update(), and updateGeometry().

Referenced by addEngine(), and GLWidget().

Set the type of projection

Parameters:
typetype of projection

References QWidget::update(), and updateGeometry().

void Avogadro::GLWidget::setQuality ( int  quality)
Parameters:
qualityset the global quality of the widget.

References invalidateDLs().

Referenced by readSettings().

void Avogadro::GLWidget::setQuickRender ( bool  enabled)
Parameters:
enabledTrue if quick render is desired when moving the view.

References QWidget::enabled.

void Avogadro::GLWidget::setRenderAxes ( bool  renderAxes)

Set to render x, y, z axes as an overlay in the bottom left of the widget.

References renderAxes(), and QWidget::update().

void Avogadro::GLWidget::setRenderDebug ( bool  renderDebug)

Set to render the "debug info" (i.e., FPS, number of atoms, etc.)

References renderDebug(), and QWidget::update().

Parameters:
enabledTrue if we should render the unit cell axes

References QWidget::enabled, and unitCellAxesRenderChanged().

void Avogadro::GLWidget::setSelected ( PrimitiveList  primitives,
bool  select = true 
)

Change the selection status for the atoms in the supplied list. All objects in the list will have the same selection status.

Parameters:
primitivesthe set of objects to update.
selectwhether to select or deselect the objects.

References Avogadro::Primitive::update().

void Avogadro::GLWidget::setTool ( Tool tool) [slot]

NavigateTool is a super tool.

Set the active Tool of the GLWidget.

References tool().

Referenced by setToolGroup().

Parameters:
undoStackthe new undoStack.

References undoStack().

Set the color of unit cells

Parameters:
ccolor of unit cells
void Avogadro::GLWidget::setUnitCells ( int  a,
int  b,
int  c 
)

Set the number of unit cells for a periodic molecule like a crystal a, b, and c, are the three primitive unit cell axes. Does nothing if the molecule does not have a unit cell defined.

Parameters:
anumber of unit cells to display along the a axis.
bnumber of unit cells to display along the b axis.
cnumber of unit cells to display along the c axis.

References QWidget::update(), and updateGeometry().

QSize Avogadro::GLWidget::sizeHint ( ) const [virtual]

Virtual function setting the size hint for this widget.

Returns:
the preferred size of the widget.

Reimplemented from QWidget.

References minimumSizeHint().

Toggle the selection for the atoms in the supplied list. That is, if the primitive is selected, deselect it and vice-versa.

Parameters:
primitivesthe set of objects to update.

Toggle the selection for the GLWidget, that is if the primitive is selected, deselect it and vice-versa.

Returns:
the active Tool.

Referenced by render(), setTool(), and setToolGroup().

Returns:
the ToolGroup of the GLWidget.

Referenced by setToolGroup().

One or more tools are deleted..

Referenced by setToolGroup().

Returns:
the current GLWidget undoStack.

Referenced by setUndoStack().

void Avogadro::GLWidget::unitCellAxesRenderChanged ( bool  enabled) [signal]

Signal that the unit cell axis display has changed

Referenced by setRenderUnitCellAxes().

void Avogadro::GLWidget::unselectAtom ( Atom a) [slot]

An atom, was removed, so update the selection

References unselectPrimitive().

Referenced by setMolecule().

void Avogadro::GLWidget::unselectBond ( Bond b) [slot]

A bond, was removed, so update the selection

References unselectPrimitive().

Referenced by setMolecule().

A primitive, was removed, so update the selection

Referenced by setMolecule(), unselectAtom(), and unselectBond().

update the Molecule geometry.

Reimplemented from QWidget.

References QList::at(), Avogadro::Atom::pos(), and QWidget::x().

Referenced by clearUnitCell(), setMolecule(), setProjection(), and setUnitCells().

void Avogadro::GLWidget::wheel ( QWheelEvent event) [signal]

Signal for the mouse wheel event which is passed to the tools.

Referenced by wheelEvent().

void Avogadro::GLWidget::wheelEvent ( QWheelEvent event) [protected, virtual]

Virtual function reaction to mouse while in the GL rendering area.

Reimplemented from QWidget.

References QEvent::isAccepted(), wheel(), and Avogadro::Tool::wheelEvent().

void Avogadro::GLWidget::writeSettings ( QSettings settings) const [virtual]

Write the settings of the GLWidget in order to save them to disk.

References QSettings::beginWriteArray(), QSettings::endArray(), QSettings::remove(), QSettings::setArrayIndex(), and QSettings::setValue().


Member Data Documentation

Static pointer to the current GLWidget.

Referenced by current(), and setCurrent().


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