<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[Implementation of TouchArea using TUIO API for QML application]]></title><description><![CDATA[<p dir="auto">Hello,<br />
I am implementing a TUIO API interface for multiple touch screen able to touch several touch screen simultaneously.</p>
<p dir="auto">Is is nearly working:</p>
<p dir="auto">I have several instance of a class :</p>
<p dir="auto">@class SdcnApplicationViewer<br />
: public QDeclarativeView, TUIO::TuioListener@</p>
<p dir="auto">For every TUIO Event I use a Qt function to emit deep asome touch event and reach the touch areas</p>
<p dir="auto">@//Send Event to main application<br />
QApplicationPrivate *qAppPriv = QApplicationPrivate::instance();<br />
qAppPriv-&gt;translateRawTouchEvent(this,QTouchEvent::TouchScreen,touchPointsList);@</p>
<p dir="auto">have for the moment 3 instance of my <em>SdcnApplicationViewer</em></p>
<ul>
<li>one receives All event of <em>translateRawTouchEvent</em></li>
<li>one receives All only the Touchbegin event of <em>translateRawTouchEvent</em></li>
<li>one receives no event of <em>translateRawTouchEvent</em></li>
</ul>
<p dir="auto">Does someone has information of about the <em>translateRawTouchEvent</em> and how it dispatches data from application to toucareas</p>
<p dir="auto">--</p>
]]></description><link>https://forum.qt.io/topic/36845/implementation-of-toucharea-using-tuio-api-for-qml-application</link><generator>RSS for Node</generator><lastBuildDate>Sat, 08 Aug 2026 00:08:58 GMT</lastBuildDate><atom:link href="https://forum.qt.io/topic/36845.rss" rel="self" type="application/rss+xml"/><pubDate>Tue, 21 Jan 2014 09:39:24 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Implementation of TouchArea using TUIO API for QML application on Tue, 20 May 2014 11:23:52 GMT]]></title><description><![CDATA[<p dir="auto"><em>Conclusion:</em><br />
Hello,<br />
I am implementing a TUIO API interface for multiple touch screen able to touch several touch screen simultaneously.<br />
It is working!</p>
<p dir="auto"><em>0./ I add a modiffication into:</em><br />
qapplication_p.h<br />
@public:<br />
//Add a filter to completely ignore touch event if they do not match the pressure value<br />
//only when touchEventPressurFilter&gt;0 !!<br />
static qreal  touchEventPressurFilter;@<br />
and also into gui\kern@el\qapplication.cpp<br />
so the methode translateRawTouchEvent can ignore touch event based on a pressure value<br />
@//Add a filter to completely ignore touch event if they do not match the pressure value<br />
//only when touchEventPressurFilter&gt;0 !!<br />
qreal QApplicationPrivate::touchEventPressurFilter = -1;@</p>
<p dir="auto">@void QApplicationPrivate::translateRawTouchEvent(QWidget *window,<br />
QTouchEvent::DeviceType deviceType,<br />
const QList<a target="_blank" rel="noopener noreferrer nofollow ugc">QTouchEvent::TouchPoint</a> &amp;touchPoints)<br />
{<br />
QApplicationPrivate *d = self;<br />
typedef QPair&lt;Qt::TouchPointStates, QList<a target="_blank" rel="noopener noreferrer nofollow ugc">QTouchEvent::TouchPoint</a> &gt; StatesAndTouchPoints;<br />
QHash&lt;QWidget *, StatesAndTouchPoints&gt; widgetsNeedingEvents;</p>
<pre><code>//TestTuio
if(touchEventPressurFilter&gt;=0)
    for (int i = 0; i &lt; touchPoints.count(); ++i)
    {
        QTouchEvent::TouchPoint touchPoint = touchPoints.at(i);
        if(touchPoint.pressure()!=touchEventPressurFilter)
        {
            //qDebug()&lt;&lt; "Ignore WM_TOUCH Events: filter on pressure value: "&lt;&lt;touchPoint.pressure()&lt;&lt; touchEventPressurFilter;
            return;
        }
    }@
</code></pre>
<p dir="auto"><em>1./ I have several instance of a class :</em></p>
<p dir="auto">@class SdcnTUIOApplicationViewer<br />
: public QDeclarativeView, TUIO::TuioListener@</p>
<p dir="auto"><em>2./ Only one instance is listening the TUIO UDP frames</em> All instance are child of a static global background widget, setparent() is called during initialisation:<br />
The filter/pressure value is also set once during initialisation of one of the ApplicationViewer instance<br />
@        //GlobalWidget use for multitouch<br />
if(globalWidget==NULL)<br />
{</p>
<pre><code>        //globalWidget Must fill the virtual desktop
        globalWidget = new SdcnBackgroundWidget( 0, Qt::Tool|Qt::FramelessWindowHint );

        //Set geometry instead of maximized !
        ((QWidget*)globalWidget)-&gt;setGeometry(0,0,mGlobalVirtualScreenWidth,mGlobalVirtualScreenHeight);

        globalWidget-&gt;m_initialSize.setWidth( mGlobalVirtualScreenWidth );
        globalWidget-&gt;m_initialSize.setHeight( mGlobalVirtualScreenHeight );

        ((QWidget*)globalWidget)-&gt;setVisible(true);
        //Set the background color of the globalwidget
        ((QWidget*)globalWidget)-&gt;setStyleSheet("* { background-color: rgb(50, 50, 50); }");
        this-&gt;setParent(globalWidget);

        //Main application :
        QApplicationPrivate *qAppPriv = QApplicationPrivate::instance();
        //Set pressure filter value to ignore system nativ touch events
        qAppPriv-&gt;touchEventPressurFilter=TUIO_PRESSURE_VALUE;
    }
    else
        this-&gt;setParent(globalWidget);@
</code></pre>
<p dir="auto"><em>3./ The translateRawTouchEvent methode is then alled on the top most widget of the application (even detached popup)</em></p>
<p dir="auto">@ //Main application :<br />
QApplicationPrivate *qAppPriv = QApplicationPrivate::instance();</p>
<pre><code>//Get the topest widget, even Detached popup windows:
QWidget* lToplevelWidget= QApplication::topLevelAt(QPoint(posInScreen.x(), posInScreen.y()));
qAppPriv-&gt;translateRawTouchEvent(lToplevelWidget,QTouchEvent::TouchScreen,touchPointsList);@
</code></pre>
]]></description><link>https://forum.qt.io/post/225785</link><guid isPermaLink="true">https://forum.qt.io/post/225785</guid><dc:creator><![CDATA[[[global:former-user]]]]></dc:creator><pubDate>Tue, 20 May 2014 11:23:52 GMT</pubDate></item><item><title><![CDATA[Reply to Implementation of TouchArea using TUIO API for QML application on Fri, 16 May 2014 08:04:09 GMT]]></title><description><![CDATA[<p dir="auto">Hi,<br />
I improve the implementation but it required a modification in QTGui4.dll.<br />
The idea was to set a specific pressure that allow to filter touch event.<br />
System touch event pressure are only 0 or 1, so I added a static member<br />
<em>touchEventPressurFilter</em> which allow to ignore those.</p>
<p dir="auto">@void QApplicationPrivate::translateRawTouchEvent(QWidget *window,<br />
QTouchEvent::DeviceType deviceType,<br />
const QList<a target="_blank" rel="noopener noreferrer nofollow ugc">QTouchEvent::TouchPoint</a> &amp;touchPoints)<br />
{<br />
QApplicationPrivate *d = self;<br />
typedef QPair&lt;Qt::TouchPointStates, QList<a target="_blank" rel="noopener noreferrer nofollow ugc">QTouchEvent::TouchPoint</a> &gt; StatesAndTouchPoints;<br />
QHash&lt;QWidget *, StatesAndTouchPoints&gt; widgetsNeedingEvents;</p>
<pre><code>//TestTuio
if(touchEventPressurFilter&gt;=0)
    for (int i = 0; i &lt; touchPoints.count(); ++i)
    {
        QTouchEvent::TouchPoint touchPoint = touchPoints.at(i);
        if(touchPoint.pressure()!=touchEventPressurFilter)
        {
            //qDebug()&lt;&lt; "Ignore WM_TOUCH Events: filter on pressure value: "&lt;&lt;touchPoint.pressure()&lt;&lt; touchEventPressurFilter;
            return;
        }
    }@
</code></pre>
<p dir="auto">The only problem left is when my application is creating popup (a framed window which can be moved), they do not take touch event into account.</p>
<p dir="auto">the popup is made of a class Q_DECL_EXPORT SdcnPopup: public QMainWindow</p>
<p dir="auto">all instance are set to be children of the global SdcnBackgroundWidget whici is parent of all other application viewer:<br />
@// Parent is null when TUIO is not active<br />
setParent( SdcnBackgroundWidget::getInstance() );@</p>
]]></description><link>https://forum.qt.io/post/225745</link><guid isPermaLink="true">https://forum.qt.io/post/225745</guid><dc:creator><![CDATA[[[global:former-user]]]]></dc:creator><pubDate>Fri, 16 May 2014 08:04:09 GMT</pubDate></item><item><title><![CDATA[Reply to Implementation of TouchArea using TUIO API for QML application on Mon, 27 Jan 2014 18:04:19 GMT]]></title><description><![CDATA[<p dir="auto">Hi,<br />
I finaly  succeeded  !!</p>
<p dir="auto">All I had to do is to create one static background Widget which is parent of all SdcnApplicationViewer instance -using setParent methode.<br />
Then I call <em>translaterawTouchEvent</em> on this  static widget</p>
<p dir="auto">For future debug feature I need to trace the touchEvents from this backgroundwidget but the event is not call with touch event , only updatedisplay  and mouse over.</p>
<p dir="auto">What Method should I overload to trace touch events??<br />
Here after is the SdcnBackgroundWidget class I made:<br />
@class SdcnBackgroundWidget<br />
: public QWidget<br />
{<br />
Q_OBJECT<br />
public:<br />
explicit SdcnBackgroundWidget ( QWidget * parent = 0, Qt::WindowFlags f = 0 );<br />
virtual ~SdcnBackgroundWidget ( );</p>
<p dir="auto">protected:<br />
bool event ( QEvent* event );<br />
};<br />
@<br />
@SdcnBackgroundWidget::SdcnBackgroundWidget ( QWidget * parent, Qt::WindowFlags f )<br />
:QWidget( parent, f )<br />
{</p>
<p dir="auto">}<br />
SdcnBackgroundWidget::~SdcnBackgroundWidget()<br />
{<br />
}<br />
//-----------------------------------------------------------------------------<br />
bool SdcnBackgroundWidget::event( QEvent* event )<br />
{<br />
qDebug()&lt;&lt; "SdcnBackgroundWidget::event" &lt;&lt; event-&gt;type();<br />
}@</p>
]]></description><link>https://forum.qt.io/post/212443</link><guid isPermaLink="true">https://forum.qt.io/post/212443</guid><dc:creator><![CDATA[[[global:former-user]]]]></dc:creator><pubDate>Mon, 27 Jan 2014 18:04:19 GMT</pubDate></item></channel></rss>