how to set focus onto the textedit.
I checked the docs and tried with "focus : true" and forceActiveFocus() but in vain

The code is as below.
Notes.qml
Qt Code:
  1. import QtQuick 1.1
  2.  
  3. Rectangle {
  4. id: notesrect
  5. width: 250
  6. height: 175
  7. border.width: 2
  8. border.color: "#B1B0A8"
  9. color: "transparent"
  10.  
  11. property alias text: searchtext.text
  12.  
  13. Rectangle {
  14. id: notesrect1
  15. width: parent.width
  16. anchors.top: parent.top
  17. height: 40
  18. color: "#F4F4F4"
  19.  
  20. Image {
  21. id: img2
  22. anchors.top: parent.top
  23. anchors.horizontalCenter: parent.horizontalCenter
  24. anchors.topMargin: 2
  25. source: "images/hideicons.png"
  26.  
  27. MouseArea {
  28. anchors.fill: parent
  29. onClicked:
  30. {
  31. if(searchtext.text.length > 0)
  32. {
  33. rw.setannottext(searchtext.text)
  34. browserwindow.storeannotations()
  35. }
  36. searchtext.text = ""
  37. notesrect.visible = false
  38.  
  39. }
  40. }
  41. }
  42.  
  43. Text {
  44. id:txt1
  45. text: qsTr("Take Note")
  46. font.pointSize: 9
  47. font.family: "san-serif"
  48. anchors.bottom: parent.bottom
  49. anchors.horizontalCenter: parent.horizontalCenter
  50. anchors.bottomMargin: 2
  51. color: "black"
  52. }
  53.  
  54. }
  55.  
  56. Rectangle {
  57. id: notesrect2
  58. width: parent.width
  59. height: parent.height -40
  60. anchors.top: notesrect1.bottom
  61. color: "#FFFCD0"
  62. clip: true
  63.  
  64. /* Flickable {
  65.   id: flickArea
  66.   anchors.fill: parent
  67.   contentWidth: searchtext.width; contentHeight: searchtext.height
  68.   flickableDirection: Flickable.VerticalFlick
  69.   clip: true */
  70.  
  71. TextEdit {
  72. id: searchtext
  73. anchors.fill: parent
  74. focus: true
  75. cursorVisible: true
  76. color: "black"
  77. clip:true
  78. textFormat: TextEdit.AutoText
  79. wrapMode: TextEdit.Wrap
  80. Keys.onPressed: TextEdit.forceActiveFocus()
  81.  
  82. Keys.onReturnPressed:
  83. {
  84. if(searchtext.text.length > 0)
  85. {
  86. rw.setannottext(searchtext.text)
  87. browserwindow.storeannotations()
  88. }
  89. }
  90. }
  91. }
  92. }
  93. in browserwindow.qml
  94. I will set this Notes.qml to visible
  95. [code]
  96. function newnotes()
  97. {
  98. mypoint = graphicswebview.getscreenpos()
  99. notesbox.x = mypoint.x - notesbox.width/2
  100. notesbox.y = mypoint.y - 36
  101. notesbox.visible = true
  102. hlbox.visible = false
  103. }
To copy to clipboard, switch view to plain text mode 
[/code]