<div dir="ltr">I've end up copying the source of TextArea ( /usr/lib/qt5/Sailfish/Silica/TextArea.qml ) and adding a custom signal called pressed. This signal is fired when the Keys.onPressed for the TextEdit [0] is fired. This signal send the KeyEvent object, so in order to stop propagation event.accepted has to be setted to true.<div><br></div><div>With this approach i've encountered several issues:</div><div><br></div><div>1- The enter key isn't recognised as an Qt.Key_Enter, but as Qt.Key_Return, so if you want to filter the enter key, you'll have to use `event.key == Qt.Key_Return`.</div><div>2- Although the shift is activated in the virtual keyboard, event.modifiers is always 0. I was expecting i could do event.modifiers & Qt.ShiftModifier in order to filter the Enter + Shift.</div><div>3- As Pekka Vourela said, only enter key and backspace send events.</div><div><br></div><div>[0] <a href="https://github.com/NickCis/sailfishos-message-enter-patch/blob/master/org/nickcis/base/MyTextArea.qml">https://github.com/NickCis/sailfishos-message-enter-patch/blob/master/org/nickcis/base/MyTextArea.qml</a></div></div><div class="gmail_extra"><br><div class="gmail_quote">2015-02-12 0:20 GMT-03:00 Nicolas Cisco <span dir="ltr"><<a href="mailto:ncis20@gmail.com" target="_blank">ncis20@gmail.com</a>></span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">I don't understand to what are you refering by sailing RichText. Can you explain it?.<div>Thanks!</div></div><div class="gmail_extra"><br><div class="gmail_quote">2015-02-07 16:55 GMT-03:00 Andrey Kozhevnikov <span dir="ltr"><<a href="mailto:coderusinbox@gmail.com" target="_blank">coderusinbox@gmail.com</a>></span>:<div><div class="h5"><br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
  
    
  
  <div bgcolor="#FFFFFF" text="#000000">
    If you using RichText enter key not adding newline. So depends on
    settings you entering <br/> yourself or doing send.<br>
    <br>
    <div>07.02.2015 23:37, Nicolas Cisco пишет:<br>
    </div><div><div>
    <blockquote type="cite">
      <div dir="ltr">Yes, i tried the text.substr(0, text.length-1). In
        my first mail, i wrote why doesn't wok:
        <div>"<span style="font-size:13px">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."
            (text.substr(0, text.lenght-1) does bassically the same as
            text.slice(0, -1) ).</span></div>
        <div><span style="font-size:13px"><br>
          </span></div>
        <div>I don't think that multiline support is critical. The
          problem of changing TextArea to a TextField, is that when
          writing long texts, altought you are writing only one line,
          TextArea expands in a multilineal way, which is easier to
          edit, while TextField mantains the widget size and the text
          moves.</div>
        <div><br>
        </div>
        <div>I remember that Mitakuuluu2 [1] [2] app had a nice
          conversation input. A widget that expands in a multilineal way
          with a custom enter action. I had a glance at the code, and i
          find it very hard to understand (i'm a begginner at qml). I'll
          try to reuse that code, any help on understand it will be
          appreciated =).</div>
        <div><br>
        </div>
        <div>Thanks!</div>
        <div><br>
        </div>
        <div>[1] <a href="https://github.com/CODeRUS/mitakuuluu2/blob/master/client/qml/EmojiTextArea.qml" target="_blank">https://github.com/CODeRUS/mitakuuluu2/blob/master/client/qml/EmojiTextArea.qml</a></div>
        <div>[2] <a href="https://github.com/CODeRUS/mitakuuluu2/blob/master/client/qml/EmojiTextBase.qml" target="_blank">https://github.com/CODeRUS/mitakuuluu2/blob/master/client/qml/EmojiTextBase.qml</a></div>
      </div>
      <div class="gmail_extra"><br>
        <div class="gmail_quote">2015-02-07 4:19 GMT-03:00 Asser
          Lähdemäki <span dir="ltr"><<a href="mailto:sailfishmail@denden.pw" target="_blank">sailfishmail@denden.pw</a>></span>:<br>
          <blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hello,<br>
            <br>
            Did you try text.substr(0, text.lenght-1) to remove the last
            char?<br>
            <br>
            Also, if the multiline support is important for your UX,
            perhaps you could open a Dialog when the text is clicked,
            where you could accept the edits without EnterKey.<br>
            <br>
            Cheers,<br>
            Asser<br>
            <br>
            ncis20 kirjoitti la helmikuuta 7 08:32:12 2015 GMT+0200:<br>
            <div>
              <div>> Uhh, that's bad news =(, i'll have to
                use TextField instead and forget of having multineal
                support.<br>
                > When i said shift+enter, i wasn't refering to
                actually touching both keys at the same time, i was
                thinking in something like caps lock (like entering
                upper cased letters in the virtual keyboard).  When you
                hit the shift in the virtual keyboard, it sticks and you
                can input uppercased letters without multitouch support.
                I was wondering if with the enter key could be done
                something similar, i.e. normal enter would trigger the
                action shift+enter (not actually pressing both keys at
                the same time, but like uppercased letters) would input
                a newline.<br>
                ><br>
                > Thanks for the fast answer, any further infornation
                about the topic will also be thanked =).<br>
                ><br>
                > El vie feb 6 09:13:35 2015 GMT-0300, Pekka Vuorela
                escribió:<br>
                > > to, 2015-02-05 kello 20:11 -0300, Nicolas
                Cisco kirjoitti:<br>
                > ><br>
                > ><br>
                > > > I try using the qml Keys api:<br>
                > > ><br>
                > > ><br>
                > > >     TextArea {<br>
                > > >        id: textArea<br>
                > > >        EnterKey.onClicked:
                console.log("EnterKey.onClicked")<br>
                > > >        Key.onEnterPressed:
                console.log("Key.onEnterPressed")<br>
                > > ><br>
                > > >        Key.onPressed:
                console.log("Key.onPressed")<br>
                > > ><br>
                > > >     }<br>
                > ><br>
                > > > But doesn't work, the only signal fired
                is EnterKey.onClicked.<br>
                > > ><br>
                > > > In addition, my idea is to allow the user
                to input enters by using<br>
                > > > shift and then the enter key, is there a
                way in order to achieve<br>
                > > > this?.<br>
                > ><br>
                > > At the moment EnterKey doesn't allow to filter
                out the click event and<br>
                > > indeed Keys attached property doesn't work on
                Silica editors. Could look<br>
                > > into both, but not sure if that would be too
                high priority.<br>
                > ><br>
                > > First, the virtual keyboard sends key events
                only on few cases: enter<br>
                > > and backspace when no word is active (i.e.
                underlined). Second, shift<br>
                > > modifier is not supported on either. And even
                if shift would be passed,<br>
                > > that as user interface would require
                multitouch, which doesn't sound<br>
                > > like a good idea.<br>
                > ><br>
                > ><br>
                > ><br>
                > >
                _______________________________________________<br>
                > > SailfishOS.org Devel mailing list<br>
                > > To unsubscribe, please send a mail to <a href="mailto:devel-unsubscribe@lists.sailfishos.org" target="_blank">devel-unsubscribe@lists.sailfishos.org</a><br>
                > ><br>
                ><br>
                > --<br>
                > Enviado desde mi Jolla<br>
                > _______________________________________________<br>
                > SailfishOS.org Devel mailing list<br>
                > To unsubscribe, please send a mail to
                <a href="mailto:devel-unsubscribe@lists.sailfishos.or" target="_blank">devel-unsubscribe@lists.sailfishos.or</a><br>
                _______________________________________________<br>
                SailfishOS.org Devel mailing list<br>
                To unsubscribe, please send a mail to <a href="mailto:devel-unsubscribe@lists.sailfishos.org" target="_blank">devel-unsubscribe@lists.sailfishos.org</a></div>
            </div>
          </blockquote>
        </div>
        <br>
        <br clear="all">
        <div><br>
        </div>
        -- <br>
        <div>Nicolas Cisco<br>
          <a href="http://www.nckweb.com.ar" target="_blank">www.nckweb.com.ar</a><br>
        </div>
      </div>
      <br>
      <fieldset></fieldset>
      <br>
      <pre>_______________________________________________
SailfishOS.org Devel mailing list
To unsubscribe, please send a mail to <a href="mailto:devel-unsubscribe@lists.sailfishos.org" target="_blank">devel-unsubscribe@lists.sailfishos.org</a></pre>
    </blockquote>
    <br>
  </div></div></div>

<br>_______________________________________________<br>
SailfishOS.org Devel mailing list<br>
To unsubscribe, please send a mail to <a href="mailto:devel-unsubscribe@lists.sailfishos.org" target="_blank">devel-unsubscribe@lists.sailfishos.org</a><br></blockquote></div></div></div><span class="HOEnZb"><font color="#888888"><br><br clear="all"><div><br></div>-- <br><div>Nicolas Cisco<br><a href="http://www.nckweb.com.ar" target="_blank">www.nckweb.com.ar</a><br></div>
</font></span></div>
</blockquote></div><br><br clear="all"><div><br></div>-- <br><div class="gmail_signature">Nicolas Cisco<br><a href="http://www.nckweb.com.ar" target="_blank">www.nckweb.com.ar</a><br></div>
</div>