group lveditqmljs

Library used for extending and interacting with qml projects.

Summary

Members Descriptions
classlv::CodeQmlHandler Main code handler for the qml extension.
classlv::DocumentQmlInfo::ValueReference Contains a reference to a value within a parsed qml document.
classlv::DocumentQmlInfo::ASTReference Reference to an AST node within the parsed qml document.
classlv::DocumentQmlInfo::Message Message information containing parsing status.
classlv::DocumentQmlInfo Contains parsed information about a Project qml document.
classlv::DocumentQmlObject::FunctionValue Stores information about a QmlObject function.
classlv::DocumentQmlObject Stores information about a QmlObject from a document.
classlv::DocumentQmlScope::Import Import data associated with a lv::DocumentQmlScope.
classlv::DocumentQmlScope Imports and import data for a lv::ProjectDocument.
classlv::DocumentQmlValueObjects::RangeItem Base range item acting as a node in the hierarchy.
classlv::DocumentQmlValueObjects::RangeProperty Property range item inside the ierarchy.
classlv::DocumentQmlValueObjects::RangeObject Object range item inside the hierarchy.
classlv::DocumentQmlValueObjects Contains the ierarchy of Qml objects and a reference to their AST.
classlv::PluginInfoExtractor Extracts plugin information from a given plugin path.
classlv::ProjectQmlExtension Main object used throughout qml extension plugin.
classlv::ProjectQmlScope Contains all the loaded plugins of a project.
classlv::QmlCompletionContext Contains a qml code completion context.
classlv::QmlDeclaration Holds a qml property declaration.
classlv::QmlEditFragment An editing fragment for a lv::ProjectDocument.

class lv::CodeQmlHandler

class lv::CodeQmlHandler
  : public lv::AbstractCodeHandler

Main code handler for the qml extension.

Handles code completion, palette control, property and item searching.

Summary

Members Descriptions
public explicitCodeQmlHandler(ViewEngine* engine,Project* project,QmlJsSettings * settings,ProjectQmlExtension* projectHandler,DocumentHandler* handler) CodeQmlHandler constructor.
public~CodeQmlHandler() CodeQmlHandler destructor.
public virtual voidassistCompletion(const QTextCursor & cursor,const QChar & insertion,bool manuallyTriggered,CodeCompletionModel* model,QTextCursor & cursorChange) Implementation of code completion assist.
public virtual voidsetDocument(ProjectDocument* document) Assints the document that will be used by this class.
public virtual voiddocumentContentsChanged(int position,int charsRemoved,int charsAdded) DocumentContentsChanged handler.
public virtual voidrehighlightBlock(const QTextBlock & block) Calls a new rehighlight on the specified block.
public virtual QPair< int, int >contextBlock(int position) Returns the block starting position and end position.
public QList<lv::QmlDeclaration::Ptr>getDeclarations(const QTextCursor & cursor) Get a list of declarations from a specific cursor.
public boolfindDeclarationValue(int position,int length,int & valuePosition,int & valueEnd) Given a declaration identifier position and lenght, get the valuePosition and valueEnd for that declaration.
publicQmlEditFragment*createInjectionChannel(QmlDeclaration::Ptrproperty,QObject * runtime) Creates an injection channel between a declaration and the runtime.
public booladdEditingFragment(QmlEditFragment* edit) Adds an editing fragment to the current document.
public voidremoveEditingFragment(QmlEditFragment* edit) Removes an editing fragment from this document.
public inline QmlJsSettings *settings() Returns the settings associated with this object.
publicQmlEditFragment*findEditFragment(CodePalette* palette)
publicQmlEditFragment*findEditFragmentIn(QmlEditFragment* parent,CodePalette* palette)
{slot} public lv::QmlCursorInfo *cursorInfo(int position,int length) Receive different qml based information about a given cursor position.
{slot} publiclv::QmlEditFragment*openConnection(int position,QObject * currentApp)
{slot} publiclv::QmlEditFragment*openNestedConnection(lv::QmlEditFragment* edit,int position,QObject * currentApp)
{slot} public voidremoveConnection(lv::QmlEditFragment* edit)
{slot} publiclv::PaletteList*findPalettes(int position,bool unrepeated) Finds the available list of palettes at the current cursor position.
{slot} publiclv::CodePalette*openPalette(lv::QmlEditFragment* fragment,lv::PaletteList* palette,int index) Opens the palette index from a given paletteList.
{slot} publiclv::QmlEditFragment*removePalette(lv::CodePalette* palette) Removes a palette given its container object.
{slot} publiclv::CodePalette*openBinding(lv::QmlEditFragment* edit,lv::PaletteList* paletteList,int index) Open a specific binding palette for edit fragment given a paletteList and an index.
{slot} public voidcloseBinding(int position,int length) Closes the bindings between the given position and length.
{slot} public boolisForAnObject(lv::QmlEditFragment* palette)
{slot} public voidframeEdit(QQuickItem * box,lv::QmlEditFragment* palette) Integrates a given palette box within the editor.
{slot} public voidremoveEditFrame(QQuickItem * box)
{slot} public voidresizedEditFrame(QQuickItem * box)
{slot} publiclv::CodePalette*edit(lv::QmlEditFragment* ef) Opens an editing palette for the given edit fragment.
{slot} public voidcancelEdit() Cancels the current editing palette.
{slot} public lv::QmlAddContainer *getAddOptions(int position) Get the insertion options at the given position.
{slot} public intaddProperty(int position,const QString & object,const QString & type,const QString & name,bool assignDefault) Add a property given the addText at the specified position.
{slot} public intaddItem(int position,const QString & object,const QString & type) Adds an item given the addText at the specitied position.
{slot} public voidaddItemToRuntime(lv::QmlEditFragment* edit,const QString & type,QObject * currentApp)
{slot} public voidupdateRuntimeBindings(QObject * obj) Update palette binding channels for a new runtime root.
{slot} public voidnewDocumentScopeReady(const QString & path,DocumentQmlScope::PtrdocumentScope) Handler for when a new document scope is ready.
{slot} public voidnewProjectScopeReady() Handler for when a new project scope is ready.
{slot} public voidupdateScope() Called when a new scope is available from the scanMonitor.

Members

public explicitCodeQmlHandler(ViewEngine* engine,Project* project,QmlJsSettings * settings,ProjectQmlExtension* projectHandler,DocumentHandler* handler)

CodeQmlHandler constructor.

This is called through the ProjectQmlHandler.

public~CodeQmlHandler()

CodeQmlHandler destructor.

public virtual voidassistCompletion(const QTextCursor & cursor,const QChar & insertion,bool manuallyTriggered,CodeCompletionModel* model,QTextCursor & cursorChange)

Implementation of code completion assist.

Handles bracket and paranthesis auto-completion together with suggestions population.

public virtual voidsetDocument(ProjectDocument* document)

Assints the document that will be used by this class.

public virtual voiddocumentContentsChanged(int position,int charsRemoved,int charsAdded)

DocumentContentsChanged handler.

public virtual voidrehighlightBlock(const QTextBlock & block)

Calls a new rehighlight on the specified block.

public virtual QPair< int, int >contextBlock(int position)

Returns the block starting position and end position.

public QList<lv::QmlDeclaration::Ptr>getDeclarations(const QTextCursor & cursor)

Get a list of declarations from a specific cursor.

public boolfindDeclarationValue(int position,int length,int & valuePosition,int & valueEnd)

Given a declaration identifier position and lenght, get the valuePosition and valueEnd for that declaration.

publicQmlEditFragment*createInjectionChannel(QmlDeclaration::Ptrproperty,QObject * runtime)

Creates an injection channel between a declaration and the runtime.

This method will find all binding channels available by parsing the contents of the code structure, creating a set of binding pahts that describe where each component resides, and use those binding paths to connect the position of the code structure to the same values within the runtime.

public booladdEditingFragment(QmlEditFragment* edit)

Adds an editing fragment to the current document.

public voidremoveEditingFragment(QmlEditFragment* edit)

Removes an editing fragment from this document.

public inline QmlJsSettings *settings()

Returns the settings associated with this object.

publicQmlEditFragment*findEditFragment(CodePalette* palette)

publicQmlEditFragment*findEditFragmentIn(QmlEditFragment* parent,CodePalette* palette)

{slot} public lv::QmlCursorInfo *cursorInfo(int position,int length)

Receive different qml based information about a given cursor position.

{slot} publiclv::QmlEditFragment*openConnection(int position,QObject * currentApp)

{slot} publiclv::QmlEditFragment*openNestedConnection(lv::QmlEditFragment* edit,int position,QObject * currentApp)

{slot} public voidremoveConnection(lv::QmlEditFragment* edit)

{slot} publiclv::PaletteList*findPalettes(int position,bool unrepeated)

Finds the available list of palettes at the current cursor position.

The unrepeated parameter makes sure the palettes that are found at that position are not already opened.

{slot} publiclv::CodePalette*openPalette(lv::QmlEditFragment* fragment,lv::PaletteList* palette,int index)

Opens the palette index from a given paletteList.

{slot} publiclv::QmlEditFragment*removePalette(lv::CodePalette* palette)

Removes a palette given its container object.

{slot} publiclv::CodePalette*openBinding(lv::QmlEditFragment* edit,lv::PaletteList* paletteList,int index)

Open a specific binding palette for edit fragment given a paletteList and an index.

Returns

A pointer to the opened lv::CodePalette.

{slot} public voidcloseBinding(int position,int length)

Closes the bindings between the given position and length.

{slot} public boolisForAnObject(lv::QmlEditFragment* palette)

{slot} public voidframeEdit(QQuickItem * box,lv::QmlEditFragment* palette)

Integrates a given palette box within the editor.

{slot} public voidremoveEditFrame(QQuickItem * box)

{slot} public voidresizedEditFrame(QQuickItem * box)

{slot} publiclv::CodePalette*edit(lv::QmlEditFragment* ef)

Opens an editing palette for the given edit fragment.

{slot} public voidcancelEdit()

Cancels the current editing palette.

{slot} public lv::QmlAddContainer *getAddOptions(int position)

Get the insertion options at the given position.

Returns an lv::QmlAddContainer for all the options

{slot} public intaddProperty(int position,const QString & object,const QString & type,const QString & name,bool assignDefault)

Add a property given the addText at the specified position.

{slot} public intaddItem(int position,const QString & object,const QString & type)

Adds an item given the addText at the specitied position.

{slot} public voidaddItemToRuntime(lv::QmlEditFragment* edit,const QString & type,QObject * currentApp)

{slot} public voidupdateRuntimeBindings(QObject * obj)

Update palette binding channels for a new runtime root.

{slot} public voidnewDocumentScopeReady(const QString & path,DocumentQmlScope::PtrdocumentScope)

Handler for when a new document scope is ready.

{slot} public voidnewProjectScopeReady()

Handler for when a new project scope is ready.

{slot} public voidupdateScope()

Called when a new scope is available from the scanMonitor.

class lv::DocumentQmlInfo::ValueReference

Contains a reference to a value within a parsed qml document.

Summary

Members Descriptions
public const QmlJS::Value *value Internal reference to the value.
public constDocumentQmlInfo*parent Reference to the parent.
public inlineValueReference(const QmlJS::Value * val,constDocumentQmlInfo* p) ValueReference constructor.
public inlineValueReference() ValueReference destructor.

Members

public const QmlJS::Value *value

Internal reference to the value.

public constDocumentQmlInfo*parent

Reference to the parent.

public inlineValueReference(const QmlJS::Value * val,constDocumentQmlInfo* p)

ValueReference constructor.

public inlineValueReference()

ValueReference destructor.

class lv::DocumentQmlInfo::ASTReference

Reference to an AST node within the parsed qml document.

Summary

Members Descriptions
public QmlJS::AST::Node *node Internal reference to the AST node.
public inlineASTReference(QmlJS::AST::Node * n) ASTReference constructor.
public inlineASTReference() ASTReference destructor.

Members

public QmlJS::AST::Node *node

Internal reference to the AST node.

public inlineASTReference(QmlJS::AST::Node * n)

ASTReference constructor.

public inlineASTReference()

ASTReference destructor.

class lv::DocumentQmlInfo::Message

Message information containing parsing status.

Summary

Members Descriptions
publicSeveritykind Message severity level.
public intposition Position the message was generated at.
public intline Line the message was generated at.
public QStringtext Message text.
public inlineMessage(Severitypkind,int pposition,int pline,const QString & ptext) DocumentQmlInfo::Message constructor.
enumSeverity Severity of a message.

Members

publicSeveritykind

Message severity level.

public intposition

Position the message was generated at.

public intline

Line the message was generated at.

public QStringtext

Message text.

public inlineMessage(Severitypkind,int pposition,int pline,const QString & ptext)

DocumentQmlInfo::Message constructor.

enumSeverity

Values Descriptions
Hint Lowest severity level.
MaybeWarning Might be a warning.
Warning Warning Level.
MaybeError Might be an error.
Error Error level.

Severity of a message.

class lv::DocumentQmlInfo

Contains parsed information about a Project qml document.

Summary

Members Descriptions
public QStringListextractIds() const Extract the declared id's within a qml document.
public constValueReferencerootObject() Return a reference to the root object of this qml document.
public constValueReferencevalueForId(const QString & id) const Returns a reference to the value represented by the given id.
publicDocumentQmlObjectextractValueObject(constValueReference& value,ValueReference* parent) const Extracts a usable object given a value reference.
public QStringextractTypeName(constValueReference& value) const Extract the name of the type given by this value reference.
public voidextractTypeNameRange(constValueReference& value,int & begin,int & end) Extract the range of the type given by a value reference.
public voidextractRange(constValueReference& value,int & begin,int & end) Extract the full range given by a value reference.
public voidcreateRanges() Finds the ranges within this document.
public constValueReferencevalueAtPosition(int position) const Find the value reference at a given position.
public constValueReferencevalueAtPosition(int position,int & begin,int & end) const Find the value reference and range at a given position.
public constASTReferenceastObjectAtPosition(int position) Returns the reference to an AST node at a specified position.
public boolisValueNull(constValueReference& vr) const Check wether the value reference is null.
public boolisParsedCorrectly() const Check wether the document was parsed correctly after calling the lv::DocumentQmlInfo::parse() method.
public boolparse(const QString & source) Parses the source code to an AST form.
public QStringpath() const Return the path of the Document.
public QStringcomponentName() const Return the component name represented by this Document.
publicDocumentQmlValueObjects::PtrcreateObjects() const Visit the AST and create the objects defined in this document.
publicDocumentQmlValueObjects::PtrcreateObjects(constASTReference& ast) const Visit the AST from the given ast node and create the objects defined within.
public~DocumentQmlInfo() DocumentQmlInfo destructor.
protectedDocumentQmlInfo(const QString & fileName) DocumentQmlInfo constructor.
enumDialect Dialect used by the source code of a file.
typedefConstPtr Constat SharedPointer to DocumentqmlInfo.
typedefPtr SharedPointer to DocumentqmlInfo.

Members

public QStringListextractIds() const

Extract the declared id's within a qml document.

public constValueReferencerootObject()

Return a reference to the root object of this qml document.

public constValueReferencevalueForId(const QString & id) const

Returns a reference to the value represented by the given id.

publicDocumentQmlObjectextractValueObject(constValueReference& value,ValueReference* parent) const

Extracts a usable object given a value reference.

For example, you can use this class together with lv::DocumentQmlInfo::valueForId() to inspect a specific object defined with an id within the qml document.

public QStringextractTypeName(constValueReference& value) const

Extract the name of the type given by this value reference.

public voidextractTypeNameRange(constValueReference& value,int & begin,int & end)

Extract the range of the type given by a value reference.

begin and end will be populated with the given range, or -1 if the range cannot be extracted

public voidextractRange(constValueReference& value,int & begin,int & end)

Extract the full range given by a value reference.

begin and end will be populated with the given range, or -1 if the range cannot be extracted

public voidcreateRanges()

Finds the ranges within this document.

public constValueReferencevalueAtPosition(int position) const

Find the value reference at a given position.

public constValueReferencevalueAtPosition(int position,int & begin,int & end) const

Find the value reference and range at a given position.

The begin and end arguments will be populated with the range positino

public constASTReferenceastObjectAtPosition(int position)

Returns the reference to an AST node at a specified position.

public boolisValueNull(constValueReference& vr) const

Check wether the value reference is null.

Returns

true if vr is null, false otherwise

public boolisParsedCorrectly() const

Check wether the document was parsed correctly after calling the lv::DocumentQmlInfo::parse() method.

Returns

true if it was, false otherwise

public boolparse(const QString & source)

Parses the source code to an AST form.

Returns

True if the parse went correctly, false otherwise

public QStringpath() const

Return the path of the Document.

public QStringcomponentName() const

Return the component name represented by this Document.

publicDocumentQmlValueObjects::PtrcreateObjects() const

Visit the AST and create the objects defined in this document.

Returns

A pointer to the lv::DocumentQmlValueObjects

publicDocumentQmlValueObjects::PtrcreateObjects(constASTReference& ast) const

Visit the AST from the given ast node and create the objects defined within.

Returns

A pointer to the lv::DocumentQmlValueObjects

public~DocumentQmlInfo()

DocumentQmlInfo destructor.

protectedDocumentQmlInfo(const QString & fileName)

DocumentQmlInfo constructor.

This constructor is private. Use lv::DocumentQmlInfo::create() function.

enumDialect

Values Descriptions
Unknown Unknown dialect.
Javascript Javascript dialect.
Qml Qml dialect.
QmlTypeInfo QmlTypeInfo dialect.
QmlProject QmlProject dialect.
Json Json dialect.

Dialect used by the source code of a file.

typedefConstPtr

Constat SharedPointer to DocumentqmlInfo.

typedefPtr

SharedPointer to DocumentqmlInfo.

class lv::DocumentQmlObject::FunctionValue

Stores information about a QmlObject function.

Summary

Members Descriptions
public QStringname name of the fucntion
public QStringreturnType return type of the function
public QList< QPair< QString, QString > >arguments list of a pair of type/name argument parameters

Members

public QStringname

name of the fucntion

public QStringreturnType

return type of the function

public QList< QPair< QString, QString > >arguments

list of a pair of type/name argument parameters

class lv::DocumentQmlObject

Stores information about a QmlObject from a document.

Summary

Members Descriptions
publicDocumentQmlObject() DocumentQmlObject constructor.
public~DocumentQmlObject() DocumentQmlObject destructor.
public inline voidsetTypeName(const QString & name) Set the class name of this object.
public inline voidaddProperty(const QString & name,const QString & type) Add a property to this object.
public inline voidaddFunction(constFunctionValue& value) Add a function to this object.
public inline voidaddSlot(const QString & name,const QString & member) Add a slot to this object.
public inline voidaddSignal(constFunctionValue& value) Add a signal to this object.
public inline const QString &typeName() const Returns the class name of this object.
public inline const QMap< QString, QString > &memberProperties() const Returns the properties of this object.
public inline const QMap< QString, QString > &memberSlots() const Returns the slots of this object.
public inline const QMap< QString,FunctionValue> &memberFunctions() const Returns the functions of this object.
public inline const QMap< QString,FunctionValue> &memberSignals() const Returns the signals of this object.

Members

publicDocumentQmlObject()

DocumentQmlObject constructor.

public~DocumentQmlObject()

DocumentQmlObject destructor.

public inline voidsetTypeName(const QString & name)

Set the class name of this object.

public inline voidaddProperty(const QString & name,const QString & type)

Add a property to this object.

public inline voidaddFunction(constFunctionValue& value)

Add a function to this object.

public inline voidaddSlot(const QString & name,const QString & member)

Add a slot to this object.

public inline voidaddSignal(constFunctionValue& value)

Add a signal to this object.

public inline const QString &typeName() const

Returns the class name of this object.

public inline const QMap< QString, QString > &memberProperties() const

Returns the properties of this object.

public inline const QMap< QString, QString > &memberSlots() const

Returns the slots of this object.

public inline const QMap< QString,FunctionValue> &memberFunctions() const

Returns the functions of this object.

public inline const QMap< QString,FunctionValue> &memberSignals() const

Returns the signals of this object.

class lv::DocumentQmlScope::Import

Import data associated with a lv::DocumentQmlScope.

Summary

Members Descriptions
publicImport(TypeimportType,const QString & path,const QString & as,int vMajor,int vMinor) Import constructor.
public inlineTypeimportType() const Returns the import type for this import.
public inline voidsetImportType(TypeimportType) Sets the importType for this import.
public inline const QString &path() const Returns the path of this import.
public inline const QString &as() const Returns the import namespace for this import.
public inline intversionMajor() const Returns the major version of this import.
public inline intversionMinor() const Returns the minor version of this import.
public inline boolisVersionValid() const Returns true if this version is valid, false otherwise.
public inline booloperator==(constImport& other) const Returns true if this object is the same as other, false otherwise.
enumType Import type

Members

publicImport(TypeimportType,const QString & path,const QString & as,int vMajor,int vMinor)

Import constructor.

Takes an importType, the path of the import, the as namespace in which to import for this document and the two versions: vMajor, vMinor

public inlineTypeimportType() const

Returns the import type for this import.

public inline voidsetImportType(TypeimportType)

Sets the importType for this import.

public inline const QString &path() const

Returns the path of this import.

public inline const QString &as() const

Returns the import namespace for this import.

public inline intversionMajor() const

Returns the major version of this import.

public inline intversionMinor() const

Returns the minor version of this import.

public inline boolisVersionValid() const

Returns true if this version is valid, false otherwise.

public inline booloperator==(constImport& other) const

Returns true if this object is the same as other, false otherwise.

enumType

Values Descriptions
Invalid Invalid type
Library Library based import with qmldir file.
Directory Directory based import
ImplicitDirectory Implicit import
File Js file import
UnknownFile Unknown file import

Import type

class lv::DocumentQmlScope

Imports and import data for a lv::ProjectDocument.

The DocumentQmlScope contains external information, or information comming in from imports for a lv::ProjectDocument.

DocumentQmlScopes are mostly used internally, expecially by the lv::CodeQmlHandler

Summary

Members Descriptions
public~DocumentQmlScope() DocumentQmlScope destructor.
public boolhasImport(constImport& key) Checks for a given import key and.
public inline inttotalImports() const Returns the total number of imports for this lv::ProjectDocument.
public inline constImportList&imports() const Returns the ImportList associated with this object.
public voidaddImport(constImport& key,const QString & path) Adds an import path to a given key.
public inlineDocumentQmlInfo::ConstPtrinfo() const Returns the lv::DocumentQmlInfo associated with this object.
public inlineProjectQmlScope::PtrprojectScope() const Returns the project scope.
public inline QStringpath() const Returns the path of this document.
public inline QStringcomponentName() const Returnns the component name for this document.
typedefPtr SharedPointer to q DocumentQmlScope.
typedefImportEntry Import entry
typedefImportList List of import entries

Members

public~DocumentQmlScope()

DocumentQmlScope destructor.

public boolhasImport(constImport& key)

Checks for a given import key and.

Returns

true if it exists, false otherwise

public inline inttotalImports() const

Returns the total number of imports for this lv::ProjectDocument.

public inline constImportList&imports() const

Returns the ImportList associated with this object.

public voidaddImport(constImport& key,const QString & path)

Adds an import path to a given key.

public inlineDocumentQmlInfo::ConstPtrinfo() const

Returns the lv::DocumentQmlInfo associated with this object.

public inlineProjectQmlScope::PtrprojectScope() const

Returns the project scope.

public inline QStringpath() const

Returns the path of this document.

public inline QStringcomponentName() const

Returnns the component name for this document.

typedefPtr

SharedPointer to q DocumentQmlScope.

typedefImportEntry

Import entry

typedefImportList

List of import entries

class lv::DocumentQmlValueObjects::RangeItem

Base range item acting as a node in the hierarchy.

Summary

Members Descriptions
public inline virtual~RangeItem()
public QmlJS::AST::Node *getAst() Returns internal AST node.
publicRangeItem*getParent() Returns the parent of this item, or nullptr if there isn't any.
public voidappendObject(RangeObject* child) Appends an object to this item.
public inline virtual voidappendProperty(RangeProperty*) Appends a property to this item.

Members

public inline virtual~RangeItem()

public QmlJS::AST::Node *getAst()

Returns internal AST node.

publicRangeItem*getParent()

Returns the parent of this item, or nullptr if there isn't any.

public voidappendObject(RangeObject* child)

Appends an object to this item.

public inline virtual voidappendProperty(RangeProperty*)

Appends a property to this item.

class lv::DocumentQmlValueObjects::RangeProperty

class lv::DocumentQmlValueObjects::RangeProperty
  : public lv::DocumentQmlValueObjects::RangeItem

Property range item inside the ierarchy.

Summary

Members Descriptions
public QmlJS::AST::Node *ast Internal AST node.
publicRangeItem*parent Parent of this item.
publicRangeObject*child Child object of this property if it has any.
public intbegin Start range of this property.
public intpropertyEnd Returns the end of this property's identifier declaration.
public intvalueBegin Returns the starting position of this property's value declaration.
public intend Returns the end of this property.
public inlineRangeProperty()
public inline~RangeProperty()
public inline virtual voidappendObject(RangeObject* object) Sets the value of this property to the specified object.
public inline virtual QmlJS::AST::Node *getAst() Returns internal AST node.
public inline virtualRangeItem*getParent() Returns the parent of this item, or nullptr if there isn't any.
public QStringListname() const Returns the name chain of this property.
public QStringListobject() const Returns the declared object chain this property belongs to.
public QStringtype() const Returns the declared type of this property if it has any.
public boolhasType() const Returns true if this property's type was declared within this document, false otherwise.

Members

public QmlJS::AST::Node *ast

Internal AST node.

publicRangeItem*parent

Parent of this item.

publicRangeObject*child

Child object of this property if it has any.

public intbegin

Start range of this property.

public intpropertyEnd

Returns the end of this property's identifier declaration.

public intvalueBegin

Returns the starting position of this property's value declaration.

public intend

Returns the end of this property.

public inlineRangeProperty()

public inline~RangeProperty()

public inline virtual voidappendObject(RangeObject* object)

Sets the value of this property to the specified object.

public inline virtual QmlJS::AST::Node *getAst()

Returns internal AST node.

public inline virtualRangeItem*getParent()

Returns the parent of this item, or nullptr if there isn't any.

public QStringListname() const

Returns the name chain of this property.

For example

border.size : 20 // will return border.size

public QStringListobject() const

Returns the declared object chain this property belongs to.

Returns the object type chain for this property.

public QStringtype() const

Returns the declared type of this property if it has any.

Returns the type of this property.

public boolhasType() const

Returns true if this property's type was declared within this document, false otherwise.

Checks wether this property was declared with a type.

Returns

True on success, false otherwise

class lv::DocumentQmlValueObjects::RangeObject

class lv::DocumentQmlValueObjects::RangeObject
  : public lv::DocumentQmlValueObjects::RangeItem

Object range item inside the hierarchy.

Summary

Members Descriptions
public QmlJS::AST::Node *ast Internal AST node.
publicRangeItem*parent Parent of this object.
public QList<RangeObject* >children Children for this object.
public QList<RangeProperty* >properties Properties for this obejct.
public intbegin Start position for this object.
public intend End position for this object.
public inlineRangeObject()
public inline~RangeObject()
public inline virtual voidappendObject(RangeObject* child) Appends a child object to this object.
public inline virtual voidappendProperty(RangeProperty* property) Appends a property to this object.
public inline virtual QmlJS::AST::Node *getAst() Returns internal AST node.
public inline virtualRangeItem*getParent() Returns the parent of this object, or nullptr if there isn't any.

Members

public QmlJS::AST::Node *ast

Internal AST node.

publicRangeItem*parent

Parent of this object.

public QList<RangeObject* >children

Children for this object.

public QList<RangeProperty* >properties

Properties for this obejct.

public intbegin

Start position for this object.

public intend

End position for this object.

public inlineRangeObject()

public inline~RangeObject()

public inline virtual voidappendObject(RangeObject* child)

Appends a child object to this object.

public inline virtual voidappendProperty(RangeProperty* property)

Appends a property to this object.

public inline virtual QmlJS::AST::Node *getAst()

Returns internal AST node.

public inline virtualRangeItem*getParent()

Returns the parent of this object, or nullptr if there isn't any.

class lv::DocumentQmlValueObjects

Contains the ierarchy of Qml objects and a reference to their AST.

This class can be used to extract parsed objects and their properties using their range and position in code.

Summary

Members Descriptions
public~DocumentQmlValueObjects() DocumentQmlValueObjects destructor.
public inlineRangeObject*root() Returns the root node of this ierarchy.
public QStringtoString() const String representation of this object.
public voidvisit(QmlJS::AST::Node * astroot) Visitor method implementation.
public QList<RangeProperty* >propertiesBetween(int start,int end,RangeObject* root) Returns the properties between start and end for the given root object.
typedefPtr Shared Pointer to a lv::DocumentQmlValueObjects.
typedefConstPtr Const Shared Pointer to a lv::DocumentQmlValueObjects.

Members

public~DocumentQmlValueObjects()

DocumentQmlValueObjects destructor.

public inlineRangeObject*root()

Returns the root node of this ierarchy.

public QStringtoString() const

String representation of this object.

Will output the hierarchy of nodes defined in this object

public voidvisit(QmlJS::AST::Node * astroot)

Visitor method implementation.

public QList<RangeProperty* >propertiesBetween(int start,int end,RangeObject* root)

Returns the properties between start and end for the given root object.

typedefPtr

Shared Pointer to a lv::DocumentQmlValueObjects.

typedefConstPtr

Const Shared Pointer to a lv::DocumentQmlValueObjects.

class lv::PluginInfoExtractor

class lv::PluginInfoExtractor
  : public QObject

Extracts plugin information from a given plugin path.

Given an import string, i.e. import lcvcore 1.0, the lv::PluginInfoExtractor will extract the information from that plugin in a plugininfo file string.

Usage:

lv::ProjectQmlExtension* qmlHandler = new lv::ProjectQmlExtension(settings, project, engine);

lv::PluginInfoExtractor* extractor = qmlHandler->getPluginInfoExtractor(import); if ( extractor ){ extractor->waitForResult(10000); if (extractor->timedOut() ){ return "Error: Timed out\n"; }

} QByteArray result = extractor->result();

Summary

Members Descriptions
public explicitPluginInfoExtractor(ProjectQmlScanner * scanner,const QString & path,QObject * parent) PluginInfoExtractor constructor.
public~PluginInfoExtractor() PluginInfoExtractor destructor.
public inline const QByteArrayresult() const Returns the processed result.
public inline boolisDone() const Returns true if the result has been captured, false otherwise.
public inline booltimedOut() const Returns true if capturing the result has timed out, false otherwise.
public voidwaitForResult(int msTimeout) Waits a specific time for the result.
{slot} public voidnewProjectScope() Internal slot used to capture a new project scope.
{slot} public voidtimeOut() Internal slot used to capture the timeout of the waiting time for the extractor.

Members

public explicitPluginInfoExtractor(ProjectQmlScanner * scanner,const QString & path,QObject * parent)

PluginInfoExtractor constructor.

This is mainly used internally, the lv::PluginInfoExtractor should be captured from a lv::ProjectQmlExtension. As soon as the extractor is created, the search is automaticalluy activated, so the user only has to wait for the result.

public~PluginInfoExtractor()

PluginInfoExtractor destructor.

public inline const QByteArrayresult() const

Returns the processed result.

public inline boolisDone() const

Returns true if the result has been captured, false otherwise.

public inline booltimedOut() const

Returns true if capturing the result has timed out, false otherwise.

public voidwaitForResult(int msTimeout)

Waits a specific time for the result.

{slot} public voidnewProjectScope()

Internal slot used to capture a new project scope.

{slot} public voidtimeOut()

Internal slot used to capture the timeout of the waiting time for the extractor.

class lv::ProjectQmlExtension

class lv::ProjectQmlExtension
  : public QObject
  : public QQmlParserStatus

Main object used throughout qml extension plugin.

To capture the object, you can use the workspace layer:

var projectQmlExtension = lk.layers.workspace.extensions["editqml"].globals

Summary

Members Descriptions
publicProjectQmlExtension(QObject * parent) ProjectQmlExtension constructor with a parent parameter.
public virtual~ProjectQmlExtension() ProjectQmlExtension destructor.
public voidclassBegin() Override of QQmlParserStatus::classBegin.
public voidcomponentComplete() Override of QQmlParserStatus::componentComplete.
public inline ProjectQmlScanMonitor *scanMonitor() Returns the lv::ProjectQmlScanMonitor associated with this object.
public ProjectQmlScanner *scanner() Returns the the qml scanner associated with this object.
publicPluginInfoExtractor*getPluginInfoExtractor(const QString & import) Returns the lv::PluginInfoExtractor associated with this object.
public voidaddCodeQmlHandler(CodeQmlHandler* handler) Adds a codeHandler to this object.
public voidremoveCodeQmlHandler(CodeQmlHandler* handler) Removes the handler from this object.
public inlinePaletteContainer*paletteContainer() Returns the lv::PaletteContainer associated with this object.
public voidsetParams(Settings* settings,Project* project,ViewEngine* engine) Assign initialization params for this object.
{slot} public QObject *createHandler(ProjectDocument* document,DocumentHandler* handler) Creates a CodeQmlHandler for the given document.

Members

publicProjectQmlExtension(QObject * parent)

ProjectQmlExtension constructor with a parent parameter.

public virtual~ProjectQmlExtension()

ProjectQmlExtension destructor.

public voidclassBegin()

Override of QQmlParserStatus::classBegin.

public voidcomponentComplete()

Override of QQmlParserStatus::componentComplete.

public inline ProjectQmlScanMonitor *scanMonitor()

Returns the lv::ProjectQmlScanMonitor associated with this object.

public ProjectQmlScanner *scanner()

Returns the the qml scanner associated with this object.

publicPluginInfoExtractor*getPluginInfoExtractor(const QString & import)

Returns the lv::PluginInfoExtractor associated with this object.

public voidaddCodeQmlHandler(CodeQmlHandler* handler)

Adds a codeHandler to this object.

CodeHandlers are updated each time the engine recompiles the code.

public voidremoveCodeQmlHandler(CodeQmlHandler* handler)

Removes the handler from this object.

Note that this does not destroy the object.

public inlinePaletteContainer*paletteContainer()

Returns the lv::PaletteContainer associated with this object.

public voidsetParams(Settings* settings,Project* project,ViewEngine* engine)

Assign initialization params for this object.

{slot} public QObject *createHandler(ProjectDocument* document,DocumentHandler* handler)

Creates a CodeQmlHandler for the given document.

class lv::ProjectQmlScope

Contains all the loaded plugins of a project.

Summary

Members Descriptions
public~ProjectQmlScope() ProjectQmlScope destructor.
public voidfindQmlLibraryInImports(const QString & path,int versionMajor,int versionMinor,QList< QString > & paths) Finds a libraries paths given it's uri.
public voidfindQmlLibrary(const QString & path,int versionMajor,int versionMinor,QList< QString > & paths) Finds a qml library in a given path.
public voidfindQmlLibraryInPath(const QString & path,bool requiresQmlDir,QList< QString > & paths) Finds a qml library in a given path.
public voidaddImplicitLibrary(const QString & path) Adds a library as implicit.
public inttotalLibraries() const Returns the total number of global libraries.
public inttotalImplicitLibraries() const Returns the total number of implicit libraries.
public inline ProjectQmlScopeContainer *globalLibraries() Returns the global libraries container.
public inline ProjectQmlScopeContainer *implicitLibraries() Returns the implicit libraries container.
public inline QList< QString >pathsForImport(const QString & importUri) Returns the stored paths for an import uri.
public QStringuriForPath(const QString & path) Returns the uri of a library from it's path.
public inline voidaddDefaultLibraries(const QList< QString > & paths) Adds a set of paths to the default libraries.
public inline const QList< QString > &defaultLibraries() const Returns the default libraries.
typedefConstPtr Constant SharedPointer to ProjectQmlScope.
typedefPtr SharedPointer to ProjectQmlScope.

Members

public~ProjectQmlScope()

ProjectQmlScope destructor.

public voidfindQmlLibraryInImports(const QString & path,int versionMajor,int versionMinor,QList< QString > & paths)

Finds a libraries paths given it's uri.

public voidfindQmlLibrary(const QString & path,int versionMajor,int versionMinor,QList< QString > & paths)

Finds a qml library in a given path.

public voidfindQmlLibraryInPath(const QString & path,bool requiresQmlDir,QList< QString > & paths)

Finds a qml library in a given path.

public voidaddImplicitLibrary(const QString & path)

Adds a library as implicit.

public inttotalLibraries() const

Returns the total number of global libraries.

public inttotalImplicitLibraries() const

Returns the total number of implicit libraries.

public inline ProjectQmlScopeContainer *globalLibraries()

Returns the global libraries container.

public inline ProjectQmlScopeContainer *implicitLibraries()

Returns the implicit libraries container.

public inline QList< QString >pathsForImport(const QString & importUri)

Returns the stored paths for an import uri.

public QStringuriForPath(const QString & path)

Returns the uri of a library from it's path.

public inline voidaddDefaultLibraries(const QList< QString > & paths)

Adds a set of paths to the default libraries.

public inline const QList< QString > &defaultLibraries() const

Returns the default libraries.

typedefConstPtr

Constant SharedPointer to ProjectQmlScope.

typedefPtr

SharedPointer to ProjectQmlScope.

class lv::QmlCompletionContext

class lv::QmlCompletionContext
  : public lv::CodeCompletionContext

Contains a qml code completion context.

You can use the QmlCompletionContextFinder to find such a context at a given cursor position.

To find out the actual context state, use the QmlCompletionContext::context method.

QTextCursor cursor(document);
cursor.setPosition(100);
QmlCompletionContextFinder finder;

QmlCompltionContext::ConstPtr context = finder.getContext(cursor); vlog() << (context->context() == QmlCompletionContext::InImport);

For a string based output, QmlCompletionContext::contextString() will give a concatenated string of the states

// ...
QmlCompletionContext::ConstPtr context = finder.getContext(cursor);
vlog() << context->contextString();

Summary

Members Descriptions
public~QmlCompletionContext() Completion context destructor.
public inline intcontext() const Returns the current context state.
public QStringcontextString() const Returns the context a string of concatenated states.
public inline QStringobjectTypeName() const Returns the object typename for this context if it has any, or an empty string if it hasn't been captured.
public inline const QStringList &objectTypePath() const Returns the object type for this context, or an empty list if it hasn't been captured.
public inline QStringpropertyName() const Returns the property name for this completion context, or an empty string if it hasn't been captured.
public inline const QStringList &propertyPath() const Returns the property type for this context, or an empty list if it hasn't been captured.
public inline intpropertyPosition() const Returns the property start position for this context, or -1 if it hasn't been captured.
public inline const QStringList &expressionPath() const Returns the current expression the cursor is under.
public booloperator==(constQmlCompletionContext& other) const Returns true if this QmlCompletionContext is equal to other, false otherwise.
public booloperator!=(constQmlCompletionContext& other) const Returns true if this QmlCompletionContext is not equal to other, false otherwise.
protectedQmlCompletionContext(int context,const QStringList & objectTypePath,const QStringList & propertyPath,const QStringList & expressionPath,int propertyPosition) QmlCompletionContext constructor.
enumContext Context state
typedefConstPtr Shared const pointer to QmlCompletionContext
typedefPtr Shared pointer to QmlCompletionContext

Members

public~QmlCompletionContext()

Completion context destructor.

public inline intcontext() const

Returns the current context state.

public QStringcontextString() const

Returns the context a string of concatenated states.

public inline QStringobjectTypeName() const

Returns the object typename for this context if it has any, or an empty string if it hasn't been captured.

public inline const QStringList &objectTypePath() const

Returns the object type for this context, or an empty list if it hasn't been captured.

public inline QStringpropertyName() const

Returns the property name for this completion context, or an empty string if it hasn't been captured.

public inline const QStringList &propertyPath() const

Returns the property type for this context, or an empty list if it hasn't been captured.

public inline intpropertyPosition() const

Returns the property start position for this context, or -1 if it hasn't been captured.

public inline const QStringList &expressionPath() const

Returns the current expression the cursor is under.

public booloperator==(constQmlCompletionContext& other) const

Returns true if this QmlCompletionContext is equal to other, false otherwise.

public booloperator!=(constQmlCompletionContext& other) const

Returns true if this QmlCompletionContext is not equal to other, false otherwise.

protectedQmlCompletionContext(int context,const QStringList & objectTypePath,const QStringList & propertyPath,const QStringList & expressionPath,int propertyPosition)

QmlCompletionContext constructor.

Use lv::QmlCompletionContext::create() to create a new completion context.

enumContext

Values Descriptions
InImport Context is within an import statement
InImportVersion Context is within an import statement at the version section
InQml Context is within qml
InLhsOfBinding Context is within the left side of the binding
InRhsofBinding Context is within the right side of the binding
InAfterOnLhsOfBinding Context is within the right side of a slot binding
InStringLiteral Context is within a string literal

Context state

typedefConstPtr

Shared const pointer to QmlCompletionContext

typedefPtr

Shared pointer to QmlCompletionContext

class lv::QmlDeclaration

Holds a qml property declaration.

Item{
    property int declaration: 20
}

In the above case, the lv::QmlDeclaration has the following properties:

  • identifierChain : the property identifier, in this case declaration

  • identifierPosition: position of the declaration property

  • identifierLength: length of the declaration property

  • type: type of the declaration property, in this case int

  • document: document where the declaration property was declared

  • length: length of the declaration property

  • valueOffset: offset for the value of the declaration property, in this case it's the position of the number 20 minus the position of the property

  • valueLength: length of the value for the declaration property, or 2

  • section: A section within the project document

Summary

Members Descriptions
public~QmlDeclaration() QmlDeclaration destructor.
public inline intidentifierPosition() const Returns the identifier position.
public inline intidentifierLength() const Returns the identifier length.
public inline intposition() const Returns position of this declaration, equivalent to identifier position.
public inline intvaluePosition() const Returns the value position for this delcaration, calculated relative to the identifierPosition.
public inline const QStringList &identifierChain() const Returns the identifierChain for this delcaration.
public inline const QString &type() const Returns the type of this declaration.
public inline const QStringList &parentType() const Returns the paret type for this declaration.
public inlineProjectDocument*document() Returns the document this declaration is in.
public inline intlength() const Returns the length of this declaration.
public inline intvalueOffset() const Returns the valueOffset for this declaration.
public inline voidsetValuePositionOffset(int positionOffset) Assings a new positionOffset for this declaration.
public inline intvalueLength() const Returns the value lenght of this declaration.
public inline voidsetValueLength(int valueLength) Sets the value length of this declaration.
public inlineProjectDocumentSection::Ptrsection() Returns the current lv::ProjectDocument section.
public inline voidsetSection(ProjectDocumentSection::Ptrsection) Assigns the lv::ProjectDocument section.
enumSectionType ProjectDocument section type.
typedefPtr Shared pointer to QmlDeclaration
typedefConstPtr Shared const pointer to QmlDeclaration

Members

public~QmlDeclaration()

QmlDeclaration destructor.

public inline intidentifierPosition() const

Returns the identifier position.

public inline intidentifierLength() const

Returns the identifier length.

public inline intposition() const

Returns position of this declaration, equivalent to identifier position.

public inline intvaluePosition() const

Returns the value position for this delcaration, calculated relative to the identifierPosition.

public inline const QStringList &identifierChain() const

Returns the identifierChain for this delcaration.

public inline const QString &type() const

Returns the type of this declaration.

public inline const QStringList &parentType() const

Returns the paret type for this declaration.

public inlineProjectDocument*document()

Returns the document this declaration is in.

public inline intlength() const

Returns the length of this declaration.

public inline intvalueOffset() const

Returns the valueOffset for this declaration.

public inline voidsetValuePositionOffset(int positionOffset)

Assings a new positionOffset for this declaration.

public inline intvalueLength() const

Returns the value lenght of this declaration.

public inline voidsetValueLength(int valueLength)

Sets the value length of this declaration.

public inlineProjectDocumentSection::Ptrsection()

Returns the current lv::ProjectDocument section.

public inline voidsetSection(ProjectDocumentSection::Ptrsection)

Assigns the lv::ProjectDocument section.

enumSectionType

Values Descriptions
Section Section type

ProjectDocument section type.

typedefPtr

Shared pointer to QmlDeclaration

typedefConstPtr

Shared const pointer to QmlDeclaration

class lv::QmlEditFragment

class lv::QmlEditFragment
  : public QObject

An editing fragment for a lv::ProjectDocument.

An editing fragment represents a section within a lv::ProjectDocument that is connected to the running application. Fragments have palettes associated with them, and can write code based on the given value of a palette. They provide the set of binding channels connected to the application.

Summary

Members Descriptions
publicQmlEditFragment(QmlDeclaration::Ptrdeclaration,QObject * parent) QmlEditFragment contructor.
public virtual~QmlEditFragment() QmlEditFragment destructor.
public voidsetExpressionPath(BindingPath * bindingPath) Sets the main expressions bindingPath.
public BindingPath *expressionPath() Returns the main expressions binding path.
public inline BindingChannel *bindingChannel() Returns the binding channel associated with this object.
public voidsetPaletteForBinding(CodePalette* palette)
public inline boolhasPalette(CodePalette* palette)
publicCodePalette*palette(const QString & type)
public voidaddPalette(CodePalette* palette)
public voidremovePalette(CodePalette* palette)
public inline QList<CodePalette* >::iteratorbegin()
public inline QList<CodePalette* >::iteratorend()
public voidremoveBindingPalette()
public voidsetBindingPalette(CodePalette* palette)
public voidaddChildFragment(QmlEditFragment* edit)
public voidremoveChildFragment(QmlEditFragment* edit)
publicQmlEditFragment*findChildFragment(QmlEditFragment* edit)
public inline const QList<QmlEditFragment* >childFragments()
public inlineQmlDeclaration::Ptrdeclaration() const Returns the lv::CodeDeclaration associated with this object.
public voidwrite(const QString & code) Writes the code to the value part of this fragment.
public QStringreadValueText() const Reads the code value of this fragment and returns it.
public voidupdatePaletteValue(CodePalette* palette)
public inline QObject *visualParent() const
public inline voidsetVisualParent(QObject * visualParent)
public voidemitRemoval()
{signal} public voidvisualParentChanged()
{signal} public voidaboutToRemovePalette(lv::CodePalette* palette)
{signal} public voidaboutToBeRemoved()
{signal} public voidpaletteListEmpty()
{slot} public inline intposition()
{slot} public intvaluePosition() const Returns the lv::QmlDeclaration's value postion.
{slot} public intvalueLength() const Returns the lv::QmlDeclaration's value length.
{slot} public inttotalPalettes() const
{slot} public inlinelv::CodePalette*bindingPalette()
{slot} public voidupdateValue()
enumSectionType ProjectDocument section type for this QmlEditFragment

Members

publicQmlEditFragment(QmlDeclaration::Ptrdeclaration,QObject * parent)

QmlEditFragment contructor.

The Fragment is constructed from a declaration object and a palette object.

public virtual~QmlEditFragment()

QmlEditFragment destructor.

public voidsetExpressionPath(BindingPath * bindingPath)

Sets the main expressions bindingPath.

public BindingPath *expressionPath()

Returns the main expressions binding path.

public inline BindingChannel *bindingChannel()

Returns the binding channel associated with this object.

public voidsetPaletteForBinding(CodePalette* palette)

public inline boolhasPalette(CodePalette* palette)

publicCodePalette*palette(const QString & type)

public voidaddPalette(CodePalette* palette)

public voidremovePalette(CodePalette* palette)

public inline QList<CodePalette* >::iteratorbegin()

public inline QList<CodePalette* >::iteratorend()

public voidremoveBindingPalette()

public voidsetBindingPalette(CodePalette* palette)

public voidaddChildFragment(QmlEditFragment* edit)

public voidremoveChildFragment(QmlEditFragment* edit)

publicQmlEditFragment*findChildFragment(QmlEditFragment* edit)

public inline const QList<QmlEditFragment* >childFragments()

public inlineQmlDeclaration::Ptrdeclaration() const

Returns the lv::CodeDeclaration associated with this object.

public voidwrite(const QString & code)

Writes the code to the value part of this fragment.

public QStringreadValueText() const

Reads the code value of this fragment and returns it.

public voidupdatePaletteValue(CodePalette* palette)

public inline QObject *visualParent() const

public inline voidsetVisualParent(QObject * visualParent)

public voidemitRemoval()

{signal} public voidvisualParentChanged()

{signal} public voidaboutToRemovePalette(lv::CodePalette* palette)

{signal} public voidaboutToBeRemoved()

{signal} public voidpaletteListEmpty()

{slot} public inline intposition()

{slot} public intvaluePosition() const

Returns the lv::QmlDeclaration's value postion.

{slot} public intvalueLength() const

Returns the lv::QmlDeclaration's value length.

{slot} public inttotalPalettes() const

{slot} public inlinelv::CodePalette*bindingPalette()

{slot} public voidupdateValue()

enumSectionType

Values Descriptions
Section Section Value

ProjectDocument section type for this QmlEditFragment