forked from chili-epfl/Carpenter-App-RoofDesigner
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathToolsMenu.qml
More file actions
executable file
·72 lines (55 loc) · 1.73 KB
/
ToolsMenu.qml
File metadata and controls
executable file
·72 lines (55 loc) · 1.73 KB
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
import QtQuick 2.0
import QtQuick.Controls 1.4
import QtQuick.Layouts 1.2
import "." // to import Settings
Rectangle {
id: menu
width: childrenRect.width
z: 100
height: menuItems.count * itemHeight
property real itemHeight: 72
anchors.left: sketchArea.left
anchors.leftMargin: 10
anchors.verticalCenter: sketchArea.verticalCenter
function toggleState() {
console.log("change state")
if(menu.state === "hidden") {
menu.state = "visible"
}
else {
menu.state = "hidden"
}
}
transitions: Transition {
PropertyAnimation { properties: "y"; easing.type: Easing.InOutQuad }
}
ListView {
height: menu.height
width:itemHeight
model: menuItems
delegate: Rectangle {
width: childrenRect.width
height: childrenRect.height
color: isToolSelected(tool) ? Settings.paletteHighlight : Settings.palette;
function isToolSelected(tool) {
return mainForm.state === tool;
}
property color labelColor : isToolSelected(tool) ? Settings.selectedToolColor : Settings.toolColor
property int labelFontSize : 24
Label {
text: icon
font.family: fontName
font.pointSize: labelFontSize
color: labelColor
height: menu.itemHeight
width: menu.width
horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter
}
MouseArea {
anchors.fill: parent
onClicked: mainForm.changeTool(tool, name)
}
}
}
}