QTouchEvent always called 4 times with any interaction with the screen. Even if i just touch the screen for a 0.1 second (not moving and not released the finger). So i can`t get an information when the touch is actually was ends or updated.
bool ChartPlotter::touchEvent(QTouchEvent* ev) {
switch (ev->type()) {
case QTouchEvent::TouchBegin: {
__android_log_write(ANDROID_LOG_WARN,"","begin");
}
case QTouchEvent::TouchUpdate: {
__android_log_write(ANDROID_LOG_WARN,"","update");
}
case QTouchEvent::TouchEnd: {
__android_log_write(ANDROID_LOG_WARN,"","end");
}
...
and the output when i just touched the screen (i not moved the finger, and not released it, i just touched and holded it on on the same place)
W : begin
W : update
W : end
W : end
``
You are missing a
breakfor eachcase, because like this it will go trough all cases.You don't need a
{}for the case, it's fine like this:Since you make a
TouchBeginevent, it prints out all 3 logs (since there is no break to stop them), and once you release the press,TouchEndis triggered and because of that you haveendprinted out two times.