6 property alias text: textInp.text
8 width: textInp.width + 11
12 color: 'lightsteelblue'
16 Component.onCompleted: textInp.cursorPosition = 0;
19 cursorDelegate: Item {
21 visible: parent.parent.focus
28 property int leftMargin: 6
29 property int rightMargin: 6
32 //Below function implements all scrolling logic
33 onCursorPositionChanged: {
34 if(cursorRectangle.x < leftMargin - textInp.x){//Cursor went off the front
35 textInp.x = leftMargin - Math.max(0, cursorRectangle.x);
36 }else if(cursorRectangle.x > parent.width - leftMargin - rightMargin - textInp.x){//Cusor went off the end
37 textInp.x = leftMargin - Math.max(0, cursorRectangle.x - (parent.width - leftMargin - rightMargin));
41 autoScroll: false //It is preferable to implement your own scrolling
43 horizontalAlignment: TextInput.AlignLeft
45 selectionColor: 'steelblue'
48 //Implements all line edit mouse handling
51 function translateX(x){
56 textInp.cursorPosition = textInp.positionAt(translateX(mouse.x));
59 textInp.moveCursorSelection(textInp.positionAt(translateX(mouse.x)));