Trace QML Type

跟蹤是用於觸摸輸入數據的數據模型。 更多...

import 語句: import QtQuick.VirtualKeyboard 2.4
Since: QtQuick.VirtualKeyboard 2.0
實例化: QVirtualKeyboardTrace

特性

方法

詳細描述

跟蹤為坐標數據和單個筆畫關聯的其它可選數據,提供數據模型。

跟蹤對象的典型用例如下:

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:

例如,要配置對象以收集每點的時間:

QVirtualKeyboardTrace *trace = new QVirtualKeyboardTrace(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) 方法。

特性文檔編製

canceled : bool

This property defines whether the Trace is canceled. The input data should not be processed from the Traces whose canceled 特性被設為 true。

channels : list < strings >

List of additional data channels in the Trace. This property must be initialized before the data is added.

final : bool

This property defines whether the Trace can accept more data. If the value is true ,不接受更多數據。

opacity : qreal

This property defines how opaque the Trace is.

較值産生更透明跟蹤: 0.0 完全透明,而 1.0 完全不透明。

此特性很有用,為使舊跟蹤更透明當添加新跟蹤時。

This property was introduced in QtQuick.VirtualKeyboard 2.4.

traceId : int

Unique id of this Trace.


方法文檔編製

int addPoint ( point point )

添加 point to the Trace.

方法返迴點添加索引,或 -1 若點無法被添加 (即 final 為 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 參數限製返迴多少項。

另請參閱 setChannelData() .

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 .

若每數據點未調用此方法,將以空值填充通道數據。不管怎樣,無法在任意索引處添加數據 (即:它必須與點數據同步添加)。

另請參閱 channelData() .