Plugin 'live'

This modules contains the main qml files that link to LiveKeys functionality.

import live 1.0

Summary

TypeMainProvides a main script entry to a qml application.
TypeTriangleA simple visual representation of an oriented triangle
TypeStaticLoaderCreates and stores a component statically. See {Static Items
TypeFileReaderRepresents a file reader which extracts the data from a file and potentially monitors changes.
TypeStaticFileReaderLoads a given file statically
TypeVisualLogFilterRepresents a filtered set of log entries
TypeStringBasedLoaderGiven a piece of qml code as string, it will create the item
TypeComponentSourceMaps its internal source component to a string, together with the imports within the file it was declared on. Can be used to map components that should be created in different processes.
TypeTextButtonRepresents a button with a custom text
TypeVisualLogViewA view to display the messages of a visual log filter

Main type

InheritsItem
Propertyarray options
Propertystring version
Methodlist arguments()
Methodstring option(string key)
Methodbool isOptionSet(string key)
Signalrun()

Provides a main script entry to a qml application.

An example of use can be found in samples/live/mainscript.qml

array options property

Configuration options to parse received arguments. There are two types of options. Value types and flag types. Flags are simply checked to see whether they have been set within Livekeys.

Main{
  id: main
  options : [
    { key: ['-f', '--someflag'], describe: 'Enables a feature.' }
  ]
}

Then we can check if the option has been set by querying our Main object:

console.log('Flag status: ' + main.isOptionSet('-f'))

Value types need an extra type key and an optional required key, which by default is false:

Main{
  id: main
  options : [
    { key: ['-v', '--value'], type: 'string', describe: 'Receive value.', required: true }
  ]
}

The type can be anything used to intuitively describe the value. It does not have to match a qml type. If an option is required and is missing when Livekeys is called, then Livekeys will exit, and a help text will be displayed to the user.

string version property

Sets the script version.

run() signal

Emited once the arguments are parsed and the script is ready to run.

list arguments() method

Returns the arguments after extracting the parsed options

string option(string key) method

Returns the option configured at key. Raises a warning if the option was not configured.

bool isOptionSet(string key) method

Returns true if the option at key has been set. False otherwise.

Triangle type

InheritsItem
EnumRotation
PropertyTriangle.Rotation rotation
PropertyColor color

A simple visual representation of an oriented triangle

An example of use:

Triangle{
    ...
    width: 9
    height: 5
    color: "#9b6804"
    rotation: Triangle.Bottom
}

Rotation enum

Orientation of the triangle can be one of the following:

  • Top
  • Right
  • Bottom
  • Left

Triangle.Rotation rotation property

Represents the rotation of the triangle i.e. whether it's pointing up, down, left or right.

Color color property

Returns the color of the triangle.

StaticLoader type

InheritsItem
PropertyComponent source
Propertyobject item
MethodstaticLoad(string id)
SignalitemCreated()

Creates and stores a component statically. See {Static Items

An example is available at samples/live/staticloader.qml

Component source property

Component to load statically.

object item property

This property holds the top-level object that was loaded

itemCreated() signal

This signal is emitted when the item is created. This is usually at the start of the application, or when the user calls the staticLoad function with a different state id than the previous compilation.

staticLoad(string id) method

Loads the StaticLoader state. id has to be unique for this component when used in context with other StaticLoaders.

FileReader type

InheritsObject , ParserStatus
Propertystring source
Propertybool monitor
Propertyarray data
Methodstring asString(array data)
MethodsystemFileChanged(string file)

Represents a file reader which extracts the data from a file and potentially monitors changes.

See a simple example at samples/live/filereading.qml

string source property

Represents the path to our file.

bool monitor property

Indicates if the (external) file changes should be monitored.

array data property

Represents the data read from the file.

string asString(array data) method

Return the loaded data as a string

systemFileChanged(string file) method

React to a change inside a file by resyncing data.

StaticFileReader type

InheritsItem
Propertyarray data
MethodstaticLoad(string file, object params)
Methodstring asString(array data)
MethodreaderDataChanged(array data)
Signalinit()

Loads a given file statically

An example cna be seen at samples/live/staticfilereading.qml

array data property

The data extracted from the file

staticLoad(string file, object params) method

Loads the given file statically, with the params potentially containing only a single property, "monitor", in order to monitor external changes.

string asString(array data) method

Returns the loaded data as a string

readerDataChanged(array data) method

Reacts to data changes inside the file by resyncing local copy of the data.

init() signal

Called when the loader is initialized (component complete).

VisualLogFilter type

InheritsVisualLogBaseModel
PropertyVisualLogBaseModel source
Propertystring tag
Propertyvar prefix
Propertyvar search
Propertybool isIndexing
MethodrefilterReady()
MethodsourceDestroyed()
MethodsourceModelReset()
MethodsourceModelAboutToReset()
MethodsourceRowsAboutToBeRemoved(ModelIndex, int from, int to)
MethodsourceRowsInserted(ModelIndex, int from, int to)

Represents a filtered set of log entries

The filter can be applied via tag, prefix or a regular search string

An example can be found in samples/live/visuallogfilter.qml

VisualLogBaseModel source property

Base model which is the model we're applying the filter too.

Interestingly, it can be both the main model, or even another filter model! We could, in theory, have an array or filter models where each one is filtering on the previous one.

string tag property

The tag string that we're filtering by

var prefix property

The prefix string/regexp that we're filtering by

The string/regexp we're filtering log messages by

bool isIndexing property

Indicator that the search is being done within the source model

refilterReady() method

Slot that listens for the ending of indexing in the background.

This slot gets called after the worker finishes, but also gets called only after control is returned to the event loop. Any changes in between will be lost, therefore we handle the changes separately, using the m_workerIgnoreResult variable.

sourceDestroyed() method

Source is destroyed

sourceModelReset() method

Reacts to changes in the source model

sourceModelAboutToReset() method

Before a reset, we ignore the results of the worker because they're not valid anymore

sourceRowsAboutToBeRemoved(ModelIndex, int from, int to) method

When source model is having rows removed, we ignore the worker results and rebuild

sourceRowsInserted(ModelIndex, int from, int to) method

When source model is having rows added, we ignore the worker results and rebuild

StringBasedLoader type

InheritsItem
Propertystring source
Propertyobject item

Given a piece of qml code as string, it will create the item

An example is available at samples/live/stringbasedloader.qml

string source property

The source code of the item

object item property

The created item

ComponentSource type

InheritsQtObject
PropertyComponent source

Maps its internal source component to a string, together with the imports within the file it was declared on. Can be used to map components that should be created in different processes.

Component source property

The item whose source code will be copied.

TextButton type

InheritsRectangle
Propertystring text
Propertystring fontFamily
Propertyint fontPixelSize
Propertycolor textColor
Propertycolor backgroundHoverColor
Propertycolor backgroundColor
Signalclicked()

Represents a button with a custom text

An example can be found at samples/live/valuehistory.qml

string text property

Button display text

string fontFamily property

Font family

int fontPixelSize property

Font size

color textColor property

Color of the button text

color backgroundHoverColor property

Color of the button when we're hovering over it

color backgroundColor property

Color of the button

clicked() signal

Signal that we've clicked the button

VisualLogView type

InheritsScrollView
Propertyvar model
Propertycolor backgroundColor
SignalitemAdded()

A view to display the messages of a visual log filter

An example can be seen in samples/live/visuallogfilter.qml

var model property

Model to be displayed

color backgroundColor property

Background color of the view

itemAdded() signal

Notifies that a log message has been added