- Extending Qt Creator Manual
- QtCreator
- IDocumentFactory
- Extending Qt Creator Manual 20.0.0-beta1

# Core::IDocumentFactory Class

class Core::IDocumentFactory

The IDocumentFactory class is used to open files that are not opened in an editor. More...

Header: | `#include <coreplugin/idocumentfactory.cpp>`

- List of all members, including inherited members

## Public Functions

void | addMimeType(const QString &mimeType)
void | addMimeType(const char *mimeType)
bool | isProjectFactory() const
Core::IDocument * | open(const Utils::FilePath &filePath)
void | setIsProjectFactory(bool isProjectFactory)
void | setMimeTypes(const QStringList &mimeTypes)
void | setOpener(const Core::IDocumentFactory::Opener &opener)

## Detailed Description

## Member Function Documentation

### void IDocumentFactory::addMimeType(const QString &mimeType)

Adds the MIME type with name mimeType to the list of mime types that this factory can open.

### void IDocumentFactory::addMimeType(const char *mimeType)

Adds the mimeType to the list of mime types that this factory can open.

### bool IDocumentFactory::isProjectFactory() const

Returns whether this factory is used to open projects.

See also setIsProjectFactory().

### Core::IDocument *IDocumentFactory::open(const Utils::FilePath &filePath)

Opens the file at filePath.

This uses the opener function set by setOpener() to open the file. Returns the document that was opened or `nullptr` if an error occurred.

See also setOpener().

### void IDocumentFactory::setIsProjectFactory(bool isProjectFactory)

Sets whether this factory is used to open projects to isProjectFactory.

Factories that are not used to open projects are considered when the user triggers File > Open File.

See also isProjectFactory().

### void IDocumentFactory::setMimeTypes(const QStringList &mimeTypes)

Sets the mimeTypes that this factory can open.

### void IDocumentFactory::setOpener(const Core::IDocumentFactory::Opener &opener)

Sets the opener function that is called to open a file.