forked from qt-creator/qt-creator
QmlDesigner: add getLineInDocument() for convenience
Change-Id: I34f788e320fe4c38e3dbb55ba6d0bc1b8d9ba59a Reviewed-by: Thomas Hartmann <Thomas.Hartmann@theqtcompany.com>
This commit is contained in:
@@ -74,6 +74,7 @@ public:
|
|||||||
virtual QTextDocument *textDocument() const = 0;
|
virtual QTextDocument *textDocument() const = 0;
|
||||||
virtual QString text() const = 0;
|
virtual QString text() const = 0;
|
||||||
virtual QTextCursor textCursor() const = 0;
|
virtual QTextCursor textCursor() const = 0;
|
||||||
|
static int getLineInDocument(QTextDocument* document, int offset);
|
||||||
|
|
||||||
virtual void deactivateChangeSignals() = 0;
|
virtual void deactivateChangeSignals() = 0;
|
||||||
virtual void reactivateChangeSignals() = 0;
|
virtual void reactivateChangeSignals() = 0;
|
||||||
|
@@ -26,6 +26,7 @@
|
|||||||
#include "textmodifier.h"
|
#include "textmodifier.h"
|
||||||
|
|
||||||
#include <qmljs/qmljsmodelmanagerinterface.h>
|
#include <qmljs/qmljsmodelmanagerinterface.h>
|
||||||
|
#include <texteditor/convenience.h>
|
||||||
|
|
||||||
using namespace QmlDesigner;
|
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::Snapshot TextModifier::qmljsSnapshot()
|
||||||
{
|
{
|
||||||
QmlJS::ModelManagerInterface *modelManager = QmlJS::ModelManagerInterface::instance();
|
QmlJS::ModelManagerInterface *modelManager = QmlJS::ModelManagerInterface::instance();
|
||||||
|
Reference in New Issue
Block a user