Extending Qt Creator Manual | IEditor

Extending Qt Creator Manual 4.12.3

# IEditor Class

(Core::IEditor)

The IEditor class is an interface for providing suitable editors for documents according to their MIME type. More...

Header: | #include <IEditor>
Inherits: | Core::IContext

- List of all members, including inherited members

## Public Functions

virtual int | currentColumn() const
virtual int | currentLine() const
virtual Core::IDocument * | document() const = 0
virtual Core::IEditor * | duplicate()
bool | duplicateSupported() const
virtual void | gotoLine(int line, int column = ..., bool centerLine = ...)
virtual bool | isDesignModePreferred() const
virtual bool | restoreState(const QByteArray &state)
virtual QByteArray | saveState() const
void | setDuplicateSupported(bool duplicatesSupported)
virtual QWidget * | toolBar() = 0

## Detailed Description

Classes that implement this interface are for example the editors for C++ files, UI files, and resource files.

Whenever a user wants to edit or create a document, the EditorManager scans all IEditorFactory interfaces for suitable editors. The selected IEditorFactory is then asked to create an editor, which must implement this interface.

See also Core::IEditorFactory and Core::EditorManager.

## Member Function Documentation

### `[virtual]` int IEditor::currentColumn() const

Returns the current column in the document.

### `[virtual]` int IEditor::currentLine() const

Returns the current line in the document.

### `[pure virtual]` Core::IDocument *IEditor::document() const

Returns the document to open in an editor.

### `[virtual]` Core::IEditor *IEditor::duplicate()

Duplicates the editor.

See also duplicateSupported().

### bool IEditor::duplicateSupported() const

Returns whether duplication is supported.

See also setDuplicateSupported().

### `[virtual]` void IEditor::gotoLine(int line, int column = ..., bool centerLine = ...)

Goes to line and column in the document. If centerLine is `true`, centers the line in the editor.

### `[virtual]` bool IEditor::isDesignModePreferred() const

Indicates whether the document should be opened in the Design mode. Returns `false` unless Design mode is preferred.

### `[virtual]` bool IEditor::restoreState(const QByteArray &state)

Restores the state of the document.

Returns `true` on success.

### `[virtual]` QByteArray IEditor::saveState() const

Saves the state of the document.

### void IEditor::setDuplicateSupported(bool duplicatesSupported)

Sets whether duplication is supported to duplicatesSupported.

See also duplicateSupported().

### `[pure virtual]` QWidget *IEditor::toolBar()

Returns the toolbar for the editor.

The editor toolbar is located at the top of the editor view. The editor toolbar is context sensitive and shows items relevant to the document currently open in the editor.