Utils QML Type

Helper functions. More...

Import Statement: import CSDataQuick.Components 1.0

Methods

Detailed Description

This is a group of helper functions, which are called by QML components.

Method Documentation

double calculate(expression, input)

Evalute an expression based on given input variables. This calls postfix and calcPerform functions from EPICS base.


string convert(TextFormat format, real value, int precision)

Convert a number value with given format. This routine calls cvsFast functions from EPICS base and also functions from MEDM for certain special formats.


copyToClipboard(text)

Copy the text to the global clipboard.


Window createComponentByFile(display, filePath, macro)

Create a qml component from a file with given filePath with macro expansion.

It calls parser library to create the qml source, and then call QQmlComponent to create an instance. The QQmlEngine used is which display was created in.


Window createDisplay(qml, display, filePath)

Create a top level window based on qml source, represented by filePath. The QQmlEngine used is which display was created in.


Window createDisplayByFile(display, filePath, macro)

Create a top level window from a file with given filePath with macro expansion. The file can be either ADL or QML.

It calls parser library to create the qml source, and then calls Utils::createDisplay to actually create the display window. The QQmlEngine used is which display was created in.


string currentDateTime()

Return the current time in the form of "yyyy-MM-dd HH:mm:ss".


bool execute(program)

Execute a program. If program ends with "&", the new process will be detached. Otherwise it will wait for the new process to finish and return the exit code.

See also QProcess::startDetached() and QProcess::execute().


string format(format, number)

Format a number with given format,

See also QString::asprintf().


string formatString(data, format, precision)

Convert control system data according to format and precision.


var getProperty(object, name)

Returns the value of the object's name property.


url isDisplayFile(fileName)

Check wether fileName is a supported display file.


point mapToGlobal(item, point)

Maps the given point in this item's coordinate system to the equivalent point within global screen coordinate system, and returns the mapped coordinate.

This is an equivalent implementation of QQuickItem::mapToGlobal that first appeared in Qt 5.7.


string openUrl(url)

Open the given url,

See also QDesktopServices::openUrl().


Window parentWindow(item)

Return the parent window for item.


double parse(int format, QString textValue)

Parse a numeric value in format from textValue. This is the opposite of Utils::convert.


list<object> parseExecList()

Return the command list defined by MEDM_EXEC_LIST environment variable. Each command object contains the following property,

  • label - menu text
  • command - system command

object parseX11Geometry(geometry)

Parse a token of a X11 geometry specification, e.g. "200x100+10-20". The returned map contains the following fields,

  • xOffset - x offset
  • yOffset - y offset
  • corner - the corner from where the offset counts, see Qt::Corner.
  • width - window width
  • height - window height

int qtVersion()

Return the QT_VERSION macro.


resizeChildItems(parent, rw, rh)

Resize all child items from parent by rw horizontally and rh vertically, and move their top left position as well.


url searchDisplayFile(fileName, filePath)

Search a display file with given fileName from the current directory, the filePath and environment variables specific to the display file type

  • EPICS_DISPLAY_PATH (.adl)
  • EDMDATAFILES (.edl)
  • CAQTDM_DISPLAY_PATH (.ui)
  • QML_DISPLAY_PATH (.qml)

vectorGet(vector, array, index, count)

Get the subarray from a vector variant into array, starting at position index (default 0). If count is -1 (the default), all elements after index are included.

See also QVector::mid.


vectorSet(vector, value, index)

Set the index element from vector variant to value and return the modified copy.