- Extending Qt Creator Manual
- PluginSpec
- Extending Qt Creator Manual 8.0.2

# PluginSpec Class

class ExtensionSystem::PluginSpec

The PluginSpec class contains the information of the plugin's embedded meta data and information about the plugin's current state. More...

Header: | #include <extensionsystem/pluginspec.h>

- List of all members, including inherited members

## Public Types

enum | State { Invalid, Read, Resolved, Loaded, Initialized, …, Deleted }

## Public Functions

void | addArgument(const QString &argument)
ExtensionSystem::PluginSpec::PluginArgumentDescriptions | argumentDescriptions() const
QStringList | arguments() const
QString | category() const
QString | compatVersion() const
QString | copyright() const
QVector<ExtensionSystem::PluginDependency> | dependencies() const
QHash<ExtensionSystem::PluginDependency, ExtensionSystem::PluginSpec *> | dependencySpecs() const
QString | description() const
QString | errorString() const
QString | filePath() const
bool | hasError() const
bool | isAvailableForHostPlatform() const
bool | isEffectivelyEnabled() const
bool | isEnabledByDefault() const
bool | isEnabledBySettings() const
bool | isEnabledIndirectly() const
bool | isExperimental() const
bool | isForceDisabled() const
bool | isForceEnabled() const
bool | isRequired() const
QString | license() const
QString | location() const
QJsonObject | metaData() const
QString | name() const
QRegularExpression | platformSpecification() const
ExtensionSystem::IPlugin * | plugin() const
bool | provides(const QString &pluginName, const QString &version) const
bool | requiresAny(const QSet<ExtensionSystem::PluginSpec *> &plugins) const
void | setArguments(const QStringList &arguments)
void | setEnabledBySettings(bool value)
ExtensionSystem::PluginSpec::State | state() const
QString | url() const
QString | vendor() const
QString | version() const

## Detailed Description

The plugin spec is also filled with more information as the plugin goes through its loading process (see PluginSpec::State). If an error occurs, the plugin spec is the place to look for the error details.

## Member Type Documentation

### enum PluginSpec::State

The State enum indicates the states the plugin goes through while it is being loaded.

The state gives a hint on what went wrong in case of an error.

Constant | Value | Description
--- | --- | ---
`ExtensionSystem::PluginSpec::Invalid` | `0` | Starting point: Even the plugin meta data was not read.
`ExtensionSystem::PluginSpec::Read` | `1` | The plugin meta data has been successfully read, and its information is available via the PluginSpec.
`ExtensionSystem::PluginSpec::Resolved` | `2` | The dependencies given in the description file have been successfully found, and are available via the dependencySpecs() function.
`ExtensionSystem::PluginSpec::Loaded` | `3` | The plugin's library is loaded and the plugin instance created (available through plugin()).
`ExtensionSystem::PluginSpec::Initialized` | `4` | The plugin instance's IPlugin::initialize() function has been called and returned a success value.
`ExtensionSystem::PluginSpec::Running` | `5` | The plugin's dependencies are successfully initialized and extensionsInitialized has been called. The loading process is complete.
`ExtensionSystem::PluginSpec::Stopped` | `6` | The plugin has been shut down, i.e. the plugin's IPlugin::aboutToShutdown() function has been called.
`ExtensionSystem::PluginSpec::Deleted` | `7` | The plugin instance has been deleted.

## Member Function Documentation

### void PluginSpec::addArgument(const QString &argument)

Adds argument to the command line arguments specific to the plugin.

### ExtensionSystem::PluginSpec::PluginArgumentDescriptions PluginSpec::argumentDescriptions() const

Returns a list of descriptions of command line arguments the plugin processes.

### QStringList PluginSpec::arguments() const

Returns command line arguments specific to the plugin. Set at startup.

See also setArguments().

### QString PluginSpec::category() const

Returns the category that the plugin belongs to. Categories are used to group plugins together in the UI. Returns an empty string if the plugin does not belong to a category.

### QString PluginSpec::compatVersion() const

Returns the plugin compatibility version. This is valid after the PluginSpec::Read state is reached.

### QString PluginSpec::copyright() const

Returns the plugin copyright. This is valid after the PluginSpec::Read state is reached.

### QVector<ExtensionSystem::PluginDependency> PluginSpec::dependencies() const

The plugin dependencies. This is valid after the PluginSpec::Read state is reached.

### QHash<ExtensionSystem::PluginDependency, ExtensionSystem::PluginSpec *> PluginSpec::dependencySpecs() const

Returns the list of dependencies, already resolved to existing plugin specs. Valid if PluginSpec::Resolved state is reached.

See also PluginSpec::dependencies().

### QString PluginSpec::description() const

Returns the plugin description. This is valid after the PluginSpec::Read state is reached.

### QString PluginSpec::errorString() const

Returns a detailed, possibly multi-line, error description in case of an error.

### QString PluginSpec::filePath() const

Returns the absolute path to the plugin.

### bool PluginSpec::hasError() const

Returns whether an error occurred while reading or starting the plugin.

### bool PluginSpec::isAvailableForHostPlatform() const

Returns whether the plugin works on the host platform.

### bool PluginSpec::isEffectivelyEnabled() const

Returns whether the plugin is loaded at startup.

See also isEnabledBySettings().

### bool PluginSpec::isEnabledByDefault() const

Returns whether the plugin is enabled by default. A plugin might be disabled because the plugin is experimental, or because the installation settings define it as disabled by default.

### bool PluginSpec::isEnabledBySettings() const

Returns whether the plugin should be loaded at startup, taking into account the default enabled state, and the user's settings.

Note: This function might return `false` even if the plugin is loaded as a requirement of another enabled plugin.

See also isEffectivelyEnabled().

### bool PluginSpec::isEnabledIndirectly() const

Returns `true` if loading was not done due to user unselecting this plugin or its dependencies.

### bool PluginSpec::isExperimental() const

Returns whether the plugin has its experimental flag set.

### bool PluginSpec::isForceDisabled() const

Returns whether the plugin is disabled via the `-noload` option on the command line.

### bool PluginSpec::isForceEnabled() const

Returns whether the plugin is enabled via the `-load` option on the command line.

### bool PluginSpec::isRequired() const

Returns whether the plugin is required.

### QString PluginSpec::license() const

Returns the plugin license. This is valid after the PluginSpec::Read state is reached.

### QString PluginSpec::location() const

Returns the absolute path to the directory containing the plugin.

### QJsonObject PluginSpec::metaData() const

Returns the plugin meta data.

### QString PluginSpec::name() const

Returns the plugin name. This is valid after the PluginSpec::Read state is reached.

### QRegularExpression PluginSpec::platformSpecification() const

Returns a QRegularExpression matching the platforms this plugin works on. An empty pattern implies all platforms.

This function was introduced in Qt 3.0.

### ExtensionSystem::IPlugin *PluginSpec::plugin() const

Returns the corresponding IPlugin instance, if the plugin library has already been successfully loaded. That is, the PluginSpec::Loaded state is reached.

### bool PluginSpec::provides(const QString &pluginName, const QString &version) const

Returns whether this plugin can be used to fill in a dependency of the given pluginName and version.

See also PluginSpec::dependencies().

### bool PluginSpec::requiresAny(const QSet<ExtensionSystem::PluginSpec *> &plugins) const

Returns whether the plugin requires any of the plugins specified by plugins.

### void PluginSpec::setArguments(const QStringList &arguments)

Sets the command line arguments specific to the plugin to arguments.

See also arguments().

### void PluginSpec::setEnabledBySettings(bool value)

Sets whether the plugin should be loaded at startup to value.

See also isEnabledBySettings().

### ExtensionSystem::PluginSpec::State PluginSpec::state() const

Returns the state in which the plugin currently is. See the description of the PluginSpec::State enum for details.

### QString PluginSpec::url() const

Returns the plugin URL where you can find more information about the plugin. This is valid after the PluginSpec::Read state is reached.

### QString PluginSpec::vendor() const

Returns the plugin vendor. This is valid after the PluginSpec::Read state is reached.

### QString PluginSpec::version() const

Returns the plugin version. This is valid after the PluginSpec::Read state is reached.