IEditor Classclass Core::IEditor
The IEditor class provides an interface for editing an open document in Qt Creator. More...
|virtual int||currentColumn() const|
|virtual int||currentLine() const|
|virtual Core::IDocument *||document() const = 0|
|virtual Core::IEditor *||duplicate()|
|virtual void||gotoLine(int line, int column = 0, bool centerLine = true)|
|virtual bool||isDesignModePreferred() const|
|virtual void||restoreState(const QByteArray &state)|
|virtual QByteArray||saveState() const|
|virtual QWidget *||toolBar() = 0|
IEditor instances are usually created by a corresponding IEditorFactory.
An IEditor instance provides an editor widget for a single IDocument via the IContext::widget() method. If the the editor type supports it, multiple editors can be opened for the same document. Multiple IEditor instances share ownership of the same IDocument instance in that case.
The IEditor::toolBar() is integrated into the toolbar above the editor widget, next to the document drop down.
Member Function Documentation
Creates an IEditor.
Implementations must create a corresponding document, or share an existing document with another IEditor.
Returns the current column in the document, if appropriate. The default implementation returns
0. Column numbers start at
0 for the first column.
Returns the current line in the document, if appropriate. The default implementation returns
0. Line numbers start at
1 for the first line.
[pure virtual] Core::IDocument *IEditor::document() const
Returns the document that is edited by this editor. The editor owns the document. If the editor supports splitting, all editors created with duplicate() share ownership of the document.
This must never return
[virtual] Core::IEditor *IEditor::duplicate()
Returns a duplicate of the editor, for example when the user splits the editor view. The default implementation returns
See also duplicateSupported().
Returns whether duplication is supported, for example when the user splits the editor view.
Goes to line and column in the document. If centerLine is
true, centers the line in the editor.
Line numbers start at
1 for the first line, column numbers start at
0 for the first column.
The default implementation does nothing.
Returns whether the document should be opened in the Design mode by default. This requires design mode to support that document type. The default implementation returns
[virtual] void IEditor::restoreState(const QByteArray &state)
Restores the state of the editor. The default implementation does nothing.
See also saveState().
[virtual] QByteArray IEditor::saveState() const
Returns the state of the editor, like scroll and cursor position, as a QByteArray. This is used for restoring the state for example after the document was closed (manually or automatically) and re-opened later. The default implementation returns an empty QByteArray.
See also restoreState().
Sets whether duplication is supported to duplicatesSupported.
The default is
[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.
© 2020 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.