TextEditor: Introduce some convenience text accessors in the editor

And adjust users.

Change-Id: I9329257cfa5f3298731deb07c2881bc37d9a051d
Reviewed-by: Christian Stenger <christian.stenger@digia.com>
This commit is contained in:
hjk
2014-08-27 11:57:32 +02:00
parent d2c243464e
commit 2a5c602341
19 changed files with 111 additions and 104 deletions

View File

@@ -442,11 +442,10 @@ bool BaseTextDocument::save(QString *errorString, const QString &saveFileName, b
// When saving the current editor, make sure to maintain the cursor and scroll bar
// positions for undo
IEditor *currentEditor = EditorManager::currentEditor();
if (BaseTextEditor *editable = qobject_cast<BaseTextEditor*>(currentEditor)) {
if (editable->document() == this) {
editorWidget = editable->editorWidget();
QTextCursor cur = editorWidget->textCursor();
if (BaseTextEditor *editor = BaseTextEditor::currentTextEditor()) {
if (editor->document() == this) {
editorWidget = editor->editorWidget();
QTextCursor cur = editor->textCursor();
savedPosition = cur.position();
savedAnchor = cur.anchor();
savedVScrollBarValue = editorWidget->verticalScrollBar()->value();