-
Notifications
You must be signed in to change notification settings - Fork 44
/
CommentBox.qml
74 lines (58 loc) · 1.42 KB
/
CommentBox.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
import QtQuick 2.6
import QtQuick.Layouts 1.1
import Pyblish 0.1
Rectangle {
id: root
clip: true
height: 0
color: Theme.backgroundColor
property bool isUp
property bool isMaximised
property alias text: textBox.text
property var readOnly: false
Behavior on height {
NumberAnimation {
duration: 500
easing.type: Easing.OutQuint
}
}
function up() {
isUp = true
textBox.forceActiveFocus()
}
function down() {
isUp = false
isMaximised = false
}
function toggle() {
isUp ? down() : up()
}
View {
radius: 3
elevation: -1
anchors.fill: parent
anchors.margins: 5
Layout.fillHeight: true
Layout.fillWidth: true
TextEdit {
id: textBox
anchors.fill: parent
anchors.margins: 5
color: "white"
selectionColor: "#222"
selectByMouse: true
readOnly: root.readOnly
wrapMode: TextEdit.WordWrap
clip: true
Label {
text: "Comment"
opacity: 0.5
visible: parent.length == 0
}
font.family: "Open Sans"
font.weight: Font.Normal
KeyNavigation.priority: KeyNavigation.BeforeItem
onTextChanged: app.commenting(text)
}
}
}