Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

Twice QWidget::TouchBegin event



  • I wrote an application for raspberry with qt 5.3, raspbian jessie and a 7-inch touch screen.
    In my application I need to override the QWidget::event method. And everything was worked ok.
    My problems start when I ported my code to raspbian stretch with the qt 5.7.1.
    Now my code doesn't work because the QEvent::TouchBegin event is sent twice time.
    Do you have any suggestions?

    Code
    bool Zone::event(QEvent *e)
    {
    if (e->type() == QEvent::TouchBegin) {
    qDebug("TouchBegin");
    .........
    return true;
    }

    if (e->type() == QEvent::TouchEnd) {
    	qDebug("TouchEnd");
    	.....
    	return true;
    }
    
    if (e->type() == QEvent::MouseButtonPress) {
    	qDebug("MouseButtonPress");
    	.....
    	return true;
    }
    
    if (e->type() == QEvent::MouseButtonRelease) {
    	qDebug("MouseButtonRelease");
    	.......
    	return true;
    }
    return QWidget::event(e);
    

    }

    Output
    TouchBegin
    TouchBegin
    MouseButtonPresseds
    TouchEnd
    MouseButtonReleased


Log in to reply