Description
The QML application will not start if I try to use a MouseEvent under PySide6. Minimal example:
main.qml
import QtQuick import QtQuick.Window Window { width: 640 height: 480 visible: true MouseArea { anchors.fill: parent onWheel: console.log(wheel.angleDelta) } }
main.py
import sys import os import PySide6.QtCore as QtCore from PySide6.QtGui import QGuiApplication from PySide6.QtQml import QQmlApplicationEngine def qt_message_handler(mode, context, message): if mode == QtCore.QtInfoMsg: mode = 'INFO' elif mode == QtCore.QtWarningMsg: mode = 'WARNING' elif mode == QtCore.QtCriticalMsg: mode = 'CRITICAL' elif mode == QtCore.QtFatalMsg: mode = 'FATAL' else: mode = 'DEBUG' print('qt_message_handler: line: %d, func: %s(), file: %s' % ( context.line, context.function, context.file)) print(' %s: %s\n' % (mode, message)) if __name__ == "__main__": QtCore.qInstallMessageHandler(qt_message_handler) app = QGuiApplication(sys.argv) engine = QQmlApplicationEngine() engine.load(os.path.join(os.path.dirname(__file__), "main.qml")) if not engine.rootObjects(): sys.exit(-1) sys.exit(app.exec())
If I change to PySide2 and add version numbers to the qml imports, the application starts and logs fine.