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:
@@ -113,12 +113,11 @@ void ClangFormat::formatFile()
|
||||
|
||||
void ClangFormat::formatSelectedText()
|
||||
{
|
||||
TextEditor::BaseTextEditor *editor
|
||||
= qobject_cast<TextEditor::BaseTextEditor *>(Core::EditorManager::currentEditor());
|
||||
TextEditor::BaseTextEditor *editor = TextEditor::BaseTextEditor::currentTextEditor();
|
||||
if (!editor)
|
||||
return;
|
||||
|
||||
QTextCursor tc = editor->editorWidget()->textCursor();
|
||||
QTextCursor tc = editor->textCursor();
|
||||
if (tc.hasSelection()) {
|
||||
const int offset = tc.selectionStart();
|
||||
const int length = tc.selectionEnd() - offset;
|
||||
|
||||
Reference in New Issue
Block a user