Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. depends on non-NOTIFYable properties: QQuickMultiPointTouchArea::touchPoints
Qt 6.11 is out! See what's new in the release blog

depends on non-NOTIFYable properties: QQuickMultiPointTouchArea::touchPoints

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
1 Posts 1 Posters 2.4k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • chaithubkC Offline
    chaithubkC Offline
    chaithubk
    wrote on last edited by chaithubk
    #1

    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.

    1 Reply Last reply
    0

    • Login

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Get Qt Extensions
    • Unsolved