IWizardFactory Class | Extending Qt Creator Manual

Extending Qt Creator Manual | IWizardFactory

Extending Qt Creator Manual 4.5.1

# IWizardFactory Class

(Core::IWizardFactory)

The class IWizardFactory is the base class for all wizard factories (for example shown in File | New). More...

Header: | #include <IWizardFactory>

- List of all members, including inherited members

## Public Types

typedef | FactoryCreator
enum | WizardFlag { PlatformIndependent, ForceCapitalLetterForFileName }
flags | WizardFlags
enum | WizardKind { FileWizard, ClassWizard, ProjectWizard }

## Public Functions

void | addRequiredFeature(const Id &feature)
QString | category() const
QString | description() const
QString | descriptionImage() const
QString | displayCategory() const
QString | displayName() const
WizardFlags | flags() const
QIcon | icon() const
QString | iconText() const
Id | id() const
virtual bool | isAvailable(Id platformId) const
WizardKind | kind() const
QSet<Id> | requiredFeatures() const
QString | runPath(const QString &defaultPath)
Utils::Wizard * | runWizard(const QString &path, QWidget *parent, Id platform, const QVariantMap &variables)
void | setCategory(const QString &category)
void | setDescription(const QString &description)
void | setDescriptionImage(const QString &descriptionImage)
void | setDisplayCategory(const QString &displayCategory)
void | setDisplayName(const QString &displayName)
void | setFlags(WizardFlags flags)
void | setIcon(const QIcon &icon)
void | setIconText(const QString &iconText)
void | setId(const Id id)
void | setRequiredFeatures(const QSet<Id> &featureSet)
void | setSupportedProjectTypes(const QSet<Id> &projectTypes)
QSet<Id> | supportedPlatforms() const
QSet<Id> | supportedProjectTypes() const

## Static Public Members

QSet<Id> | allAvailablePlatforms()
QList<IWizardFactory *> | allWizardFactories()
QWidget * | currentWizard()
QString | displayNameForPlatform(Id i)
bool | isWizardRunning()
void | registerFactoryCreator(const FactoryCreator &creator)
void | registerFeatureProvider(IFeatureProvider *provider)
void | requestNewItemDialog(const QString &title, const QList<IWizardFactory *> &factories, const QString &defaultLocation, const QVariantMap &extraVariables)

## Protected Functions

QSet<Id> | availableFeatures(Id platformId) const
QSet<Id> | pluginFeatures() const
virtual Utils::Wizard * | runWizardImpl(const QString &path, QWidget *parent, Id platform, const QVariantMap &variables) = 0

## Detailed Description

The class IWizardFactory is the base class for all wizard factories (for example shown in File | New).

The wizard interface is a very thin abstraction for the New... wizards. Basically it defines what to show to the user in the wizard selection dialogs, and a hook that is called if the user selects the wizard.

Wizards can then perform any operations they like, including showing dialogs and creating files. Often it is not necessary to create your own wizard from scratch, instead use one of the predefined wizards and adapt it to your needs.

To make your wizard known to the system, add your IWizardFactory instance to the plugin manager's object pool in your plugin's initialize function:

      bool MyPlugin::initialize(const QStringList &arguments, QString *errorString)
      {
          // ... do setup
          addAutoReleasedObject(new MyWizardFactory);
          // ... do more setup
      }

See also Core::BaseFileWizard and Core::StandardFileWizard.

## Member Type Documentation

### typedef IWizardFactory::FactoryCreator

### enum IWizardFactory::WizardFlag
flags IWizardFactory::WizardFlags

The WizardFlags type is a typedef for QFlags<WizardFlag>. It stores an OR combination of WizardFlag values.

### enum IWizardFactory::WizardKind

Used to specify what kind of objects the wizard creates. This information is used to show e.g. only wizards that create projects when selecting a New Project menu item.

Constant | Value | Description
--- | --- | ---
`Core::IWizardFactory::FileWizard` | `0x01` | The wizard creates one or more files.
`Core::IWizardFactory::ClassWizard` | ? | The wizard creates a new class (e.g. source+header files).
`Core::IWizardFactory::ProjectWizard` | `0x02` | The wizard creates a new project.

## Member Function Documentation

### void IWizardFactory::addRequiredFeature(const Id &feature)

### `[static]` QSet<Id> IWizardFactory::allAvailablePlatforms()

### `[static]` QList<IWizardFactory *> IWizardFactory::allWizardFactories()

### `[protected]` QSet<Id> IWizardFactory::availableFeatures(Id platformId) const

### QString IWizardFactory::category() const

Returns a category ID to add the wizard to.

See also setCategory().

### `[static]` QWidget *IWizardFactory::currentWizard()

### QString IWizardFactory::description() const

Returns a translated description to show when this wizard is selected in the dialog.

See also setDescription().

### QString IWizardFactory::descriptionImage() const

See also setDescriptionImage().

### QString IWizardFactory::displayCategory() const

Returns the translated string of the category, how it should appear in the dialog.

See also setDisplayCategory().

### QString IWizardFactory::displayName() const

Returns the translated name of the wizard, how it should appear in the dialog.

See also setDisplayName().

### `[static]` QString IWizardFactory::displayNameForPlatform(Id i)

### WizardFlags IWizardFactory::flags() const

See also setFlags().

### QIcon IWizardFactory::icon() const

Returns an icon to show in the wizard selection dialog.

See also setIcon().

### QString IWizardFactory::iconText() const

See also setIconText().

### Id IWizardFactory::id() const

Returns an arbitrary id that is used for sorting within the category.

See also setId().

### `[virtual]` bool IWizardFactory::isAvailable(Id platformId) const

### `[static]` bool IWizardFactory::isWizardRunning()

### WizardKind IWizardFactory::kind() const

Returns what kind of objects are created by the wizard.

See also Kind.

### `[protected]` QSet<Id> IWizardFactory::pluginFeatures() const

### `[static]` void IWizardFactory::registerFactoryCreator(const FactoryCreator &creator)

### `[static]` void IWizardFactory::registerFeatureProvider(IFeatureProvider *provider)

### `[static]` void IWizardFactory::requestNewItemDialog(const QString &title, const QList<IWizardFactory *> &factories, const QString &defaultLocation, const QVariantMap &extraVariables)

### QSet<Id> IWizardFactory::requiredFeatures() const

See also setRequiredFeatures().

### QString IWizardFactory::runPath(const QString &defaultPath)

### Utils::Wizard *IWizardFactory::runWizard(const QString &path, QWidget *parent, Id platform, const QVariantMap &variables)

### `[pure virtual protected]` Utils::Wizard *IWizardFactory::runWizardImpl(const QString &path, QWidget *parent, Id platform, const QVariantMap &variables)

### void IWizardFactory::setCategory(const QString &category)

See also category().

### void IWizardFactory::setDescription(const QString &description)

See also description().

### void IWizardFactory::setDescriptionImage(const QString &descriptionImage)

See also descriptionImage().

### void IWizardFactory::setDisplayCategory(const QString &displayCategory)

See also displayCategory().

### void IWizardFactory::setDisplayName(const QString &displayName)

See also displayName().

### void IWizardFactory::setFlags(WizardFlags flags)

See also flags().

### void IWizardFactory::setIcon(const QIcon &icon)

See also icon().

### void IWizardFactory::setIconText(const QString &iconText)

See also iconText().

### void IWizardFactory::setId(const Id id)

See also id().

### void IWizardFactory::setRequiredFeatures(const QSet<Id> &featureSet)

See also requiredFeatures().

### void IWizardFactory::setSupportedProjectTypes(const QSet<Id> &projectTypes)

See also supportedProjectTypes().

### QSet<Id> IWizardFactory::supportedPlatforms() const

### QSet<Id> IWizardFactory::supportedProjectTypes() const

See also setSupportedProjectTypes().