- Home
- Installation
- Using Livekeys
- Plugins
- Developer
Plugin 'live'
This modules contains the main qml files that link to LiveKeys functionality.
import live 1.0
Summary
Type Main | Provides a main script entry to a qml application. |
Type Triangle | A simple visual representation of an oriented triangle |
Type StaticLoader | Creates and stores a component statically. See {Static Items |
Type FileReader | Represents a file reader which extracts the data from a file and potentially monitors changes. |
Type StaticFileReader | Loads a given file statically |
Type VisualLogFilter | Represents a filtered set of log entries |
Type StringBasedLoader | Given a piece of qml code as string, it will create the item |
Type ComponentSource | 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. |
Type TextButton | Represents a button with a custom text |
Type VisualLogView | A view to display the messages of a visual log filter |
Main
type
Inherits | Item |
Property | array options |
Property | string version |
Method | list arguments() |
Method | string option(string key) |
Method | bool isOptionSet(string key) |
Signal | run() |
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
Inherits | Item |
Enum | Rotation |
Property | Triangle.Rotation rotation |
Property | Color 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
Inherits | Item |
Property | Component source |
Property | object item |
Method | staticLoad(string id) |
Signal | itemCreated() |
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
Inherits | Object , ParserStatus |
Property | string source |
Property | bool monitor |
Property | array data |
Method | string asString(array data) |
Method | systemFileChanged(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
Inherits | Item |
Property | array data |
Method | staticLoad(string file, object params) |
Method | string asString(array data) |
Method | readerDataChanged(array data) |
Signal | init() |
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
Inherits | VisualLogBaseModel |
Property | VisualLogBaseModel source |
Property | string tag |
Property | var prefix |
Property | var search |
Property | bool isIndexing |
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
var search
property
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
Inherits | Item |
Property | string source |
Property | object 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
Inherits | QtObject |
Property | Component 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
Inherits | Rectangle |
Property | string text |
Property | string fontFamily |
Property | int fontPixelSize |
Property | color textColor |
Property | color backgroundHoverColor |
Property | color backgroundColor |
Signal | clicked() |
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
Inherits | ScrollView |
Property | var model |
Property | color backgroundColor |
Signal | itemAdded() |
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