-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathTag.qml
72 lines (60 loc) · 1.82 KB
/
Tag.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.0
Rectangle {
id: root
width: rootLayout.implicitWidth + 4
height: rootLayout.implicitHeight + 4
property string text
color: "#b05050"
ColorAnimation { // animation on tag drop error
id: error_animation
target: root
properties: "color"
from: "red"
to: "#b05050"
duration: 500
}
radius: 3
Row {
id: rootLayout
anchors.centerIn: parent
spacing: 2
Image {
source: root.text == "signed" ? "qrc:/images/typicons/tag_signed.png"
: root.text == "attachment" ? "qrc:/images/typicons/tag_attachment.png"
: root.text.substring(0, 9) == "notmuch::" ? "qrc:/images/tag_notmuch.png"
: ""
}
Text {
id: textItem
color: "white"
font.pixelSize: 10
text: root.text == "signed" ? ""
: root.text == "attachment" ? ""
: root.text.substring(0, 9) == "notmuch::" ? root.text.substring(9)
: root.text
}
Rectangle {
id: close_btn
visible: tags.canDrop(root.text)
width: 11
height: 11
radius: 3
color: ma.containsMouse ? "#580000" : " transparent"
Image {
source: "qrc:/images/tag_close.png"
width: 11
height: 11
}
MouseArea {
id: ma
anchors.fill: parent
hoverEnabled: true
// TODO undo_animation
onClicked: if(!tags.drop(root.text)) {
error_animation.restart()
close_btn.visible = false
}
}
}
}
}