IEditorFactory Class

class Core::IEditorFactory

The IEditorFactory class creates suitable editors for documents according to their MIME type. More...

Header: #include <coreplugin/editormanager/ieditorfactory.h>

Public Functions

IEditorFactory()
Core::IEditor *createEditor() const

Static Public Members

const Core::EditorFactoryList defaultEditorFactories(const Utils::MimeType &mimeType)
const Core::EditorFactoryList preferredEditorFactories(const QString &fileName)

Protected Functions

void setEditorCreator(const std::function<IEditor *()> &creator)

Detailed Description

Whenever a user wants to edit or create a document, the EditorManager scans all IEditorFactory instances for suitable editors. The selected IEditorFactory is then asked to create an editor.

Implementations should set the properties of the IEditorFactory subclass in their constructor.

IEditorFactory instances automatically register themselves in Qt Creator in their constructor.

See also Core::IEditor, Core::IDocument, and Core::EditorManager.

Member Function Documentation

IEditorFactory::IEditorFactory()

Creates an IEditorFactory.

Registers the IEditorFactory in Qt Creator.

Core::IEditor *IEditorFactory::createEditor() const

Creates an editor.

Uses the function set with setEditorCreator() to create the editor.

See also setEditorCreator().

[static] const Core::EditorFactoryList IEditorFactory::defaultEditorFactories(const Utils::MimeType &mimeType)

Returns all available editor factories for the mimeType in the default order (editor types ordered by MIME type hierarchy).

[static] const Core::EditorFactoryList IEditorFactory::preferredEditorFactories(const QString &fileName)

Returns the available editor factories for fileName in order of preference. That is the default order for the document's MIME type but with a user overridden default editor first, and the binary editor as the very first item if a text document is too large to be opened as a text file.

[protected] void IEditorFactory::setEditorCreator(const std::function<IEditor *()> &creator)

Sets the function that is used to create an editor instance in createEditor() to creator.

See also createEditor().