Avogadro
1.1.0
|
Interface for tool plugins. More...
#include <avogadro/tool.h>
Public Slots | |
virtual void | setMolecule (Molecule *molecule) |
Signals | |
void | message (const QString &m) |
Public Member Functions | |
Tool (QObject *parent=0) | |
virtual | ~Tool () |
Plugin::Type | type () const |
QString | typeName () const |
virtual QAction * | activateAction () const |
virtual QWidget * | settingsWidget () |
virtual QString | settingsTitle () const =0 |
virtual QUndoCommand * | mousePressEvent (GLWidget *widget, QMouseEvent *event)=0 |
virtual QUndoCommand * | mouseReleaseEvent (GLWidget *widget, QMouseEvent *event)=0 |
virtual QUndoCommand * | mouseMoveEvent (GLWidget *widget, QMouseEvent *event)=0 |
virtual QUndoCommand * | mouseDoubleClickEvent (GLWidget *widget, QMouseEvent *event)=0 |
virtual QUndoCommand * | wheelEvent (GLWidget *widget, QWheelEvent *event) |
virtual QUndoCommand * | keyPressEvent (GLWidget *widget, QKeyEvent *event) |
virtual QUndoCommand * | keyReleaseEvent (GLWidget *widget, QKeyEvent *event) |
virtual bool | paint (GLWidget *widget) |
virtual int | usefulness () const |
bool | operator< (const Tool &other) const |
virtual void | writeSettings (QSettings &settings) const |
virtual void | readSettings (QSettings &settings) |
Protected Attributes | |
QAction * | m_activateAction |
ToolPrivate *const | d |
Interface for tool plugins.
This is a template class for tools which manipulate the GLWidget area. The functions they implement are in response to actions performed by the user on the GLWidget.
Avogadro::Tool::Tool | ( | QObject * | parent = 0 | ) |
Constructor
References QString::fromUtf8(), QAction::setCheckable(), and QAction::setIcon().
Avogadro::Tool::~Tool | ( | ) | [virtual] |
Destructor
QAction * Avogadro::Tool::activateAction | ( | ) | const [virtual] |
References Avogadro::Plugin::description(), Avogadro::Plugin::name(), QAction::setText(), QAction::setToolTip(), QAction::text, and QAction::toolTip.
Referenced by Avogadro::ToolGroup::append(), Avogadro::PythonTool::PythonTool(), and Avogadro::ToolGroup::setActiveTool().
QUndoCommand * Avogadro::Tool::keyPressEvent | ( | GLWidget * | widget, |
QKeyEvent * | event | ||
) | [virtual] |
Response to key press events.
widget | the GLWidget where the event occurred |
event | the key event information |
Referenced by Avogadro::GLWidget::keyPressEvent().
QUndoCommand * Avogadro::Tool::keyReleaseEvent | ( | GLWidget * | widget, |
QKeyEvent * | event | ||
) | [virtual] |
Response to key release events.
widget | the GLWidget where the event occurred |
event | the key event information |
Referenced by Avogadro::GLWidget::keyReleaseEvent().
void Avogadro::Tool::message | ( | const QString & | m | ) | [signal] |
Can be used to add messages to the message pane.
m | the message to add to the message pane. |
virtual QUndoCommand* Avogadro::Tool::mouseDoubleClickEvent | ( | GLWidget * | widget, |
QMouseEvent * | event | ||
) | [pure virtual] |
Response to a user double-click
widget | the GLWidget where the event occurred |
event | the mouse event information |
Implemented in Avogadro::PythonTool.
Referenced by Avogadro::GLWidget::mouseDoubleClickEvent().
virtual QUndoCommand* Avogadro::Tool::mouseMoveEvent | ( | GLWidget * | widget, |
QMouseEvent * | event | ||
) | [pure virtual] |
Response to mouse movement
widget | the GLWidget where the event occurred |
event | the mouse event information |
Implemented in Avogadro::PythonTool.
Referenced by Avogadro::GLWidget::mouseMoveEvent().
virtual QUndoCommand* Avogadro::Tool::mousePressEvent | ( | GLWidget * | widget, |
QMouseEvent * | event | ||
) | [pure virtual] |
Response to mouse press
widget | the GLWidget where the even occurred |
event | the mouse event information |
Implemented in Avogadro::PythonTool.
Referenced by Avogadro::GLWidget::mousePressEvent().
virtual QUndoCommand* Avogadro::Tool::mouseReleaseEvent | ( | GLWidget * | widget, |
QMouseEvent * | event | ||
) | [pure virtual] |
Response to mouse release
widget | the GLWidget where the even occurred |
event | the mouse event information |
Implemented in Avogadro::PythonTool.
Referenced by Avogadro::GLWidget::mouseReleaseEvent().
bool Avogadro::Tool::paint | ( | GLWidget * | widget | ) | [virtual] |
Called by the GLWidget allowing overlay painting by the tool. Tools get painted last in the overall scheme.
widget | the GLWidget to paint to |
Reimplemented in Avogadro::PythonTool.
Referenced by Avogadro::GLWidget::render().
void Avogadro::Tool::readSettings | ( | QSettings & | settings | ) | [virtual] |
Read in the settings that have been saved for the tool instance.
Reimplemented from Avogadro::Plugin.
Reimplemented in Avogadro::PythonTool.
Referenced by Avogadro::ToolGroup::readSettings().
void Avogadro::Tool::setMolecule | ( | Molecule * | molecule | ) | [virtual, slot] |
Called by the parent (normally toolGroup) to tell the tool the underlying model (molecule) has changed
Referenced by Avogadro::ToolGroup::setMolecule().
virtual QString Avogadro::Tool::settingsTitle | ( | ) | const [pure virtual] |
Implemented in Avogadro::PythonTool.
QWidget * Avogadro::Tool::settingsWidget | ( | ) | [virtual] |
Reimplemented from Avogadro::Plugin.
Reimplemented in Avogadro::PythonTool.
Plugin::Type Avogadro::Tool::type | ( | ) | const [virtual] |
Plugin Type.
Implements Avogadro::Plugin.
QString Avogadro::Tool::typeName | ( | ) | const |
Plugin Type Name (Tools).
References QObject::tr().
int Avogadro::Tool::usefulness | ( | ) | const [virtual] |
Determines the ordering of the tools. More useful tools are placed first. It is up to the tool designer to be humble about their usefulness value.
QUndoCommand * Avogadro::Tool::wheelEvent | ( | GLWidget * | widget, |
QWheelEvent * | event | ||
) | [virtual] |
Response to mouse wheel movement
widget | the GLWidget where the event occurred |
event | the mouse wheel event information |
Reimplemented in Avogadro::PythonTool.
Referenced by Avogadro::GLWidget::wheelEvent().
void Avogadro::Tool::writeSettings | ( | QSettings & | settings | ) | const [virtual] |
Write the tool settings so that they can be saved between sessions.
Reimplemented from Avogadro::Plugin.
Reimplemented in Avogadro::PythonTool.
Referenced by Avogadro::ToolGroup::writeSettings().