I have a custom touchscreen driver which is generating touch events which are being captured in QT.
I have to convert these event data( position x and y, press and release) to something which QML Mouse Area will understand.
My limitiation is to use QtQuick1ApplicationViewer.

I am converting the touch events like this. The view is of type QtQuickApplicationViewer
Qt Code:
  1. if(newState == PANEL_RELEASED)
  2. {
  3. qApp->postEvent(view, new QMouseEvent(QEvent::MouseButtonPress, pos, Qt::RightButton, Qt::AllButtons, Qt::NoModifier));
  4. }
  5. else if(newState == PANEL_PRESSED)
  6. {
  7. qApp->postEvent(view, new QMouseEvent(QEvent::MouseButtonRelease, pos, Qt::RightButton, Qt::AllButtons, Qt::NoModifier));
  8. }
To copy to clipboard, switch view to plain text mode 

My QML is like this. But i am not getting the onPressed/onReleased Slot in QML. I have checked position is ok
Qt Code:
  1. import QtQuick 1.1
  2. Rectangle {
  3. width: 360
  4. height: 360
  5. Text {
  6. text: qsTr("Hello World")
  7. font.pixelSize: 14
  8. anchors.fill: parent
  9. }
  10.  
  11. MouseArea {
  12. id: mouseAreaX
  13. anchors.fill: parent
  14. acceptedButtons: Qt.RightButton | Qt.LeftButton | Qt.MiddleButton
  15. hoverEnabled: false
  16.  
  17. onEntered:
  18. {
  19. console.log("I have entered Mouse Area");
  20. }
  21.  
  22. onClicked: {
  23. console.log("I am in Mouse Area X",mouseX);
  24. }
  25. onPressed:
  26. {
  27. console.log("mouse Pressed",mouseX);
  28. parent.color = "red";
  29.  
  30. }
  31. onReleased:
  32. {
  33. }
  34. }
  35. }
To copy to clipboard, switch view to plain text mode