Avogadro::QtGui::ExtensionPlugin#
-
class ExtensionPlugin : public QObject#
The base class for extension plugin factories in Avogadro.
- Author
Marcus D. Hanwell
Public Functions
-
explicit ExtensionPlugin(QObject *parent = nullptr)#
-
~ExtensionPlugin() override#
-
virtual QString name() const = 0#
The name of the extension plugin, will be displayed in the user interface.
-
virtual QString description() const = 0#
A description of the extension plugin, may be displayed in the user interface.
-
virtual QList<QAction*> actions() const = 0#
- Returns:
The QActions for this extension (should be at least one).
- Returns:
The menu path of the supplied action. This can be empty if the action was not recognized, or contain two or more strings (top level, plus name, e.g. File, &Open).
-
virtual QList<Io::FileFormat*> fileFormats() const#
The caller takes ownership of the objects in the returned list.
- Returns:
A list of file format readers/writers.
-
inline virtual void registerCommands()#
If the extension plugin has script commands, this method should be implemented to emit the registerCommand signals.
Public Slots
-
virtual bool readMolecule(QtGui::Molecule &mol)#
Call this slot when the moleculeReady signal indicated that a molecule is ready to be read. The
molecule
will have the data read into it. The slot will- Returns:
true if a molecule was successfully read in.
-
virtual void setCamera(Rendering::Camera *camera)#
Called when the active camera for the view changes.
-
virtual void setActiveWidget(QWidget *widget)#
Called when the active widget changes. This must be used carefully, and should check that the widget has been cast if used.
-
virtual bool handleCommand(const QString &command, const QVariantMap &options)#
Called by the app to handle a command registered by the extension. (e.g., “renderMovie” or “generateSurface”, etc.)
The app will turn the command into a string and pass it to the extension. and any options will go from a JSON dictionary to a QVariantMap.
- Returns:
true if the command was handled, false otherwise.
Signals
-
void moleculeReady(int numberOfMolecules)#
Signal that the extension has a new molecule that is ready to be loaded. The application must call readMolecule in order to actually read the molecule(s).
-
void fileFormatsReady()#
Signal that the extension has file formats that are ready to be registered. If emitted the application should call fileFormats to get the formats the extension is registering.
-
void requestActiveTool(QString toolName)#
Signal to request a particular tool is set as the active tool. This is useful when loading a structure outside of the normal file API and setting “Navigator” to active instead of “Editor” (the default).
-
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.
-
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.