跟踪是用于触摸输入数据的数据模型。 更多...
头: | #include <QVirtualKeyboardTrace> |
CMake: |
find_package(Qt6 REQUIRED COMPONENTS VirtualKeyboard)
target_link_libraries(mytarget PRIVATE Qt6::VirtualKeyboard) |
qmake: | QT += virtualkeyboard |
Since: | QtQuick.VirtualKeyboard 2.0 |
实例化: | Trace |
继承: | QObject |
int | addPoint (const QPointF & point ) |
QVariantList | channelData (const QString & channel , int pos = 0, int count = -1) const |
QStringList | channels () const |
bool | isCanceled () const |
bool | isFinal () const |
int | length () const |
qreal | opacity () const |
QVariantList | points (int pos = 0, int count = -1) const |
void | setCanceled (bool canceled ) |
void | setChannelData (const QString & channel , int index , const QVariant & data ) |
void | setChannels (const QStringList & channels ) |
void | setFinal (bool final ) |
void | setOpacity (qreal opacity ) |
void | setTraceId (int id ) |
(since QtQuick.VirtualKeyboard.Styles 6.1)
void
|
startHideTimer (int delayMs ) |
int | traceId () const |
void | canceledChanged (bool isCanceled ) |
void | channelsChanged () |
void | finalChanged (bool isFinal ) |
void | lengthChanged (int length ) |
void | opacityChanged (qreal opacity ) |
void | traceIdChanged (int traceId ) |
跟踪为坐标数据和单个笔画关联的其它可选数据,提供数据模型。
跟踪对象的典型用例如下:
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");
QVirtualKeyboardTrace 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) method.
根据定义,可以最早销毁跟踪对象在 InputMethod.traceEnd () (QML) method.
定义是否 QVirtualKeyboardTrace 被取消。
不应处理其输入数据,若跟踪
canceled
特性被设为 true。
访问函数:
bool | isCanceled () const |
void | setCanceled (bool canceled ) |
通知程序信号:
void | canceledChanged (bool isCanceled ) |
QQTrace 中的数据通道列表。
必须初始化此特性,在添加数据之前。
访问函数:
QStringList | channels () const |
void | setChannels (const QStringList & channels ) |
通知程序信号:
void | channelsChanged () |
定义是否
QVirtualKeyboardTrace
可以接受更多数据。若值为
true
,不接受更多数据。
访问函数:
bool | isFinal () const |
void | setFinal (bool final ) |
通知程序信号:
void | finalChanged (bool isFinal ) |
[read-only]
length
: const
int
此特性保持点数在 QVirtualKeyboardTrace .
访问函数:
int | length () const |
通知程序信号:
void | lengthChanged (int length ) |
此特性定义如何不透明 QVirtualKeyboardTrace is.
较值产生更透明跟踪:
0.0
完全透明,而
1.0
完全不透明。
此特性很有用,为使旧跟踪更透明当添加新跟踪时。
访问函数:
qreal | opacity () const |
void | setOpacity (qreal opacity ) |
通知程序信号:
void | opacityChanged (qreal opacity ) |
唯一 ID 为此 QVirtualKeyboardTrace .
访问函数:
int | traceId () const |
void | setTraceId (int id ) |
通知程序信号:
void | traceIdChanged (int traceId ) |
[invokable]
int
QVirtualKeyboardTrace::
addPoint
(const
QPointF
&
point
)
添加 point 到 QVirtualKeyboardTrace .
方法返回点添加索引,或 -1 若点无法被添加 (即 final 为 True)。
注意: 返回索引被要求关联额外数据采用点使用 setChannelData () 方法。
注意: 此函数可以被援引,通过元对象系统和从 QML。见 Q_INVOKABLE .
[invokable]
QVariantList
QVirtualKeyboardTrace::
channelData
(const
QString
&
channel
,
int
pos
= 0,
int
count
= -1) const
返回数据从指定 channel 。若未给定其它参数,方法返回所有数据。
若 pos 参数有给定,方法返回从位置起的数据。 count 参数限制返回多少项。
注意: 此函数可以被援引,通过元对象系统和从 QML。见 Q_INVOKABLE .
另请参阅 setChannelData ().
[invokable]
QVariantList
QVirtualKeyboardTrace::
points
(
int
pos
= 0,
int
count
= -1) const
返回点的列表。若不给定参数,方法返回所有数据。
若 pos 参数有给定,方法返回从位置起的点。 count 参数限制返回多少点。
返回列表包含 QPointF 类型。
注意: 此函数可以被援引,通过元对象系统和从 QML。见 Q_INVOKABLE .
[invokable]
void
QVirtualKeyboardTrace::
setChannelData
(const
QString
&
channel
,
int
index
, const
QVariant
&
data
)
设置 data 为点在 index 按给定数据 channel .
若每数据点未调用此方法,将以空值填充通道数据。不管怎样,无法在任意索引处添加数据 (即:它必须与点数据同步添加)。
注意: 此函数可以被援引,通过元对象系统和从 QML。见 Q_INVOKABLE .
另请参阅 channelData ().
[invokable, since QtQuick.VirtualKeyboard.Styles 6.1]
void
QVirtualKeyboardTrace::
startHideTimer
(
int
delayMs
)
Starts a timer to set opacity to zero after delayMs . If called again within delayMs , the timer is restarted.
With this function the input method can hide the trace from screen before destroying the trace object, for example, to indicate that the trace has been processed.
注意: 此函数可以被援引,通过元对象系统和从 QML。见 Q_INVOKABLE .
This function was introduced in QtQuick.VirtualKeyboard.Styles 6.1.