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();
16 function setText(string) { textInLineEdit = string; }
17 function setCompleter(string) { completerItemText.text=string; }
18 function hideCompleter() { completerItem.visible=false; }
20 function addOneChar(){
21 if(completerItemText.text.length>0)
22 text_input1.text=text_input1.text+completerItemText.text.charAt(0);
25 function addAllChars(){
26 text_input1.text=text_input1.text+completerItemText.text;
27 completerItemText.text="";
32 width: rectangle1.width-20
33 height: rectangle1.height*0.6;
35 transformOrigin: Item.Left
36 anchors.centerIn: parent
38 font.pixelSize: rectangle1.height * .5;
39 onCursorPositionChanged: {
40 moveCursorSelection(cursorPosition);
41 if(cursorPosition==text.length && useCompleter)
42 completerItem.visible=true;
44 completerItem.visible=false;
46 focus: rectangle1.focus;
47 Keys.priority : Keys.AfterItem
49 if ((event.key == Qt.Key_Enter) || (event.key == Qt.Key_Return)){
50 rectangle1.enterPressed(text_input1.text)
51 completerItem.visible=false;
54 if (event.key == Qt.Key_Up)
55 rectangle1.nextCompleter();
56 if (event.key == Qt.Key_Down)
57 rectangle1.prevCompleter();
58 if ((event.key == Qt.Key_Right) && (cursorPosition==text.length))
60 if(Qt.ControlModifier){
61 if (event.key == Qt.Key_Space){
62 if(completerItem.visible=false)
63 completerItem.visible=true
68 if(event.key == Qt.Key_Escape)
69 completerItem.visible=false;
72 onTextChanged: rectangle1.textChange(text);
78 x: text_input1.x + text_input1.positionToRectangle(text_input1.cursorPosition).x +1
80 width: completerItemText.paintedWidth;
82 height: text_input1.height
83 color: (completerItemText.text.length>0)?"#5e71fb":"#FFFFFF"
89 font.pixelSize: text_input1.font.pixelSize;
95 anchors.centerIn: parent;
100 height: parent.height;
105 name: "FokusState"; when: text_input1.focus==true && rectangle1.enabled==true;
112 name: "DisableState"; when: rectangle1.enabled==false;
113 PropertyChanges { target: shadeDisable; z: 3; opacity: 0.5 }