Conclusion:
Hello,
I am implementing a TUIO API interface for multiple touch screen able to touch several touch screen simultaneously.
It is working!
0./ I add a modiffication into:
qapplication_p.h
@public:
//Add a filter to completely ignore touch event if they do not match the pressure value
//only when touchEventPressurFilter>0 !!
static qreal touchEventPressurFilter;@
and also into gui\kern@el\qapplication.cpp
so the methode translateRawTouchEvent can ignore touch event based on a pressure value
@//Add a filter to completely ignore touch event if they do not match the pressure value
//only when touchEventPressurFilter>0 !!
qreal QApplicationPrivate::touchEventPressurFilter = -1;@
@void QApplicationPrivate::translateRawTouchEvent(QWidget *window,
QTouchEvent::DeviceType deviceType,
const QListQTouchEvent::TouchPoint &touchPoints)
{
QApplicationPrivate *d = self;
typedef QPair<Qt::TouchPointStates, QListQTouchEvent::TouchPoint > StatesAndTouchPoints;
QHash<QWidget *, StatesAndTouchPoints> widgetsNeedingEvents;
//TestTuio
if(touchEventPressurFilter>=0)
for (int i = 0; i < touchPoints.count(); ++i)
{
QTouchEvent::TouchPoint touchPoint = touchPoints.at(i);
if(touchPoint.pressure()!=touchEventPressurFilter)
{
//qDebug()<< "Ignore WM_TOUCH Events: filter on pressure value: "<<touchPoint.pressure()<< touchEventPressurFilter;
return;
}
}@
1./ I have several instance of a class :
@class SdcnTUIOApplicationViewer
: public QDeclarativeView, TUIO::TuioListener@
2./ Only one instance is listening the TUIO UDP frames All instance are child of a static global background widget, setparent() is called during initialisation:
The filter/pressure value is also set once during initialisation of one of the ApplicationViewer instance
@ //GlobalWidget use for multitouch
if(globalWidget==NULL)
{
//globalWidget Must fill the virtual desktop
globalWidget = new SdcnBackgroundWidget( 0, Qt::Tool|Qt::FramelessWindowHint );
//Set geometry instead of maximized !
((QWidget*)globalWidget)->setGeometry(0,0,mGlobalVirtualScreenWidth,mGlobalVirtualScreenHeight);
globalWidget->m_initialSize.setWidth( mGlobalVirtualScreenWidth );
globalWidget->m_initialSize.setHeight( mGlobalVirtualScreenHeight );
((QWidget*)globalWidget)->setVisible(true);
//Set the background color of the globalwidget
((QWidget*)globalWidget)->setStyleSheet("* { background-color: rgb(50, 50, 50); }");
this->setParent(globalWidget);
//Main application :
QApplicationPrivate *qAppPriv = QApplicationPrivate::instance();
//Set pressure filter value to ignore system nativ touch events
qAppPriv->touchEventPressurFilter=TUIO_PRESSURE_VALUE;
}
else
this->setParent(globalWidget);@
3./ The translateRawTouchEvent methode is then alled on the top most widget of the application (even detached popup)
@ //Main application :
QApplicationPrivate *qAppPriv = QApplicationPrivate::instance();
//Get the topest widget, even Detached popup windows:
QWidget* lToplevelWidget= QApplication::topLevelAt(QPoint(posInScreen.x(), posInScreen.y()));
qAppPriv->translateRawTouchEvent(lToplevelWidget,QTouchEvent::TouchScreen,touchPointsList);@