Line locator: Also work with editors that are derived from IEditor

IEditor has a concept of line and column number and goto line, thus this
can be done.

Change-Id: Ic2e3bdcfa2b1debf102afc21bfe9be667a0264c8
Reviewed-by: Eike Ziller <eike.ziller@digia.com>
This commit is contained in:
Daniel Teske
2014-01-10 18:25:59 +01:00
parent e485b439bc
commit 83c3b6c20a
4 changed files with 24 additions and 18 deletions

View File

@@ -36,6 +36,7 @@
#include <QActionGroup>
#include <QToolBar>
#include <QTextBlock>
using namespace Android;
using namespace Internal;
@@ -93,6 +94,17 @@ TextEditor::BaseTextEditorWidget *AndroidManifestEditor::textEditor() const
return widget()->textEditorWidget();
}
int AndroidManifestEditor::currentLine() const
{
return textEditor()->textCursor().blockNumber() + 1;
}
int AndroidManifestEditor::currentColumn() const
{
QTextCursor cursor = textEditor()->textCursor();
return cursor.position() - cursor.block().position() + 1;
}
void AndroidManifestEditor::changeEditorPage(QAction *action)
{
if (!widget()->setActivePage(static_cast<AndroidManifestEditorWidget::EditorPage>(action->data().toInt()))) {