Hi,

I have a QML TextArea (RichText), where I append an image from resources (using HTML <img>)
After appending, the cursor goes automatically to 0, although I set

Qt Code:
  1. textArea.cursorPosition = textArea.text.length
To copy to clipboard, switch view to plain text mode 

How can I keep the cursor at the end, to keep writing?

My code:

Qt Code:
  1. import QtQuick 2.7
  2. import QtQuick.Controls 1.3
  3.  
  4. Item {
  5. height: 600
  6. width: 600
  7. anchors.centerIn: parent
  8.  
  9. TextArea {
  10. id: textArea
  11. anchors.centerIn: parent
  12. height: 300
  13. width: 500
  14.  
  15. textFormat: TextEdit.RichText // diego.donate
  16. verticalAlignment: TextEdit.AlignVCenter
  17. font. pointSize: 14
  18. horizontalAlignment: Text.AlignLeft
  19. }
  20.  
  21. DropArea {
  22. anchors.fill: textArea
  23.  
  24. onEntered: drag.accepted = true
  25. onDropped: {
  26. var sImageFromRes = "qrc:///images/image.png"
  27. textArea.text += "<img src=" + sImageFromRes + " height=25 width=25>"
  28. textArea.cursorPosition = textArea.text.length // NOT working
  29. }
  30. }
  31. }
To copy to clipboard, switch view to plain text mode 

Thanks,
Diego