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:
@@ -62,23 +62,15 @@ static void moveCursorToEndOfName(QTextCursor *tc)
|
||||
// We cannot depend on this since CppEditor plugin code is internal and requires building the implementation files ourselves
|
||||
CPlusPlus::Symbol *AnalyzerUtils::findSymbolUnderCursor()
|
||||
{
|
||||
IEditor *editor = EditorManager::currentEditor();
|
||||
TextEditor::BaseTextEditor *editor = TextEditor::BaseTextEditor::currentTextEditor();
|
||||
if (!editor)
|
||||
return 0;
|
||||
TextEditor::BaseTextEditor *textEditor = qobject_cast<TextEditor::BaseTextEditor *>(editor);
|
||||
if (!textEditor)
|
||||
return 0;
|
||||
|
||||
TextEditor::BaseTextEditorWidget *editorWidget = textEditor->editorWidget();
|
||||
if (!editorWidget)
|
||||
return 0;
|
||||
|
||||
QTextCursor tc;
|
||||
tc = editorWidget->textCursor();
|
||||
QTextCursor tc = editor->textCursor();
|
||||
int line = 0;
|
||||
int column = 0;
|
||||
const int pos = tc.position();
|
||||
editorWidget->convertPosition(pos, &line, &column);
|
||||
editor->convertPosition(pos, &line, &column);
|
||||
|
||||
const CPlusPlus::Snapshot &snapshot = CppTools::CppModelManagerInterface::instance()->snapshot();
|
||||
CPlusPlus::Document::Ptr doc = snapshot.document(editor->document()->filePath());
|
||||
|
||||
Reference in New Issue
Block a user