Extending Qt Creator Manual | Project

Extending Qt Creator Manual 4.6.2

# Project Class

(ProjectExplorer::Project)

The Project class implements a project node in the project explorer. More...

Header: | #include <Project>

- List of all members, including inherited members

## Public Types

enum | ModelRoles { FilePathRole, EnabledRole, isParsingRole }
enum | RestoreResult { Ok, Error, UserAbort }

## Public Functions

| Project(const QString &mimeType, const Utils::FileName &fileName, const ProjectDocument::ProjectCallback &callback = {})
| ~Project() override
void | aboutToRemoveProjectConfiguration(ProjectExplorer::ProjectConfiguration *pc)
void | aboutToRemoveTarget(ProjectExplorer::Target *target)
void | aboutToSaveSettings()
void | activeProjectConfigurationChanged(ProjectExplorer::ProjectConfiguration *pc)
Target * | activeTarget() const
void | activeTargetChanged(ProjectExplorer::Target *target)
void | addTarget(Target *target)
void | addedProjectConfiguration(ProjectExplorer::ProjectConfiguration *pc)
void | addedTarget(ProjectExplorer::Target *target)
virtual void | configureAsExampleProject(const QSet<Core::Id> &platforms)
ContainerNode * | containerNode() const
Target * | createTarget(Kit *k)
QString | displayName() const
Core::IDocument * | document() const
EditorConfiguration * | editorConfiguration() const
void | fileListChanged()
Utils::FileNameList | files(const NodeMatcher &matcher) const
virtual QStringList | filesGeneratedFrom(const QString &sourceFile) const
bool | hasActiveBuildSettings() const
bool | hasParsingData() const
Core::Id | id() const
bool | isKnownFile(const Utils::FileName &filename) const
bool | isParsing() const
virtual bool | knowsAllBuildExecutables() const
Utils::MacroExpander * | macroExpander() const
QString | mimeType() const
QVariant | namedSettings(const QString &name) const
virtual bool | needsConfiguration() const
virtual bool | needsSpecialDeployment() const
void | parsingFinished(bool success)
void | parsingStarted()
Kit::Predicate | preferredKitPredicate() const
Core::Context | projectContext() const
Utils::FileName | projectDirectory() const
Utils::FileName | projectFilePath() const
virtual ProjectImporter * | projectImporter() const
Core::Context | projectLanguages() const
void | projectLanguagesUpdated()
bool | removeTarget(Target *target)
void | removedProjectConfiguration(ProjectExplorer::ProjectConfiguration *pc)
void | removedTarget(ProjectExplorer::Target *target)
Kit::Predicate | requiredKitPredicate() const
virtual bool | requiresTargetPanel() const
RestoreResult | restoreSettings(QString *errorMessage)
Target * | restoreTarget(const QVariantMap &data)
virtual ProjectNode * | rootProjectNode() const
void | saveSettings()
void | setNamedSettings(const QString &name, const QVariant &value)
void | settingsLoaded()
void | setup(QList<const BuildInfo *> infoList)
virtual bool | supportsKit(const Kit *k, QString *errorMessage = nullptr) const
Target * | target(Core::Id id) const
Target * | target(Kit *k) const
QList<Target *> | targets() const
virtual QVariantMap | toMap() const

## Static Public Members

bool | copySteps(Target *sourceTarget, Target *newTarget)
QString | makeUnique(const QString &preferredName, const QStringList &usedNames)
Utils::FileName | projectDirectory(const Utils::FileName &top)

## Protected Functions

void | addProjectLanguage(Core::Id id)
void | createTargetFromMap(const QVariantMap &map, int index)
void | emitParsingFinished(bool success)
void | emitParsingStarted()
virtual RestoreResult | fromMap(const QVariantMap &map, QString *errorMessage)
virtual void | projectLoaded()
void | removeProjectLanguage(Core::Id id)
void | setDisplayName(const QString &name)
void | setId(Core::Id id)
void | setPreferredKitPredicate(const Kit::Predicate &predicate)
void | setProjectLanguage(Core::Id id, bool enabled)
void | setProjectLanguages(Core::Context language)
void | setRequiredKitPredicate(const Kit::Predicate &predicate)
void | setRootProjectNode(ProjectNode *root)
virtual bool | setupTarget(Target *t)

## Detailed Description

The Project class implements a project node in the project explorer.

## Member Type Documentation

### enum Project::ModelRoles

### enum Project::RestoreResult

## Member Function Documentation

### Project::Project(const QString &mimeType, const Utils::FileName &fileName, const ProjectDocument::ProjectCallback &callback = {})

Copy constructor.

### Project::~Project()

Destroys the instance of Project.

### void Project::aboutToRemoveProjectConfiguration(ProjectExplorer::ProjectConfiguration *pc)

### void Project::aboutToRemoveTarget(ProjectExplorer::Target *target)

### void Project::aboutToSaveSettings()

### void Project::activeProjectConfigurationChanged(ProjectExplorer::ProjectConfiguration *pc)

### Target *Project::activeTarget() const

### void Project::activeTargetChanged(ProjectExplorer::Target *target)

### `[protected]` void Project::addProjectLanguage(Core::Id id)

### void Project::addTarget(Target *target)

### void Project::addedProjectConfiguration(ProjectExplorer::ProjectConfiguration *pc)

### void Project::addedTarget(ProjectExplorer::Target *target)

### `[virtual]` void Project::configureAsExampleProject(const QSet<Core::Id> &platforms)

### ContainerNode *Project::containerNode() const

### `[static]` bool Project::copySteps(Target *sourceTarget, Target *newTarget)

### Target *Project::createTarget(Kit *k)

### `[protected]` void Project::createTargetFromMap(const QVariantMap &map, int index)

### QString Project::displayName() const

See also setDisplayName().

### Core::IDocument *Project::document() const

### EditorConfiguration *Project::editorConfiguration() const

### `[protected]` void Project::emitParsingFinished(bool success)

### `[protected]` void Project::emitParsingStarted()

### void Project::fileListChanged()

### Utils::FileNameList Project::files(const NodeMatcher &matcher) const

### `[virtual]` QStringList Project::filesGeneratedFrom(const QString &sourceFile) const

### `[virtual protected]` RestoreResult Project::fromMap(const QVariantMap &map, QString *errorMessage)

### bool Project::hasActiveBuildSettings() const

### bool Project::hasParsingData() const

### Core::Id Project::id() const

See also setId().

### bool Project::isKnownFile(const Utils::FileName &filename) const

### bool Project::isParsing() const

### `[virtual]` bool Project::knowsAllBuildExecutables() const

### Utils::MacroExpander *Project::macroExpander() const

### `[static]` QString Project::makeUnique(const QString &preferredName, const QStringList &usedNames)

### QString Project::mimeType() const

### QVariant Project::namedSettings(const QString &name) const

See also setNamedSettings().

### `[virtual]` bool Project::needsConfiguration() const

### `[virtual]` bool Project::needsSpecialDeployment() const

### void Project::parsingFinished(bool success)

### void Project::parsingStarted()

### Kit::Predicate Project::preferredKitPredicate() const

See also setPreferredKitPredicate().

### Core::Context Project::projectContext() const

### Utils::FileName Project::projectDirectory() const

Returns the directory that contains the project.

This includes the absolute path.

### `[static]` Utils::FileName Project::projectDirectory(const Utils::FileName &top)

Returns the directory that contains the file top.

This includes the absolute path.

### Utils::FileName Project::projectFilePath() const

### `[virtual]` ProjectImporter *Project::projectImporter() const

### Core::Context Project::projectLanguages() const

See also setProjectLanguages().

### void Project::projectLanguagesUpdated()

### `[virtual protected]` void Project::projectLoaded()

### `[protected]` void Project::removeProjectLanguage(Core::Id id)

### bool Project::removeTarget(Target *target)

### void Project::removedProjectConfiguration(ProjectExplorer::ProjectConfiguration *pc)

### void Project::removedTarget(ProjectExplorer::Target *target)

### Kit::Predicate Project::requiredKitPredicate() const

See also setRequiredKitPredicate().

### `[virtual]` bool Project::requiresTargetPanel() const

### RestoreResult Project::restoreSettings(QString *errorMessage)

### Target *Project::restoreTarget(const QVariantMap &data)

### `[virtual]` ProjectNode *Project::rootProjectNode() const

See also setRootProjectNode().

### void Project::saveSettings()

### `[protected]` void Project::setDisplayName(const QString &name)

See also displayName().

### `[protected]` void Project::setId(Core::Id id)

See also id().

### void Project::setNamedSettings(const QString &name, const QVariant &value)

See also namedSettings().

### `[protected]` void Project::setPreferredKitPredicate(const Kit::Predicate &predicate)

See also preferredKitPredicate().

### `[protected]` void Project::setProjectLanguage(Core::Id id, bool enabled)

### `[protected]` void Project::setProjectLanguages(Core::Context language)

See also projectLanguages().

### `[protected]` void Project::setRequiredKitPredicate(const Kit::Predicate &predicate)

See also requiredKitPredicate().

### `[protected]` void Project::setRootProjectNode(ProjectNode *root)

See also rootProjectNode().

### void Project::settingsLoaded()

### void Project::setup(QList<const BuildInfo *> infoList)

### `[virtual protected]` bool Project::setupTarget(Target *t)

### `[virtual]` bool Project::supportsKit(const Kit *k, QString *errorMessage = nullptr) const

### Target *Project::target(Core::Id id) const

### Target *Project::target(Kit *k) const

### QList<Target *> Project::targets() const

### `[virtual]` QVariantMap Project::toMap() const

Serializes all data into a QVariantMap.

This map is then saved in the .user file of the project. Just put all your data into the map.

Note: Do not forget to call your base class' toMap function.

Note: Do not forget to call setActiveBuildConfiguration when creating new build configurations.