touch event in qml does not propagate to its parent qquickwidget
-
-
Has overriding QObject::event() to handle QEvent::Touch(Begin|CancelEnd|Update) been tried?
-
@jeremy_k Tried it and saw touchBegin there. But I can not use it because it will make my app very slow.
@JoeCFD said in touch event in qml does not propagate to its parent qquickwidget:
@jeremy_k Tried it and saw touchBegin there. But I can not use it because it will make my app very slow.
Please elaborate. Is overriding QObject::event() making it slow, the program's access patterns for the touch events, or something else?
-
@JoeCFD said in touch event in qml does not propagate to its parent qquickwidget:
@jeremy_k Tried it and saw touchBegin there. But I can not use it because it will make my app very slow.
Please elaborate. Is overriding QObject::event() making it slow, the program's access patterns for the touch events, or something else?
-
The signal sounds very convenient, not necessary, and surprising that it is faster than overriding event() ... unless the signal is emitted by an Item at the top of a very deep stack, circumventing delivery to lots of items that will ignore it. Event handling is how large swaths of Qt Widgets and Quick item implementations work.
I'm presuming that the implementation is something like:
bool MyClass::event(QEvent *ev) { switch(ev->type()) { case QEvent::TouchBegin: qDebug() << "touch started"; break; default: return ParentClass::event(ev); } return true; } -
The signal sounds very convenient, not necessary, and surprising that it is faster than overriding event() ... unless the signal is emitted by an Item at the top of a very deep stack, circumventing delivery to lots of items that will ignore it. Event handling is how large swaths of Qt Widgets and Quick item implementations work.
I'm presuming that the implementation is something like:
bool MyClass::event(QEvent *ev) { switch(ev->type()) { case QEvent::TouchBegin: qDebug() << "touch started"; break; default: return ParentClass::event(ev); } return true; } -
@jeremy_k Yes, the override of QObject::event() makes my app slow. I have managed to solve the issue by adding a signal pressed() in the qml code and connecting to qquickwidget. But this should not be needed.
-
J JoeCFD has marked this topic as solved on