Core::IEditor Class
class Core::IEditorIEditor 클래스는 Qt Creator 에서 열려 있는 문서를 편집하기 위한 인터페이스를 제공합니다. 더 보기...
| Header: | #include <coreplugin/editormanager/ieditor.h> |
| Inherits: | Core::IContext |
공개 함수
| IEditor() | |
| 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 = 0, bool centerLine = true) |
| virtual bool | isDesignModePreferred() const |
| virtual void | restoreState(const QByteArray &state) |
| virtual QByteArray | saveState() const |
| void | setDuplicateSupported(bool duplicatesSupported) |
| virtual QWidget * | toolBar() = 0 |
상세 설명
IEditor 인스턴스는 일반적으로 해당 IEditorFactory 에 의해 생성됩니다.
IEditor 인스턴스는 IContext::widget() 메서드를 통해 단일 IDocument 에 대한 편집기 위젯을 제공합니다. 편집기 유형이 이를 지원하는 경우, 동일한 문서에 대해 여러 편집기를 열 수 있습니다. 이 경우 여러 IEditor 인스턴스가 동일한 IDocument 인스턴스의 소유권을 공유합니다.
IEditor::toolBar()은 편집기 위젯 상단의 툴바, 문서 드롭다운 메뉴 옆에 통합되어 있습니다.
Core::IEditorFactory 및 Core::EditorManager도 참조하십시오 .
멤버 함수 문서
IEditor::IEditor()
IEditor를 생성합니다.
구현체는 해당 문서를 생성하거나, 기존 문서를 다른 IEditor와 공유해야 합니다.
[virtual] int IEditor::currentColumn() const
해당하는 경우, 문서의 현재 열을 반환합니다. 기본 구현은 0 를 반환합니다. 열 번호는 첫 번째 열의 경우 0 에서 시작합니다.
currentLine() 및 gotoLine()도 참조하십시오 .
[virtual] int IEditor::currentLine() const
해당하는 경우 문서의 현재 줄을 반환합니다. 기본 구현은 ` 0`를 반환합니다. 줄 번호는 첫 번째 줄의 경우 ` 1 `부터 시작합니다.
currentColumn() 및 gotoLine()도 참조하십시오 .
[pure virtual] Core::IDocument *IEditor::document() const
이 편집기가 편집하는 문서를 반환합니다. 편집기가 문서의 소유권을 가집니다. 편집기가 분할 기능을 지원하는 경우, duplicate()을 통해 생성된 모든 편집기가 문서의 소유권을 공유합니다.
이 메서드는 절대로 ` nullptr`를 반환해서는 안 됩니다.
[virtual] Core::IEditor *IEditor::duplicate()
예를 들어 사용자가 편집기 보기를 분할할 때와 같이, 편집기의 복사본을 반환합니다. 기본 구현은 nullptr 를 반환합니다.
duplicateSupported()도 참조하십시오 .
bool IEditor::duplicateSupported() const
사용자가 편집기 보기를 분할하는 경우 등, 중복 기능이 지원되는지 여부를 반환합니다.
duplicate() 및 setDuplicateSupported()도 참조하십시오 .
[virtual] void IEditor::gotoLine(int line, int column = 0, bool centerLine = true)
문서 내의 line 및 column 로 이동합니다. centerLine 가 true 일 경우, 편집기에서 해당 줄을 중앙 정렬합니다.
줄 번호는 첫 번째 줄부터 1 로 시작하고, 열 번호는 첫 번째 열부터 0 로 시작합니다.
기본 구현은 아무 작업도 수행하지 않습니다.
currentLine() 및 currentColumn()도 참조하십시오 .
[virtual] bool IEditor::isDesignModePreferred() const
문서가 기본적으로 디자인 모드로 열려야 하는지 여부를 반환합니다. 이를 위해서는 해당 문서 유형이 디자인 모드를 지원해야 합니다. 기본 구현은 ` false`를 반환합니다.
[virtual] void IEditor::restoreState(const QByteArray &state)
에디터의 state 을 복원합니다. 기본 구현은 아무 작업도 수행하지 않습니다.
saveState()도 참조하십시오 .
[virtual] QByteArray IEditor::saveState() const
스크롤 및 커서 위치와 같은 편집기의 상태를 ` QByteArray` 객체로 반환합니다. 이는 예를 들어 문서가 (수동 또는 자동으로) 닫힌 후 나중에 다시 열렸을 때 상태를 복원하는 데 사용됩니다. 기본 구현은 빈 ` QByteArray` 객체를 반환합니다.
restoreState()도 참조하십시오 .
void IEditor::setDuplicateSupported(bool duplicatesSupported)
중복 생성을 지원하는지 여부를 ` duplicatesSupported`로 설정합니다.
기본값은 ` false`입니다.
duplicate() 및 duplicateSupported()도 참조하십시오 .
[pure virtual] QWidget *IEditor::toolBar()
에디터용 도구 모음을 반환합니다.
에디터 툴바는 에디터 뷰의 상단에 위치합니다. 에디터 툴바는 상황에 따라 달라지며, 현재 에디터에 열려 있는 문서와 관련된 항목을 표시합니다.
Copyright © The Qt Company Ltd. and other contributors. 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.