- Extending Qt Creator Manual
- QtCreator
- PluginSpec
- Extending Qt Creator Manual 20.0.0-beta2

# ExtensionSystem::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

virtual void | addArgument(const QString &argument)
virtual ExtensionSystem::PluginSpec::PluginArgumentDescriptions | argumentDescriptions() const
virtual QStringList | arguments() const
virtual QString | category() const
virtual QString | compatVersion() const
virtual QString | copyright() const
virtual QList<ExtensionSystem::PluginDependency> | dependencies() const
virtual QHash<ExtensionSystem::PluginDependency, ExtensionSystem::PluginSpec *> | dependencySpecs() const
virtual QString | description() const
virtual QString | displayName() const
virtual QString | documentationUrl() const
virtual QString | errorString() const
virtual Utils::FilePath | filePath() const
virtual bool | hasError() const
virtual QString | id() const
virtual bool | isAvailableForHostPlatform() const
virtual bool | isDeprecated() const
virtual bool | isEffectivelyEnabled() const
virtual bool | isEnabledByDefault() const
virtual bool | isEnabledBySettings() const
virtual bool | isEnabledIndirectly() const
virtual bool | isExperimental() const
virtual bool | isForceDisabled() const
virtual bool | isForceEnabled() const
virtual bool | isRequired() const
virtual bool | isSoftLoadable() const
virtual QString | license() const
virtual Utils::FilePath | location() const
virtual QString | longDescription() const
virtual QJsonObject | metaData() const
virtual QString | name() const
`(since 3.0)` virtual QRegularExpression | platformSpecification() const
virtual bool | provides(ExtensionSystem::PluginSpec *spec, const ExtensionSystem::PluginDependency &dependency) const
virtual QStringList | recommends() const
virtual QSet<ExtensionSystem::PluginSpec *> | recommendsSpecs() const
virtual bool | requiresAny(const QSet<ExtensionSystem::PluginSpec *> &plugins) const
virtual void | setArguments(const QStringList &arguments)
virtual void | setEnabledBySettings(bool value)
virtual ExtensionSystem::PluginSpec::State | state() const
virtual QString | url() const
virtual QString | vendor() const
virtual QString | vendorId() const
virtual 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

### `[virtual]` void PluginSpec::addArgument(const QString &argument)

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

### `[virtual]` ExtensionSystem::PluginSpec::PluginArgumentDescriptions PluginSpec::argumentDescriptions() const

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

### `[virtual]` QStringList PluginSpec::arguments() const

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

See also setArguments().

### `[virtual]` 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.

### `[virtual]` QString PluginSpec::compatVersion() const

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

### `[virtual]` QString PluginSpec::copyright() const

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

### `[virtual]` QList<ExtensionSystem::PluginDependency> PluginSpec::dependencies() const

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

### `[virtual]` 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().

### `[virtual]` QString PluginSpec::description() const

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

### `[virtual]` QString PluginSpec::displayName() const

Returns either DisplayName, name(), or id() if name() is empty. If all are empty, returns "<unknown>".

### `[virtual]` QString PluginSpec::documentationUrl() const

Returns the documentation URL where you can find the online manual about the plugin. This is valid after the PluginSpec::Read state is reached.

### `[virtual]` QString PluginSpec::errorString() const

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

### `[virtual]` Utils::FilePath PluginSpec::filePath() const

Returns the absolute path to the plugin.

### `[virtual]` bool PluginSpec::hasError() const

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

### `[virtual]` QString PluginSpec::id() const

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

### `[virtual]` bool PluginSpec::isAvailableForHostPlatform() const

Returns whether the plugin works on the host platform.

### `[virtual]` bool PluginSpec::isDeprecated() const

Returns whether the plugin has its deprecated flag set.

### `[virtual]` bool PluginSpec::isEffectivelyEnabled() const

Returns whether the plugin is loaded at startup.

See also isEnabledBySettings().

### `[virtual]` bool PluginSpec::isEnabledByDefault() const

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

### `[virtual]` 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().

### `[virtual]` bool PluginSpec::isEnabledIndirectly() const

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

### `[virtual]` bool PluginSpec::isExperimental() const

Returns whether the plugin has its experimental flag set.

### `[virtual]` bool PluginSpec::isForceDisabled() const

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

### `[virtual]` bool PluginSpec::isForceEnabled() const

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

### `[virtual]` bool PluginSpec::isRequired() const

Returns whether the plugin is required.

### `[virtual]` bool PluginSpec::isSoftLoadable() const

Returns whether the plugin is allowed to be loaded during runtime without a restart.

### `[virtual]` QString PluginSpec::license() const

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

### `[virtual]` Utils::FilePath PluginSpec::location() const

Returns the absolute path to the directory containing the plugin.

### `[virtual]` QString PluginSpec::longDescription() const

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

### `[virtual]` QJsonObject PluginSpec::metaData() const

Returns the plugin meta data.

### `[virtual]` QString PluginSpec::name() const

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

### `[virtual, since 3.0]` 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 3.0.

### `[virtual]` bool PluginSpec::provides(ExtensionSystem::PluginSpec *spec, const ExtensionSystem::PluginDependency &dependency) const

Returns whether the plugin spec can be used to fill the dependency of this plugin.

See also PluginSpec::dependencies().

### `[virtual]` QStringList PluginSpec::recommends() const

Returns the list of IDs of plugins that a user is recommended to enable if this one is enabled. This is valid after the PluginSpec::Read state is reached.

### `[virtual]` QSet<ExtensionSystem::PluginSpec *> PluginSpec::recommendsSpecs() const

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

See also PluginSpec::recommends().

### `[virtual]` bool PluginSpec::requiresAny(const QSet<ExtensionSystem::PluginSpec *> &plugins) const

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

### `[virtual]` void PluginSpec::setArguments(const QStringList &arguments)

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

See also arguments().

### `[virtual]` void PluginSpec::setEnabledBySettings(bool value)

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

See also isEnabledBySettings().

### `[virtual]` 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.

### `[virtual]` 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.

### `[virtual]` QString PluginSpec::vendor() const

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

### `[virtual]` QString PluginSpec::vendorId() const

Returns the display name of the plugins vendor. This is valid after the PluginSpec::Read state is reached.

### `[virtual]` QString PluginSpec::version() const

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