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
import QtQuick 1.1
Rectangle {
id: notesrect
width: 250
height: 175
border.width: 2
border.color: "#B1B0A8"
color: "transparent"
property alias text: searchtext.text
Rectangle {
id: notesrect1
width: parent.width
anchors.top: parent.top
height: 40
color: "#F4F4F4"
Image {
id: img2
anchors.top: parent.top
anchors.horizontalCenter: parent.horizontalCenter
anchors.topMargin: 2
source: "images/hideicons.png"
MouseArea {
anchors.fill: parent
onClicked:
{
if(searchtext.text.length > 0)
{
rw.setannottext(searchtext.text)
browserwindow.storeannotations()
}
searchtext.text = ""
notesrect.visible = false
}
}
}
Text {
id:txt1
text: qsTr("Take Note")
font.pointSize: 9
font.family: "san-serif"
anchors.bottom: parent.bottom
anchors.horizontalCenter: parent.horizontalCenter
anchors.bottomMargin: 2
color: "black"
}
}
Rectangle {
id: notesrect2
width: parent.width
height: parent.height -40
anchors.top: notesrect1.bottom
color: "#FFFCD0"
clip: true
/* Flickable {
id: flickArea
anchors.fill: parent
contentWidth: searchtext.width; contentHeight: searchtext.height
flickableDirection: Flickable.VerticalFlick
clip: true */
TextEdit {
id: searchtext
anchors.fill: parent
focus: true
cursorVisible: true
color: "black"
clip:true
textFormat: TextEdit.AutoText
wrapMode: TextEdit.Wrap
Keys.onPressed: TextEdit.forceActiveFocus()
Keys.onReturnPressed:
{
if(searchtext.text.length > 0)
{
rw.setannottext(searchtext.text)
browserwindow.storeannotations()
}
}
}
}
}
in browserwindow.qml
I will set this Notes.qml to visible
[code]
function newnotes()
{
mypoint = graphicswebview.getscreenpos()
notesbox.x = mypoint.x - notesbox.width/2
notesbox.y = mypoint.y - 36
notesbox.visible = true
hlbox.visible = false
}
import QtQuick 1.1
Rectangle {
id: notesrect
width: 250
height: 175
border.width: 2
border.color: "#B1B0A8"
color: "transparent"
property alias text: searchtext.text
Rectangle {
id: notesrect1
width: parent.width
anchors.top: parent.top
height: 40
color: "#F4F4F4"
Image {
id: img2
anchors.top: parent.top
anchors.horizontalCenter: parent.horizontalCenter
anchors.topMargin: 2
source: "images/hideicons.png"
MouseArea {
anchors.fill: parent
onClicked:
{
if(searchtext.text.length > 0)
{
rw.setannottext(searchtext.text)
browserwindow.storeannotations()
}
searchtext.text = ""
notesrect.visible = false
}
}
}
Text {
id:txt1
text: qsTr("Take Note")
font.pointSize: 9
font.family: "san-serif"
anchors.bottom: parent.bottom
anchors.horizontalCenter: parent.horizontalCenter
anchors.bottomMargin: 2
color: "black"
}
}
Rectangle {
id: notesrect2
width: parent.width
height: parent.height -40
anchors.top: notesrect1.bottom
color: "#FFFCD0"
clip: true
/* Flickable {
id: flickArea
anchors.fill: parent
contentWidth: searchtext.width; contentHeight: searchtext.height
flickableDirection: Flickable.VerticalFlick
clip: true */
TextEdit {
id: searchtext
anchors.fill: parent
focus: true
cursorVisible: true
color: "black"
clip:true
textFormat: TextEdit.AutoText
wrapMode: TextEdit.Wrap
Keys.onPressed: TextEdit.forceActiveFocus()
Keys.onReturnPressed:
{
if(searchtext.text.length > 0)
{
rw.setannottext(searchtext.text)
browserwindow.storeannotations()
}
}
}
}
}
in browserwindow.qml
I will set this Notes.qml to visible
[code]
function newnotes()
{
mypoint = graphicswebview.getscreenpos()
notesbox.x = mypoint.x - notesbox.width/2
notesbox.y = mypoint.y - 36
notesbox.visible = true
hlbox.visible = false
}
To copy to clipboard, switch view to plain text mode
[/code]
Bookmarks