- Extending Qt Creator Manual
- QtCreator
- EditorManager
- Extending Qt Creator Manual 13.0.0

# EditorManager Class

class Core::EditorManager

The EditorManager class manages the editors created for files according to their MIME type. More...

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

- List of all members, including inherited members

## Public Functions

void | aboutToSave(Core::IDocument *document)
void | autoSaved()
void | currentDocumentStateChanged()
void | currentEditorAboutToChange(Core::IEditor *editor)
void | documentClosed(Core::IDocument *document)
void | documentOpened(Core::IDocument *document)
void | documentStateChanged(Core::IDocument *document)
void | editorAboutToClose(Core::IEditor *editor)
void | editorOpened(Core::IEditor *editor)
void | editorsClosed(QList<Core::IEditor *> editors)
void | saved(Core::IDocument *document)

## Static Public Members

bool | closeAllEditors(bool askAboutModifiedEditors = true)
void | closeOtherDocuments()
void | goBackInNavigationHistory()
void | goForwardInNavigationHistory()
void | gotoOtherSplit()
IDocument::ReloadSetting | reloadSetting()
void | revertToSaved()
void | saveDocumentAs()
void | splitSideBySide()

## Detailed Description

Whenever a user wants to edit or create a file, the EditorManager scans all IEditorFactory interfaces for suitable editors. The selected IEditorFactory is then asked to create an editor, as determined by the MIME type of the file.

Users can split the editor view or open the editor in a new window when to work on and view multiple files on the same screen or on multiple screens. For more information, see Splitting the Editor View.

Plugins use the EditorManager to open documents in editors or close them, and to get notified when documents are opened, closed or saved.

## Member Function Documentation

### void EditorManager::aboutToSave(Core::IDocument *document)

This signal is emitted before the document is saved.

### void EditorManager::autoSaved()

This signal is emitted after auto-save was triggered.

### `[static]` bool EditorManager::closeAllEditors(bool askAboutModifiedEditors = true)

Closes all open editors. If askAboutModifiedEditors is `true`, prompts users to save their changes before closing the editors.

Returns whether all editors were closed.

### `[static]` void EditorManager::closeOtherDocuments()

Closes all open documents except the current document.

### void EditorManager::currentDocumentStateChanged()

This signal is emitted when the meta data of the current document, for example file name or modified state, changed.

See also IDocument::changed().

### void EditorManager::currentEditorAboutToChange(Core::IEditor *editor)

This signal is emitted before the current editor changes to editor.

### void EditorManager::documentClosed(Core::IDocument *document)

This signal is emitted after the document closed, but before it is deleted.

### void EditorManager::documentOpened(Core::IDocument *document)

This signal is emitted after the first editor for document opened in an editor view.

### void EditorManager::documentStateChanged(Core::IDocument *document)

This signal is emitted when the meta data of the document, for example file name or modified state, changed.

See also IDocument::changed().

### void EditorManager::editorAboutToClose(Core::IEditor *editor)

This signal is emitted before editor is closed. This can be used to free resources that were allocated for the editor separately from the editor itself. It cannot be used to prevent the editor from closing. See addCloseEditorListener() for that.

Usually the more appropriate signal to listen to is documentClosed().

See also addCloseEditorListener().

### void EditorManager::editorOpened(Core::IEditor *editor)

This signal is emitted after a new editor was opened in an editor view.

Usually the more appropriate signal to listen to is documentOpened().

### void EditorManager::editorsClosed(QList<Core::IEditor *> editors)

This signal is emitted after the editors closed, but before they are deleted.

Usually the more appropriate signal to listen to is documentClosed().

### `[static]` void EditorManager::goBackInNavigationHistory()

Goes back in the navigation history.

See also goForwardInNavigationHistory() and addCurrentPositionToNavigationHistory().

### `[static]` void EditorManager::goForwardInNavigationHistory()

Goes forward in the navigation history.

See also goBackInNavigationHistory() and addCurrentPositionToNavigationHistory().

### `[static]` void EditorManager::gotoOtherSplit()

Moves focus to another split, creating it if necessary. If there's no split and no other window, a side-by-side split is created. If the current window is split, focus is moved to the next split within this window, cycling. If the current window is not split, focus is moved to the next window.

### `[static]` IDocument::ReloadSetting EditorManager::reloadSetting()

Returns reload behavior settings.

### `[static]` void EditorManager::revertToSaved()

Reverts the current document to its last saved state.

### `[static]` void EditorManager::saveDocumentAs()

Saves the current document under a different file name.

### void EditorManager::saved(Core::IDocument *document)

This signal is emitted after the document was saved.

### `[static]` void EditorManager::splitSideBySide()

Splits the editor view horizontally into adjacent views.