summaryrefslogtreecommitdiffstats
path: root/examples/declarative/dynamic/dynamic.qml
diff options
context:
space:
mode:
Diffstat (limited to 'examples/declarative/dynamic/dynamic.qml')
-rw-r--r--examples/declarative/dynamic/dynamic.qml69
1 files changed, 34 insertions, 35 deletions
diff --git a/examples/declarative/dynamic/dynamic.qml b/examples/declarative/dynamic/dynamic.qml
index aea9b0f..e6c3812 100644
--- a/examples/declarative/dynamic/dynamic.qml
+++ b/examples/declarative/dynamic/dynamic.qml
@@ -2,8 +2,8 @@ import Qt 4.6
Item {
id: window
- //This is a desktop example
- width: 1024; height: 480
+ //This is a desktop-sized example
+ width: 1024; height: 512
property int activeSuns: 0
// sky
@@ -33,6 +33,7 @@ Item {
}
}
+ //Day state, for when you place a sun
states: State { name: "Day"; when: window.activeSuns > 0
PropertyChanges { target: stopA; color: "DeepSkyBlue"}
PropertyChanges { target: stopB; color: "SkyBlue"}
@@ -55,50 +56,48 @@ Item {
Column{
id: toolboxPositioner
anchors.centerIn: parent
- spacing: 1
- Sun {
- id: sunButton
- Script { source: "sunCreation.js" }
- MouseRegion {
- anchors.fill: parent;
- onPressed: startDrag(mouse);
- onPositionChanged: moveDrag(mouse);
- onReleased: endDrag(mouse);
+ spacing: 4
+ Text{ text: "Drag an item into the scene." }
+ Row{ spacing: 4;
+ height: childrenRect.height//TODO: Put bug in JIRA when it comes back up
+ PaletteItem{
+ anchors.verticalCenter: parent.verticalCenter
+ file: "Sun.qml";
+ image: "images/sun.png"
}
- }
- Text{ text: "Active Suns: " + activeSuns }
- Rectangle { width: 440; height: 1; color: "black" }
- Text{ text: "Arbitrary Javascript: " }
- TextEdit {
- id: jsText
- width: 460
- height: 80
- readOnly: false
- focusOnPress: true
-
- text: "window.activeSuns++;"
- }
- Rectangle {
- width: 80
- height: 20
- color: "lightsteelblue"
- Text{ anchors.centerIn: parent; text: "Execute" }
- MouseRegion {
- anchors.fill: parent;
- onClicked: eval(jsText.text.toString());
+ PaletteItem{
+ anchors.verticalCenter: parent.verticalCenter
+ file: "GenericItem.qml"
+ image: "images/moon.png"
+ }
+ PaletteItem{
+ anchors.verticalCenter: parent.verticalCenter
+ file: "GenericItem.qml"
+ image: "images/tree_s.png"
+ }
+ PaletteItem{
+ anchors.verticalCenter: parent.verticalCenter
+ file: "GenericItem.qml"
+ image: "images/rabbit_brown.png"
+ }
+ PaletteItem{
+ anchors.verticalCenter: parent.verticalCenter
+ file: "GenericItem.qml"
+ image: "images/rabbit_bw.png"
}
}
-
+ Text{ text: "Active Suns: " + activeSuns }
Rectangle { width: 440; height: 1; color: "black" }
Text{ text: "Arbitrary QML: " }
TextEdit {
id: qmlText
width: 460
- height: 180
+ height: 220
readOnly: false
focusOnPress: true
+ font.pixelSize: 16
- text: "import Qt 4.6\nImage { id: smile; x: 10; y: 10; \n source: 'images/face-smile.png';\n opacity: NumberAnimation{ \n running:true; to: 0; duration: 1500;\n }\n Component.onCompleted: smile.destroy(1500);\n}"
+ text: "import Qt 4.6\nImage { id: smile;\n x: 500*Math.random();\n y: 250*Math.random(); \n source: 'images/face-smile.png';\n opacity: NumberAnimation{ \n running:true; to: 0; duration: 1500;\n }\n Component.onCompleted: smile.destroy(1500);\n}"
}
Rectangle {
width: 80