I would also like the cursor to be different, depending on which mode is set.
So I was thinking about selecting the characters to overwrite them:
@
TextInput
{
id: input
text: "ciao"
font.pixelSize: 20
onTextChanged:
{
select(cursorPosition, cursorPosition+1);
}
}
@
This is working quite nice. But I don't know how to select the first character.
I tried this:
@
Component.onCompleted: select(0, 1)
@
The character was selected, but I couldn't enter anything anymore. Also the left/right keys were not working.
The other problem are the left/right buttons. I would need to set the selection when they are pressed, too.
I tried this:
@
Keys.onPressed:
{
if(event.key == Qt.Key_Right)
{
select(cursorPosition, cursorPosition+1);
}
}
@
When the cursorPosition is 0 and I press the right arrow key, the cursor is on the second position (before the 'a'). When I press the right arrow key again, the cursor is behind the 'o' but nothing is selected
I also tried to set the cursorDelegate, but the Rectangle is shown on top of the text.