Plugin 'editor'

This module contains all qml types related to the editor used in LiveKeys

include editor 1.0


TypeEditorVisual item that displays the text editor
TypeCodePalettePalette display of a property
TypeLiveExtensionThe class within Qml to be used when we want to add an extension
TypeDocumentHandlerThe go-to class when it comes to handling documents

Editor type

Propertybool isDirty
Propertystring text
Propertyvar font
Propertybool internalActiveFocus
Propertybool internalFocus
Propertyvar documentHandler
PropertyNewTextEdit textEdit
Propertyvar windowControls
Propertyvar document
Propertyint fragmentStart
Propertyint fragmentEnd
Propertycolor topColor
Methodvar getCursorFragment()
MethodRectangle getCursorRectangle()
Methodvar cursorWindowCoords()

Visual item that displays the text editor

This type is used extensively inside LiveKeys for each document and fragment opened.

bool isDirty property

Indicates that the contained document is dirty

string text property

Text contained inside the editor

var font property

Font of the text

bool internalActiveFocus property

Indicates that the editor has active focus

bool internalFocus property

Indicates that the editor has focus

var documentHandler property

Document handler of the currently opened document

NewTextEdit textEdit property

Text edit that is used to display and manipulate the document. The main object of the editor

var windowControls property

A set of globally available variables

var document property

The document opened inside the editor

int fragmentStart property

Start line of a fragment, in case only a fragment of the document is visible

int fragmentEnd property

End line of a fragment, in case only a fragment of the document is visible

color topColor property

Color of the editor menu

hasActiveEditor() method

Indicates if LiveKeys has an active editor

save() method

Save the current document

saveAs() method

Open the Save as dialog

closeDocument() method

Close the current document (save in case saving is necessary)

var getCursorFragment() method

Return the fragment boundaries for the fragment that contains the cursor

closeDocumentAction() method

The complete action for closing the document (in case it's the only document in the project, potentially closes the project too)

Rectangle getCursorRectangle() method

Returns the cursor rectangle

assistCompletion() method

Assist completion at current cursor position

toggleSize() method

Change size of editor to be either 3/4, 1/2 or 1/4 or the parent

forceFocus() method

Force the focus on the editor

var cursorWindowCoords() method

Returns the coordinates of the cursor

CodePalette type

PropertyItem item
Propertystring name
Propertystring type
Propertyvar value
Propertyobject extension
Signalinit(var value)

Palette display of a property

Palettes are useful visual tools for editing the values of some properties such as ints, doubles, colors etc. They can be easily opened by right-clicking on the property, and selecting "Palette" or "Shape" options, or using a related shortcut.

Item item property

Visual item for this palette

string name property

Palette name

string type property

Palette type

var value property

Property value of the palette (could be a variety of types)

object extension property

Extension for this palette

init(var value) signal

Signals that the value was initialized

LiveExtension type

Propertyobject globals
Propertyvar interceptLanguage
Propertyvar interceptMenu
Propertyvar commands
Propertyvar keyBindings
Propertyvar configuration

The class within Qml to be used when we want to add an extension

An example of an extension is the locally used EditQmlExtension.qml.

Each of the properties below has an appropriate signal <propertyName>Changed() to indicate change.

object globals property

Globally available variables inside LiveKeys

var interceptLanguage property

Function that returns a handler for the given extension (e.g. qml, js)

var interceptMenu property

Function that returns a menu array for the given extension (e.g. qml)

var commands property

Object of commands for the given extension

var keyBindings property

Key shortcuts for the given extension

var configuration property

Extension configuration

DocumentHandler type

Propertyvar completionModel
Propertyvar codeHandler
Propertybool editorFocus
MethodinsertCompletion(int from, int to, string completion)
MethoddocumentContentsChanged(int position, int charsRemoved, int charsAdded)
MethodcursorWritePositionChanged(var cursor)
MethodsetDocument(var document, var options)
MethoddocumentFormatUpdate(int position, int length)
MethodgenerateCompletion(int cursorPosition)
MethodcontextBlockRange(int cursorPosition)
MethodmanageIndent(int from, int length, bool undo)
SignalcursorPositionRequest(int position)

The go-to class when it comes to handling documents

Forwards everything to the highlighter, has a completion model in case there's a specific code handler attached to it, it can auto-complete code, which is all behavior inherited from the AbstractCodeHandler.

var completionModel property

Model used for completion of code

var codeHandler property

Handler for the document code

bool editorFocus property

Indicator that the editor is in focus

insertCompletion(int from, int to, string completion) method

Adds specific completion that the user picked between given positions

documentContentsChanged(int position, int charsRemoved, int charsAdded) method

Slot that is connected to document changes

cursorWritePositionChanged(var cursor) method

Slot reacting to cursor position change Potentially triggers the assisted completion

setDocument(var document, var options) method

Document that the document handler is operating on

documentFormatUpdate(int position, int length) method

Slot for changes in document format - triggers a rehighlight

generateCompletion(int cursorPosition) method

Generates code completion at a given cursor position

contextBlockRange(int cursorPosition) method

Finds the boundaries of the code block containing the cursor position

manageIndent(int from, int length, bool undo) method

Used to manage indentation of selected text

targetChanged() signal

Target document changed

cursorPositionRequest(int position) signal

Cursor position change request

contentsChangedManually() signal

Document content was changed manually

editorFocusChanged() signal

Editor focus changed

codeHandlerChanged() signal

Code handler changed