Extending Qt Creator Manual | IEditor

Extending Qt Creator Manual 4.3.0

# IEditor Class

(Core::IEditor)

The IEditor class is an interface for providing different editors for different file types. More...

Header: | #include <IEditor>
Inherits: | Core::IContext
Inherited By: | TextEditor::BaseTextEditor and VcsBase::VcsBaseSubmitEditor

- List of all members, including inherited members

## Public Functions

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

- 6 public functions inherited from Core::IContext

## Detailed Description

The IEditor class is an interface for providing different editors for different file types.

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 file, the EditorManager scans all EditorFactoryInterfaces for suitable editors. The selected EditorFactory is then asked to create an editor, which must implement this interface.

Guidelines for implementing:

- `displayName()` is used as a user visible description of the document (usually filename w/o path).
- `kind()` must be the same value as the `kind()` of the corresponding EditorFactory.
- If duplication is supported, you need to ensure that all duplicates return the same `file()`.
- QString `preferredMode()` const is the mode the editor manager should activate. Some editors use a special mode (such as Design mode).

See also Core::EditorFactoryInterface and Core::IContext.

## Member Function Documentation

### IEditor::IEditor(QObject *parent = 0)

Default constructs an instance of IEditor.

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

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

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

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

### bool IEditor::duplicateSupported() const

See also setDuplicateSupported().

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

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

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

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

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

See also duplicateSupported().

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