diff options
author | Alan Alpert <alan.alpert@nokia.com> | 2010-05-07 09:15:32 (GMT) |
---|---|---|
committer | Alan Alpert <alan.alpert@nokia.com> | 2010-05-07 09:15:32 (GMT) |
commit | 695ddc4a13233c8e6f626fa205336f90f8c5a565 (patch) | |
tree | 88da8a1d80219e5788db3f4e138d1d281bb3d816 /examples | |
parent | 1824eb63f6b2f8baa26b20c57fc50db84eefaa30 (diff) | |
parent | 67bf465253db71c0eddbc6ffcb811dd65c00b207 (diff) | |
download | Qt-695ddc4a13233c8e6f626fa205336f90f8c5a565.zip Qt-695ddc4a13233c8e6f626fa205336f90f8c5a565.tar.gz Qt-695ddc4a13233c8e6f626fa205336f90f8c5a565.tar.bz2 |
Merge branch '4.7' of git@scm.dev.nokia.troll.no:qt/qt-qml into 4.7
Conflicts:
examples/declarative/dynamic/qml/itemCreation.js
Diffstat (limited to 'examples')
24 files changed, 247 insertions, 219 deletions
diff --git a/examples/declarative/animations/color-animation.qml b/examples/declarative/animations/color-animation.qml index 3616a31..61737e9 100644 --- a/examples/declarative/animations/color-animation.qml +++ b/examples/declarative/animations/color-animation.qml @@ -31,15 +31,14 @@ Item { // the sun, moon, and stars Item { width: parent.width; height: 2 * parent.height - transformOrigin: Item.Center NumberAnimation on rotation { from: 0; to: 360; duration: 10000; loops: Animation.Infinite } Image { source: "images/sun.png"; y: 10; anchors.horizontalCenter: parent.horizontalCenter - transformOrigin: Item.Center; rotation: -3 * parent.rotation + rotation: -3 * parent.rotation } Image { source: "images/moon.png"; y: parent.height - 74; anchors.horizontalCenter: parent.horizontalCenter - transformOrigin: Item.Center; rotation: -parent.rotation + rotation: -parent.rotation } Particles { x: 0; y: parent.height/2; width: parent.width; height: parent.height/2 diff --git a/examples/declarative/animations/property-animation.qml b/examples/declarative/animations/property-animation.qml index 6360511..87ac8ec 100644 --- a/examples/declarative/animations/property-animation.qml +++ b/examples/declarative/animations/property-animation.qml @@ -26,7 +26,6 @@ Item { Image { anchors.horizontalCenter: parent.horizontalCenter source: "images/shadow.png"; y: smiley.minHeight + 58 - transformOrigin: Item.Center // The scale property depends on the y position of the smiley face. scale: smiley.y * 0.5 / (smiley.minHeight - smiley.maxHeight) diff --git a/examples/declarative/connections/connections-example.qml b/examples/declarative/connections/connections-example.qml index 1dd10ab..e65a280 100644 --- a/examples/declarative/connections/connections-example.qml +++ b/examples/declarative/connections/connections-example.qml @@ -13,7 +13,6 @@ Rectangle { id: image source: "content/bg1.jpg" anchors.centerIn: parent - transformOrigin: Item.Center rotation: window.angle Behavior on rotation { diff --git a/examples/declarative/dial/dial-example.qml b/examples/declarative/dial/dial-example.qml index fd899a5..2e102b0 100644 --- a/examples/declarative/dial/dial-example.qml +++ b/examples/declarative/dial/dial-example.qml @@ -37,7 +37,7 @@ Rectangle { MouseArea { anchors.fill: parent - drag.target: parent; drag.axis: "XAxis"; drag.minimumX: 2; drag.maximumX: container.width - 32 + drag.target: parent; drag.axis: Drag.XAxis; drag.minimumX: 2; drag.maximumX: container.width - 32 } } } diff --git a/examples/declarative/dynamic/dynamic.qml b/examples/declarative/dynamic/dynamic.qml index 0e6e197..52c7c1e 100644 --- a/examples/declarative/dynamic/dynamic.qml +++ b/examples/declarative/dynamic/dynamic.qml @@ -4,44 +4,49 @@ import "qml" Item { id: window + + property int activeSuns: 0 + //This is a desktop-sized example width: 1024; height: 512 - property int activeSuns: 0 - //This is the message that pops up when there's an error - Rectangle{ + //This is the message box that pops up when there's an error + Rectangle { id: dialog + opacity: 0 anchors.centerIn: parent - width: dialogText.width + 6 - height: dialogText.height + 6 + width: dialogText.width + 6; height: dialogText.height + 6 border.color: 'black' color: 'lightsteelblue' z: 65535 //Arbitrary number chosen to be above all the items, including the scaled perspective ones. + function show(str){ dialogText.text = str; dialogAnim.start(); } - Text{ + + Text { id: dialogText - x:3 - y:3 + x: 3; y: 3 font.pixelSize: 14 } - SequentialAnimation{ + + SequentialAnimation { id: dialogAnim - NumberAnimation{target: dialog; property:"opacity"; to: 1; duration: 1000} - PauseAnimation{duration: 5000} - NumberAnimation{target: dialog; property:"opacity"; to: 0; duration: 1000} + NumberAnimation { target: dialog; property:"opacity"; to: 1; duration: 1000 } + PauseAnimation { duration: 5000 } + NumberAnimation { target: dialog; property:"opacity"; to: 0; duration: 1000 } } } // sky - Rectangle { id: sky + Rectangle { + id: sky anchors { left: parent.left; top: parent.top; right: toolbox.right; bottom: parent.verticalCenter } gradient: Gradient { - GradientStop { id: stopA; position: 0.0; color: "#0E1533" } - GradientStop { id: stopB; position: 1.0; color: "#437284" } + GradientStop { id: gradientStopA; position: 0.0; color: "#0E1533" } + GradientStop { id: gradientStopB; position: 1.0; color: "#437284" } } } @@ -49,109 +54,123 @@ Item { Particles { id: stars x: 0; y: 0; width: parent.width; height: parent.height / 2 - source: "images/star.png"; angleDeviation: 360; velocity: 0 - velocityDeviation: 0; count: parent.width / 10; fadeInDuration: 2800 + source: "images/star.png" + angleDeviation: 360 + velocity: 0; velocityDeviation: 0 + count: parent.width / 10 + fadeInDuration: 2800 opacity: 1 } - // ground, which has a z such that the sun can set behind it + // ground Rectangle { id: ground - z: 2 - anchors { left: parent.left; top: parent.verticalCenter; right: toolbox.right; bottom: parent.bottom } + z: 2 // just above the sun so that the sun can set behind it + anchors { left: parent.left; top: parent.verticalCenter; right: toolbox.left; bottom: parent.bottom } gradient: Gradient { GradientStop { position: 0.0; color: "ForestGreen" } GradientStop { position: 1.0; color: "DarkGreen" } } } - //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"} - PropertyChanges { target: stars; opacity: 0 } - } - - transitions: Transition { - PropertyAnimation { duration: 3000 } - ColorAnimation { duration: 3000 } - } - SystemPalette { id: activePalette } - // toolbox + // right-hand panel Rectangle { id: toolbox - z: 3 //Above ground - color: activePalette.window; + width: 480 - anchors { right: parent.right; top:parent.top; bottom: parent.bottom } - Rectangle { //Not a child of any positioner - border.color: "black"; - width: toolRow.width + 4 - height: toolRow.height + 4 - x: toolboxPositioner.x + toolRow.x - 2 - y: toolboxPositioner.y + toolRow.y - 2 - } + color: activePalette.window + anchors { right: parent.right; top: parent.top; bottom: parent.bottom } + Column { - id: toolboxPositioner anchors.centerIn: parent spacing: 8 + Text { text: "Drag an item into the scene." } - Row { - id: toolRow - spacing: 8; - PaletteItem { - anchors.verticalCenter: parent.verticalCenter - file: "Sun.qml"; - image: "../images/sun.png" - } - PaletteItem { - file: "GenericItem.qml" - image: "../images/moon.png" - } - PaletteItem { - anchors.verticalCenter: parent.verticalCenter - file: "PerspectiveItem.qml" - image: "../images/tree_s.png" - } - PaletteItem { - anchors.verticalCenter: parent.verticalCenter - file: "PerspectiveItem.qml" - image: "../images/rabbit_brown.png" - } - PaletteItem { - anchors.verticalCenter: parent.verticalCenter - file: "PerspectiveItem.qml" - image: "../images/rabbit_bw.png" + + Rectangle { + width: childrenRect.width + 10; height: childrenRect.height + 10 + border.color: "black" + + Row { + anchors.centerIn: parent + spacing: 8 + + PaletteItem { + anchors.verticalCenter: parent.verticalCenter + componentFile: "Sun.qml" + image: "../images/sun.png" + } + PaletteItem { + anchors.verticalCenter: parent.verticalCenter + componentFile: "GenericSceneItem.qml" + image: "../images/moon.png" + } + PaletteItem { + anchors.verticalCenter: parent.verticalCenter + componentFile: "PerspectiveItem.qml" + image: "../images/tree_s.png" + } + PaletteItem { + anchors.verticalCenter: parent.verticalCenter + componentFile: "PerspectiveItem.qml" + image: "../images/rabbit_brown.png" + } + PaletteItem { + anchors.verticalCenter: parent.verticalCenter + componentFile: "PerspectiveItem.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: 220 - readOnly: false - focusOnPress: true - font.pixelSize: 14 - - text: "import Qt 4.7\nImage {\n id: smile;\n x: 500*Math.random();\n y: 200*Math.random(); \n source: 'images/face-smile.png';\n NumberAnimation on opacity { \n to: 0; duration: 1500;\n }\n Component.onCompleted: smile.destroy(1500);\n}" + + Rectangle { width: parent.width; height: 1; color: "black" } + + Text { text: "Arbitrary QML:" } + + Rectangle { + width: 460; height: 240 + + TextEdit { + id: qmlText + anchors.fill: parent; anchors.margins: 5 + readOnly: false + focusOnPress: true + font.pixelSize: 14 + + text: "import Qt 4.7\nImage {\n id: smile\n x: 500 * Math.random()\n y: 200 * Math.random() \n source: 'images/face-smile.png'\n\n NumberAnimation on opacity { \n to: 0; duration: 1500\n }\n\n Component.onCompleted: smile.destroy(1500);\n}" + } } + Button { text: "Create" - function makeCustom() { - try{ + onClicked: { + try { Qt.createQmlObject(qmlText.text, window, 'CustomObject'); - }catch(err){ - dialog.show('Error on line ' + err.qmlErrors[0].lineNumber + '\n' + err.qmlErrors[0].message ); + } catch(err) { + dialog.show('Error on line ' + err.qmlErrors[0].lineNumber + '\n' + err.qmlErrors[0].message); } } - onClicked: makeCustom(); } } } + //Day state, for when a sun is added to the scene + states: State { + name: "Day" + when: window.activeSuns > 0 + + PropertyChanges { target: gradientStopA; color: "DeepSkyBlue" } + PropertyChanges { target: gradientStopB; color: "SkyBlue" } + PropertyChanges { target: stars; opacity: 0 } + } + + transitions: Transition { + PropertyAnimation { duration: 3000 } + ColorAnimation { duration: 3000 } + } + } diff --git a/examples/declarative/dynamic/qml/Button.qml b/examples/declarative/dynamic/qml/Button.qml index 53588bb..963a850 100644 --- a/examples/declarative/dynamic/qml/Button.qml +++ b/examples/declarative/dynamic/qml/Button.qml @@ -6,19 +6,35 @@ Rectangle { property variant text signal clicked - SystemPalette { id: activePalette } - height: text.height + 10 - width: text.width + 20 + height: text.height + 10; width: text.width + 20 border.width: 1 - radius: 4; smooth: true + radius: 4 + smooth: true + gradient: Gradient { - GradientStop { position: 0.0; - color: if(!mr.pressed){activePalette.light;}else{activePalette.button;} + GradientStop { + position: 0.0 + color: !mouseArea.pressed ? activePalette.light : activePalette.button } - GradientStop { position: 1.0; - color: if(!mr.pressed){activePalette.button;}else{activePalette.dark;} + GradientStop { + position: 1.0 + color: !mouseArea.pressed ? activePalette.button : activePalette.dark } } - MouseArea { id:mr; anchors.fill: parent; onClicked: container.clicked() } - Text { id: text; anchors.centerIn:parent; font.pointSize: 10; text: parent.text; color: activePalette.buttonText } + + SystemPalette { id: activePalette } + + MouseArea { + id: mouseArea + anchors.fill: parent + onClicked: container.clicked() + } + + Text { + id: text + anchors.centerIn:parent + font.pointSize: 10 + text: parent.text + color: activePalette.buttonText + } } diff --git a/examples/declarative/dynamic/qml/GenericItem.qml b/examples/declarative/dynamic/qml/GenericItem.qml deleted file mode 100644 index faac06d..0000000 --- a/examples/declarative/dynamic/qml/GenericItem.qml +++ /dev/null @@ -1,13 +0,0 @@ -import Qt 4.7 - -Item{ - property bool created: false - property string image - width: imageItem.width - height: imageItem.height - z: 2 - Image{ - id: imageItem - source: image; - } -} diff --git a/examples/declarative/dynamic/qml/PaletteItem.qml b/examples/declarative/dynamic/qml/PaletteItem.qml index e8f2ed4..dcb5cc3 100644 --- a/examples/declarative/dynamic/qml/PaletteItem.qml +++ b/examples/declarative/dynamic/qml/PaletteItem.qml @@ -1,13 +1,19 @@ import Qt 4.7 import "itemCreation.js" as Code -GenericItem { - id: itemButton - property string file +Image { + id: paletteItem + + property string componentFile + property string image + + source: image + MouseArea { - anchors.fill: parent; + anchors.fill: parent + onPressed: Code.startDrag(mouse); - onPositionChanged: Code.moveDrag(mouse); + onPositionChanged: Code.continueDrag(mouse); onReleased: Code.endDrag(mouse); } } diff --git a/examples/declarative/dynamic/qml/PerspectiveItem.qml b/examples/declarative/dynamic/qml/PerspectiveItem.qml index 3cbe64a..c04d3dc 100644 --- a/examples/declarative/dynamic/qml/PerspectiveItem.qml +++ b/examples/declarative/dynamic/qml/PerspectiveItem.qml @@ -1,16 +1,25 @@ import Qt 4.7 Image { - id: tree + id: rootItem + property bool created: false - property double scaleFactor: Math.max((y+height-250)*0.01, 0.3) - property double scaledBottom: y + (height+height*scaleFactor)/2 - property bool onLand: scaledBottom > window.height/2 - property string image //Needed for compatibility with GenericItem + property string image + + property double scaledBottom: y + (height + height*scale) / 2 + property bool onLand: scaledBottom > window.height / 2 + + source: image opacity: onLand ? 1 : 0.25 - onCreatedChanged: if (created && !onLand) { tree.destroy() } else { z = scaledBottom } - scale: scaleFactor - transformOrigin: "Center" - source: image; smooth: true - onYChanged: z = scaledBottom + scale: Math.max((y + height - 250) * 0.01, 0.3) + smooth: true + + onCreatedChanged: { + if (created && !onLand) + rootItem.destroy(); + else + z = scaledBottom; + } + + onYChanged: z = scaledBottom; } diff --git a/examples/declarative/dynamic/qml/Sun.qml b/examples/declarative/dynamic/qml/Sun.qml index 3627964..43dcb9a 100644 --- a/examples/declarative/dynamic/qml/Sun.qml +++ b/examples/declarative/dynamic/qml/Sun.qml @@ -2,23 +2,37 @@ import Qt 4.7 Image { id: sun + property bool created: false property string image: "../images/sun.png" - onCreatedChanged: if(created){window.activeSuns++;}else{window.activeSuns--;} - source: image; - z: 1 + source: image - //x and y get set when instantiated - //head offscreen + // once item is created, start moving offscreen NumberAnimation on y { - to: window.height / 2; + to: window.height / 2 running: created - onRunningChanged: if (running) duration = (window.height - sun.y) * 10; else state = "OffScreen"; + onRunningChanged: { + if (running) + duration = (window.height - sun.y) * 10; + else + state = "OffScreen" + } } states: State { - name: "OffScreen"; - StateChangeScript { script: { sun.created = false; sun.destroy() } } + name: "OffScreen" + StateChangeScript { + script: { sun.created = false; sun.destroy() } + } + } + + onCreatedChanged: { + if (created) { + sun.z = 1; // above the sky but below the ground layer + window.activeSuns++; + } else { + window.activeSuns--; + } } } diff --git a/examples/declarative/dynamic/qml/itemCreation.js b/examples/declarative/dynamic/qml/itemCreation.js index 08f5320..59750f3 100644 --- a/examples/declarative/dynamic/qml/itemCreation.js +++ b/examples/declarative/dynamic/qml/itemCreation.js @@ -1,53 +1,38 @@ var itemComponent = null; var draggedItem = null; var startingMouse; -var startingZ; -//Until QT-2385 is resolved we need to convert to scene coordinates manually -var xOffset; -var yOffset; -function setSceneOffset() -{ - xOffset = 0; - yOffset = 0; - var p = itemButton; - while(p != window){ - xOffset += p.x; - yOffset += p.y; - p = p.parent; - } -} +var posnInWindow; function startDrag(mouse) { - setSceneOffset(); + posnInWindow = paletteItem.mapToItem(null, 0, 0); startingMouse = { x: mouse.x, y: mouse.y } loadComponent(); } -//Creation is split into two functions due to an asyncronous wait while +//Creation is split into two functions due to an asynchronous wait while //possible external files are loaded. function loadComponent() { - if (itemComponent != null) //Already loaded the component + if (itemComponent != null) { // component has been previously loaded createItem(); + return; + } - itemComponent = Qt.createComponent(itemButton.file); - //console.log(itemButton.file) - if(itemComponent.status == Component.Loading){ - component.statusChanged.connect(finishCreation); - }else{//Depending on the content, it can be ready or error immediately + itemComponent = Qt.createComponent(paletteItem.componentFile); + if (itemComponent.status == Component.Loading) //Depending on the content, it can be ready or error immediately + component.statusChanged.connect(createItem); + else createItem(); - } } function createItem() { if (itemComponent.status == Component.Ready && draggedItem == null) { draggedItem = itemComponent.createObject(window); - draggedItem.image = itemButton.image; - draggedItem.x = xOffset; - draggedItem.y = yOffset; - startingZ = draggedItem.z; - draggedItem.z = 4;//On top + draggedItem.image = paletteItem.image; + draggedItem.x = posnInWindow.x; + draggedItem.y = posnInWindow.y; + draggedItem.z = 3; // make sure created item is above the ground layer } else if (itemComponent.status == Component.Error) { draggedItem = null; console.log("error creating component"); @@ -55,25 +40,24 @@ function createItem() { } } -function moveDrag(mouse) +function continueDrag(mouse) { - if(draggedItem == null) + if (draggedItem == null) return; - draggedItem.x = mouse.x + xOffset - startingMouse.x; - draggedItem.y = mouse.y + yOffset - startingMouse.y; + draggedItem.x = mouse.x + posnInWindow.x - startingMouse.x; + draggedItem.y = mouse.y + posnInWindow.y - startingMouse.y; } function endDrag(mouse) { - if(draggedItem == null) + if (draggedItem == null) return; - if(draggedItem.x + draggedItem.width > toolbox.x){ //Don't drop it in the toolbox + if (draggedItem.x + draggedItem.width > toolbox.x) { //Don't drop it in the toolbox draggedItem.destroy(); draggedItem = null; - }else{ - draggedItem.z = startingZ; + } else { draggedItem.created = true; draggedItem = null; } diff --git a/examples/declarative/fonts/fonts.qml b/examples/declarative/fonts/fonts.qml index ae31b03..f3eac48 100644 --- a/examples/declarative/fonts/fonts.qml +++ b/examples/declarative/fonts/fonts.qml @@ -51,9 +51,9 @@ Rectangle { } Text { text: { - if (webFont.status == 1) myText - else if (webFont.status == 2) "Loading..." - else if (webFont.status == 3) "Error loading font" + if (webFont.status == FontLoader.Ready) myText + else if (webFont.status == FontLoader.Loading) "Loading..." + else if (webFont.status == FontLoader.Error) "Error loading font" } color: "lightsteelblue" width: parent.width diff --git a/examples/declarative/listview/dynamic.qml b/examples/declarative/listview/dynamic.qml index 236a9c5..9b05ad5 100644 --- a/examples/declarative/listview/dynamic.qml +++ b/examples/declarative/listview/dynamic.qml @@ -56,7 +56,7 @@ Rectangle { Item { width: container.width; height: 55 - + Column { id: moveButtons x: 5; width: childrenRect.width; anchors.verticalCenter: parent.verticalCenter @@ -84,7 +84,7 @@ Rectangle { spacing: 5 Repeater { model: attributes - Component { + Component { Text { text: description; color: "White" } } } @@ -95,13 +95,12 @@ Rectangle { id: itemButtons anchors { right: removeButton.left; rightMargin: 35; verticalCenter: parent.verticalCenter } - width: childrenRect.width + width: childrenRect.width spacing: 10 Image { source: "content/pics/list-add.png" scale: clickUp.isPressed ? 0.9 : 1 - transformOrigin: Item.Center ClickAutoRepeating { id: clickUp @@ -115,9 +114,8 @@ Rectangle { Image { source: "content/pics/list-remove.png" scale: clickDown.isPressed ? 0.9 : 1 - transformOrigin: Item.Center - ClickAutoRepeating { + ClickAutoRepeating { id: clickDown anchors.fill: parent onClicked: fruitModel.setProperty(index, "cost", Math.max(0,cost-0.25)) @@ -147,7 +145,7 @@ Rectangle { width: 8; height: view.height; anchors.right: view.right opacity: 0 - orientation: "Vertical" + orientation: Qt.Vertical position: view.visibleArea.yPosition pageSize: view.visibleArea.heightRatio @@ -158,7 +156,7 @@ Rectangle { } transitions: Transition { NumberAnimation { properties: "opacity"; duration: 400 } - } + } } Row { @@ -198,10 +196,10 @@ Rectangle { } } - Image { + Image { source: "content/pics/archive-remove.png" - MouseArea { + MouseArea { anchors.fill: parent onClicked: fruitModel.clear() } diff --git a/examples/declarative/listview/itemlist.qml b/examples/declarative/listview/itemlist.qml index e387f28..b73b3a3 100644 --- a/examples/declarative/listview/itemlist.qml +++ b/examples/declarative/listview/itemlist.qml @@ -33,7 +33,7 @@ Rectangle { anchors { fill: parent; bottomMargin: 30 } model: itemModel preferredHighlightBegin: 0; preferredHighlightEnd: 0 - highlightRangeMode: "StrictlyEnforceRange" + highlightRangeMode: ListView.StrictlyEnforceRange orientation: ListView.Horizontal snapMode: ListView.SnapOneItem; flickDeceleration: 2000 } @@ -55,7 +55,7 @@ Rectangle { radius: 3 color: view.currentIndex == index ? "blue" : "white" - MouseArea { + MouseArea { width: 20; height: 20 anchors.centerIn: parent onClicked: view.currentIndex = index diff --git a/examples/declarative/listview/listview-example.qml b/examples/declarative/listview/listview-example.qml index 6feedf6..2e8cdda 100644 --- a/examples/declarative/listview/listview-example.qml +++ b/examples/declarative/listview/listview-example.qml @@ -75,7 +75,7 @@ Rectangle { highlight: petHighlight currentIndex: list1.currentIndex preferredHighlightBegin: 80; preferredHighlightEnd: 220 - highlightRangeMode: "ApplyRange" + highlightRangeMode: ListView.ApplyRange } ListView { @@ -87,7 +87,7 @@ Rectangle { highlight: Rectangle { color: "lightsteelblue" } currentIndex: list1.currentIndex preferredHighlightBegin: 125; preferredHighlightEnd: 125 - highlightRangeMode: "StrictlyEnforceRange" + highlightRangeMode: ListView.StrictlyEnforceRange flickDeceleration: 1000 } } diff --git a/examples/declarative/listview/sections.qml b/examples/declarative/listview/sections.qml index 0a81f63..21f9f03 100644 --- a/examples/declarative/listview/sections.qml +++ b/examples/declarative/listview/sections.qml @@ -61,7 +61,7 @@ Rectangle { height: 20 Text { x: 2; height: parent.height - verticalAlignment: 'AlignVCenter' + verticalAlignment: Text.AlignVCenter text: section font.bold: true } diff --git a/examples/declarative/mousearea/mouse.qml b/examples/declarative/mousearea/mouse.qml index 67302a8..06134b7 100644 --- a/examples/declarative/mousearea/mouse.qml +++ b/examples/declarative/mousearea/mouse.qml @@ -33,7 +33,7 @@ Rectangle { MouseArea { anchors.fill: parent drag.target: parent - drag.axis: "XAxis" + drag.axis: Drag.XAxis drag.minimumX: 0 drag.maximumX: 150 diff --git a/examples/declarative/parallax/qml/ParallaxView.qml b/examples/declarative/parallax/qml/ParallaxView.qml index 4b38d45..e869a21 100644 --- a/examples/declarative/parallax/qml/ParallaxView.qml +++ b/examples/declarative/parallax/qml/ParallaxView.qml @@ -18,9 +18,9 @@ Item { id: list currentIndex: root.currentIndex - onCurrentIndexChanged: root.currentIndex = currentIndex + onCurrentIndexChanged: root.currentIndex = currentIndex - orientation: "Horizontal" + orientation: Qt.Horizontal boundsBehavior: Flickable.DragOverBounds anchors.fill: parent model: VisualItemModel { id: visualModel } @@ -45,10 +45,10 @@ Item { anchors.horizontalCenter: parent.horizontalCenter width: Math.min(count * 50, parent.width - 20) interactive: width == parent.width - 20 - orientation: "Horizontal" + orientation: Qt.Horizontal - delegate: Item { - width: 50; height: 50 + delegate: Item { + width: 50; height: 50 id: delegateRoot Image { @@ -56,7 +56,6 @@ Item { source: modelData.icon smooth: true scale: 0.8 - transformOrigin: "Center" } MouseArea { @@ -64,10 +63,10 @@ Item { onClicked: { root.currentIndex = index } } - states: State { + states: State { name: "Selected" when: delegateRoot.ListView.isCurrentItem == true - PropertyChanges { + PropertyChanges { target: image scale: 1 y: -5 diff --git a/examples/declarative/parallax/qml/Smiley.qml b/examples/declarative/parallax/qml/Smiley.qml index cfa4fed..662addc 100644 --- a/examples/declarative/parallax/qml/Smiley.qml +++ b/examples/declarative/parallax/qml/Smiley.qml @@ -8,7 +8,6 @@ Item { Image { anchors.horizontalCenter: parent.horizontalCenter source: "../pics/shadow.png"; y: smiley.minHeight + 58 - transformOrigin: Item.Center // The scale property depends on the y position of the smiley face. scale: smiley.y * 0.5 / (smiley.minHeight - smiley.maxHeight) @@ -32,7 +31,7 @@ Item { from: smiley.minHeight; to: smiley.maxHeight easing.type: Easing.OutExpo; duration: 300 } - + // Then move back to minHeight in 1 second, using the OutBounce easing function NumberAnimation { from: smiley.maxHeight; to: smiley.minHeight diff --git a/examples/declarative/scrollbar/ScrollBar.qml b/examples/declarative/scrollbar/ScrollBar.qml index 5433156..c628a20 100644 --- a/examples/declarative/scrollbar/ScrollBar.qml +++ b/examples/declarative/scrollbar/ScrollBar.qml @@ -7,26 +7,26 @@ Item { // position and pageSize are in the range 0.0 - 1.0. They are relative to the // height of the page, i.e. a pageSize of 0.5 means that you can see 50% // of the height of the view. - // orientation can be either 'Vertical' or 'Horizontal' + // orientation can be either Qt.Vertical or Qt.Horizontal property real position property real pageSize - property variant orientation : "Vertical" + property variant orientation : Qt.Vertical // A light, semi-transparent background Rectangle { id: background anchors.fill: parent - radius: orientation == 'Vertical' ? (width/2 - 1) : (height/2 - 1) + radius: orientation == Qt.Vertical ? (width/2 - 1) : (height/2 - 1) color: "white" opacity: 0.3 } // Size the bar to the required size, depending upon the orientation. Rectangle { - x: orientation == 'Vertical' ? 1 : (scrollBar.position * (scrollBar.width-2) + 1) - y: orientation == 'Vertical' ? (scrollBar.position * (scrollBar.height-2) + 1) : 1 - width: orientation == 'Vertical' ? (parent.width-2) : (scrollBar.pageSize * (scrollBar.width-2)) - height: orientation == 'Vertical' ? (scrollBar.pageSize * (scrollBar.height-2)) : (parent.height-2) - radius: orientation == 'Vertical' ? (width/2 - 1) : (height/2 - 1) + x: orientation == Qt.Vertical ? 1 : (scrollBar.position * (scrollBar.width-2) + 1) + y: orientation == Qt.Vertical ? (scrollBar.position * (scrollBar.height-2) + 1) : 1 + width: orientation == Qt.Vertical ? (parent.width-2) : (scrollBar.pageSize * (scrollBar.width-2)) + height: orientation == Qt.Vertical ? (scrollBar.pageSize * (scrollBar.height-2)) : (parent.height-2) + radius: orientation == Qt.Vertical ? (width/2 - 1) : (height/2 - 1) color: "black" opacity: 0.7 } diff --git a/examples/declarative/scrollbar/display.qml b/examples/declarative/scrollbar/display.qml index cb1da16..b8a5e36 100644 --- a/examples/declarative/scrollbar/display.qml +++ b/examples/declarative/scrollbar/display.qml @@ -37,7 +37,7 @@ Rectangle { width: 12; height: view.height-12 anchors.right: view.right opacity: 0 - orientation: "Vertical" + orientation: Qt.Vertical position: view.visibleArea.yPosition pageSize: view.visibleArea.heightRatio } @@ -47,7 +47,7 @@ Rectangle { width: view.width-12; height: 12 anchors.bottom: view.bottom opacity: 0 - orientation: "Horizontal" + orientation: Qt.Horizontal position: view.visibleArea.xPosition pageSize: view.visibleArea.widthRatio } diff --git a/examples/declarative/slideswitch/content/Switch.qml b/examples/declarative/slideswitch/content/Switch.qml index 1aa7696..526a171 100644 --- a/examples/declarative/slideswitch/content/Switch.qml +++ b/examples/declarative/slideswitch/content/Switch.qml @@ -45,7 +45,7 @@ Item { MouseArea { anchors.fill: parent - drag.target: knob; drag.axis: "XAxis"; drag.minimumX: 1; drag.maximumX: 78 + drag.target: knob; drag.axis: Drag.XAxis; drag.minimumX: 1; drag.maximumX: 78 onClicked: toggle() onReleased: dorelease() } diff --git a/examples/declarative/velocity/Day.qml b/examples/declarative/velocity/Day.qml index 433295b..350c1c4 100644 --- a/examples/declarative/velocity/Day.qml +++ b/examples/declarative/velocity/Day.qml @@ -61,7 +61,7 @@ Component { id: mouse anchors.fill: parent drag.target: stickyPage - drag.axis: "XandYAxis" + drag.axis: Drag.XandYAxis drag.minimumY: 0 drag.maximumY: page.height - 80 drag.minimumX: 100 diff --git a/examples/declarative/webview/alerts.qml b/examples/declarative/webview/alerts.qml index 6a5a0d2..7684c3e 100644 --- a/examples/declarative/webview/alerts.qml +++ b/examples/declarative/webview/alerts.qml @@ -52,7 +52,7 @@ WebView { font.pixelSize: 20 width: webView.width*0.75 wrapMode: Text.WordWrap - horizontalAlignment: "AlignHCenter" + horizontalAlignment: Text.AlignHCenter } } } |