depends on non-NOTIFYable properties: QQuickMultiPointTouchArea::touchPoints



  • I was trying to learn about the multi touch capability of my touchscreen monitor. And I have developed a simple Qt application to just display the touch points on screen as below:

    Rectangle {
    
            MultiPointTouchArea {
                id: touchArea
                anchors.fill: parent
                touchPoints: [
                    TouchPoint { id: point1 },
                    TouchPoint { id: point2 },
                    TouchPoint { id: point3 },
                    TouchPoint { id: point4 },
                    TouchPoint { id: point5 },
                    TouchPoint { id: point6 },
                    TouchPoint { id: point7 },
                    TouchPoint { id: point8 },
                    TouchPoint { id: point9 },
                    TouchPoint { id: point10 }
                ]
            }
    
            Repeater {
                model: touchArea.touchPoints.length
                delegate: Rectangle {
                    width: 30
                    height: 30
                    x: touchArea.touchPoints[index].x
                    y: touchArea.touchPoints[index].y
                    color: Qt.rgba(Math.random(), Math.random(), Math.random())
                }
            }
        }
    

    When I run my application I am seeing my application as intended and shows the touch points as expected BUT I am noticing this error on the Qt Application Output of my Qt Creator:

    QQmlExpression: Expression qrc:/main.qml:36:20 depends on non-NOTIFYable properties:
        QQuickMultiPointTouchArea::touchPoints
    

    The same code if I remove the repeater and write the rectangles as below, am not seeing any errors on the application output and my application is running as I wanted.

    Rectangle {
            anchors.fill: parent
    
            MultiPointTouchArea {
                id: touchArea
                anchors.fill: parent
                touchPoints: [
                    TouchPoint { id: point1 },
                    TouchPoint { id: point2 },
                    TouchPoint { id: point3 },
                    TouchPoint { id: point4 },
                    TouchPoint { id: point5 },
                    TouchPoint { id: point6 },
                    TouchPoint { id: point7 },
                    TouchPoint { id: point8 },
                    TouchPoint { id: point9 },
                    TouchPoint { id: point10 }
                ]
            }
    
            Rectangle {
                width: 30; height: 30
                color: "green"
                x: point1.x
                y: point1.y
            }
    
            Rectangle {
                width: 30; height: 30
                color: "yellow"
                x: point2.x
                y: point2.y
            }
    
            Rectangle {
                width: 30; height: 30
                color: "Red"
                x: point3.x
                y: point3.y
            }
        }
    

    Am unable to understand the mistake with the Repeater approach. Any comments on how to solve it ? Thanks in advance.


Log in to reply