6 border.color: "#000666";
7 property alias textInLineEdit:text_input1.text
8 property bool useCompleter:false
10 signal enterPressed(string text);
11 signal textChange(string text);
13 signal nextCompleter();
14 signal prevCompleter();
19 function setText(string) { textInLineEdit = string; }
20 function setCompleter(string) { completerItemText.text=string; }
21 function hideCompleter() { completerItem.visible=false; }
23 function addOneChar(){
24 if(completerItemText.text.length>0)
25 text_input1.text=text_input1.text+completerItemText.text.charAt(0);
28 function addAllChars(){
29 text_input1.text=text_input1.text+completerItemText.text;
30 completerItemText.text="";
34 if(rectangle1.enabled){
35 text_input1.focus=true;
42 width: rectangle1.width-20
43 height: rectangle1.height*0.6;
45 transformOrigin: Item.Left
46 anchors.centerIn: parent
48 font.pixelSize: rectangle1.height * .5;
49 onCursorPositionChanged: {
50 moveCursorSelection(cursorPosition);
51 if(cursorPosition==text.length && useCompleter)
52 completerItem.visible=true;
54 completerItem.visible=false;
56 Keys.priority : Keys.AfterItem
58 if ((event.key == Qt.Key_Enter) || (event.key == Qt.Key_Return)){
59 rectangle1.enterPressed(text_input1.text)
60 completerItem.visible=false;
63 if (event.key == Qt.Key_Up)
64 rectangle1.nextCompleter();
65 if (event.key == Qt.Key_Down)
66 rectangle1.prevCompleter();
67 if ((event.key == Qt.Key_Right) && (cursorPosition==text.length))
69 if(Qt.ControlModifier){
70 if (event.key == Qt.Key_Space){
71 if(completerItem.visible=false)
72 completerItem.visible=true
77 if(event.key == Qt.Key_Escape)
78 completerItem.visible=false;
81 onTextChanged: rectangle1.textChange(text);
82 onFocusChanged: if(focus) isFocused();
83 onActiveFocusChanged: rectangle1.checkFocus();
89 x: text_input1.x + text_input1.positionToRectangle(text_input1.cursorPosition).x +1
91 width: completerItemText.paintedWidth;
93 height: text_input1.height
94 color: (completerItemText.text.length>0)?"#5e71fb":"#FFFFFF"
100 font.pixelSize: text_input1.font.pixelSize;
106 anchors.centerIn: parent;
107 radius: parent.radius
111 height: parent.height;
116 name: "FokusState"; when: text_input1.focus && rectangle1.enabled;
123 name: "DisableState"; when: !rectangle1.enabled;
124 PropertyChanges { target: shadeDisable; z: 3; opacity: 0.5 }