[SailfishDevel] TextArea | Using EnterKey.onClicked

Nicolas Cisco ncis20 at gmail.com
Thu Feb 5 23:11:22 UTC 2015


Hi,
I'm using the EnterKey.onClicked in a TextArea, the problem is that if I
retrieve the text area's text in the callback function, it has a trailing
newline (the enter input). Is there a way to prevent the enter key?. I
though of striping the enterkey by hand in the callback like `textArea.text
= textArea.text.slice(0, -1)`, but, the problem is that if you are not in
the end of the input this doesn't work.

The example is simple:

    TextArea {
       id: textArea
       EnterKey.onClicked: console.log("my text is: \""+textArea.text+"\"")
    }

I tried to see if the event works (as the QML Keys Element [
http://doc.qt.io/qt-5/qml-qtquick-keys.html ] ), but it doesn't.

I try using the qml Keys api:

    TextArea {
       id: textArea
       EnterKey.onClicked: console.log("EnterKey.onClicked")
       Key.onEnterPressed: console.log("Key.onEnterPressed")
       Key.onPressed: console.log("Key.onPressed")
    }

But doesn't work, the only signal fired is EnterKey.onClicked.

In addition, my idea is to allow the user to input enters by using shift
and then the enter key, is there a way in order to achieve this?.

Any help is appreciated! =)
Thanks in advance!

-- 
Nicolas Cisco
www.nckweb.com.ar
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.sailfishos.org/pipermail/devel/attachments/20150205/b3d58677/attachment.html>


More information about the Devel mailing list