-
Notifications
You must be signed in to change notification settings - Fork 22
/
main.qml
72 lines (64 loc) · 1.81 KB
/
main.qml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
import QtQuick 2.2
Item {
id:root
width:768
height:263
anchors.margins: 4
Image { source: "asset/bg.png"; anchors.fill: parent; }
// Drawing zone for Text recognition
Writing {
id:canvas
width: Zinnia.drawing_width;
height: Zinnia.drawing_height;
x: 200
y: 0
// set the handwritingEngine in the writing zone
engine: Zinnia
}
// Presenting the results on the right
Flow {
anchors.top: root.top;
anchors.left: canvas.right
anchors.right: root.right
Repeater {
model: Zinnia.results
delegate: Item {
id: delegateItem
width: 99
height: delegateText.height
Rectangle{
id: delegateBackground
anchors.fill: parent;
color: "transparent"
opacity: .5
}
Text {
id: delegateText
width: parent.width
font.pointSize: 42
text: modelData
horizontalAlignment: Text.AlignHCenter
}
MouseArea {
anchors.fill: parent
onPressed: delegateBackground.color = "black"
onReleased: delegateBackground.color = "transparent"
// Print the selected result
onClicked: console.log(modelData)
}
}
}
}
Item {
id:clearbutton
width:100
height:65
anchors.left: parent.left
anchors.top: parent.top
anchors.leftMargin: 100
MouseArea {
anchors.fill:parent
onClicked: canvas.clear();
}
}
}