- Home
- Installation
- Using Livekeys
- Plugins
- Developer
Plugin 'editor'
This module contains all qml types related to the editor used in LiveKeys
include editor 1.0
Summary
Type Editor | Visual item that displays the text editor |
Type CodePalette | Palette display of a property |
Type LiveExtension | The class within Qml to be used when we want to add an extension |
Type DocumentHandler | The go-to class when it comes to handling documents |
Editor
type
Inherits | Rectangle |
Property | bool isDirty |
Property | string text |
Property | var font |
Property | bool internalActiveFocus |
Property | bool internalFocus |
Property | var documentHandler |
Property | NewTextEdit textEdit |
Property | var windowControls |
Property | var document |
Property | int fragmentStart |
Property | int fragmentEnd |
Property | color topColor |
Method | hasActiveEditor() |
Method | save() |
Method | saveAs() |
Method | closeDocument() |
Method | var getCursorFragment() |
Method | closeDocumentAction() |
Method | Rectangle getCursorRectangle() |
Method | assistCompletion() |
Method | toggleSize() |
Method | forceFocus() |
Method | var 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
Inherits | Object |
Property | Item item |
Property | string name |
Property | string type |
Property | var value |
Property | object extension |
Signal | init(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
Inherits | QtObject |
Property | object globals |
Property | var interceptLanguage |
Property | var interceptMenu |
Property | var commands |
Property | var keyBindings |
Property | var 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
Inherits | QtObject |
Property | var completionModel |
Property | var codeHandler |
Property | bool editorFocus |
Signal | targetChanged() |
Signal | cursorPositionRequest(int position) |
Signal | contentsChangedManually() |
Signal | editorFocusChanged() |
Signal | codeHandlerChanged() |
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