Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-47007

mousePressEvent of QWidget gets called even though QTabletEvent was accepted [Qt 5.4.2]

    XMLWordPrintable

Details

    • others for 5.7; 5.12 on Windows: 8ada0633cd58e0608df2e16880f1293286025504; b4b706d454b785aecbec5cefe46e2a6d7572edbf

    Description

      In a QWidget derived class object with implemented tabletEvent(QTabletEvent *event) and mousePressEvent(QMouseEvent *event), the mousePressEvent gets called every time tabletEvent gets called with type QTabletEvent::TabletPress. According to the Qt documentation, this should not happen:

      "The event handler QWidget::tabletEvent() receives TabletPress, TabletRelease and TabletMove events. Qt will first send a tablet event, then if it is not accepted by any widget, it will send a mouse event."

      Here are the mousePressEvent() and tabletEvent() functions of the attached example project:

      void TabletWidget::tabletEvent(QTabletEvent *event)

      { event->accept(); qDebug() << "tabletEvent: " << event->type(); }

      void TabletWidget::mousePressEvent(QMouseEvent *event)

      { qDebug() << "mousePressEvent"; }

      The output generated if I press any button of the Wacom Intuos CTH-680S-DEIT is:

      tabletEvent: 92
      mousePressEvent
      tabletEvent: 87
      tabletEvent: 87
      tabletEvent: 87
      tabletEvent: 87
      tabletEvent: 93

      So first the tabletEvent gets called, and even though I accept the event, mousePressEvent gets called anyway. Every following tabletEvent is of type QTabletEvent::TabletMove and the last one is QTabletEvent::TabletRelease. From the Qt documentation:

      QEvent::TabletMove 87
      QEvent::TabletPress 92
      QEvent::TabletRelease 93

      I have tested this on Mac OS 10.10.3 and Windows 7 with the same result.

      Attachments

        Issue Links

          For Gerrit Dashboard: QTBUG-47007
          # Subject Branch Project Status CR V

          Activity

            People

              srutledg Shawn Rutledge
              unruhschuh Thomas Leitz
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: