1// Copyright (C) 2016 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
3
4#ifndef QVIRTUALKEYBOARDTRACE_H
5#define QVIRTUALKEYBOARDTRACE_H
6
7#include <QtCore/QObject>
8#include <QtCore/QVariant>
9#include <QtCore/QPointF>
10#include <QtQml/qqml.h>
11#include <QtVirtualKeyboard/qvirtualkeyboard_global.h>
12
13QT_BEGIN_NAMESPACE
14
15class QVirtualKeyboardTracePrivate;
16
17class Q_VIRTUALKEYBOARD_EXPORT QVirtualKeyboardTrace : public QObject
18{
19 Q_OBJECT
20 Q_DECLARE_PRIVATE(QVirtualKeyboardTrace)
21 Q_PROPERTY(int traceId READ traceId WRITE setTraceId NOTIFY traceIdChanged)
22 Q_PROPERTY(QStringList channels READ channels WRITE setChannels NOTIFY channelsChanged)
23 Q_PROPERTY(int length READ length NOTIFY lengthChanged)
24 Q_PROPERTY(bool final READ isFinal WRITE setFinal NOTIFY finalChanged)
25 Q_PROPERTY(bool canceled READ isCanceled WRITE setCanceled NOTIFY canceledChanged)
26 Q_PROPERTY(qreal opacity READ opacity WRITE setOpacity NOTIFY opacityChanged)
27 QML_NAMED_ELEMENT(Trace)
28 QML_UNCREATABLE("Trace object is created by InputContext.inputEngine.traceBegin() function")
29 QML_ADDED_IN_VERSION(2, 0)
30
31public:
32 explicit QVirtualKeyboardTrace(QObject *parent = nullptr);
33 ~QVirtualKeyboardTrace();
34
35 int traceId() const;
36 void setTraceId(int id);
37
38 QStringList channels() const;
39 void setChannels(const QStringList &channels);
40
41 int length() const;
42
43 Q_INVOKABLE QVariantList points(int pos = 0, int count = -1) const;
44 Q_INVOKABLE int addPoint(const QPointF &point);
45
46 Q_INVOKABLE void setChannelData(const QString &channel, int index, const QVariant &data);
47 Q_INVOKABLE QVariantList channelData(const QString &channel, int pos = 0, int count = -1) const;
48
49 bool isFinal() const;
50 void setFinal(bool final);
51
52 bool isCanceled() const;
53 void setCanceled(bool canceled);
54
55 qreal opacity() const;
56 void setOpacity(qreal opacity);
57
58 Q_REVISION(6, 1) Q_INVOKABLE void startHideTimer(int delayMs);
59
60protected:
61 void timerEvent(QTimerEvent *event) override;
62
63Q_SIGNALS:
64 void traceIdChanged(int traceId);
65 void channelsChanged();
66 void lengthChanged(int length);
67 void finalChanged(bool isFinal);
68 void canceledChanged(bool isCanceled);
69 void opacityChanged(qreal opacity);
70};
71
72QT_END_NAMESPACE
73
74#endif // QVIRTUALKEYBOARDTRACE_H
75

source code of qtvirtualkeyboard/src/virtualkeyboard/qvirtualkeyboardtrace.h