tapableTriangle.qml Example File
shapes/content/tapableTriangle.qml
import QtQuick 2.11
import QtQuick.Shapes 1.11
import Qt.labs.handlers 1.0
Rectangle {
width: 120
height: 120
color: th.pressed ? "steelBlue" : "lightGray"
containmentMask: ctr
TapHandler { id: th }
Shape {
id: ctr
anchors.fill: parent
containsMode: Shape.FillContains
ShapePath {
strokeColor: "red"
fillColor: "blue"
SequentialAnimation on strokeWidth {
loops: Animation.Infinite
NumberAnimation { from: 1; to: 30; duration: 5000 }
NumberAnimation { from: 30; to: 1; duration: 5000 }
PauseAnimation { duration: 2000 }
}
startX: 30; startY: 30
PathLine { x: ctr.width - 30; y: ctr.height - 30 }
PathLine { x: 30; y: ctr.height - 30 }
PathLine { x: 30; y: 30 }
}
Rectangle {
id: testRect
color: "green"
opacity: 0.3
width: 20
height: 20
anchors.right: parent.right
}
Timer {
interval: 100
repeat: true
onTriggered: testRect.width = testRect.width > 1 ? testRect.width - 1 : 20
running: true
}
}
}