Access.qml
import QtQuick 2.0
Rectangle {
id: newq
width: 100
height: 62
property var pp : [1]
onPpChanged:
{
console.log("\non pp changed, show pp's length: " + pp.length)
}
property int inde : 0
MouseArea
{
anchors.fill: parent
onClicked:
{
pp.push (inde++)
console.log("mousearea shows pp's length: " + pp.length)
}
}
}
import QtQuick 2.0
Rectangle {
id: newq
width: 100
height: 62
property var pp : [1]
onPpChanged:
{
console.log("\non pp changed, show pp's length: " + pp.length)
}
property int inde : 0
MouseArea
{
anchors.fill: parent
onClicked:
{
pp.push (inde++)
console.log("mousearea shows pp's length: " + pp.length)
}
}
}
To copy to clipboard, switch view to plain text mode
main.qml
import QtQuick 2.0
Rectangle {
id: root
width: 360
height: 360
Access
{
color: "red"
}
}
import QtQuick 2.0
Rectangle {
id: root
width: 360
height: 360
Access
{
color: "red"
}
}
To copy to clipboard, switch view to plain text mode
Output (on mouse clicks):
QML debugging is enabled. Only use this in a safe environment.
on pp changed, show pp's length: 1
mousearea shows pp's length: 2
mousearea shows pp's length: 3
mousearea shows pp's length: 4
mousearea shows pp's length: 5
QML debugging is enabled. Only use this in a safe environment.
on pp changed, show pp's length: 1
mousearea shows pp's length: 2
mousearea shows pp's length: 3
mousearea shows pp's length: 4
mousearea shows pp's length: 5
To copy to clipboard, switch view to plain text mode
Why isn't the onPpChanged getting called when I push the items in pp? What can I do to get it called?
Bookmarks