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

QWheelEvent passed to QQuickItem::wheelEvent() has 0 delta since 5.12

    XMLWordPrintable

Details

    • macOS
    • 4fdda5a584f7ecf68a0a9ac4006c2abd730b918c

    Description

      The following code prints a valid, non-zero value for event->delta() in 5.11, but 0 in 5.12. Even though the property has been deprecated, it should continue to work until Qt 6.

      main.cpp
      #include <QGuiApplication>
      #include <QQmlApplicationEngine>
      #include <QDebug>
      #include <QQuickItem>
      
      class MyItem : public QQuickItem
      {
          Q_OBJECT
      
      public:
          MyItem() {}
      
          void wheelEvent(QWheelEvent *event) override {
              qDebug() << event->angleDelta() << event->delta() << event->pixelDelta();
          }
      };
      
      int main(int argc, char *argv[])
      {
          QGuiApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
          QGuiApplication app(argc, argv);
      
          qmlRegisterType<MyItem>("App", 1, 0, "MyItem");
      
          QQmlApplicationEngine engine;
          engine.load(QUrl("qrc:/main.qml"));
      
          return app.exec();
      }
      
      #include "main.moc"
      
      main.qml
      import QtQuick 2.10
      import QtQuick.Window 2.10
      import QtQuick.Controls 2.3
      
      import App 1.0
      
      Window {
          id: window
          width: 400
          height: 440
          visible: true
      
          MyItem {
              anchors.fill: parent
          }
      }
      

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            srutledg Shawn Rutledge
            mitch_curtis Mitch Curtis
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes