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

Reduced frequency of QWidget::TabletEvent if calling update()

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • P3: Somewhat important
    • None
    • 5.4.2, 5.5.0
    • QPA
    • None
    • Mac OS X Yosemite 10.10.4, Mac OS X Mavericks 10.9.5
    • macOS

    Description

      If you implement the QTabletEvent of a QWidget and from there call update(), the frequency with which the TabletEvent gets called drops from roughly 135 times per second to 100 times per second. It is even worse for QOpenGLWidget, where the rate is dropped to 60 times per second. This is critical for applications, that use QTabletEvent to draw smooth lines, since points are reduced if the frequency goes down. This does not happen Linux.

      This happens even though paintEvent of QWidget doesn't do anything.

      I attached an example project to illustrate this issue. Run the program and start drawing on the widget with the pen (nothing will be drawn actually). On TabletRelease, the average frequency is shown through qDebug().

      Uncomment the following line in the example
      // update();
      to see the effect.

      void TabletWidget::tabletEvent(QTabletEvent *event)
      {
      if (event->type() == QTabletEvent::TabletPress)

      { timer.start(); count = 1; }

      if (event->type() == QTabletEvent::TabletMove)

      { ++count; // update(); }

      if (event->type() == QTabletEvent::TabletRelease)

      { ++count; qDebug() << "tablet: " << static_cast<qreal>(count) / static_cast<qreal>(timer.elapsed()) * 1000.0; }

      }

      void TabletWidget::paintEvent(QPaintEvent *event)

      { // nothing }

      Attachments

        Issue Links

          Activity

            People

              sorvig Morten Sørvig
              unruhschuh Thomas Leitz
              Veli-Pekka Heinonen Veli-Pekka Heinonen
              Votes:
              0 Vote for this issue
              Watchers:
              9 Start watching this issue

              Dates

                Created:
                Updated: