AvogadroLibs 1.98.1
Loading...
Searching...
No Matches
Public Slots | Signals | Public Member Functions | List of all members
ToolPlugin Class Referenceabstract

The base class for plugins that interact with QtOpenGL::GLWidget. More...

#include <avogadro/qtgui/toolplugin.h>

Inheritance diagram for ToolPlugin:

Public Slots

virtual void setMolecule (QtGui::Molecule *mol)=0
 
virtual void setEditMolecule (QtGui::RWMolecule *)
 
virtual void setGLWidget (QtOpenGL::GLWidget *)
 
virtual void setActiveWidget (QWidget *)
 
virtual void setGLRenderer (Rendering::GLRenderer *)
 

Signals

void drawablesChanged ()
 
void updateRequested ()
 
void registerCommand (QString command, QString description)
 

Public Member Functions

 ToolPlugin (QObject *parent=nullptr)
 
virtual QString name () const =0
 
virtual QString description () const =0
 
virtual unsigned char priority () const =0
 
virtual QAction * activateAction () const =0
 
virtual QWidget * toolWidget () const =0
 
virtual void draw (Rendering::GroupNode &node)
 
virtual bool handleCommand (const QString &command, const QVariantMap &options)
 
virtual void registerCommands ()
 
virtual QUndoCommand * mousePressEvent (QMouseEvent *e)
 
virtual QUndoCommand * mouseReleaseEvent (QMouseEvent *e)
 
virtual QUndoCommand * mouseMoveEvent (QMouseEvent *e)
 
virtual QUndoCommand * mouseDoubleClickEvent (QMouseEvent *e)
 
virtual QUndoCommand * wheelEvent (QWheelEvent *e)
 
virtual QUndoCommand * keyPressEvent (QKeyEvent *e)
 
virtual QUndoCommand * keyReleaseEvent (QKeyEvent *e)
 

Detailed Description

Author
Allison Vacanti

Member Function Documentation

◆ name()

virtual QString name ( ) const
pure virtual

The name of the tool, will be displayed in the user interface.

◆ description()

virtual QString description ( ) const
pure virtual

A description of the tool, may be displayed in the user interface.

◆ priority()

virtual unsigned char priority ( ) const
pure virtual

A priority of the tool for sorting in the user interface.

◆ activateAction()

virtual QAction * activateAction ( ) const
pure virtual
Returns
The QAction that will cause this tool to become active.

◆ toolWidget()

virtual QWidget * toolWidget ( ) const
pure virtual
Returns
A QWidget that will be displayed to the user while this tool is active.

◆ mousePressEvent()

virtual QUndoCommand * mousePressEvent ( QMouseEvent *  e)
virtual

Respond to user-input events.

Parameters
eThe QEvent object.
Returns
A QUndoCommand that can be used to undo any changes to the molecule. If no undoable change is made, the method may return nullptr.

◆ mouseReleaseEvent()

virtual QUndoCommand * mouseReleaseEvent ( QMouseEvent *  e)
virtual

Respond to user-input events.

Parameters
eThe QEvent object.
Returns
A QUndoCommand that can be used to undo any changes to the molecule. If no undoable change is made, the method may return nullptr.

◆ mouseMoveEvent()

virtual QUndoCommand * mouseMoveEvent ( QMouseEvent *  e)
virtual

Respond to user-input events.

Parameters
eThe QEvent object.
Returns
A QUndoCommand that can be used to undo any changes to the molecule. If no undoable change is made, the method may return nullptr.

◆ mouseDoubleClickEvent()

virtual QUndoCommand * mouseDoubleClickEvent ( QMouseEvent *  e)
virtual

Respond to user-input events.

Parameters
eThe QEvent object.
Returns
A QUndoCommand that can be used to undo any changes to the molecule. If no undoable change is made, the method may return nullptr.

◆ wheelEvent()

virtual QUndoCommand * wheelEvent ( QWheelEvent *  e)
virtual

Respond to user-input events.

Parameters
eThe QEvent object.
Returns
A QUndoCommand that can be used to undo any changes to the molecule. If no undoable change is made, the method may return nullptr.

◆ keyPressEvent()

virtual QUndoCommand * keyPressEvent ( QKeyEvent *  e)
virtual

Respond to user-input events.

Parameters
eThe QEvent object.
Returns
A QUndoCommand that can be used to undo any changes to the molecule. If no undoable change is made, the method may return nullptr.

◆ keyReleaseEvent()

virtual QUndoCommand * keyReleaseEvent ( QKeyEvent *  e)
virtual

Respond to user-input events.

Parameters
eThe QEvent object.
Returns
A QUndoCommand that can be used to undo any changes to the molecule. If no undoable change is made, the method may return nullptr.

◆ draw()

virtual void draw ( Rendering::GroupNode node)
virtual

Override this method to add drawables to the scene graph.

◆ handleCommand()

virtual bool handleCommand ( const QString &  command,
const QVariantMap &  options 
)
virtual

Called by the app to handle a command registered by the plugin. (e.g., "renderMovie" or "drawAtom", etc.)

The app will turn the command into a string and pass it to the tool. and any options will go from a JSON dictionary to a QVariantMap.

Returns
true if the command was handled, false otherwise.

◆ registerCommands()

virtual void registerCommands ( )
virtual

Called by the app to tell the tool to register commands. If the tool has commands, it should emit the registerCommand signals.

◆ drawablesChanged

void drawablesChanged ( )
signal

Emitted when draw() needs to be called again due to updates.

◆ updateRequested

void updateRequested ( )
signal

Emitted when something changed (camera, etc) and the molecule should be redrawn.

◆ registerCommand

void registerCommand ( QString  command,
QString  description 
)
signal

Register a new command with the application. The command will be available through scripting (e.g., "renderMovie" or "generateSurface", etc.)

Parameters
commandThe name of the command to register.
descriptionA description of the command.
See also
handleCommand

◆ setMolecule

virtual void setMolecule ( QtGui::Molecule mol)
pure virtualslot

Called when the current molecule changes.

◆ setGLWidget

virtual void setGLWidget ( QtOpenGL::GLWidget )
virtualslot

Set the GLWidget used by the tool.

◆ setActiveWidget

virtual void setActiveWidget ( QWidget *  )
virtualslot

Set the active widget used by the tool, this can be anything derived from QWidget.

◆ setGLRenderer

virtual void setGLRenderer ( Rendering::GLRenderer )
virtualslot

Set the GLRenderer used by the tool.


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