Extending Qt Creator Manual | PluginSpec

Extending Qt Creator Manual 4.4.0

# PluginSpec 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 <PluginSpec>

- List of all members, including inherited members

## Public Types

typedef | PluginArgumentDescriptions
enum | State { Invalid, Read, Resolved, Loaded, ..., Deleted }

## Public Functions

void | addArgument(const QString &argument)
PluginArgumentDescriptions | argumentDescriptions() const
QStringList | arguments() const
QString | category() const
QString | compatVersion() const
QString | copyright() const
QVector<PluginDependency> | dependencies() const
QHash<PluginDependency, 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 | isHiddenByDefault() const
bool | isRequired() const
QString | license() const
QString | location() const
QJsonObject | metaData() const
QString | name() const
QRegExp | platformSpecification() const
IPlugin * | plugin() const
bool | provides(const QString &pluginName, const QString &version) const
bool | requiresAny(const QSet<PluginSpec *> &plugins) const
void | setArguments(const QStringList &arguments)
State | state() const
QString | url() const
QString | vendor() const
QString | version() const

## Detailed Description

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

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

### typedef PluginSpec::PluginArgumentDescriptions

### 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.

### PluginArgumentDescriptions PluginSpec::argumentDescriptions() const

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

### QStringList PluginSpec::arguments() const

Command line arguments specific to the plugin. Set at startup.

See also setArguments().

### QString PluginSpec::category() const

The category that the plugin belongs to. Categories are groups of plugins which allow for keeping them together in the UI. Returns an empty string if the plugin does not belong to a category.

### QString PluginSpec::compatVersion() const

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

### QString PluginSpec::copyright() const

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

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

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

### QHash<PluginDependency, 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

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

### QString PluginSpec::errorString() const

Detailed, possibly multi-line, error description in case of an error.

### QString PluginSpec::filePath() const

The absolute path to the plugin XML description file (including the file name) this PluginSpec corresponds to.

### bool PluginSpec::hasError() const

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

### bool PluginSpec::isAvailableForHostPlatform() const

### bool PluginSpec::isEffectivelyEnabled() const

Returns whether the plugin is loaded at startup.

See also PluginSpec::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 install 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 PluginSpec::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::isHiddenByDefault() const

### bool PluginSpec::isRequired() const

### QString PluginSpec::license() const

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

### QString PluginSpec::location() const

The absolute path to the directory containing the plugin XML description file this PluginSpec corresponds to.

### QJsonObject PluginSpec::metaData() const

### QString PluginSpec::name() const

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

### QRegExp PluginSpec::platformSpecification() const

A QRegExp matching the platforms this plugin works on. An empty pattern implies all platforms.

This function was introduced in Qt 3.0.

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

The corresponding IPlugin instance, if the plugin library has already been successfully loaded, i.e. 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<PluginSpec *> &plugins) const

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

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

See also arguments().

### State PluginSpec::state() const

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

### QString PluginSpec::url() const

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

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

### QString PluginSpec::version() const

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