PDA

View Full Version : TouchEvents by Driver not being captured in QtQuick1ApplicationViewer



basha
7th July 2015, 13:07
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


if(newState == PANEL_RELEASED)
{
qApp->postEvent(view, new QMouseEvent(QEvent::MouseButtonPress, pos, Qt::RightButton, Qt::AllButtons, Qt::NoModifier));
}
else if(newState == PANEL_PRESSED)
{
qApp->postEvent(view, new QMouseEvent(QEvent::MouseButtonRelease, pos, Qt::RightButton, Qt::AllButtons, Qt::NoModifier));
}


My QML is like this. But i am not getting the onPressed/onReleased Slot in QML. I have checked position is ok

import QtQuick 1.1
Rectangle {
width: 360
height: 360
Text {
text: qsTr("Hello World")
font.pixelSize: 14
anchors.fill: parent
}

MouseArea {
id: mouseAreaX
anchors.fill: parent
acceptedButtons: Qt.RightButton | Qt.LeftButton | Qt.MiddleButton
hoverEnabled: false

onEntered:
{
console.log("I have entered Mouse Area");
}

onClicked: {
console.log("I am in Mouse Area X",mouseX);
}
onPressed:
{
console.log("mouse Pressed",mouseX);
parent.color = "red";

}
onReleased:
{
}
}
}