forked from qt-creator/qt-creator
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:
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user