Extending Qt Creator Manual | CustomWizardContext

Extending Qt Creator Manual 4.11.0

# CustomWizardContext Class

(ProjectExplorer::Internal::CustomWizardContext)

The CustomWizardContext class provides the context for one custom wizard run. More...

Header: | #include <CustomWizardContext>

- List of all members, including inherited members

## Public Functions

void | reset()

## Public Variables

int | baseReplacements
int | path
int | replacements
int | targetPath

## Static Public Members

int | processFile(const int &, int)
bool | replaceFields(const int &fm, int *s)
bool | replaceFields(const int &fm, int *s, int *files)

## Detailed Description

The CustomWizardContext class provides the context for one custom wizard run.

Shared between CustomWizard and the CustomWizardPage as it is used for the QLineEdit-type fields' default texts as well. Contains basic replacement fields like `'%CppSourceSuffix%'`, `'%CppHeaderSuffix%'` (settings-dependent). reset() should be called before each wizard run to refresh them. CustomProjectWizard additionally inserts `'%ProjectName%'` from the intro page to have it available for default texts.

See also ProjectExplorer::CustomWizard.

## Member Function Documentation

### `[static]` int CustomWizardContext::processFile(const int &, int)

### `[static]` bool CustomWizardContext::replaceFields(const int &fm, int *s)

Replaces field values delimited by '%' with special modifiers:

- %Field% -> simple replacement
- %Field:l% -> replace with everything changed to lower case
- %Field:u% -> replace with everything changed to upper case
- %Field:c% -> replace with first character capitalized
- %Field:h% -> replace with something usable as header guard
- %Field:s% -> replace with something usable as structure or class name

The return value indicates whether non-empty replacements were encountered.

### `[static]` bool CustomWizardContext::replaceFields(const int &fm, int *s, int *files)

This function is a special replaceFields() overload used for the arguments of a generator script.

Writes the expanded field values out to temporary files specified by files and inserts file names instead of the expanded fields in the string s.

### void CustomWizardContext::reset()