6 property alias text: textEdit.text
8 width: 240 + 11 //Should be set manually in most cases
9 height: textEdit.height + 11
12 color: 'lightsteelblue'
16 Component.onCompleted: textEdit.cursorPosition = 0;
19 cursorDelegate: Item {
21 visible: parent.parent.focus
28 property int leftMargin: 6
29 property int topMargin: 6
30 property int rightMargin: 6
31 property int bottomMargin: 6
33 width: parent.width - leftMargin - rightMargin;
35 //Below function implements all scrolling logic
36 onCursorPositionChanged: {
37 if(cursorRectangle.y < topMargin - textEdit.y){//Cursor went off the front
38 textEdit.y = topMargin - Math.max(0, cursorRectangle.y);
39 }else if(cursorRectangle.y > parent.height - topMargin - bottomMargin - textEdit.y){//Cursor went off the end
40 textEdit.y = topMargin - Math.max(0, cursorRectangle.y - (parent.height - topMargin - bottomMargin) + cursorRectangle.height);
43 onHeightChanged: y=topMargin//reset scroll
46 horizontalAlignment: TextInput.AlignLeft
47 wrapMode: TextEdit.WordWrap
49 selectionColor: 'steelblue'
52 //Implements all line edit mouse handling
55 function translateY(y){
58 function translateX(x){
62 textEdit.focus = true;
63 textEdit.cursorPosition = textEdit.positionAt(translateX(mouse.x), translateY(mouse.y));
66 textEdit.moveCursorSelection(textEdit.positionAt(translateX(mouse.x), translateY(mouse.y)));