- Extending Qt Creator Manual
- IWizardFactory
- Extending Qt Creator Manual 6.0.2

# IWizardFactory Class

class Core::IWizardFactory

The IWizardFactory class is the base class for all wizard factories. More...

Header: | #include <coreplugin/iwizardfactory.h>
Inherited By: | Core::BaseFileWizardFactory

- List of all members, including inherited members

## Public Types

flags | WizardFlags
enum | WizardKind { FileWizard, ProjectWizard }

## Public Functions

QString | category() const
QString | description() const
QString | displayCategory() const
QString | displayName() const
QIcon | icon() const
Utils::Id | id() const
Core::IWizardFactory::WizardKind | kind() const
Utils::Wizard * | runWizard(const Utils::FilePath &path, QWidget *parent, Utils::Id platform, const QVariantMap &variables, bool showWizard = true)

## Detailed Description

Note: Instead of using this class, we recommend that you create JSON-based wizards, as instructed in Adding New Custom Wizards.

The wizard interface is a very thin abstraction for the wizards in File > New File or Project. 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. 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::BaseFileWizardFactory and Core::BaseFileWizard.

## Member Type Documentation

### 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::ProjectWizard` | `0x02` | The wizard creates a new project.

## Member Function Documentation

### QString IWizardFactory::category() const

Returns a category ID to add the wizard to.

### QString IWizardFactory::description() const

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

### QString IWizardFactory::displayCategory() const

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

### QString IWizardFactory::displayName() const

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

### QIcon IWizardFactory::icon() const

Returns an icon to show in the wizard selection dialog.

### Utils::Id IWizardFactory::id() const

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

### Core::IWizardFactory::WizardKind IWizardFactory::kind() const

Returns what kind of objects are created by the wizard.

### Utils::Wizard *IWizardFactory::runWizard(const Utils::FilePath &path, QWidget *parent, Utils::Id platform, const QVariantMap &variables, bool showWizard = true)

Creates the wizard that the user selected for execution on the operating system platform with variables.

Any dialogs the wizard opens should use the given parent. The path argument is a suggestion for the location where files should be created. The wizard should fill this in its path selection elements as a default path.