Details
-
Bug
-
Resolution: Done
-
P1: Critical
-
5.12
-
None
-
MacBook Pro Touchpad
-
-
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 } }