跟踪是用于触摸输入数据的数据模型。 更多...
import 语句: | import QtQuick.VirtualKeyboard 2.2 |
Since: | QtQuick.VirtualKeyboard 2.0 |
跟踪为坐标数据和单个笔画关联的其它可选数据,提供数据模型。
跟踪对象的典型用例如下:
The coordinate data is retrieved using the points() 函数。
In addition to coordinate based data, it is possible to attach an arbitrary data channel for each data point.
The data channels must be defined before the points are added. The data channels supported by the TraceInputArea are listed below:
"t"
Collects time for each data point. The time is the number of milliseconds since 1970/01/01:
例如,要配置对象以收集每点的时间:
Trace *trace = new Trace(this); trace->setChannels(QStringList() << "t");
可以访问收集数据使用 channelData() 函数:
QVariantList timeData = trace->channelData("t");
Trace objects are owned by their creator, which is the input method in normal case. This means the objects are constructed in the InputMethod.traceBegin() (QML) 方法。
根据定义,可以最早销毁跟踪对象在 InputMethod.traceEnd() (QML) 方法。
List of additional data channels in the Trace. This property must be initialized before the data is added.
This property defines whether the Trace is canceled. The input data should not be processed from the Traces whose isCanceled property set to true.
This property defines whether the Trace can accept more data. If the value is true, no more data is accepted.
The number of points in the Trace.
Unique id of this Trace.
添加 point to the Trace.
方法返回点添加索引,或 -1 若点无法被添加 (即 isFinal 为 True)。
注意: 返回索引被要求关联额外数据采用点使用 setChannelData() 函数。
var channelData ( string channel , int pos , int count ) |
返回数据从指定 channel . If no other parameters are given, the function returns all the data.
若 pos parameter is given, the function returns data starting at the position. The count 参数限制返回多少项。
var points ( int pos , int count ) |
Returns list of points. If no parameters are given, the function returns all the points.
若 pos parameter is given, the function returns points starting at the position. The count 参数限制返回多少点。
返回列表包含
point
类型。
void setChannelData ( int index , string channel , var data ) |
集 data 为点在 index 按给定数据 channel .
若每数据点未调用此方法,将以空值填充通道数据。不管怎样,无法在任意索引处添加数据 (即:它必须与点数据同步添加)。