<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">Hey,<div class=""><br class=""></div><div class="">I was never successful extending QQuickItem to override touchEvent and handle then on the C++.</div><div class=""><br class=""></div><div class="">that’s what I was trying to say on previous email that Shawn Rutledge replied to me and I forgot to reply to him.</div><div class=""><br class=""></div><div class="">What exactly must done (the minimal necessary steps), to have a QQuickItem responding to touchEvents on the C++ side?</div><div class=""><br class=""></div><div class="">Can you please point an example or explicitly say here the minimal amount of code to make it do it? I simply can’t! :(</div><div class=""><br class=""></div><div class="">Regards,</div><div class=""><br class=""></div><div class="">Nuno</div><div class=""><br class=""></div><div class=""><br class=""></div><div class=""><br class=""><div><blockquote type="cite" class=""><div class="">On 1 May 2017, at 11:15, Jean-Michaël Celerier <<a href="mailto:jeanmichael.celerier@gmail.com" class="">jeanmichael.celerier@gmail.com</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div dir="ltr" class=""><div class=""><div class=""><div class="">> You can reimplement QQuickItem::touchEvent() to handle touch events. See QTouchEvent docs for the details.<br class=""><br class=""></div>Thanks. I guess there's not a similar way if one wants to stay in the QML realm ? <br class=""><br class=""></div>Best<br class=""></div>Jean-Michaël<br class=""><div class="gmail_extra"><br clear="all" class=""><div class=""><div class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr" class=""><div class=""><br class=""></div></div></div></div>
<br class=""><div class="gmail_quote">On Mon, May 1, 2017 at 8:24 AM, J-P Nurmi <span dir="ltr" class=""><<a href="mailto:jpnurmi@qt.io" target="_blank" class="">jpnurmi@qt.io</a>></span> wrote:<br class=""><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class="">> On 1 May 2017, at 01:31, Jean-Michaël Celerier <<a href="mailto:jeanmichael.celerier@gmail.com" class="">jeanmichael.celerier@gmail.<wbr class="">com</a>> wrote:<br class="">
><br class="">
> Bump.<br class="">
><br class="">
> Even if Qt Quick Controls 2.0 are apparently gaining this feature in 5.9.0, how would one go when writing custom QQuickItem, if multiple distinct items have to be able to receive touch events simultaneously ?<br class="">
<br class="">
</span>Hi,<br class="">
<br class="">
You can reimplement QQuickItem::touchEvent() to handle touch events. See QTouchEvent docs for the details.<br class="">
<br class="">
- <a href="http://doc.qt.io/qt-5/qquickitem.html#touchEvent" rel="noreferrer" target="_blank" class="">http://doc.qt.io/qt-5/<wbr class="">qquickitem.html#touchEvent</a><br class="">
- <a href="http://doc.qt.io/qt-5/qtouchevent.html" rel="noreferrer" target="_blank" class="">http://doc.qt.io/qt-5/<wbr class="">qtouchevent.html</a><br class="">
<br class="">
PS. Unlike for QWidgets and QGraphicsItems, there is no need to explicitly enable touch events for QQuickItems.<br class="">
<br class="">
--<br class="">
J-P Nurmi<br class="">
<div class="HOEnZb"><div class="h5"><br class="">
______________________________<wbr class="">_________________<br class="">
Interest mailing list<br class="">
<a href="mailto:Interest@qt-project.org" class="">Interest@qt-project.org</a><br class="">
<a href="http://lists.qt-project.org/mailman/listinfo/interest" rel="noreferrer" target="_blank" class="">http://lists.qt-project.org/<wbr class="">mailman/listinfo/interest</a><br class="">
</div></div></blockquote></div><br class=""></div></div>
_______________________________________________<br class="">Interest mailing list<br class=""><a href="mailto:Interest@qt-project.org" class="">Interest@qt-project.org</a><br class="">http://lists.qt-project.org/mailman/listinfo/interest<br class=""></div></blockquote></div><br class=""></div></body></html>