-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathFileMenu.qml
84 lines (79 loc) · 2.08 KB
/
FileMenu.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
73
74
75
76
77
78
79
80
81
82
83
84
import QtQuick
import QtQuick.Dialogs
Item {
id: fileMenu
property bool expanded: false
width: fileMenu.expanded ? 50 : 30
height: fileMenu.expanded ? 90 : 30
MouseArea{
anchors.fill: parent
onClicked: {
fileMenu.expanded = !fileMenu.expanded;
}
}
Rectangle{
anchors.fill: parent
clip: true
radius: 5
color: "#a0ccd9"
Image{
id: icon
width: 20
height: 20
anchors.right: parent.right
anchors.top: parent.top
anchors.rightMargin: 5
anchors.topMargin: 5
source: "qrc:/icons/icons/menu_black_24dp.svg"
}
Text {
id: loadText
anchors.left: parent.left
anchors.top: icon.bottom
anchors.leftMargin: 10
anchors.topMargin: 10
text: qsTr("load")
MouseArea{
anchors.fill: parent
onClicked: {
fileMenu.expanded = false
loadDialog.visible = true
}
}
}
Text {
anchors.left: parent.left
anchors.top: loadText.bottom
anchors.leftMargin: 10
anchors.topMargin: 10
text: qsTr("save")
MouseArea{
anchors.fill: parent
onClicked: {
fileMenu.expanded = false
saveDialog.visible = true
}
}
}
}
FileDialog {
id: loadDialog
title: "Please choose a file to load"
defaultSuffix: "txt"
fileMode: FileDialog.OpenFile
nameFilters: ["Text files (*.txt)"]
onAccepted: {
speechModel.load(selectedFile)
}
}
FileDialog {
id: saveDialog
title: "Please choose a file to save"
defaultSuffix: "txt"
nameFilters: ["Text files (*.txt)"]
fileMode: FileDialog.SaveFile
onAccepted: {
speechModel.save(selectedFile)
}
}
}