For instance, in the last sample of phosphorescence: Mouse event on QML, transform property appears twice, but from Qt 4.7.0 beta, it is forbidden appearing transform property twice. So I rewrite this with QML array like below:
import Qt 4.7
Rectangle {
width: 200
height: 200
Text {
id: original
x: 60
y: 80
text: qsTr("Hello World")
MouseArea {
/* inherit parent item area to handle click event
because default area is none */
anchors.fill: parent
/* write acceptable buttons
because there are no default button events*/
acceptedButtons: Qt.LeftButton | Qt.RightButton
onClicked: { // hooked event when mouse is clicked
if (mouse.button == Qt.RightButton) {
parent.color = 'black';
} else {
parent.color = 'red';
}
}
}
}
Text {
x: original.x
y: original.y + 16
text: original.text + "!"
font {
family: "Helvetica"
pointSize: 12
italic: true
}
color: "blue"
transform: [Scale {
xScale: 1.25
yScale: 0.8
}, Rotation {
angle: 45
}]
smooth: true
}
}
No comments:
Post a Comment