Avogadro::QtGui::ToolPlugin#
-
class ToolPlugin : public QObject#
The base class for plugins that interact with QtOpenGL::GLWidget.
- Author
Allison Vacanti
Unnamed Group
-
virtual QUndoCommand *mousePressEvent(QMouseEvent *e)#
Respond to user-input events.
- Parameters:
e – The 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.
-
virtual QUndoCommand *mouseReleaseEvent(QMouseEvent *e)#
Respond to user-input events.
- Parameters:
e – The 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.
-
virtual QUndoCommand *mouseMoveEvent(QMouseEvent *e)#
Respond to user-input events.
- Parameters:
e – The 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.
-
virtual QUndoCommand *mouseDoubleClickEvent(QMouseEvent *e)#
Respond to user-input events.
- Parameters:
e – The 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.
-
virtual QUndoCommand *wheelEvent(QWheelEvent *e)#
Respond to user-input events.
- Parameters:
e – The 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.
-
virtual QUndoCommand *keyPressEvent(QKeyEvent *e)#
Respond to user-input events.
- Parameters:
e – The 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.
-
virtual QUndoCommand *keyReleaseEvent(QKeyEvent *e)#
Respond to user-input events.
- Parameters:
e – The 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.
Public Functions
-
explicit ToolPlugin(QObject *parent = nullptr)#
-
~ToolPlugin() override#
-
virtual QString name() const = 0#
The name of the tool, will be displayed in the user interface.
-
virtual QString description() const = 0#
A description of the tool, may be displayed in the user interface.
-
virtual unsigned char priority() const = 0#
A priority of the tool for sorting in the user interface.
-
virtual QAction *activateAction() const = 0#
- Returns:
The QAction that will cause this tool to become active.
-
virtual void setIcon(bool darkTheme = false) = 0#
Set the tool icon (based on dark / light theme).
-
virtual QWidget *toolWidget() const = 0#
- Returns:
A QWidget that will be displayed to the user while this tool is active.
-
virtual void draw(Rendering::GroupNode &node)#
Override this method to add drawables to the scene graph.
-
virtual bool handleCommand(const QString &command, const QVariantMap &options)#
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.
-
inline virtual void registerCommands()#
Called by the app to tell the tool to register commands. If the tool has commands, it should emit the registerCommand signals.
Public Slots
-
inline virtual void setEditMolecule(QtGui::RWMolecule*)#
-
inline virtual void setActiveWidget(QWidget*)#
Set the active widget used by the tool, this can be anything derived from QWidget.
-
inline virtual void setGLRenderer(Rendering::GLRenderer*)#
Set the GLRenderer used by the tool.
Signals
-
void updateRequested()#
Emitted when something changed (camera, etc) and the molecule should be redrawn.
-
void registerCommand(QString command, QString description)#
Register a new command with the application. The command will be available through scripting (e.g., “renderMovie” or “generateSurface”, etc.)
See also
- Parameters:
command – The name of the command to register.
description – A description of the command.
-
void requestActiveDisplayTypes(QStringList displayTypes)#
Request a specific display type (or types) are made active. This can be useful when loading a specific type of data that would be most readily viewed with a specialized view.