Commit 81bdb9cd authored by Tim Jenssen's avatar Tim Jenssen
Browse files

QmlDesigner: add getLineInDocument() for convenience



Change-Id: I34f788e320fe4c38e3dbb55ba6d0bc1b8d9ba59a
Reviewed-by: default avatarThomas Hartmann <Thomas.Hartmann@theqtcompany.com>
parent 9844cd24
......@@ -74,6 +74,7 @@ public:
virtual QTextDocument *textDocument() const = 0;
virtual QString text() const = 0;
virtual QTextCursor textCursor() const = 0;
static int getLineInDocument(QTextDocument* document, int offset);
virtual void deactivateChangeSignals() = 0;
virtual void reactivateChangeSignals() = 0;
......
......@@ -26,6 +26,7 @@
#include "textmodifier.h"
#include <qmljs/qmljsmodelmanagerinterface.h>
#include <texteditor/convenience.h>
using namespace QmlDesigner;
......@@ -33,6 +34,14 @@ TextModifier::~TextModifier()
{
}
int TextModifier::getLineInDocument(QTextDocument *document, int offset)
{
int line = -1;
int column = -1;
TextEditor::Convenience::convertPosition(document, offset, &line, &column);
return line;
}
QmlJS::Snapshot TextModifier::qmljsSnapshot()
{
QmlJS::ModelManagerInterface *modelManager = QmlJS::ModelManagerInterface::instance();
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment