-
Notifications
You must be signed in to change notification settings - Fork 0
/
Search.qml
73 lines (59 loc) · 1.87 KB
/
Search.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
import QtQuick 2.12
SearchFormular {
id: search
property alias search: search
property string objName
property var note
state: "hidden"
height: 0
opacity: 0.1
width: parent.width
visible: false
anchors.bottom: parent.bottom
textInput.text: textInput.activeFocus ? "" : qsTr("Search String")
textInput.color: textInput.activeFocus ? "0000": "#aba6a6"
textInput.onEditingFinished: {
// console.log("edtingFinished " + objName)
searchString = textInput.text
searchSignal(searchString, objName)
if (search.visible || search.activeFocus){
textInput.text = searchString.length > 0 ? searchString : qsTr("Search String")
}
if(document.curpos().length > 0)
{
if (document.curpos()[0] < note.length /2)
{
note.cursorPosition = note.length /2
note.cursorPosition = document.curpos()[0]
}
}
}
states: [
State {
name: "visible"
PropertyChanges { target: search; visible: true; }
},
State {
name: "hidden"
PropertyChanges { target: search; visible: false }
}
]
transitions: [
Transition {
from: "hidden"
to: "visible"
SequentialAnimation {
NumberAnimation{ target: search; property: "height"; to: 40; duration: 200}
NumberAnimation{ target: search; property: "opacity"; to: 1.0; duration: 200}
}
},
Transition {
from: "visible"
to: "hidden"
SequentialAnimation {
NumberAnimation{ target: search; property: "height"; to: 0.0; duration: 400}
NumberAnimation{ target: search; property: "opacity"; to: 0.1; duration: 200}
}
}
]
}