'qml doesn't handle touch events but widgets do, how can this be fixed?

I am developing a windows desktop program using qml and widgets, I am using QQuickWidget for the qml part. My computer has a second monitor with touch, my question is why when I use a mouse my ui works correctly and when I use the touch only the widgets work and the qml part doesn't. In qml part I am using MouseArea, may be I have to use TapHandler instead?



Solution 1:[1]

Did u set the qml windows flags: Qt.WA_AcceptTouchEvents?

ApplicationWindow {
    id: window

    property string gCurrentDate
    property string gCurrentTime

    property int gUserType: CfUser.Normal

    property bool gNetStatus: true

    property var gSysInfo;

    property int __idleCount: 0

    property real currentBacklight: 0.0
    property var activeItem: null

    width: QmlGlobalParas.appWidth
    height: QmlGlobalParas.appHeight
    minimumWidth: width
    maximumWidth: width
    minimumHeight: height
    maximumHeight: height
    visible: true

    flags: Qt.Popup | Qt.NoDropShadowWindowHint | Qt.WindowStaysOnTopHint | Qt.WA_AcceptTouchEvents
...
}

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 sonicss