Extending Qt Creator Manual | TextDocument

Extending Qt Creator Manual 4.3.0

# TextDocument Class

(TextEditor::TextDocument)

Inherits: | Core::BaseTextDocument

- List of all members, including inherited members

## Public Functions

| TextDocument(Core::Id id = Core::Id())
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 QuickFixAssistProvider * | 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)

- 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 | openFinishedSuccessfully()
void | tabSettingsChanged()

- 6 signals inherited from Core::IDocument

## Static Public Members

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.

### `[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

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

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

See also setCompletionAssistProvider().

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

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

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

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

See also setExtraEncodingSettings().

### 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().

### TextMarks TextDocument::marks() const

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

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

### `[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]` QuickFixAssistProvider *TextDocument::quickFixAssistProvider() const

### `[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)

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

See also completionAssistProvider().

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

See also extraEncodingSettings().

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

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

### 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().

### 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)