Extending Qt Creator Manual | TextDocument

Extending Qt Creator Manual 4.6.0

# TextDocument Class

(TextEditor::TextDocument)

Inherits: | Core::BaseTextDocument

- List of all members, including inherited members

## Public Functions

| TextDocument(Core::Id id = Core::Id())
| ~TextDocument() override
bool | addMark(TextMark *mark)
void | autoIndent(const QTextCursor &cursor, QChar typedChar = QChar::Null)
void | autoReindent(const QTextCursor &cursor)
virtual QChar | characterAt(int pos) const
void | cleanWhitespace(const QTextCursor &cursor)
virtual CompletionAssistProvider * | completionAssistProvider() const
QTextDocument * | document() const
const ExtraEncodingSettings & | extraEncodingSettings() const
const FontSettings & | fontSettings() const
QTextCursor | indent(const QTextCursor &cursor, bool blockSelection = false, int column = 0, int *offset = 0)
Indenter * | indenter() const
TextMarks | marks() const
TextMarks | marksAt(int line) const
void | moveMark(TextMark *mark, int previousLine)
virtual QString | plainText() const
virtual IAssistProvider * | quickFixAssistProvider() const
virtual bool | reload(QString *errorString)
bool | reload(QString *errorString, const QString &realFileName)
bool | reload(QString *errorString, QTextCodec *codec)
void | removeMark(TextMark *mark)
void | removeMarkFromMarksCache(TextMark *mark)
void | setCompletionAssistProvider(CompletionAssistProvider *provider)
void | setExtraEncodingSettings(const ExtraEncodingSettings &extraEncodingSettings)
void | setFallbackSaveAsFileName(const QString &fallbackSaveAsFileName)
void | setFallbackSaveAsPath(const QString &fallbackSaveAsPath)
void | setFontSettings(const TextEditor::FontSettings &fontSettings)
void | setIndenter(Indenter *indenter)
bool | setPlainText(const QString &text)
void | setStorageSettings(const StorageSettings &storageSettings)
void | setSyntaxHighlighter(SyntaxHighlighter *highlighter)
void | setTabSettings(const TextEditor::TabSettings &tabSettings)
void | setTypingSettings(const TypingSettings &typingSettings)
const StorageSettings & | storageSettings() const
SyntaxHighlighter * | syntaxHighlighter() const
const TabSettings & | tabSettings() const
virtual QString | textAt(int pos, int length) const
virtual void | triggerPendingUpdates()
const TypingSettings & | typingSettings() const
QTextCursor | unindent(const QTextCursor &cursor, bool blockSelection = false, int column = 0, int *offset = 0)
void | updateMark(TextMark *mark)

## Reimplemented Public Functions

virtual void | checkPermissions() override
virtual QByteArray | contents() const override
virtual QString | fallbackSaveAsFileName() const override
virtual QString | fallbackSaveAsPath() const override
virtual bool | isFileReadOnly() const override
virtual bool | isModified() const override
virtual bool | isSaveAsAllowed() const override
virtual OpenResult | open(QString *errorString, const QString &fileName, const QString &realFileName) override
virtual bool | reload(QString *errorString, ReloadFlag flag, ChangeType type) override
virtual bool | save(QString *errorString, const QString &fileName, bool autoSave) override
virtual bool | setContents(const QByteArray &contents) override
virtual void | setFilePath(const Utils::FileName &newName) override
virtual bool | shouldAutoSave() const override

- 12 public functions inherited from Core::BaseTextDocument
- 33 public functions inherited from Core::IDocument

## Signals

void | aboutToOpen(const QString &fileName, const QString &realFileName)
void | contentsChangedWithPosition(int position, int charsRemoved, int charsAdded)
void | fontSettingsChanged()
void | markRemoved(TextMark *mark)
void | openFinishedSuccessfully()
void | tabSettingsChanged()

- 6 signals inherited from Core::IDocument

## Static Public Members

QAction * | createDiffAgainstCurrentFileAction(QObject *parent, const std::function<Utils::FileName() > &filePath)
TextDocument * | currentTextDocument()
QMap<QString, QString> | openedTextDocumentContents()
QMap<QString, QTextCodec *> | openedTextDocumentEncodings()

## Protected Functions

virtual void | applyFontSettings()

## Member Function Documentation

### TextDocument::TextDocument(Core::Id id = Core::Id())

Default constructs an instance of TextDocument.

### TextDocument::~TextDocument()

Destroys the instance of TextDocument.

### `[signal]` void TextDocument::aboutToOpen(const QString &fileName, const QString &realFileName)

### bool TextDocument::addMark(TextMark *mark)

### `[virtual protected]` void TextDocument::applyFontSettings()

### void TextDocument::autoIndent(const QTextCursor &cursor, QChar typedChar = QChar::Null)

### void TextDocument::autoReindent(const QTextCursor &cursor)

### `[virtual]` QChar TextDocument::characterAt(int pos) const

### `[override virtual]` void TextDocument::checkPermissions()

### void TextDocument::cleanWhitespace(const QTextCursor &cursor)

### `[virtual]` CompletionAssistProvider *TextDocument::completionAssistProvider() const

See also setCompletionAssistProvider().

### `[override virtual]` QByteArray TextDocument::contents() const

See also setContents().

### `[signal]` void TextDocument::contentsChangedWithPosition(int position, int charsRemoved, int charsAdded)

### `[static]` QAction *TextDocument::createDiffAgainstCurrentFileAction(QObject *parent, const std::function<Utils::FileName() > &filePath)

### `[static]` TextDocument *TextDocument::currentTextDocument()

### QTextDocument *TextDocument::document() const

### const ExtraEncodingSettings &TextDocument::extraEncodingSettings() const

See also setExtraEncodingSettings().

### `[override virtual]` QString TextDocument::fallbackSaveAsFileName() const

See also setFallbackSaveAsFileName().

### `[override virtual]` QString TextDocument::fallbackSaveAsPath() const

See also setFallbackSaveAsPath().

### const FontSettings &TextDocument::fontSettings() const

See also setFontSettings().

### `[signal]` void TextDocument::fontSettingsChanged()

### QTextCursor TextDocument::indent(const QTextCursor &cursor, bool blockSelection = false, int column = 0, int *offset = 0)

### Indenter *TextDocument::indenter() const

See also setIndenter().

### `[override virtual]` bool TextDocument::isFileReadOnly() const

### `[override virtual]` bool TextDocument::isModified() const

### `[override virtual]` bool TextDocument::isSaveAsAllowed() const

### `[signal]` void TextDocument::markRemoved(TextMark *mark)

### TextMarks TextDocument::marks() const

### TextMarks TextDocument::marksAt(int line) const

### void TextDocument::moveMark(TextMark *mark, int previousLine)

### `[override virtual]` OpenResult TextDocument::open(QString *errorString, const QString &fileName, const QString &realFileName)

### `[signal]` void TextDocument::openFinishedSuccessfully()

### `[static]` QMap<QString, QString> TextDocument::openedTextDocumentContents()

### `[static]` QMap<QString, QTextCodec *> TextDocument::openedTextDocumentEncodings()

### `[virtual]` QString TextDocument::plainText() const

See also setPlainText().

### `[virtual]` IAssistProvider *TextDocument::quickFixAssistProvider() const

### `[override virtual]` bool TextDocument::reload(QString *errorString, ReloadFlag flag, ChangeType type)

### `[virtual]` bool TextDocument::reload(QString *errorString)

### bool TextDocument::reload(QString *errorString, const QString &realFileName)

### bool TextDocument::reload(QString *errorString, QTextCodec *codec)

### void TextDocument::removeMark(TextMark *mark)

### void TextDocument::removeMarkFromMarksCache(TextMark *mark)

### `[override virtual]` bool TextDocument::save(QString *errorString, const QString &fileName, bool autoSave)

### void TextDocument::setCompletionAssistProvider(CompletionAssistProvider *provider)

See also completionAssistProvider().

### `[override virtual]` bool TextDocument::setContents(const QByteArray &contents)

See also contents().

### void TextDocument::setExtraEncodingSettings(const ExtraEncodingSettings &extraEncodingSettings)

See also extraEncodingSettings().

### void TextDocument::setFallbackSaveAsFileName(const QString &fallbackSaveAsFileName)

See also fallbackSaveAsFileName().

### void TextDocument::setFallbackSaveAsPath(const QString &fallbackSaveAsPath)

See also fallbackSaveAsPath().

### `[override virtual]` void TextDocument::setFilePath(const Utils::FileName &newName)

### void TextDocument::setFontSettings(const TextEditor::FontSettings &fontSettings)

See also fontSettings().

### void TextDocument::setIndenter(Indenter *indenter)

See also indenter().

### bool TextDocument::setPlainText(const QString &text)

See also plainText().

### void TextDocument::setStorageSettings(const StorageSettings &storageSettings)

See also storageSettings().

### void TextDocument::setSyntaxHighlighter(SyntaxHighlighter *highlighter)

See also syntaxHighlighter().

### void TextDocument::setTabSettings(const TextEditor::TabSettings &tabSettings)

See also tabSettings().

### void TextDocument::setTypingSettings(const TypingSettings &typingSettings)

See also typingSettings().

### `[override virtual]` bool TextDocument::shouldAutoSave() const

### const StorageSettings &TextDocument::storageSettings() const

See also setStorageSettings().

### SyntaxHighlighter *TextDocument::syntaxHighlighter() const

See also setSyntaxHighlighter().

### const TabSettings &TextDocument::tabSettings() const

See also setTabSettings().

### `[signal]` void TextDocument::tabSettingsChanged()

### `[virtual]` QString TextDocument::textAt(int pos, int length) const

### `[virtual]` void TextDocument::triggerPendingUpdates()

### const TypingSettings &TextDocument::typingSettings() const

See also setTypingSettings().

### QTextCursor TextDocument::unindent(const QTextCursor &cursor, bool blockSelection = false, int column = 0, int *offset = 0)

### void TextDocument::updateMark(TextMark *mark)