From afd8fd8cbf0ae3f7d7febc4f4a00628c7bd5c541 Mon Sep 17 00:00:00 2001 From: Aaron Kennedy Date: Fri, 1 May 2009 18:24:14 +1000 Subject: Use QML properties syntax --- demos/declarative/calculator/CalcButton.qml | 10 +++----- .../phonebrowser/content/LikeOMeter.qml | 6 ++--- .../phonebrowser/content/MediaButton.qml | 5 ++-- .../phonebrowser/content/PhoneInfoContainer.qml | 16 +++++------- .../declarative/phonebrowser/content/ScrollBar.qml | 5 ++-- demos/declarative/phonebrowser/content/Star.qml | 8 +++--- demos/declarative/phonebrowser/phonebrowser.qml | 2 +- demos/declarative/webbrowser/webbrowser.qml | 30 +++++----------------- examples/declarative/dial/DialLibrary/Dial.qml | 8 +++--- examples/declarative/follow/pong.qml | 8 +++--- .../declarative/listview/content/MediaButton.qml | 5 ++-- examples/declarative/listview/recipes.qml | 7 ++--- examples/declarative/minehunt/Description.qml | 4 +-- examples/declarative/minehunt/Explosion.qml | 7 ++--- examples/declarative/minehunt/minehunt.qml | 14 +++------- examples/declarative/scrollbar/ScrollBar.qml | 14 +++------- examples/declarative/slideswitch/Switch.qml | 6 ++--- .../contacts/1_Drawing_and_Animation/GroupBox.qml | 10 +++----- .../tutorials/contacts/2_Reuse/3/Contact.qml | 1 + .../declarative/tutorials/helloworld/t2/Cell.qml | 6 ++--- .../declarative/tutorials/helloworld/t3/Cell.qml | 5 ++-- examples/declarative/velocity/Day.qml | 10 +++----- .../declarative/webview/content/SpinSquare.qml | 11 +++----- 23 files changed, 68 insertions(+), 130 deletions(-) diff --git a/demos/declarative/calculator/CalcButton.qml b/demos/declarative/calculator/CalcButton.qml index f4ccdae..8203710 100644 --- a/demos/declarative/calculator/CalcButton.qml +++ b/demos/declarative/calculator/CalcButton.qml @@ -1,11 +1,9 @@ Item { - id: Button; width: 50; height: 30 + property string operation + property bool toggable : false + property bool toggled : false - properties: [ - Property { name: "operation"; type: "string" }, - Property { name: "toggable"; value: false }, - Property { name: "toggled"; value: false } - ] + id: Button; width: 50; height: 30 Script { function buttonClicked(operation) { diff --git a/demos/declarative/phonebrowser/content/LikeOMeter.qml b/demos/declarative/phonebrowser/content/LikeOMeter.qml index 31b8195..d928f48 100644 --- a/demos/declarative/phonebrowser/content/LikeOMeter.qml +++ b/demos/declarative/phonebrowser/content/LikeOMeter.qml @@ -1,9 +1,7 @@ Item { + property var rating : 2 + id: Container - properties: Property { - name: "rating" - value: 2 - } HorizontalLayout { Star { rating: 0 diff --git a/demos/declarative/phonebrowser/content/MediaButton.qml b/demos/declarative/phonebrowser/content/MediaButton.qml index bb2510a..7aec2e4 100644 --- a/demos/declarative/phonebrowser/content/MediaButton.qml +++ b/demos/declarative/phonebrowser/content/MediaButton.qml @@ -1,11 +1,10 @@ Item { + property var text + id: Container signals: Signal { name: "clicked" } - properties: Property { - name: "text" - } Image { id: Image source: "pics/button.png" diff --git a/demos/declarative/phonebrowser/content/PhoneInfoContainer.qml b/demos/declarative/phonebrowser/content/PhoneInfoContainer.qml index da475b1..597c3ee 100644 --- a/demos/declarative/phonebrowser/content/PhoneInfoContainer.qml +++ b/demos/declarative/phonebrowser/content/PhoneInfoContainer.qml @@ -1,15 +1,13 @@ Flipable { id: Container - properties: [ - Property { name: "frontContainer"; value: ContainerFront }, - Property { name: "flickableArea"; value: Flickable }, - Property { name: "phoneTitle"; value: "N/A" }, - Property { name: "phoneDescription"; value: "..." }, - Property { name: "phoneSpecifications"; value: "" }, - Property { name: "phoneUrl"; value: "" }, - Property { name: "rating"; value: 2 } - ] + property var frontContainer : ContainerFront + property var flickableArea : Flickable + property var phoneTitle : "N/A" + property var phoneDescription : "..." + property var phoneSpecifications : "" + property var phoneUrl : "" + property var rating : 2 signals: Signal { name: "closed" } diff --git a/demos/declarative/phonebrowser/content/ScrollBar.qml b/demos/declarative/phonebrowser/content/ScrollBar.qml index a0f2925..e65f92f 100644 --- a/demos/declarative/phonebrowser/content/ScrollBar.qml +++ b/demos/declarative/phonebrowser/content/ScrollBar.qml @@ -1,8 +1,7 @@ Item { + property var flickableArea + id: Container - properties: Property { - name: "flickableArea" - } Rect { radius: 5 color: "black" diff --git a/demos/declarative/phonebrowser/content/Star.qml b/demos/declarative/phonebrowser/content/Star.qml index ebcd78b..d53c529 100644 --- a/demos/declarative/phonebrowser/content/Star.qml +++ b/demos/declarative/phonebrowser/content/Star.qml @@ -1,13 +1,11 @@ Item { + property var rating + property var on + id: Container width: 24 height: 24 - properties: [ - Property { name: "rating" }, - Property { name: "on" } - ] - signals: Signal { name: "clicked" } diff --git a/demos/declarative/phonebrowser/phonebrowser.qml b/demos/declarative/phonebrowser/phonebrowser.qml index 85d352d..ce74367 100644 --- a/demos/declarative/phonebrowser/phonebrowser.qml +++ b/demos/declarative/phonebrowser/phonebrowser.qml @@ -3,7 +3,7 @@ import "content" Item { id: MainWindow; width: 800; height: 480 - properties: Property { name: "minimized"; value: false } + property var minimized : false Item { id: Background diff --git a/demos/declarative/webbrowser/webbrowser.qml b/demos/declarative/webbrowser/webbrowser.qml index 709d649..c754543 100644 --- a/demos/declarative/webbrowser/webbrowser.qml +++ b/demos/declarative/webbrowser/webbrowser.qml @@ -3,10 +3,7 @@ import "content" Item { id: WebBrowser - properties: Property { - name: "url" - value: "http://www.qtsoftware.com" - } + property var url : "http://www.qtsoftware.com" width: 640 height: 480 @@ -163,11 +160,8 @@ Item { onClicked: { proxy.focus=true } } } - properties: Property { - name: "progressOff" - value: 1 - type: "Real" - } + + property real progressOff : 1 states: [ State { name: "Normal" @@ -210,16 +204,8 @@ Item { anchors.left: parent.left anchors.right: parent.right - properties: Property { - name: "centerX" - value: 0 - type: "Real" - } - properties: Property { - name: "centerY" - value: 0 - type: "Real" - } + property real centerX : 0 + property real centerY : 0 WebView { id: WebView @@ -237,11 +223,7 @@ Item { onUrlChanged: { Flick.xPosition=0; Flick.yPosition=0; zoomOut() } onDoubleClick: { toggleZoom() } - properties: Property { - name: "zoomedOut" - type: "real" - value: 1 - } + property real zoomedOut : 1 } Rect { id: WebViewTint diff --git a/examples/declarative/dial/DialLibrary/Dial.qml b/examples/declarative/dial/DialLibrary/Dial.qml index fe8528d..485188a 100644 --- a/examples/declarative/dial/DialLibrary/Dial.qml +++ b/examples/declarative/dial/DialLibrary/Dial.qml @@ -1,11 +1,9 @@ Item { + property real value : 0 + width: 210 height: 210 - properties: Property { - name: "value" - type: "real" - value: 0 - } + Image { id: Background source: "background.svg" diff --git a/examples/declarative/follow/pong.qml b/examples/declarative/follow/pong.qml index 32ee049..582b04c 100644 --- a/examples/declarative/follow/pong.qml +++ b/examples/declarative/follow/pong.qml @@ -5,14 +5,14 @@ Rect { // Make a ball to bounce Rect { + // Add a property for the target y coordinate + property var targetY : Page.height-10 + property var direction : "right" + id: Ball color: "#00ee00" x: 20; width: 20; height: 20; z: 1 - // Add a property for the target y coordinate - properties: Property { name: "targetY"; value: Page.height-10 } - properties: Property { name: "direction"; value: "right" } - // Move the ball to the right and back to the left repeatedly x: SequentialAnimation { running: true; repeat: true diff --git a/examples/declarative/listview/content/MediaButton.qml b/examples/declarative/listview/content/MediaButton.qml index bb2510a..7aec2e4 100644 --- a/examples/declarative/listview/content/MediaButton.qml +++ b/examples/declarative/listview/content/MediaButton.qml @@ -1,11 +1,10 @@ Item { + property var text + id: Container signals: Signal { name: "clicked" } - properties: Property { - name: "text" - } Image { id: Image source: "pics/button.png" diff --git a/examples/declarative/listview/recipes.qml b/examples/declarative/listview/recipes.qml index db8604e..8863d1c 100644 --- a/examples/declarative/listview/recipes.qml +++ b/examples/declarative/listview/recipes.qml @@ -18,11 +18,8 @@ Rect { // We can bind multiple element's opacity to this one property, // rather than having a "SetProperty" line for each element we // want to fade. - properties: Property { - name: "detailsOpacity" - value: 0 - type: "real" - } + property real detailsOpacity : 0 + // A simple rounded rectangle for the background Rect { id: background diff --git a/examples/declarative/minehunt/Description.qml b/examples/declarative/minehunt/Description.qml index f59c8f9..0241ae5 100644 --- a/examples/declarative/minehunt/Description.qml +++ b/examples/declarative/minehunt/Description.qml @@ -1,9 +1,7 @@ Item { id: Page height: MyText.height + 20 - properties: Property { - name: "text" - } + property var text MouseRegion { anchors.fill: parent drag.target: Page diff --git a/examples/declarative/minehunt/Explosion.qml b/examples/declarative/minehunt/Explosion.qml index 8d868bc..2886559 100644 --- a/examples/declarative/minehunt/Explosion.qml +++ b/examples/declarative/minehunt/Explosion.qml @@ -1,9 +1,6 @@ Item { - properties: Property { - name: "explode" - type: "Bool" - value: false - } + property bool explode : false + Particles { width: 38 height: 21 diff --git a/examples/declarative/minehunt/minehunt.qml b/examples/declarative/minehunt/minehunt.qml index cde2612..58397b0 100644 --- a/examples/declarative/minehunt/minehunt.qml +++ b/examples/declarative/minehunt/minehunt.qml @@ -2,16 +2,10 @@ Item { id: field width: 370 height: 480 - properties: Property { - name: "clickx" - type: "Int" - value: 0 - } - properties: Property { - name: "clicky" - type: "Int" - value: 0 - } + + property int clickx : 0 + property int clicky : 0 + resources: [ Component { id: tile diff --git a/examples/declarative/scrollbar/ScrollBar.qml b/examples/declarative/scrollbar/ScrollBar.qml index e3ca0c2..929c72a 100644 --- a/examples/declarative/scrollbar/ScrollBar.qml +++ b/examples/declarative/scrollbar/ScrollBar.qml @@ -5,16 +5,10 @@ Item { // 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' - properties: Property { - name: "position" - } - properties: Property { - name: "pageSize" - } - properties: Property { - name: "orientation" - value: "Vertical" - } + property var position + property var pageSize + property var orientation : "Vertical" + // A light, semi-transparent background Rect { id: Background diff --git a/examples/declarative/slideswitch/Switch.qml b/examples/declarative/slideswitch/Switch.qml index 3ae7a0f..6777277 100644 --- a/examples/declarative/slideswitch/Switch.qml +++ b/examples/declarative/slideswitch/Switch.qml @@ -2,9 +2,9 @@ Item { id: Switch width: Groove.width height: Groove.height - properties: Property { - name: "on" - } + + property var on + Script { function toggle() { diff --git a/examples/declarative/tutorials/contacts/1_Drawing_and_Animation/GroupBox.qml b/examples/declarative/tutorials/contacts/1_Drawing_and_Animation/GroupBox.qml index 665c072..edaae72 100644 --- a/examples/declarative/tutorials/contacts/1_Drawing_and_Animation/GroupBox.qml +++ b/examples/declarative/tutorials/contacts/1_Drawing_and_Animation/GroupBox.qml @@ -2,12 +2,10 @@ FocusRealm { id: groupBox width: Math.max(270, subItem.width+40) height: Math.max(70, subItem.height+40) - properties: Property { - name: "contents" - } - properties: Property { - name: "label" - } + + property var contents + property var label + Rect { id: wrapper x: 5 diff --git a/examples/declarative/tutorials/contacts/2_Reuse/3/Contact.qml b/examples/declarative/tutorials/contacts/2_Reuse/3/Contact.qml index 33ac627..23560ce 100644 --- a/examples/declarative/tutorials/contacts/2_Reuse/3/Contact.qml +++ b/examples/declarative/tutorials/contacts/2_Reuse/3/Contact.qml @@ -2,6 +2,7 @@ Item { id: contactDetails width: 230 height: layout.height + properties: Property { name: "contactid" value: "" diff --git a/examples/declarative/tutorials/helloworld/t2/Cell.qml b/examples/declarative/tutorials/helloworld/t2/Cell.qml index bd5bbe7..0109251 100644 --- a/examples/declarative/tutorials/helloworld/t2/Cell.qml +++ b/examples/declarative/tutorials/helloworld/t2/Cell.qml @@ -1,10 +1,10 @@ Item { + property var color + id: CellContainer width: 40 height: 25 - properties: Property { - name: "color" - } + Rect { anchors.fill: parent color: CellContainer.color diff --git a/examples/declarative/tutorials/helloworld/t3/Cell.qml b/examples/declarative/tutorials/helloworld/t3/Cell.qml index bd5bbe7..e779406 100644 --- a/examples/declarative/tutorials/helloworld/t3/Cell.qml +++ b/examples/declarative/tutorials/helloworld/t3/Cell.qml @@ -1,10 +1,9 @@ Item { + property var color + id: CellContainer width: 40 height: 25 - properties: Property { - name: "color" - } Rect { anchors.fill: parent color: CellContainer.color diff --git a/examples/declarative/velocity/Day.qml b/examples/declarative/velocity/Day.qml index 7d26e88..c70a211 100644 --- a/examples/declarative/velocity/Day.qml +++ b/examples/declarative/velocity/Day.qml @@ -1,16 +1,12 @@ Rect { + property string day + property var stickies + width: 400 height: 500 radius: 7 pen.color: "black" id: Page - properties: Property { - name: "day" - type: "string" - } - properties: Property { - name: "stickies" - } Image { x: 10 y: 10 diff --git a/examples/declarative/webview/content/SpinSquare.qml b/examples/declarative/webview/content/SpinSquare.qml index 5c14506..5e4735e 100644 --- a/examples/declarative/webview/content/SpinSquare.qml +++ b/examples/declarative/webview/content/SpinSquare.qml @@ -1,13 +1,8 @@ Item { + properties var period : 250 + properties var color : "black" id: Root - properties: Property { - name: "period" - value: 250 - } - properties: Property { - name: "color" - value: "black" - } + Item { x: Root.width/2 y: Root.height/2 -- cgit v0.12