In the previous email, I transcribed wrongly the qml keys example. The correct example is:
TextArea { id: textArea EnterKey.onClicked: console.log("EnterKey.onClicked") Keys.onEnterPressed: console.log("Keys.onEnterPressed") Keys.onPressed: console.log("Keys.onPressed") } (I forgot to put the 's' in "Keys", anyways, it doesn't work, signals are not fired) 2015-02-05 20:11 GMT-03:00 Nicolas Cisco <nci...@gmail.com>: > 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 > -- Nicolas Cisco www.nckweb.com.ar
_______________________________________________ SailfishOS.org Devel mailing list To unsubscribe, please send a mail to devel-unsubscr...@lists.sailfishos.org