Important: Please read the Qt Code of Conduct -

QWSMouseHandler: problems with MousePressEvent

  • Hi!

    I've tried to create my first touchscreen driver using QWSMouseHandler, but I only get 1-3 click events, while the mouse pointer is set correctly.

    Every time the touchscreen is pressed, the following method setMouseChanged is called and the debug message "pressed" is printed. I've also written a small test program which consists of one MainWidget and print out all MousePressEvents.

    The result is something like this:
    pressed: true 419 258
    event QPoint(419,258)
    pressed: true 320 250
    event QPoint(320,250)
    pressed: true 275 328
    event QPoint(275,328)
    pressed: true 378 237
    pressed: true 320 287
    pressed: true 290 247
    pressed: true 268 195

    No further mousePressEvents are delived. There are only 1-3 MousePressEvents in a run.
    Does anybody has an idea what's going wrong?

    Greetings, Anke


    code in subclass of QWSMouseHandler:
    @void TouchMouseHandler::setMouseChanged(int x, int y, bool pressed)
    if (pressed) {
    qDebug() << "pressed: " << pressed << x << y;
    mouseChanged(QPoint(x,y), Qt::NoButton);
    mouseChanged(QPoint(x,y), Qt::LeftButton);
    mouseChanged(QPoint(x,y), Qt::NoButton);

    code in MainWindow:
    @void MainWindow::mousePressEvent ( QMouseEvent * event ){
    qDebug() << "event"<< event->pos();

Log in to reply