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

@@ -1030,9 +1030,7 @@ public slots:
{
BaseTextEditor *textEditor = BaseTextEditor::currentTextEditor();
QTC_ASSERT(textEditor, return);
QPlainTextEdit *ed = textEditor->editorWidget();
QTC_ASSERT(ed, return);
QTextCursor cursor = ed->textCursor();
QTextCursor cursor = textEditor->textCursor();
QString functionName = cursor.selectedText();
if (functionName.isEmpty()) {
const QTextBlock block = cursor.block();
@@ -1098,11 +1096,10 @@ public slots:
void handleAddToWatchWindow()
{
// Requires a selection, but that's the only case we want anyway.
IEditor *editor = EditorManager::currentEditor();
BaseTextEditor *textEditor = qobject_cast<BaseTextEditor*>(editor);
BaseTextEditor *textEditor = BaseTextEditor::currentTextEditor();
if (!textEditor)
return;
QTextCursor tc = textEditor->editorWidget()->textCursor();
QTextCursor tc = textEditor->textCursor();
QString exp;
if (tc.hasSelection()) {
exp = tc.selectedText();