diff options
Diffstat (limited to 'examples/declarative/tutorials/t3/tutorial3.qml')
-rw-r--r-- | examples/declarative/tutorials/t3/tutorial3.qml | 105 |
1 files changed, 78 insertions, 27 deletions
diff --git a/examples/declarative/tutorials/t3/tutorial3.qml b/examples/declarative/tutorials/t3/tutorial3.qml index f9f1415..8e2b697 100644 --- a/examples/declarative/tutorials/t3/tutorial3.qml +++ b/examples/declarative/tutorials/t3/tutorial3.qml @@ -1,27 +1,78 @@ -<Rect id="Page" width="480" height="200" color="white"> - <Text id="HelloText" text="Hello world!" font.size="24" font.bold="true" y="30" anchors.horizontalCenter="{Page.horizontalCenter}"> - <states> - <State name="down" when="{MouseRegion.pressed == true}"> - <SetProperty target="{HelloText}" property="y" value="160"/> - <SetProperty target="{HelloText}" property="color" value="red"/> - </State> - </states> - <transitions> - <Transition fromState="*" toState="down" reversible="true"> - <ParallelAnimation> - <NumericAnimation properties="y" duration="500" easing="easeOutBounce"/> - <ColorAnimation duration="500"/> - </ParallelAnimation> - </Transition> - </transitions> - </Text> - <MouseRegion id="MouseRegion" anchors.fill="{HelloText}"/> - <GridLayout id="ColorPicker" x="0" anchors.bottom="{Page.bottom}" width="120" height="50" columns="3" rows="2"> - <Cell color="#ff0000"/> - <Cell color="#00ff00"/> - <Cell color="#0000ff"/> - <Cell color="#ffff00"/> - <Cell color="#00ffff"/> - <Cell color="#ff00ff"/> - </GridLayout> -</Rect> +Rect { + id: Page + width: 480 + height: 200 + color: "white" + Text { + id: HelloText + text: "Hello world!" + font.size: 24 + font.bold: true + y: 30 + anchors.horizontalCenter: Page.horizontalCenter + states: [ + State { + name: "down" + when: MouseRegion.pressed == true + SetProperty { + target: HelloText + property: "y" + value: 160 + } + SetProperty { + target: HelloText + property: "color" + value: "red" + } + } + ] + transitions: [ + Transition { + fromState: "*" + toState: "down" + reversible: true + ParallelAnimation { + NumericAnimation { + properties: "y" + duration: 500 + easing: "easeOutBounce" + } + ColorAnimation { + duration: 500 + } + } + } + ] + } + MouseRegion { + id: MouseRegion + anchors.fill: HelloText + } + GridLayout { + id: ColorPicker + x: 0 + anchors.bottom: Page.bottom + width: 120 + height: 50 + columns: 3 + rows: 2 + Cell { + color: "#ff0000" + } + Cell { + color: "#00ff00" + } + Cell { + color: "#0000ff" + } + Cell { + color: "#ffff00" + } + Cell { + color: "#00ffff" + } + Cell { + color: "#ff00ff" + } + } +} |