forked from qt-creator/qt-creator
TextEditors: Separate away methods that actually work on a document
Introduces ITextEditorDocument. This is part of a more general "use documents instead of editors whereever possible". It will allow to move to e.g. ITextEditor::openedTextDocumentContents() instead of ITextEditor::openedTextEditorsContents(). Change-Id: I5ebceaa257a0d2c3e8ac4ac51b9b08b6faa42487 Reviewed-by: David Schulz <david.schulz@digia.com>
This commit is contained in:
@@ -31,6 +31,7 @@
|
||||
|
||||
#include "basetextdocumentlayout.h"
|
||||
#include "basetexteditor.h"
|
||||
#include "convenience.h"
|
||||
#include "typingsettings.h"
|
||||
#include "storagesettings.h"
|
||||
#include "tabsettings.h"
|
||||
@@ -90,6 +91,21 @@ BaseTextDocument::~BaseTextDocument()
|
||||
delete d;
|
||||
}
|
||||
|
||||
QString BaseTextDocument::contents() const
|
||||
{
|
||||
return document()->toPlainText();
|
||||
}
|
||||
|
||||
QString BaseTextDocument::textAt(int pos, int length) const
|
||||
{
|
||||
return Convenience::textAt(QTextCursor(document()), pos, length);
|
||||
}
|
||||
|
||||
QChar BaseTextDocument::characterAt(int pos) const
|
||||
{
|
||||
return document()->characterAt(pos);
|
||||
}
|
||||
|
||||
QString BaseTextDocument::mimeType() const
|
||||
{
|
||||
return d->m_mimeType;
|
||||
|
||||
Reference in New Issue
Block a user