summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--demos/declarative/calculator/CalcButton.qml32
-rw-r--r--demos/declarative/calculator/calculator.js58
-rw-r--r--demos/declarative/calculator/calculator.qml59
-rw-r--r--demos/declarative/flickr/common/ImageDetails.qml120
-rw-r--r--demos/declarative/flickr/common/LikeOMeter.qml22
-rw-r--r--demos/declarative/flickr/common/Loading.qml4
-rw-r--r--demos/declarative/flickr/common/MediaButton.qml22
-rw-r--r--demos/declarative/flickr/common/MediaLineEdit.qml62
-rw-r--r--demos/declarative/flickr/common/Progress.qml5
-rw-r--r--demos/declarative/flickr/common/ScrollBar.qml10
-rw-r--r--demos/declarative/flickr/common/Slider.qml16
-rw-r--r--demos/declarative/flickr/common/Star.qml13
-rw-r--r--demos/declarative/flickr/flickr-desktop.qml132
-rw-r--r--demos/declarative/flickr/flickr-mobile.qml56
-rw-r--r--demos/declarative/flickr/mobile/Button.qml27
-rw-r--r--demos/declarative/flickr/mobile/GridDelegate.qml52
-rw-r--r--demos/declarative/flickr/mobile/ImageDetails.qml74
-rw-r--r--demos/declarative/flickr/mobile/ListDelegate.qml13
-rw-r--r--demos/declarative/flickr/mobile/TitleBar.qml38
-rw-r--r--demos/declarative/flickr/mobile/ToolBar.qml14
-rw-r--r--demos/declarative/minehunt/Description.qml10
-rw-r--r--demos/declarative/samegame/content/Button.qml6
-rw-r--r--demos/declarative/samegame/content/Dialog.qml8
-rw-r--r--demos/declarative/samegame/samegame.qml24
-rw-r--r--demos/declarative/twitter/content/AuthView.qml12
-rw-r--r--demos/declarative/twitter/content/FatDelegate.qml20
-rw-r--r--demos/declarative/twitter/content/HomeTitleBar.qml64
-rw-r--r--demos/declarative/twitter/content/MultiTitleBar.qml14
-rw-r--r--demos/declarative/twitter/twitter.qml73
-rw-r--r--demos/declarative/webbrowser/content/RectSoftShadow.qml2
-rw-r--r--demos/declarative/webbrowser/webbrowser.qml170
-rw-r--r--doc/src/declarative/binding.qdoc5
-rw-r--r--doc/src/declarative/qmlmodels.qdoc61
-rw-r--r--doc/src/declarative/qtdeclarative.qdoc1
-rw-r--r--doc/src/snippets/declarative/GroupBox.qml4
-rw-r--r--doc/src/snippets/declarative/gridview/dummydata/ContactModel.qml2
-rw-r--r--doc/src/snippets/declarative/gridview/gridview.qml12
-rw-r--r--doc/src/snippets/declarative/listview/highlight.qml14
-rw-r--r--doc/src/snippets/declarative/listview/listview.qml12
-rw-r--r--doc/src/snippets/declarative/pathview/pathattributes.qml12
-rw-r--r--doc/src/snippets/declarative/pathview/pathview.qml12
-rw-r--r--examples/declarative/anchors/anchor-changes.qml18
-rw-r--r--examples/declarative/aspectratio/face_fit.qml6
-rw-r--r--examples/declarative/aspectratio/face_fit_animated.qml10
-rw-r--r--examples/declarative/aspectratio/scale_and_crop.qml6
-rw-r--r--examples/declarative/aspectratio/scale_and_crop_simple.qml6
-rw-r--r--examples/declarative/aspectratio/scale_and_sidecrop.qml6
-rw-r--r--examples/declarative/aspectratio/scale_to_fit.qml6
-rw-r--r--examples/declarative/aspectratio/scale_to_fit_simple.qml6
-rw-r--r--examples/declarative/behaviours/MyRect.qml4
-rw-r--r--examples/declarative/behaviours/test.qml4
-rw-r--r--examples/declarative/border-image/MyBorderImage.qml26
-rw-r--r--examples/declarative/border-image/animated.qml2
-rw-r--r--examples/declarative/border-image/borders.qml2
-rw-r--r--examples/declarative/border-image/example.qml2
-rw-r--r--examples/declarative/clock/Clock.qml16
-rw-r--r--examples/declarative/clock/display.qml2
-rw-r--r--examples/declarative/dial/DialLibrary/Dial.qml13
-rw-r--r--examples/declarative/dial/dial.qml6
-rw-r--r--examples/declarative/easing/easing.qml24
-rw-r--r--examples/declarative/effects/test.qml20
-rw-r--r--examples/declarative/extending/binding/example.qml18
-rw-r--r--examples/declarative/fillmode/fillmode.qml14
-rw-r--r--examples/declarative/flowview/FlickrView.qml22
-rw-r--r--examples/declarative/flowview/flowview.qml78
-rw-r--r--examples/declarative/focusscope/test.qml24
-rw-r--r--examples/declarative/focusscope/test3.qml18
-rw-r--r--examples/declarative/focusscope/test4.qml24
-rw-r--r--examples/declarative/follow/follow.qml30
-rw-r--r--examples/declarative/follow/pong.qml44
-rw-r--r--examples/declarative/fonts/fonts.qml42
-rw-r--r--examples/declarative/gridview/gridview.qml60
-rw-r--r--examples/declarative/gridview/pics/AddressBook_48.pngbin0 -> 3350 bytes
-rw-r--r--examples/declarative/gridview/pics/AudioPlayer_48.pngbin0 -> 3806 bytes
-rw-r--r--examples/declarative/gridview/pics/Camera_48.pngbin0 -> 3540 bytes
-rw-r--r--examples/declarative/gridview/pics/DateBook_48.pngbin0 -> 2610 bytes
-rw-r--r--examples/declarative/gridview/pics/EMail_48.pngbin0 -> 3655 bytes
-rw-r--r--examples/declarative/gridview/pics/TodoList_48.pngbin0 -> 3429 bytes
-rw-r--r--examples/declarative/gridview/pics/VideoPlayer_48.pngbin0 -> 4151 bytes
-rw-r--r--examples/declarative/listview/content/ClickAutoRepeating.qml17
-rw-r--r--examples/declarative/listview/content/MediaButton.qml34
-rw-r--r--examples/declarative/listview/dynamic.qml42
-rw-r--r--examples/declarative/listview/highlight.qml18
-rw-r--r--examples/declarative/listview/itemlist.qml20
-rw-r--r--examples/declarative/listview/listview.qml23
-rw-r--r--examples/declarative/listview/recipes.qml6
-rw-r--r--examples/declarative/listview/sections.qml28
-rw-r--r--examples/declarative/loader/Browser.qml52
-rw-r--r--examples/declarative/loader/Button.qml10
-rw-r--r--examples/declarative/scrollbar/ScrollBar.qml12
-rw-r--r--examples/declarative/scrollbar/display.qml34
-rw-r--r--examples/declarative/slideswitch/Switch.qml38
-rw-r--r--examples/declarative/smooth/GradientRect.qml10
-rw-r--r--examples/declarative/smooth/MyRect.qml8
-rw-r--r--examples/declarative/snow/ImageBatch.qml26
-rw-r--r--examples/declarative/snow/Loading.qml4
-rw-r--r--examples/declarative/snow/create.js6
-rw-r--r--examples/declarative/snow/snow.qml24
-rw-r--r--examples/declarative/states/states.qml10
-rw-r--r--examples/declarative/states/transitions.qml10
-rw-r--r--examples/declarative/tutorials/helloworld/t1/tutorial1.qml6
-rw-r--r--examples/declarative/tutorials/helloworld/t2/Cell.qml6
-rw-r--r--examples/declarative/tutorials/helloworld/t2/tutorial2.qml10
-rw-r--r--examples/declarative/tutorials/helloworld/t3/Cell.qml6
-rw-r--r--examples/declarative/tutorials/helloworld/t3/tutorial3.qml16
-rw-r--r--examples/declarative/velocity/Day.qml32
-rw-r--r--examples/declarative/velocity/velocity.qml10
-rw-r--r--examples/declarative/webview/autosize.qml19
-rw-r--r--examples/declarative/webview/content/SpinSquare.qml12
-rw-r--r--examples/declarative/webview/newwindows.qml16
-rw-r--r--examples/declarative/webview/qml-in-html.qml6
-rw-r--r--examples/declarative/webview/transparent.qml6
-rw-r--r--examples/declarative/xmldata/daringfireball.qml6
-rw-r--r--examples/declarative/xmldata/yahoonews.qml24
-rw-r--r--src/declarative/fx/qfxgridview.cpp162
-rw-r--r--src/declarative/fx/qfxgridview.h6
-rw-r--r--src/declarative/fx/qfxlistview.cpp63
-rw-r--r--src/declarative/fx/qfxlistview.h11
-rw-r--r--src/declarative/fx/qfxpathview.cpp2
-rw-r--r--src/declarative/fx/qfxrepeater.cpp24
-rw-r--r--src/declarative/fx/qfxrepeater.h5
-rw-r--r--src/declarative/fx/qfxvisualitemmodel.cpp6
-rw-r--r--src/declarative/qml/qmlengine.cpp42
-rw-r--r--src/declarative/util/qmllistaccessor.cpp2
-rw-r--r--tests/auto/declarative/qfxwebview/data/basic.html12
-rw-r--r--tests/auto/declarative/qfxwebview/data/basic.qml5
-rw-r--r--tests/auto/declarative/qfxwebview/qfxwebview.pro6
-rw-r--r--tests/auto/declarative/qfxwebview/tst_qfxwebview.cpp100
-rw-r--r--tests/auto/declarative/sql/tst_sql.cpp27
129 files changed, 1700 insertions, 1306 deletions
diff --git a/demos/declarative/calculator/CalcButton.qml b/demos/declarative/calculator/CalcButton.qml
index 55b5f0c..c2e3a81 100644
--- a/demos/declarative/calculator/CalcButton.qml
+++ b/demos/declarative/calculator/CalcButton.qml
@@ -1,41 +1,41 @@
import Qt 4.6
Rectangle {
- property alias operation: Label.text
+ property alias operation: label.text
property bool toggable: false
property bool toggled: false
signal clicked
- id: Button; width: 50; height: 30
- border.color: Palette.mid; radius: 6
+ id: button; width: 50; height: 30
+ border.color: palette.mid; radius: 6
gradient: Gradient {
- GradientStop { id: G1; position: 0.0; color: Palette.lighter(Palette.button) }
- GradientStop { id: G2; position: 1.0; color: Palette.button }
+ GradientStop { id: G1; position: 0.0; color: palette.lighter(palette.button) }
+ GradientStop { id: G2; position: 1.0; color: palette.button }
}
- Text { id: Label; anchors.centerIn: parent; color: Palette.buttonText }
+ Text { id: label; anchors.centerIn: parent; color: palette.buttonText }
MouseRegion {
- id: ClickRegion
+ id: clickRegion
anchors.fill: parent
onClicked: {
doOp(operation);
- Button.clicked();
- if (!Button.toggable) return;
- Button.toggled ? Button.toggled = false : Button.toggled = true
+ button.clicked();
+ if (!button.toggable) return;
+ button.toggled ? button.toggled = false : button.toggled = true
}
}
states: [
State {
- name: "Pressed"; when: ClickRegion.pressed == true
- PropertyChanges { target: G1; color: Palette.dark }
- PropertyChanges { target: G2; color: Palette.button }
+ name: "Pressed"; when: clickRegion.pressed == true
+ PropertyChanges { target: G1; color: palette.dark }
+ PropertyChanges { target: G2; color: palette.button }
},
State {
- name: "Toggled"; when: Button.toggled == true
- PropertyChanges { target: G1; color: Palette.dark }
- PropertyChanges { target: G2; color: Palette.button }
+ name: "Toggled"; when: button.toggled == true
+ PropertyChanges { target: G1; color: palette.dark }
+ PropertyChanges { target: G2; color: palette.button }
}
]
}
diff --git a/demos/declarative/calculator/calculator.js b/demos/declarative/calculator/calculator.js
index 774b232..cd6490a 100644
--- a/demos/declarative/calculator/calculator.js
+++ b/demos/declarative/calculator/calculator.js
@@ -5,9 +5,9 @@ var lastOp = "";
var timer = 0;
function disabled(op) {
- if (op == "." && CurNum.text.toString().search(/\./) != -1) {
+ if (op == "." && curNum.text.toString().search(/\./) != -1) {
return true;
- } else if (op == "Sqrt" && CurNum.text.toString().search(/-/) != -1) {
+ } else if (op == "Sqrt" && curNum.text.toString().search(/-/) != -1) {
return true;
} else {
return false;
@@ -20,12 +20,12 @@ function doOp(op) {
}
if (op.toString().length==1 && ((op >= "0" && op <= "9") || op==".") ) {
- if (CurNum.text.toString().length >= 14)
+ if (curNum.text.toString().length >= 14)
return; // No arbitrary length numbers
if (lastOp.toString().length == 1 && ((lastOp >= "0" && lastOp <= "9") || lastOp==".") ) {
- CurNum.text = CurNum.text + op.toString();
+ curNum.text = curNum.text + op.toString();
} else {
- CurNum.text = op;
+ curNum.text = op;
}
lastOp = op;
return;
@@ -33,55 +33,55 @@ function doOp(op) {
lastOp = op;
// Pending operations
- if (CurrentOperation.text == "+") {
- CurNum.text = Number(CurNum.text.valueOf()) + Number(curVal.valueOf());
- } else if (CurrentOperation.text == "-") {
- CurNum.text = Number(curVal) - Number(CurNum.text.valueOf());
- } else if (CurrentOperation.text == "x") {
- CurNum.text = Number(curVal) * Number(CurNum.text.valueOf());
- } else if (CurrentOperation.text == "/") {
- CurNum.text = Number(Number(curVal) / Number(CurNum.text.valueOf())).toString();
- } else if (CurrentOperation.text == "=") {
+ if (currentOperation.text == "+") {
+ curNum.text = Number(curNum.text.valueOf()) + Number(curVal.valueOf());
+ } else if (currentOperation.text == "-") {
+ curNum.text = Number(curVal) - Number(curNum.text.valueOf());
+ } else if (currentOperation.text == "x") {
+ curNum.text = Number(curVal) * Number(curNum.text.valueOf());
+ } else if (currentOperation.text == "/") {
+ curNum.text = Number(Number(curVal) / Number(curNum.text.valueOf())).toString();
+ } else if (currentOperation.text == "=") {
}
if (op == "+" || op == "-" || op == "x" || op == "/") {
- CurrentOperation.text = op;
- curVal = CurNum.text.valueOf();
+ currentOperation.text = op;
+ curVal = curNum.text.valueOf();
return;
}
curVal = 0;
- CurrentOperation.text = "";
+ currentOperation.text = "";
// Immediate operations
if (op == "1/x") { // reciprocal
- CurNum.text = (1 / CurNum.text.valueOf()).toString();
+ curNum.text = (1 / curNum.text.valueOf()).toString();
} else if (op == "^2") { // squared
- CurNum.text = (CurNum.text.valueOf() * CurNum.text.valueOf()).toString();
+ curNum.text = (curNum.text.valueOf() * curNum.text.valueOf()).toString();
} else if (op == "Abs") {
- CurNum.text = (Math.abs(CurNum.text.valueOf())).toString();
+ curNum.text = (Math.abs(curNum.text.valueOf())).toString();
} else if (op == "Int") {
- CurNum.text = (Math.floor(CurNum.text.valueOf())).toString();
+ curNum.text = (Math.floor(curNum.text.valueOf())).toString();
} else if (op == "+/-") { // plus/minus
- CurNum.text = (CurNum.text.valueOf() * -1).toString();
+ curNum.text = (curNum.text.valueOf() * -1).toString();
} else if (op == "Sqrt") { // square root
- CurNum.text = (Math.sqrt(CurNum.text.valueOf())).toString();
+ curNum.text = (Math.sqrt(curNum.text.valueOf())).toString();
} else if (op == "MC") { // memory clear
memory = 0;
} else if (op == "M+") { // memory increment
- memory += CurNum.text.valueOf();
+ memory += curNum.text.valueOf();
} else if (op == "MR") { // memory recall
- CurNum.text = memory.toString();
+ curNum.text = memory.toString();
} else if (op == "MS") { // memory set
- memory = CurNum.text.valueOf();
+ memory = curNum.text.valueOf();
} else if (op == "Bksp") {
- CurNum.text = CurNum.text.toString().slice(0, -1);
+ curNum.text = curNum.text.toString().slice(0, -1);
} else if (op == "C") {
- CurNum.text = "0";
+ curNum.text = "0";
} else if (op == "AC") {
curVal = 0;
memory = 0;
lastOp = "";
- CurNum.text ="0";
+ curNum.text ="0";
}
}
diff --git a/demos/declarative/calculator/calculator.qml b/demos/declarative/calculator/calculator.qml
index d93f04a..8041025 100644
--- a/demos/declarative/calculator/calculator.qml
+++ b/demos/declarative/calculator/calculator.qml
@@ -1,36 +1,35 @@
import Qt 4.6
Rectangle {
- id: MainWindow;
- width: 320; height: 270; color: Palette.window
+ width: 320; height: 270; color: palette.window
- SystemPalette { id: Palette; colorGroup: Qt.Active }
+ SystemPalette { id: palette; colorGroup: Qt.Active }
Script { source: "calculator.js" }
Column {
x: 2; spacing: 10;
Rectangle {
- id: Container
+ id: container
width: 316; height: 50
- border.color: Palette.dark; color: Palette.base
+ border.color: palette.dark; color: palette.base
Text {
- id: CurNum
+ id: curNum
font.bold: true; font.pointSize: 16
- color: Palette.text
- anchors.right: Container.right
+ color: palette.text
+ anchors.right: container.right
anchors.rightMargin: 5
- anchors.verticalCenter: Container.verticalCenter
+ anchors.verticalCenter: container.verticalCenter
}
Text {
- id: CurrentOperation
- color: Palette.text
+ id: currentOperation
+ color: palette.text
font.bold: true; font.pointSize: 16
- anchors.left: Container.left
+ anchors.left: container.left
anchors.leftMargin: 5
- anchors.verticalCenter: Container.verticalCenter
+ anchors.verticalCenter: container.verticalCenter
}
}
@@ -38,7 +37,7 @@ Rectangle {
width: 320; height: 30
CalcButton {
- id: AdvancedCheckBox
+ id: advancedCheckBox
x: 55; width: 206
operation: "Advanced Mode"
toggable: true
@@ -49,15 +48,15 @@ Rectangle {
width: 320
Item {
- id: BasicButtons
+ id: basicButtons
x: 55; width: 160; height: 160
- CalcButton { operation: "Bksp"; id: Bksp; width: 67; opacity: 0 }
- CalcButton { operation: "C"; id: C; width: 76 }
- CalcButton { operation: "AC"; id: AC; x: 78; width: 76 }
+ CalcButton { operation: "Bksp"; id: bksp; width: 67; opacity: 0 }
+ CalcButton { operation: "C"; id: c; width: 76 }
+ CalcButton { operation: "AC"; id: ac; x: 78; width: 76 }
Grid {
- id: NumKeypad; y: 32; spacing: 2; columns: 3
+ id: numKeypad; y: 32; spacing: 2; columns: 3
CalcButton { operation: "7" }
CalcButton { operation: "8" }
@@ -75,11 +74,11 @@ Rectangle {
CalcButton { operation: "0"; width: 50 }
CalcButton { operation: "."; x: 77; width: 50 }
- CalcButton { operation: "="; id: Equals; x: 77; width: 102 }
+ CalcButton { operation: "="; id: equals; x: 77; width: 102 }
}
Column {
- id: SimpleOperations
+ id: simpleOperations
x: 156; y: 0; spacing: 2
CalcButton { operation: "x" }
@@ -90,7 +89,7 @@ Rectangle {
}
Grid {
- id: AdvancedButtons
+ id: advancedButtons
x: 350; spacing: 2; columns: 2; opacity: 0
CalcButton { operation: "Abs" }
@@ -109,14 +108,14 @@ Rectangle {
states: [
State {
- name: "Advanced"; when: AdvancedCheckBox.toggled == true
- PropertyChanges { target: BasicButtons; x: 0 }
- PropertyChanges { target: SimpleOperations; y: 32 }
- PropertyChanges { target: Bksp; opacity: 1 }
- PropertyChanges { target: C; x: 69; width: 67 }
- PropertyChanges { target: AC; x: 138; width: 67 }
- PropertyChanges { target: Equals; width: 50 }
- PropertyChanges { target: AdvancedButtons; x: 210; opacity: 1 }
+ name: "Advanced"; when: advancedCheckBox.toggled == true
+ PropertyChanges { target: basicButtons; x: 0 }
+ PropertyChanges { target: simpleOperations; y: 32 }
+ PropertyChanges { target: bksp; opacity: 1 }
+ PropertyChanges { target: c; x: 69; width: 67 }
+ PropertyChanges { target: ac; x: 138; width: 67 }
+ PropertyChanges { target: equals; width: 50 }
+ PropertyChanges { target: advancedButtons; x: 210; opacity: 1 }
}
]
diff --git a/demos/declarative/flickr/common/ImageDetails.qml b/demos/declarative/flickr/common/ImageDetails.qml
index 6b42910..b8b7d29 100644
--- a/demos/declarative/flickr/common/ImageDetails.qml
+++ b/demos/declarative/flickr/common/ImageDetails.qml
@@ -1,9 +1,9 @@
import Qt 4.6
Flipable {
- id: Container
+ id: container
- property var frontContainer: ContainerFront
+ property var frontContainer: containerFront
property string photoTitle: ""
property string photoDescription: ""
property string photoTags: ""
@@ -19,13 +19,13 @@ Flipable {
signal closed
transform: Rotation {
- id: DetailsRotation
- origin.x: Container.width / 2;
+ id: detailsRotation
+ origin.x: container.width / 2;
axis.y: 1; axis.z: 0
}
front: Item {
- id: ContainerFront; anchors.fill: Container
+ id: containerFront; anchors.fill: container
Rectangle {
anchors.fill: parent
@@ -34,74 +34,74 @@ Flipable {
}
MediaButton {
- id: BackButton; x: 630; y: 370; text: "Back"
- onClicked: { Container.closed() }
+ id: backButton; x: 630; y: 370; text: "Back"
+ onClicked: { container.closed() }
}
MediaButton {
- id: MoreButton; x: 530; y: 370; text: "View..."
- onClicked: { Container.state='Back' }
+ id: moreButton; x: 530; y: 370; text: "View..."
+ onClicked: { container.state='Back' }
}
- Text { id: TitleText; style: "Raised"; styleColor: "black"; color: "white"; elide: "ElideRight"
- x: 220; y: 30; width: parent.width - 240; text: Container.photoTitle; font.pointSize: 22 }
+ Text { id: titleText; style: "Raised"; styleColor: "black"; color: "white"; elide: "ElideRight"
+ x: 220; y: 30; width: parent.width - 240; text: container.photoTitle; font.pointSize: 22 }
- LikeOMeter { x: 40; y: 250; rating: Container.rating }
+ LikeOMeter { x: 40; y: 250; rating: container.rating }
- Flickable { id: FlickSurface; x: 220; width: 480; height: 210; y: 130; clip: true
- viewportWidth: 480; viewportHeight: DescriptionText.height
+ Flickable { id: flickable; x: 220; width: 480; height: 210; y: 130; clip: true
+ viewportWidth: 480; viewportHeight: descriptionText.height
- WebView { id: DescriptionText; width: parent.width
- html: "<style TYPE=\"text/css\">body {color: white;} a:link {color: cyan; text-decoration: underline; }</style>" + Container.photoDescription }
+ WebView { id: descriptionText; width: parent.width
+ html: "<style TYPE=\"text/css\">body {color: white;} a:link {color: cyan; text-decoration: underline; }</style>" + container.photoDescription }
}
- Text { id: Size; color: "white"; width: 300; x: 40; y: 300
- text: "<b>Size:</b> " + Container.photoWidth + 'x' + Container.photoHeight }
- Text { id: Type; color: "white"; width: 300; x: 40; anchors.top: Size.bottom
- text: "<b>Type:</b> " + Container.photoType }
-
- Text { id: Author; color: "white"; width: 300; x: 220; y: 80
- text: "<b>Author:</b> " + Container.photoAuthor }
- Text { id: Date; color: "white"; width: 300; x: 220; anchors.top: Author.bottom
- text: "<b>Published:</b> " + Container.photoDate }
- Text { id: TagsLabel; color: "white"; x: 220; anchors.top: Date.bottom;
- text: Container.photoTags == "" ? "" : "<b>Tags:</b> " }
- Text { id: Tags; color: "white"; width: parent.width-x-20;
- anchors.left: TagsLabel.right; anchors.top: Date.bottom;
- elide: "ElideRight"; text: Container.photoTags }
-
- ScrollBar { id: ScrollBar; x: 720; y: FlickSurface.y; width: 7; height: FlickSurface.height; opacity: 0;
- flickableArea: FlickSurface; clip: true }
+ Text { id: size; color: "white"; width: 300; x: 40; y: 300
+ text: "<b>Size:</b> " + container.photoWidth + 'x' + container.photoHeight }
+ Text { id: type; color: "white"; width: 300; x: 40; anchors.top: size.bottom
+ text: "<b>Type:</b> " + container.photoType }
+
+ Text { id: author; color: "white"; width: 300; x: 220; y: 80
+ text: "<b>Author:</b> " + container.photoAuthor }
+ Text { id: date; color: "white"; width: 300; x: 220; anchors.top: author.bottom
+ text: "<b>Published:</b> " + container.photoDate }
+ Text { id: tagsLabel; color: "white"; x: 220; anchors.top: date.bottom;
+ text: container.photoTags == "" ? "" : "<b>Tags:</b> " }
+ Text { id: tags; color: "white"; width: parent.width-x-20;
+ anchors.left: tagsLabel.right; anchors.top: date.bottom;
+ elide: "ElideRight"; text: container.photoTags }
+
+ ScrollBar { id: scrollBar; x: 720; y: flickable.y; width: 7; height: flickable.height; opacity: 0;
+ flickableArea: flickable; clip: true }
}
back: Item {
- anchors.fill: Container
+ anchors.fill: container
Rectangle { anchors.fill: parent; color: "black"; opacity: 0.4; border.color: "white"; border.width: 2 }
- Progress { anchors.centerIn: parent; width: 200; height: 18; progress: BigImage.progress; visible: BigImage.status!=1 }
+ Progress { anchors.centerIn: parent; width: 200; height: 18; progress: bigImage.progress; visible: bigImage.status!=1 }
Flickable {
- id: Flick; width: Container.width - 10; height: Container.height - 10
+ id: flick; width: container.width - 10; height: container.height - 10
x: 5; y: 5; clip: true;
- viewportWidth: ImageContainer.width; viewportHeight: ImageContainer.height
+ viewportWidth: imageContainer.width; viewportHeight: imageContainer.height
Item {
- id: ImageContainer
- width: Math.max(BigImage.width * BigImage.scale, Flick.width);
- height: Math.max(BigImage.height * BigImage.scale, Flick.height);
+ id: imageContainer
+ width: Math.max(bigImage.width * bigImage.scale, flick.width);
+ height: Math.max(bigImage.height * bigImage.scale, flick.height);
Image {
- id: BigImage; source: Container.photoUrl; scale: Slider.value
+ id: bigImage; source: container.photoUrl; scale: slider.value
// Center image if it is smaller than the flickable area.
- x: ImageContainer.width > width*scale ? (ImageContainer.width - width*scale) / 2 : 0
- y: ImageContainer.height > height*scale ? (ImageContainer.height - height*scale) / 2 : 0
- smooth: !Flick.moving
+ x: imageContainer.width > width*scale ? (imageContainer.width - width*scale) / 2 : 0
+ y: imageContainer.height > height*scale ? (imageContainer.height - height*scale) / 2 : 0
+ smooth: !flick.moving
onStatusChanged : {
// Default scale shows the entire image.
if (status == 1 && width != 0) {
- Slider.minimum = Math.min(Flick.width / width, Flick.height / height);
- prevScale = Math.min(Slider.minimum, 1);
- Slider.value = prevScale;
+ slider.minimum = Math.min(flick.width / width, flick.height / height);
+ prevScale = Math.min(slider.minimum, 1);
+ slider.value = prevScale;
}
}
}
@@ -109,24 +109,24 @@ Flipable {
}
MediaButton {
- id: BackButton2; x: 630; y: 370; text: "Back"; onClicked: { Container.state = '' }
+ id: backButton2; x: 630; y: 370; text: "Back"; onClicked: { container.state = '' }
}
Text {
text: "Image Unavailable"
- visible: BigImage.status == 'Error'
+ visible: bigImage.status == 'Error'
anchors.centerIn: parent; color: "white"; font.bold: true
}
Slider {
- id: Slider; x: 25; y: 374; visible: { BigImage.status == 1 && maximum > minimum }
+ id: slider; x: 25; y: 374; visible: { bigImage.status == 1 && maximum > minimum }
onValueChanged: {
- if (BigImage.width * value > Flick.width) {
- var xoff = (Flick.width/2 + Flick.viewportX) * value / prevScale;
- Flick.viewportX = xoff - Flick.width/2;
+ if (bigImage.width * value > flick.width) {
+ var xoff = (flick.width/2 + flick.viewportX) * value / prevScale;
+ flick.viewportX = xoff - flick.width/2;
}
- if (BigImage.height * value > Flick.height) {
- var yoff = (Flick.height/2 + Flick.viewportY) * value / prevScale;
- Flick.viewportY = yoff - Flick.height/2;
+ if (bigImage.height * value > flick.height) {
+ var yoff = (flick.height/2 + flick.viewportY) * value / prevScale;
+ flick.viewportY = yoff - flick.height/2;
}
prevScale = value;
}
@@ -136,7 +136,7 @@ Flipable {
states: [
State {
name: "Back"
- PropertyChanges { target: DetailsRotation; angle: 180 }
+ PropertyChanges { target: detailsRotation; angle: 180 }
}
]
@@ -144,15 +144,15 @@ Flipable {
Transition {
SequentialAnimation {
PropertyAction {
- target: BigImage
+ target: bigImage
property: "smooth"
value: false
}
NumberAnimation { easing: "easeInOutQuad"; properties: "angle"; duration: 500 }
PropertyAction {
- target: BigImage
+ target: bigImage
property: "smooth"
- value: !Flick.moving
+ value: !flick.moving
}
}
}
diff --git a/demos/declarative/flickr/common/LikeOMeter.qml b/demos/declarative/flickr/common/LikeOMeter.qml
index 754dbb1..5ee048b 100644
--- a/demos/declarative/flickr/common/LikeOMeter.qml
+++ b/demos/declarative/flickr/common/LikeOMeter.qml
@@ -1,35 +1,35 @@
import Qt 4.6
Item {
- id: Container
+ id: container
property int rating: 2
Row {
Star {
rating: 0
- onClicked: { Container.rating = rating }
- on: Container.rating >= 0
+ onClicked: { container.rating = rating }
+ on: container.rating >= 0
}
Star {
rating: 1
- onClicked: { Container.rating = rating }
- on: Container.rating >= 1
+ onClicked: { container.rating = rating }
+ on: container.rating >= 1
}
Star {
rating: 2
- onClicked: { Container.rating = rating }
- on: Container.rating >= 2
+ onClicked: { container.rating = rating }
+ on: container.rating >= 2
}
Star {
rating: 3
- onClicked: { Container.rating = rating }
- on: Container.rating >= 3
+ onClicked: { container.rating = rating }
+ on: container.rating >= 3
}
Star {
rating: 4
- onClicked: { Container.rating = rating }
- on: Container.rating >= 4
+ onClicked: { container.rating = rating }
+ on: container.rating >= 4
}
}
}
diff --git a/demos/declarative/flickr/common/Loading.qml b/demos/declarative/flickr/common/Loading.qml
index ff2c829..64a04c4 100644
--- a/demos/declarative/flickr/common/Loading.qml
+++ b/demos/declarative/flickr/common/Loading.qml
@@ -1,8 +1,8 @@
import Qt 4.6
Image {
- id: Loading; source: "pics/loading.png"; transformOrigin: "Center"
+ id: loading; source: "pics/loading.png"; transformOrigin: "Center"
rotation: NumberAnimation {
- id: "RotationAnimation"; from: 0; to: 360; running: Loading.visible == true; repeat: true; duration: 900
+ id: "RotationAnimation"; from: 0; to: 360; running: loading.visible == true; repeat: true; duration: 900
}
}
diff --git a/demos/declarative/flickr/common/MediaButton.qml b/demos/declarative/flickr/common/MediaButton.qml
index e1e09e8..c12b642 100644
--- a/demos/declarative/flickr/common/MediaButton.qml
+++ b/demos/declarative/flickr/common/MediaButton.qml
@@ -1,39 +1,39 @@
import Qt 4.6
Item {
- id: Container
+ id: container
signal clicked
property string text
Image {
- id: ButtonImage
+ id: buttonImage
source: "pics/button.png"
}
Image {
- id: Pressed
+ id: pressed
source: "pics/button-pressed.png"
opacity: 0
}
MouseRegion {
- id: MyMouseRegion
- anchors.fill: ButtonImage
- onClicked: { Container.clicked(); }
+ id: mouseRegion
+ anchors.fill: buttonImage
+ onClicked: { container.clicked(); }
}
Text {
font.bold: true
color: "white"
- anchors.centerIn: ButtonImage
- text: Container.text
+ anchors.centerIn: buttonImage
+ text: container.text
}
- width: ButtonImage.width
+ width: buttonImage.width
states: [
State {
name: "Pressed"
- when: MyMouseRegion.pressed == true
+ when: mouseRegion.pressed == true
PropertyChanges {
- target: Pressed
+ target: pressed
opacity: 1
}
}
diff --git a/demos/declarative/flickr/common/MediaLineEdit.qml b/demos/declarative/flickr/common/MediaLineEdit.qml
index 7599ce6a05..4b21f66 100644
--- a/demos/declarative/flickr/common/MediaLineEdit.qml
+++ b/demos/declarative/flickr/common/MediaLineEdit.qml
@@ -1,42 +1,42 @@
import Qt 4.6
Item {
- id: Container
+ id: container
property string label
property string text
- width: Math.max(94,Label.width + Editor.width + 20)
- height: ButtonImage.height
+ width: Math.max(94,label.width + editor.width + 20)
+ height: buttonImage.height
states: [
State {
name: "Edit"
PropertyChanges {
- target: Label
- text: Container.label + ": "
+ target: label
+ text: container.label + ": "
}
PropertyChanges {
- target: Label
+ target: label
x: 10
}
PropertyChanges {
- target: Editor
+ target: editor
cursorVisible: true
width: 100
}
PropertyChanges {
- target: Container
+ target: container
focus: true
}
StateChangeScript {
- script:"Editor.selectAll()"
+ script:"editor.selectAll()"
}
},
State {
// When returning to default state, typed text is propagated
StateChangeScript {
- script: "Container.text = Editor.text"
+ script: "container.text = editor.text"
}
}
]
@@ -48,29 +48,29 @@ Item {
BorderImage {
- id: ButtonImage
+ id: buttonImage
source: "pics/button.sci"
- anchors.left: Container.left
- anchors.right: Container.right
+ anchors.left: container.left
+ anchors.right: container.right
}
BorderImage {
- id: Pressed
+ id: pressed
source: "pics/button-pressed.sci"
opacity: 0
- anchors.left: Container.left
- anchors.right: Container.right
+ anchors.left: container.left
+ anchors.right: container.right
}
MouseRegion {
- id: MyMouseRegion
- anchors.fill: ButtonImage
- onClicked: { Container.state = Container.state=="Edit" ? "" : "Edit" }
+ id: mouseRegion
+ anchors.fill: buttonImage
+ onClicked: { container.state = container.state=="Edit" ? "" : "Edit" }
states: [
State {
- when: MyMouseRegion.pressed == true
+ when: mouseRegion.pressed == true
PropertyChanges {
- target: Pressed
+ target: pressed
opacity: 1
}
}
@@ -78,27 +78,27 @@ Item {
}
Text {
- id: Label
+ id: label
font.bold: true
color: "white"
- anchors.verticalCenter: Container.verticalCenter
- x: (Container.width - width)/2
- text: Container.label + "..."
+ anchors.verticalCenter: container.verticalCenter
+ x: (container.width - width)/2
+ text: container.label + "..."
}
TextInput {
- id: Editor
+ id: editor
font.bold: true
color: "white"
selectionColor: "green"
width: 0
clip: true
- anchors.left: Label.right
- anchors.verticalCenter: Container.verticalCenter
+ anchors.left: label.right
+ anchors.verticalCenter: container.verticalCenter
}
- Keys.forwardTo: [(ReturnKey), (Editor)]
+ Keys.forwardTo: [(returnKey), (editor)]
Item {
- id: ReturnKey
- Keys.onReturnPressed: "Container.state = ''"
+ id: returnKey
+ Keys.onReturnPressed: "container.state = ''"
}
}
diff --git a/demos/declarative/flickr/common/Progress.qml b/demos/declarative/flickr/common/Progress.qml
index 00ef901..fd9be10 100644
--- a/demos/declarative/flickr/common/Progress.qml
+++ b/demos/declarative/flickr/common/Progress.qml
@@ -1,12 +1,10 @@
import Qt 4.6
Item {
- id: Progress;
-
property var progress: 0
Rectangle {
- id: Container; anchors.fill: parent; smooth: true
+ anchors.fill: parent; smooth: true
border.color: "white"; border.width: 0; radius: height/2 - 2
gradient: Gradient {
GradientStop { position: 0; color: "#66343434" }
@@ -15,7 +13,6 @@ Item {
}
Rectangle {
- id: Fill
y: 2; height: parent.height-4;
x: 2; width: Math.max(parent.width * progress - 4, 0);
opacity: width < 1 ? 0 : 1; smooth: true
diff --git a/demos/declarative/flickr/common/ScrollBar.qml b/demos/declarative/flickr/common/ScrollBar.qml
index d31c57c..feebcb0 100644
--- a/demos/declarative/flickr/common/ScrollBar.qml
+++ b/demos/declarative/flickr/common/ScrollBar.qml
@@ -1,7 +1,7 @@
import Qt 4.6
Item {
- id: Container
+ id: container
property var flickableArea
@@ -12,16 +12,16 @@ Item {
border.color: "white"
border.width: 2
x: 0
- y: flickableArea.visibleArea.yPosition * Container.height
+ y: flickableArea.visibleArea.yPosition * container.height
width: parent.width
- height: flickableArea.visibleArea.heightRatio * Container.height
+ height: flickableArea.visibleArea.heightRatio * container.height
}
states: [
State {
name: "show"
when: flickableArea.moving
PropertyChanges {
- target: Container
+ target: container
opacity: 1
}
}
@@ -31,7 +31,7 @@ Item {
from: "*"
to: "*"
NumberAnimation {
- target: Container
+ target: container
properties: "opacity"
duration: 400
}
diff --git a/demos/declarative/flickr/common/Slider.qml b/demos/declarative/flickr/common/Slider.qml
index b88636d..fa1645c 100644
--- a/demos/declarative/flickr/common/Slider.qml
+++ b/demos/declarative/flickr/common/Slider.qml
@@ -1,17 +1,17 @@
import Qt 4.6
Item {
- id: Slider; width: 400; height: 16
+ id: slider; width: 400; height: 16
// value is read/write.
property real value
- onValueChanged: { Handle.x = 2 + (value - minimum) * Slider.xMax / (maximum - minimum); }
+ onValueChanged: { handle.x = 2 + (value - minimum) * slider.xMax / (maximum - minimum); }
property real maximum: 1
property real minimum: 1
- property int xMax: Slider.width - Handle.width - 4
+ property int xMax: slider.width - handle.width - 4
Rectangle {
- id: Container; anchors.fill: parent
+ anchors.fill: parent
border.color: "white"; border.width: 0; radius: 8
gradient: Gradient {
GradientStop { position: 0.0; color: "#66343434" }
@@ -20,8 +20,8 @@ Item {
}
Rectangle {
- id: Handle; smooth: true
- x: Slider.width / 2 - Handle.width / 2; y: 2; width: 30; height: Slider.height-4; radius: 6
+ id: handle; smooth: true
+ x: slider.width / 2 - handle.width / 2; y: 2; width: 30; height: slider.height-4; radius: 6
gradient: Gradient {
GradientStop { position: 0.0; color: "lightgray" }
GradientStop { position: 1.0; color: "gray" }
@@ -29,8 +29,8 @@ Item {
MouseRegion {
anchors.fill: parent; drag.target: parent
- drag.axis: "XAxis"; drag.minimumX: 2; drag.maximumX: Slider.xMax+2
- onPositionChanged: { value = (maximum - minimum) * (Handle.x-2) / Slider.xMax + minimum; }
+ drag.axis: "XAxis"; drag.minimumX: 2; drag.maximumX: slider.xMax+2
+ onPositionChanged: { value = (maximum - minimum) * (handle.x-2) / slider.xMax + minimum; }
}
}
}
diff --git a/demos/declarative/flickr/common/Star.qml b/demos/declarative/flickr/common/Star.qml
index c4d1bec..173021b 100644
--- a/demos/declarative/flickr/common/Star.qml
+++ b/demos/declarative/flickr/common/Star.qml
@@ -1,17 +1,16 @@
import Qt 4.6
Item {
- id: Container
+ id: container
width: 24
height: 24
property int rating
property bool on
-
signal clicked
Image {
- id: StarImage
+ id: starImage
source: "pics/ghns_star.png"
x: 6
y: 7
@@ -19,15 +18,15 @@ Item {
scale: 0.5
}
MouseRegion {
- anchors.fill: Container
- onClicked: { Container.clicked() }
+ anchors.fill: container
+ onClicked: { container.clicked() }
}
states: [
State {
name: "on"
- when: Container.on == true
+ when: container.on == true
PropertyChanges {
- target: StarImage
+ target: starImage
opacity: 1
scale: 1
x: 1
diff --git a/demos/declarative/flickr/flickr-desktop.qml b/demos/declarative/flickr/flickr-desktop.qml
index f8cf048..d1ad6e1 100644
--- a/demos/declarative/flickr/flickr-desktop.qml
+++ b/demos/declarative/flickr/flickr-desktop.qml
@@ -3,79 +3,79 @@ import Qt 4.6
import "common"
Item {
- id: MainWindow; width: 800; height: 450
+ id: mainWindow; width: 800; height: 450
property bool showPathView : false
resources: [
Component {
- id: PhotoDelegate
+ id: photoDelegate
Item {
- id: Wrapper; width: 85; height: 85
- scale: Wrapper.PathView.scale; z: Wrapper.PathView.z
+ id: wrapper; width: 85; height: 85
+ scale: wrapper.PathView.scale; z: wrapper.PathView.z
transform: Rotation {
- id: ItemRotation; origin.x: Wrapper.width/2; origin.y: Wrapper.height/2
- axis.y: 1; axis.z: 0; angle: Wrapper.PathView.angle
+ id: itemRotation; origin.x: wrapper.width/2; origin.y: wrapper.height/2
+ axis.y: 1; axis.z: 0; angle: wrapper.PathView.angle
}
Connection {
- sender: ImageDetails; signal: "closed()"
+ sender: imageDetails; signal: "closed()"
script: {
- if (Wrapper.state == 'Details') {
- Wrapper.state = '';
- ImageDetails.photoUrl = "";
+ if (wrapper.state == 'Details') {
+ wrapper.state = '';
+ imageDetails.photoUrl = "";
}
}
}
Script {
function photoClicked() {
- ImageDetails.photoTitle = title;
- ImageDetails.photoDescription = description;
- ImageDetails.photoTags = tags;
- ImageDetails.photoWidth = photoWidth;
- ImageDetails.photoHeight = photoHeight;
- ImageDetails.photoType = photoType;
- ImageDetails.photoAuthor = photoAuthor;
- ImageDetails.photoDate = photoDate;
- ImageDetails.photoUrl = url;
- ImageDetails.rating = 0;
- Wrapper.state = "Details";
+ imageDetails.photoTitle = title;
+ imageDetails.photoDescription = description;
+ imageDetails.photoTags = tags;
+ imageDetails.photoWidth = photoWidth;
+ imageDetails.photoHeight = photoHeight;
+ imageDetails.photoType = photoType;
+ imageDetails.photoAuthor = photoAuthor;
+ imageDetails.photoDate = photoDate;
+ imageDetails.photoUrl = url;
+ imageDetails.rating = 0;
+ wrapper.state = "Details";
}
}
Rectangle {
- id: WhiteRect; anchors.fill: parent; color: "white"; radius: 5
+ id: whiteRect; anchors.fill: parent; color: "white"; radius: 5
- Loading { x: 26; y: 26; visible: Thumb.status!=1 }
- Image { id: Thumb; source: imagePath; x: 5; y: 5 }
+ Loading { x: 26; y: 26; visible: thumb.status!=1 }
+ Image { id: thumb; source: imagePath; x: 5; y: 5 }
Item {
- id: Shadows
- Image { source: "common/pics/shadow-right.png"; x: WhiteRect.width; height: WhiteRect.height }
- Image { source: "common/pics/shadow-bottom.png"; y: WhiteRect.height; width: WhiteRect.width }
- Image { id: Corner; source: "common/pics/shadow-corner.png"; x: WhiteRect.width; y: WhiteRect.height }
+ id: shadows
+ Image { source: "common/pics/shadow-right.png"; x: whiteRect.width; height: whiteRect.height }
+ Image { source: "common/pics/shadow-bottom.png"; y: whiteRect.height; width: whiteRect.width }
+ Image { id: Corner; source: "common/pics/shadow-corner.png"; x: whiteRect.width; y: whiteRect.height }
}
}
- MouseRegion { anchors.fill: Wrapper; onClicked: { photoClicked() } }
+ MouseRegion { anchors.fill: wrapper; onClicked: { photoClicked() } }
states: [
State {
name: "Details"
- PropertyChanges { target: ImageDetails; z: 2 }
- ParentChange { target: Wrapper; parent: ImageDetails.frontContainer }
- PropertyChanges { target: Wrapper; x: 45; y: 35; scale: 1; z: 1000 }
- PropertyChanges { target: ItemRotation; angle: 0 }
- PropertyChanges { target: Shadows; opacity: 0 }
- PropertyChanges { target: ImageDetails; y: 20 }
- PropertyChanges { target: PhotoGridView; y: -480 }
- PropertyChanges { target: PhotoPathView; y: -480 }
- PropertyChanges { target: ViewModeButton; opacity: 0 }
- PropertyChanges { target: TagsEdit; opacity: 0 }
- PropertyChanges { target: FetchButton; opacity: 0 }
- PropertyChanges { target: CategoryText; y: "-50" }
+ PropertyChanges { target: imageDetails; z: 2 }
+ ParentChange { target: wrapper; parent: imageDetails.frontContainer }
+ PropertyChanges { target: wrapper; x: 45; y: 35; scale: 1; z: 1000 }
+ PropertyChanges { target: itemRotation; angle: 0 }
+ PropertyChanges { target: shadows; opacity: 0 }
+ PropertyChanges { target: imageDetails; y: 20 }
+ PropertyChanges { target: photoGridView; y: -480 }
+ PropertyChanges { target: photoPathView; y: -480 }
+ PropertyChanges { target: viewModeButton; opacity: 0 }
+ PropertyChanges { target: tagsEdit; opacity: 0 }
+ PropertyChanges { target: fetchButton; opacity: 0 }
+ PropertyChanges { target: categoryText; y: "-50" }
}
]
@@ -92,7 +92,7 @@ Item {
SequentialAnimation {
ParentAction { }
NumberAnimation { properties: "x,y,scale,opacity,angle"; duration: 500; easing: "easeInOutQuad" }
- PropertyAction { target: Wrapper; properties: "z" }
+ PropertyAction { target: wrapper; properties: "z" }
}
}
]
@@ -102,21 +102,21 @@ Item {
]
Item {
- id: Background
+ id: background
anchors.fill: parent
Image { source: "common/pics/background.png"; anchors.fill: parent }
- RssModel { id: RssModel; tags : TagsEdit.text }
- Loading { anchors.centerIn: parent; visible: RssModel.status == 2 }
+ RssModel { id: rssModel; tags : tagsEdit.text }
+ Loading { anchors.centerIn: parent; visible: rssModel.status == 2 }
GridView {
- id: PhotoGridView; model: RssModel; delegate: PhotoDelegate; cacheBuffer: 100
+ id: photoGridView; model: rssModel; delegate: photoDelegate; cacheBuffer: 100
cellWidth: 105; cellHeight: 105; x:32; y: 80; width: 800; height: 330; z: 1
}
PathView {
- id: PhotoPathView; model: RssModel; delegate: PhotoDelegate
+ id: photoPathView; model: rssModel; delegate: photoDelegate
y: -380; width: 800; height: 330; pathItemCount: 10; z: 1
path: Path {
startX: -50; startY: 40;
@@ -146,36 +146,34 @@ Item {
}
- ImageDetails { id: ImageDetails; width: 750; x: 25; y: 500; height: 410 }
+ ImageDetails { id: imageDetails; width: 750; x: 25; y: 500; height: 410 }
MediaButton {
- id: ViewModeButton; x: 680; y: 410; text: "View Mode"
- onClicked: { if (MainWindow.showPathView == true) MainWindow.showPathView = false; else MainWindow.showPathView = true }
+ id: viewModeButton; x: 680; y: 410; text: "View Mode"
+ onClicked: { if (mainWindow.showPathView == true) mainWindow.showPathView = false; else mainWindow.showPathView = true }
}
MediaButton {
- id: FetchButton
+ id: fetchButton
text: "Update"
- anchors.right: ViewModeButton.left; anchors.rightMargin: 5
- anchors.top: ViewModeButton.top
- onClicked: { RssModel.reload(); }
+ anchors.right: viewModeButton.left; anchors.rightMargin: 5
+ anchors.top: viewModeButton.top
+ onClicked: { rssModel.reload(); }
}
MediaLineEdit {
- id: TagsEdit;
+ id: tagsEdit;
label: "Tags"
- anchors.right: FetchButton.left; anchors.rightMargin: 5
- anchors.top: ViewModeButton.top
+ anchors.right: fetchButton.left; anchors.rightMargin: 5
+ anchors.top: viewModeButton.top
}
- states: [
- State {
- name: "PathView"
- when: MainWindow.showPathView == true
- PropertyChanges { target: PhotoPathView; y: 80 }
- PropertyChanges { target: PhotoGridView; y: -380 }
- }
- ]
+ states: State {
+ name: "PathView"
+ when: mainWindow.showPathView == true
+ PropertyChanges { target: photoPathView; y: 80 }
+ PropertyChanges { target: photoGridView; y: -380 }
+ }
transitions: [
Transition {
@@ -186,9 +184,9 @@ Item {
}
Text {
- id: CategoryText; anchors.horizontalCenter: parent.horizontalCenter; y: 15;
+ id: categoryText; anchors.horizontalCenter: parent.horizontalCenter; y: 15;
text: "Flickr - " +
- (RssModel.tags=="" ? "Uploads from everyone" : "Recent Uploads tagged " + RssModel.tags)
+ (rssModel.tags=="" ? "Uploads from everyone" : "Recent Uploads tagged " + rssModel.tags)
font.pointSize: 20; font.bold: true; color: "white"; style: "Raised"; styleColor: "black"
}
}
diff --git a/demos/declarative/flickr/flickr-mobile.qml b/demos/declarative/flickr/flickr-mobile.qml
index 32f3e37..48fe7df 100644
--- a/demos/declarative/flickr/flickr-mobile.qml
+++ b/demos/declarative/flickr/flickr-mobile.qml
@@ -3,38 +3,38 @@ import "common" as Common
import "mobile" as Mobile
Item {
- id: Screen; width: 320; height: 480
+ id: screen; width: 320; height: 480
property bool inListView : false
Rectangle {
- id: Background
+ id: background
anchors.fill: parent; color: "#343434";
Image { source: "mobile/images/stripes.png"; fillMode: "Tile"; anchors.fill: parent; opacity: 0.3 }
- Common.RssModel { id: RssModel }
- Common.Loading { anchors.centerIn: parent; visible: RssModel.status == 2 }
+ Common.RssModel { id: rssModel }
+ Common.Loading { anchors.centerIn: parent; visible: rssModel.status == 2 }
Item {
- id: Views
+ id: views
x: 2; width: parent.width - 4
- anchors.top: TitleBar.bottom; anchors.bottom: ToolBar.top
+ anchors.top: titleBar.bottom; anchors.bottom: toolBar.top
- Mobile.GridDelegate { id: GridDelegate }
+ Mobile.GridDelegate { id: gridDelegate }
GridView {
- id: PhotoGridView; model: RssModel; delegate: GridDelegate; cacheBuffer: 100
+ id: photoGridView; model: rssModel; delegate: gridDelegate; cacheBuffer: 100
cellWidth: 79; cellHeight: 79; width: parent.width; height: parent.height - 1; z: 6
}
- Mobile.ListDelegate { id: ListDelegate }
+ Mobile.ListDelegate { id: listDelegate }
ListView {
- id: PhotoListView; model: RssModel; delegate: ListDelegate; z: 6
+ id: photoListView; model: rssModel; delegate: listDelegate; z: 6
width: parent.width; height: parent.height; x: -(parent.width * 1.5); cacheBuffer: 100;
}
states: State {
- name: "ListView"; when: Screen.inListView == true
- PropertyChanges { target: PhotoListView; x: 0 }
- PropertyChanges { target: PhotoGridView; x: -(parent.width * 1.5) }
+ name: "ListView"; when: screen.inListView == true
+ PropertyChanges { target: photoListView; x: 0 }
+ PropertyChanges { target: photoGridView; x: -(parent.width * 1.5) }
}
transitions: Transition {
@@ -42,37 +42,37 @@ Item {
}
}
- Mobile.ImageDetails { id: ImageDetails; width: parent.width; anchors.left: Views.right; height: parent.height; z:1 }
- Mobile.TitleBar { id: TitleBar; z: 5; width: parent.width; height: 40; opacity: 0.9 }
+ Mobile.ImageDetails { id: imageDetails; width: parent.width; anchors.left: views.right; height: parent.height; z:1 }
+ Mobile.TitleBar { id: titleBar; z: 5; width: parent.width; height: 40; opacity: 0.9 }
Mobile.ToolBar {
- id: ToolBar; z: 5
+ id: toolBar; z: 5
height: 40; anchors.bottom: parent.bottom; width: parent.width; opacity: 0.9
button1Label: "Update"; button2Label: "View mode"
- onButton1Clicked: RssModel.reload()
- onButton2Clicked: if (Screen.inListView == true) Screen.inListView = false; else Screen.inListView = true
+ onButton1Clicked: rssModel.reload()
+ onButton2Clicked: if (screen.inListView == true) screen.inListView = false; else screen.inListView = true
}
Connection {
- sender: ImageDetails; signal: "closed()"
+ sender: imageDetails; signal: "closed()"
script: {
- if (Background.state == "DetailedView") {
- Background.state = '';
- ImageDetails.photoUrl = "";
+ if (background.state == "DetailedView") {
+ background.state = '';
+ imageDetails.photoUrl = "";
}
}
}
states: State {
name: "DetailedView"
- PropertyChanges { target: Views; x: -parent.width }
- PropertyChanges { target: ToolBar; button1Label: "More..." }
+ PropertyChanges { target: views; x: -parent.width }
+ PropertyChanges { target: toolBar; button1Label: "More..." }
PropertyChanges {
- target: ToolBar
- onButton1Clicked: if (ImageDetails.state=='') ImageDetails.state='Back'; else ImageDetails.state=''
+ target: toolBar
+ onButton1Clicked: if (imageDetails.state=='') imageDetails.state='Back'; else imageDetails.state=''
}
- PropertyChanges { target: ToolBar; button2Label: "Back" }
- PropertyChanges { target: ToolBar; onButton2Clicked: ImageDetails.closed() }
+ PropertyChanges { target: toolBar; button2Label: "Back" }
+ PropertyChanges { target: toolBar; onButton2Clicked: imageDetails.closed() }
}
transitions: Transition {
diff --git a/demos/declarative/flickr/mobile/Button.qml b/demos/declarative/flickr/mobile/Button.qml
index 6887240..a4a96d4 100644
--- a/demos/declarative/flickr/mobile/Button.qml
+++ b/demos/declarative/flickr/mobile/Button.qml
@@ -1,41 +1,38 @@
import Qt 4.6
Item {
- id: Container
+ id: container
signal clicked
property string text
BorderImage {
- id: ButtonImage
+ id: buttonImage
source: "images/toolbutton.sci"
- width: Container.width; height: Container.height
+ width: container.width; height: container.height
}
BorderImage {
- id: Pressed
+ id: pressed
opacity: 0
source: "images/toolbutton.sci"
- width: Container.width; height: Container.height
+ width: container.width; height: container.height
}
MouseRegion {
- id: MyMouseRegion
- anchors.fill: ButtonImage
- onClicked: { Container.clicked(); }
+ id: mouseRegion
+ anchors.fill: buttonImage
+ onClicked: { container.clicked(); }
}
Text {
color: "white"
- anchors.centerIn: ButtonImage; font.bold: true
- text: Container.text; style: "Raised"; styleColor: "black"
+ anchors.centerIn: buttonImage; font.bold: true
+ text: container.text; style: "Raised"; styleColor: "black"
}
states: [
State {
name: "Pressed"
- when: MyMouseRegion.pressed == true
- PropertyChanges {
- target: Pressed
- opacity: 1
- }
+ when: mouseRegion.pressed == true
+ PropertyChanges { target: pressed; opacity: 1 }
}
]
}
diff --git a/demos/declarative/flickr/mobile/GridDelegate.qml b/demos/declarative/flickr/mobile/GridDelegate.qml
index 19369b2..9b9fb24 100644
--- a/demos/declarative/flickr/mobile/GridDelegate.qml
+++ b/demos/declarative/flickr/mobile/GridDelegate.qml
@@ -1,22 +1,22 @@
import Qt 4.6
Component {
- id: PhotoDelegate
+ id: photoDelegate
Item {
- id: Wrapper; width: 79; height: 79
+ id: wrapper; width: 79; height: 79
Script {
function photoClicked() {
- ImageDetails.photoTitle = title;
- ImageDetails.photoTags = tags;
- ImageDetails.photoWidth = photoWidth;
- ImageDetails.photoHeight = photoHeight;
- ImageDetails.photoType = photoType;
- ImageDetails.photoAuthor = photoAuthor;
- ImageDetails.photoDate = photoDate;
- ImageDetails.photoUrl = url;
- ImageDetails.rating = 0;
- ScaleMe.state = "Details";
+ imageDetails.photoTitle = title;
+ imageDetails.photoTags = tags;
+ imageDetails.photoWidth = photoWidth;
+ imageDetails.photoHeight = photoHeight;
+ imageDetails.photoType = photoType;
+ imageDetails.photoAuthor = photoAuthor;
+ imageDetails.photoDate = photoDate;
+ imageDetails.photoUrl = url;
+ imageDetails.rating = 0;
+ scaleMe.state = "Details";
}
}
@@ -24,31 +24,31 @@
anchors.centerIn: parent
scale: 0.0
scale: Behavior { NumberAnimation { easing: "easeInOutQuad"} }
- id: ScaleMe
+ id: scaleMe
- Rectangle { height: 79; width: 79; id: BlackRect; anchors.centerIn: parent; color: "black"; smooth: true }
+ Rectangle { height: 79; width: 79; id: blackRect; anchors.centerIn: parent; color: "black"; smooth: true }
Rectangle {
- id: WhiteRect; width: 77; height: 77; anchors.centerIn: parent; color: "#dddddd"; smooth: true
- Image { id: Thumb; source: imagePath; x: 1; y: 1; smooth: true}
+ id: whiteRect; width: 77; height: 77; anchors.centerIn: parent; color: "#dddddd"; smooth: true
+ Image { id: thumb; source: imagePath; x: 1; y: 1; smooth: true}
Image { source: "images/gloss.png" }
}
Connection {
- sender: ToolBar; signal: "button2Clicked()"
- script: if (ScaleMe.state == 'Details' ) ScaleMe.state = 'Show';
+ sender: toolBar; signal: "button2Clicked()"
+ script: if (scaleMe.state == 'Details' ) scaleMe.state = 'Show';
}
states: [
State {
- name: "Show"; when: Thumb.status == 1
- PropertyChanges { target: ScaleMe; scale: 1 }
+ name: "Show"; when: thumb.status == 1
+ PropertyChanges { target: scaleMe; scale: 1 }
},
State {
name: "Details"
- PropertyChanges { target: ScaleMe; scale: 1 }
- ParentChange { target: Wrapper; parent: ImageDetails.frontContainer }
- PropertyChanges { target: Wrapper; x: 20; y: 60; z: 1000 }
- PropertyChanges { target: Background; state: "DetailedView" }
+ PropertyChanges { target: scaleMe; scale: 1 }
+ ParentChange { target: wrapper; parent: imageDetails.frontContainer }
+ PropertyChanges { target: wrapper; x: 20; y: 60; z: 1000 }
+ PropertyChanges { target: background; state: "DetailedView" }
}
]
transitions: [
@@ -62,11 +62,11 @@
SequentialAnimation {
ParentAction { }
NumberAnimation { properties: "x,y"; duration: 500; easing: "easeInOutQuad" }
- PropertyAction { target: Wrapper; properties: "z" }
+ PropertyAction { target: wrapper; properties: "z" }
}
}
]
}
- MouseRegion { anchors.fill: Wrapper; onClicked: { photoClicked() } }
+ MouseRegion { anchors.fill: wrapper; onClicked: { photoClicked() } }
}
}
diff --git a/demos/declarative/flickr/mobile/ImageDetails.qml b/demos/declarative/flickr/mobile/ImageDetails.qml
index c55ab50..26052b9 100644
--- a/demos/declarative/flickr/mobile/ImageDetails.qml
+++ b/demos/declarative/flickr/mobile/ImageDetails.qml
@@ -2,9 +2,9 @@ import Qt 4.6
import "../common" as Common
Flipable {
- id: Container
+ id: container
- property var frontContainer: ContainerFront
+ property var frontContainer: containerFront
property string photoTitle: ""
property string photoTags: ""
property int photoWidth
@@ -19,13 +19,13 @@ Flipable {
signal closed
transform: Rotation {
- id: ItemRotation
- origin.x: Container.width / 2;
+ id: itemRotation
+ origin.x: container.width / 2;
axis.y: 1; axis.z: 0
}
front: Item {
- id: ContainerFront; anchors.fill: Container
+ id: containerFront; anchors.fill: container
Rectangle {
anchors.fill: parent
@@ -39,43 +39,43 @@ Flipable {
right: parent.right; rightMargin: 20
top: parent.top; topMargin: 180
}
- Text { id: TitleText; font.bold: true; color: "white"; elide: "ElideRight"; text: Container.photoTitle }
- Text { id: Size; color: "white"; elide: "ElideRight"; text: "<b>Size:</b> " + Container.photoWidth + 'x' + Container.photoHeight }
- Text { id: Type; color: "white"; elide: "ElideRight"; text: "<b>Type:</b> " + Container.photoType }
- Text { id: Author; color: "white"; elide: "ElideRight"; text: "<b>Author:</b> " + Container.photoAuthor }
- Text { id: Date; color: "white"; elide: "ElideRight"; text: "<b>Published:</b> " + Container.photoDate }
- Text { id: TagsLabel; color: "white"; elide: "ElideRight"; text: Container.photoTags == "" ? "" : "<b>Tags:</b> " }
- Text { id: Tags; color: "white"; elide: "ElideRight"; elide: "ElideRight"; text: Container.photoTags }
+ Text { font.bold: true; color: "white"; elide: "ElideRight"; text: container.photoTitle }
+ Text { color: "white"; elide: "ElideRight"; text: "<b>Size:</b> " + container.photoWidth + 'x' + container.photoHeight }
+ Text { color: "white"; elide: "ElideRight"; text: "<b>Type:</b> " + container.photoType }
+ Text { color: "white"; elide: "ElideRight"; text: "<b>Author:</b> " + container.photoAuthor }
+ Text { color: "white"; elide: "ElideRight"; text: "<b>Published:</b> " + container.photoDate }
+ Text { color: "white"; elide: "ElideRight"; text: container.photoTags == "" ? "" : "<b>Tags:</b> " }
+ Text { color: "white"; elide: "ElideRight"; elide: "ElideRight"; text: container.photoTags }
}
}
back: Item {
- anchors.fill: Container
+ anchors.fill: container
Rectangle { anchors.fill: parent; color: "black"; opacity: 0.4 }
- Common.Progress { anchors.centerIn: parent; width: 200; height: 18; progress: BigImage.progress; visible: BigImage.status!=1 }
+ Common.Progress { anchors.centerIn: parent; width: 200; height: 18; progress: bigImage.progress; visible: bigImage.status!=1 }
Flickable {
- id: Flick; anchors.fill: parent; clip: true
- viewportWidth: ImageContainer.width; viewportHeight: ImageContainer.height
+ id: flickable; anchors.fill: parent; clip: true
+ viewportWidth: imageContainer.width; viewportHeight: imageContainer.height
Item {
- id: ImageContainer
- width: Math.max(BigImage.width * BigImage.scale, Flick.width);
- height: Math.max(BigImage.height * BigImage.scale, Flick.height);
+ id: imageContainer
+ width: Math.max(bigImage.width * bigImage.scale, flickable.width);
+ height: Math.max(bigImage.height * bigImage.scale, flickable.height);
Image {
- id: BigImage; source: Container.photoUrl; scale: Slider.value
+ id: bigImage; source: container.photoUrl; scale: slider.value
// Center image if it is smaller than the flickable area.
- x: ImageContainer.width > width*scale ? (ImageContainer.width - width*scale) / 2 : 0
- y: ImageContainer.height > height*scale ? (ImageContainer.height - height*scale) / 2 : 0
- smooth: !Flick.moving
+ x: imageContainer.width > width*scale ? (imageContainer.width - width*scale) / 2 : 0
+ y: imageContainer.height > height*scale ? (imageContainer.height - height*scale) / 2 : 0
+ smooth: !flickable.moving
onStatusChanged : {
// Default scale shows the entire image.
if (status == 1 && width != 0) {
- Slider.minimum = Math.min(Flick.width / width, Flick.height / height);
- prevScale = Math.min(Slider.minimum, 1);
- Slider.value = prevScale;
+ slider.minimum = Math.min(flickable.width / width, flickable.height / height);
+ prevScale = Math.min(slider.minimum, 1);
+ slider.value = prevScale;
}
}
}
@@ -84,25 +84,25 @@ Flipable {
Text {
text: "Image Unavailable"
- visible: BigImage.status == 'Error'
+ visible: bigImage.status == 'Error'
anchors.centerIn: parent; color: "white"; font.bold: true
}
Common.Slider {
- id: Slider; visible: { BigImage.status == 1 && maximum > minimum }
+ id: slider; visible: { bigImage.status == 1 && maximum > minimum }
anchors {
bottom: parent.bottom; bottomMargin: 65
left: parent.left; leftMargin: 25
right: parent.right; rightMargin: 25
}
onValueChanged: {
- if (BigImage.width * value > Flick.width) {
- var xoff = (Flick.width/2 + Flick.viewportX) * value / prevScale;
- Flick.viewportX = xoff - Flick.width/2;
+ if (bigImage.width * value > flickable.width) {
+ var xoff = (flickable.width/2 + flickable.viewportX) * value / prevScale;
+ flickable.viewportX = xoff - flickable.width/2;
}
- if (BigImage.height * value > Flick.height) {
- var yoff = (Flick.height/2 + Flick.viewportY) * value / prevScale;
- Flick.viewportY = yoff - Flick.height/2;
+ if (bigImage.height * value > flickable.height) {
+ var yoff = (flickable.height/2 + flickable.viewportY) * value / prevScale;
+ flickable.viewportY = yoff - flickable.height/2;
}
prevScale = value;
}
@@ -111,14 +111,14 @@ Flipable {
states: State {
name: "Back"
- PropertyChanges { target: ItemRotation; angle: 180 }
+ PropertyChanges { target: itemRotation; angle: 180 }
}
transitions: Transition {
SequentialAnimation {
- PropertyAction { target: BigImage; property: "smooth"; value: false }
+ PropertyAction { target: bigImage; property: "smooth"; value: false }
NumberAnimation { easing: "easeInOutQuad"; properties: "angle"; duration: 500 }
- PropertyAction { target: BigImage; property: "smooth"; value: !Flick.moving }
+ PropertyAction { target: bigImage; property: "smooth"; value: !flickable.moving }
}
}
}
diff --git a/demos/declarative/flickr/mobile/ListDelegate.qml b/demos/declarative/flickr/mobile/ListDelegate.qml
index fa6f8ea..090e91a 100644
--- a/demos/declarative/flickr/mobile/ListDelegate.qml
+++ b/demos/declarative/flickr/mobile/ListDelegate.qml
@@ -1,20 +1,19 @@
import Qt 4.6
Component {
- id: ListDelegate
Item {
- id: Wrapper; width: Wrapper.ListView.view.width; height: 86
+ id: wrapper; width: wrapper.ListView.view.width; height: 86
Item {
- id: MoveMe
- Rectangle { color: "black"; opacity: index % 2 ? 0.2 : 0.4; height: 84; width: Wrapper.width; y: 1 }
+ id: moveMe
+ Rectangle { color: "black"; opacity: index % 2 ? 0.2 : 0.4; height: 84; width: wrapper.width; y: 1 }
Rectangle {
- id: WhiteRect; x: 6; y: 4; width: 77; height: 77; color: "white"; smooth: true
+ x: 6; y: 4; width: 77; height: 77; color: "white"; smooth: true
- Image { id: Thumb; source: imagePath; x: 1; y: 1 }
+ Image { source: imagePath; x: 1; y: 1 }
Image { source: "images/gloss.png" }
}
Column {
- x: 92; width: Wrapper.ListView.view.width - 95; y: 15; spacing: 2
+ x: 92; width: wrapper.ListView.view.width - 95; y: 15; spacing: 2
Text { text: title; color: "white"; width: parent.width; font.bold: true; elide: "ElideRight"; style: "Raised"; styleColor: "black" }
Text { text: photoAuthor; color: "white"; width: parent.width; elide: "ElideLeft"; color: "#cccccc"; style: "Raised"; styleColor: "black" }
Text { text: photoDate; color: "white"; width: parent.width; elide: "ElideRight"; color: "#cccccc"; style: "Raised"; styleColor: "black" }
diff --git a/demos/declarative/flickr/mobile/TitleBar.qml b/demos/declarative/flickr/mobile/TitleBar.qml
index 13484a2..108faf7 100644
--- a/demos/declarative/flickr/mobile/TitleBar.qml
+++ b/demos/declarative/flickr/mobile/TitleBar.qml
@@ -1,50 +1,50 @@
import Qt 4.6
Item {
- id: TitleBar
+ id: titleBar
property string untaggedString: "Uploads from everyone"
property string taggedString: "Recent uploads tagged "
BorderImage { source: "images/titlebar.sci"; width: parent.width; height: parent.height + 14; y: -7 }
Item {
- id: Container
+ id: container
width: (parent.width * 2) - 55 ; height: parent.height
Script {
function accept() {
- TitleBar.state = ""
- Background.state = ""
- RssModel.tags = Editor.text
+ titleBar.state = ""
+ background.state = ""
+ rssModel.tags = editor.text
}
}
Text {
- id: CategoryText
+ id: categoryText
anchors {
- left: parent.left; right: TagButton.left; leftMargin: 10; rightMargin: 10
+ left: parent.left; right: tagButton.left; leftMargin: 10; rightMargin: 10
verticalCenter: parent.verticalCenter
}
elide: "ElideLeft"
- text: (RssModel.tags=="" ? untaggedString : taggedString + RssModel.tags)
+ text: (rssModel.tags=="" ? untaggedString : taggedString + rssModel.tags)
font.bold: true; color: "White"; style: "Raised"; styleColor: "Black"
}
Button {
- id: TagButton; x: TitleBar.width - 50; width: 45; height: 32; text: "..."
- onClicked: if (TitleBar.state == "Tags") accept(); else TitleBar.state = "Tags"
+ id: tagButton; x: titleBar.width - 50; width: 45; height: 32; text: "..."
+ onClicked: if (titleBar.state == "Tags") accept(); else titleBar.state = "Tags"
anchors.verticalCenter: parent.verticalCenter
}
Item {
- id: LineEdit
+ id: lineEdit
y: 4; height: parent.height - 9
- anchors { left: TagButton.right; leftMargin: 5; right: parent.right; rightMargin: 5 }
+ anchors { left: tagButton.right; leftMargin: 5; right: parent.right; rightMargin: 5 }
BorderImage { source: "images/lineedit.sci"; anchors.fill: parent }
TextInput {
- id: Editor
+ id: editor
anchors {
left: parent.left; right: parent.right; leftMargin: 10; rightMargin: 10
verticalCenter: parent.verticalCenter
@@ -53,21 +53,21 @@ Item {
color: "#151515"; selectionColor: "Green"
}
- Keys.forwardTo: [ (ReturnKey), (Editor)]
+ Keys.forwardTo: [ (returnKey), (editor)]
Item {
- id: ReturnKey
+ id: returnKey
Keys.onReturnPressed: accept()
- Keys.onEscapePressed: TitleBar.state = ""
+ Keys.onEscapePressed: titleBar.state = ""
}
}
}
states: State {
name: "Tags"
- PropertyChanges { target: Container; x: -TagButton.x + 5 }
- PropertyChanges { target: TagButton; text: "OK" }
- PropertyChanges { target: LineEdit; focus: true }
+ PropertyChanges { target: container; x: -tagButton.x + 5 }
+ PropertyChanges { target: tagButton; text: "OK" }
+ PropertyChanges { target: lineEdit; focus: true }
}
transitions: Transition {
diff --git a/demos/declarative/flickr/mobile/ToolBar.qml b/demos/declarative/flickr/mobile/ToolBar.qml
index cfdc8fe..f96c767 100644
--- a/demos/declarative/flickr/mobile/ToolBar.qml
+++ b/demos/declarative/flickr/mobile/ToolBar.qml
@@ -1,24 +1,24 @@
import Qt 4.6
Item {
- id: Toolbar
+ id: toolbar
- property alias button1Label: Button1.text
- property alias button2Label: Button2.text
+ property alias button1Label: button1.text
+ property alias button2Label: button2.text
signal button1Clicked
signal button2Clicked
BorderImage { source: "images/titlebar.sci"; width: parent.width; height: parent.height + 14; y: -7 }
Button {
- id: Button1
+ id: button1
anchors.left: parent.left; anchors.leftMargin: 5; y: 3; width: 140; height: 32
- onClicked: Toolbar.button1Clicked()
+ onClicked: toolbar.button1Clicked()
}
Button {
- id: Button2
+ id: button2
anchors.right: parent.right; anchors.rightMargin: 5; y: 3; width: 140; height: 32
- onClicked: Toolbar.button2Clicked()
+ onClicked: toolbar.button2Clicked()
}
}
diff --git a/demos/declarative/minehunt/Description.qml b/demos/declarative/minehunt/Description.qml
index df4881c..440dd2e 100644
--- a/demos/declarative/minehunt/Description.qml
+++ b/demos/declarative/minehunt/Description.qml
@@ -1,12 +1,12 @@
import Qt 4.6
Item {
- id: Page
- height: MyText.height + 20
+ id: page
+ height: myText.height + 20
property var text
MouseRegion {
anchors.fill: parent
- drag.target: Page
+ drag.target: page
drag.axis: "XandYAxis"
drag.minimumX: 0
drag.maximumX: 1000
@@ -24,8 +24,8 @@ Item {
width: parent.width - 20
height: parent.height - 20
Text {
- id: MyText
- text: Page.text
+ id: myText
+ text: page.text
width: parent.width
clip: true
wrap: true
diff --git a/demos/declarative/samegame/content/Button.qml b/demos/declarative/samegame/content/Button.qml
index 2354218..301124e 100644
--- a/demos/declarative/samegame/content/Button.qml
+++ b/demos/declarative/samegame/content/Button.qml
@@ -1,7 +1,7 @@
import Qt 4.6
Rectangle {
- id: Container
+ id: container
signal clicked
property string text: "Button"
@@ -17,9 +17,9 @@ Rectangle {
GradientStop { position: 1.0; color: activePalette.button }
}
- MouseRegion { id: mr; anchors.fill: parent; onClicked: Container.clicked() }
+ MouseRegion { id: mr; anchors.fill: parent; onClicked: container.clicked() }
Text {
- id: txtItem; text: Container.text; anchors.centerIn: Container; color: activePalette.buttonText
+ id: txtItem; text: container.text; anchors.centerIn: container; color: activePalette.buttonText
}
}
diff --git a/demos/declarative/samegame/content/Dialog.qml b/demos/declarative/samegame/content/Dialog.qml
index 401d211..661257b 100644
--- a/demos/declarative/samegame/content/Dialog.qml
+++ b/demos/declarative/samegame/content/Dialog.qml
@@ -7,15 +7,15 @@ Rectangle {
page.opacity = 0;
}
function show(txt) {
- MyText.text = txt;
+ myText.text = txt;
page.opacity = 1;
}
signal closed();
- color: "white"; border.width: 1; width: MyText.width + 20; height: 60;
+ color: "white"; border.width: 1; width: myText.width + 20; height: 60;
opacity: 0
- opacity: Behavior {
+ opacity: Behavior {
NumberAnimation { duration: 1000 }
}
- Text { id: MyText; anchors.centerIn: parent; text: "Hello World!" }
+ Text { id: myText; anchors.centerIn: parent; text: "Hello World!" }
MouseRegion { id: mr; anchors.fill: parent; onClicked: forceClose(); }
}
diff --git a/demos/declarative/samegame/samegame.qml b/demos/declarative/samegame/samegame.qml
index ede4362..92d85f3 100644
--- a/demos/declarative/samegame/samegame.qml
+++ b/demos/declarative/samegame/samegame.qml
@@ -2,7 +2,7 @@ import Qt 4.6
import "content"
Rectangle {
- id: Screen
+ id: screen
width: 490; height: 720
Script { source: "content/samegame.js" }
@@ -10,7 +10,7 @@ Rectangle {
SystemPalette { id: activePalette; colorGroup: Qt.Active }
Item {
- width: parent.width; anchors.top: parent.top; anchors.bottom: ToolBar.top
+ width: parent.width; anchors.top: parent.top; anchors.bottom: toolBar.top
Image {
id: background
@@ -34,14 +34,14 @@ Rectangle {
}
Dialog { id: dialog; anchors.centerIn: parent; z: 21 }
- Dialog {
- id: scoreName; anchors.centerIn: parent; z: 22;
+ Dialog {
+ id: scoreName; anchors.centerIn: parent; z: 22;
TextInput {
- id: Editor
- onAccepted: {
- if(scoreName.opacity==1&&Editor.text!="")
- sendHighScore(Editor.text);
- scoreName.forceClose();
+ id: editor
+ onAccepted: {
+ if(scoreName.opacity==1&&editor.text!="")
+ sendHighScore(editor.text);
+ scoreName.forceClose();
}
anchors.verticalCenter: parent.verticalCenter
width: 72; focus: true
@@ -50,10 +50,10 @@ Rectangle {
}
Rectangle {
- id: ToolBar
+ id: toolBar
color: activePalette.window
height: 32; width: parent.width
- anchors.bottom: Screen.bottom
+ anchors.bottom: screen.bottom
Button {
id: btnA; text: "New Game"; onClicked: {initBoard();}
@@ -62,7 +62,7 @@ Rectangle {
}
Text {
- id: Score
+ id: score
text: "Score: " + gameCanvas.score; font.bold: true
anchors.right: parent.right; anchors.rightMargin: 3
anchors.verticalCenter: parent.verticalCenter
diff --git a/demos/declarative/twitter/content/AuthView.qml b/demos/declarative/twitter/content/AuthView.qml
index 3fe7e7e..73ce308 100644
--- a/demos/declarative/twitter/content/AuthView.qml
+++ b/demos/declarative/twitter/content/AuthView.qml
@@ -1,6 +1,6 @@
import Qt 4.6
import "../../flickr/common"
-import "../../flickr/mobile"
+import "../../flickr/mobile"
Item {
id: wrapper
@@ -9,7 +9,7 @@ Item {
spacing: 20
Row{
spacing: 4
- Text {
+ Text {
width: 100
text: "Screen name:"
font.pointSize: 10; font.bold: true; color: "white"; style: "Raised"; styleColor: "black"
@@ -29,7 +29,7 @@ Item {
font.bold: true
color: "#151515"; selectionColor: "green"
Keys.forwardTo: [(tabber), (nameIn)]
- Item {
+ Item {
id: tabber
//Note: it's not working yet
Keys.onPressed: {if(event.key == Qt.Key_Tab){print('Tab works!'); passIn.focus = true; accept(); }}
@@ -39,7 +39,7 @@ Item {
}
Row{
spacing: 4
- Text {
+ Text {
width: 100
text: "Password:"
font.pointSize: 10; font.bold: true; color: "white"; style: "Raised"; styleColor: "black"
@@ -71,7 +71,7 @@ Item {
height: 32
id: login
text: "Log in"
- onClicked: {RssModel.authName=nameIn.text; RssModel.authPass=passIn.text; RssModel.tags='my timeline';}
+ onClicked: {rssModel.authName=nameIn.text; rssModel.authPass=passIn.text; rssModel.tags='my timeline';}
}
Button {
x: 120
@@ -79,7 +79,7 @@ Item {
height: 32
id: guest
text: "Guest"
- onClicked: {RssModel.authName='-'; Screen.setMode(true);}
+ onClicked: {rssModel.authName='-'; screen.setMode(true);}
}
}
}
diff --git a/demos/declarative/twitter/content/FatDelegate.qml b/demos/declarative/twitter/content/FatDelegate.qml
index a2e9c39..32a921e 100644
--- a/demos/declarative/twitter/content/FatDelegate.qml
+++ b/demos/declarative/twitter/content/FatDelegate.qml
@@ -4,12 +4,12 @@ import "../../flickr/common"
Component {
id: ListDelegate
Item {
- id: Wrapper; width: Wrapper.ListView.view.width; height: if(txt.height > 58){txt.height+8}else{58}//50+4+4
+ id: wrapper; width: wrapper.ListView.view.width; height: if(txt.height > 58){txt.height+8}else{58}//50+4+4
Script {
function handleLink(link){
if(link.slice(0,3) == 'app'){
setUser(link.slice(7));
- Screen.setMode(true);
+ screen.setMode(true);
}else if(link.slice(0,4) == 'http'){
Qt.DesktopServices.openUrl(link);
}
@@ -21,17 +21,17 @@ Component {
}
}
Item {
- id: MoveMe; height: parent.height
- Rectangle {
- id: BlackRect
- color: "black"; opacity: Wrapper.ListView.index % 2 ? 0.2 : 0.3; height: Wrapper.height-2; width: Wrapper.width; y: 1
+ id: moveMe; height: parent.height
+ Rectangle {
+ id: blackRect
+ color: "black"; opacity: wrapper.ListView.index % 2 ? 0.2 : 0.3; height: wrapper.height-2; width: wrapper.width; y: 1
}
Rectangle {
- id: WhiteRect; x: 6; width: 50; height: 50; color: "white"; smooth: true
+ id: whiteRect; x: 6; width: 50; height: 50; color: "white"; smooth: true
anchors.verticalCenter: parent.verticalCenter
- Loading { x: 1; y: 1; width: 48; height: 48; visible: RealImage.status != 1 }
- Image { id: RealImage; source: userImage; x: 1; y: 1; width:48; height:48 }
+ Loading { x: 1; y: 1; width: 48; height: 48; visible: realImage.status != 1 }
+ Image { id: realImage; source: userImage; x: 1; y: 1; width:48; height:48 }
}
Text { id:txt; y:4; x: 56
text: '<html><style type="text/css">a:link {color:"#aaccaa"}; a:visited {color:"#336633"}</style>'
@@ -39,7 +39,7 @@ Component {
+ "<br /><b>" + addTags(statusText) + "</b></html>";
textFormat: Qt.RichText
color: "white"; color: "#cccccc"; style: "Raised"; styleColor: "black"; wrap: true
- anchors.left: WhiteRect.right; anchors.right: BlackRect.right; anchors.leftMargin: 6; anchors.rightMargin: 6
+ anchors.left: whiteRect.right; anchors.right: blackRect.right; anchors.leftMargin: 6; anchors.rightMargin: 6
onLinkActivated: handleLink(link)
}
}
diff --git a/demos/declarative/twitter/content/HomeTitleBar.qml b/demos/declarative/twitter/content/HomeTitleBar.qml
index bd3bc2c..3108a9b 100644
--- a/demos/declarative/twitter/content/HomeTitleBar.qml
+++ b/demos/declarative/twitter/content/HomeTitleBar.qml
@@ -10,80 +10,80 @@ Item {
BorderImage { source: "../../flickr/mobile/images/titlebar.sci"; width: parent.width; height: parent.height + 14; y: -7 }
Item {
- id: Container
+ id: container
width: (parent.width * 2) - 55 ; height: parent.height
Script {
function accept() {
- if(RssModel.authName == '' || RssModel.authPass == '')
+ if(rssModel.authName == '' || rssModel.authPass == '')
return false;//Can't login like that
- var postData = "status=" + Editor.text;
+ var postData = "status=" + editor.text;
var postman = new XMLHttpRequest();
- postman.open("POST", "http://twitter.com/statuses/update.xml", true, RssModel.authName, RssModel.authPass);
- postman.onreadystatechange = function() {
+ postman.open("POST", "http://twitter.com/statuses/update.xml", true, rssModel.authName, rssModel.authPass);
+ postman.onreadystatechange = function() {
if (postman.readyState == postman.DONE) {
titleBar.update();
}
}
postman.send(postData);
- Editor.text = ""
+ editor.text = ""
titleBar.state = ""
}
}
Rectangle {
- id: WhiteRect; x: 6; width: 50; height: 50; color: "white"; smooth: true
+ x: 6; width: 50; height: 50; color: "white"; smooth: true
anchors.verticalCenter: parent.verticalCenter
- UserModel { user: RssModel.authName; id: userModel }
- Component { id: imgDelegate;
- Item { id: Wrapper
- Loading { width:48; height:48; visible: realImage.status != 1 }
- Image { source: image; width:48; height:48; id: realImage }
+ UserModel { user: rssModel.authName; id: userModel }
+ Component { id: imgDelegate;
+ Item {
+ Loading { width:48; height:48; visible: realImage.status != 1 }
+ Image { source: image; width:48; height:48; id: realImage }
}
- }
+ }
ListView { model: userModel.model; x:1; y:1; delegate: imgDelegate }
}
Text {
- id: CategoryText
- anchors.left: parent.left; anchors.right: TagButton.left
+ id: categoryText
+ anchors.left: parent.left; anchors.right: tagButton.left
anchors.leftMargin: 58; anchors.rightMargin: 10
anchors.verticalCenter: parent.verticalCenter
elide: "ElideLeft"
- text: "Timeline for " + RssModel.authName
+ text: "Timeline for " + rssModel.authName
font.pointSize: 10; font.bold: true; color: "white"; style: "Raised"; styleColor: "black"
}
Button {
- id: TagButton; x: titleBar.width - 90; width: 85; height: 32; text: "New Post..."
+ id: tagButton; x: titleBar.width - 90; width: 85; height: 32; text: "New Post..."
anchors.verticalCenter: parent.verticalCenter;
onClicked: if (titleBar.state == "Posting") accept(); else titleBar.state = "Posting"
}
Text {
- id: charsLeftText; anchors.horizontalCenter: TagButton.horizontalCenter;
- anchors.top: TagButton.bottom; anchors.topMargin: 2
- text: {140 - Editor.text.length;} visible: titleBar.state == "Posting"
+ id: charsLeftText; anchors.horizontalCenter: tagButton.horizontalCenter;
+ anchors.top: tagButton.bottom; anchors.topMargin: 2
+ text: {140 - editor.text.length;} visible: titleBar.state == "Posting"
font.pointSize: 10; font.bold: true; color: "white"; style: "Raised"; styleColor: "black"
}
Item {
id: txtEdit;
- anchors.left: TagButton.right; anchors.leftMargin: 5; y: 4
+ anchors.left: tagButton.right; anchors.leftMargin: 5; y: 4
anchors.right: parent.right; anchors.rightMargin: 40; height: parent.height - 9
BorderImage { source: "../../flickr/mobile/images/lineedit.sci"; anchors.fill: parent }
Binding {//TODO: Can this be a function, which also resets the cursor? And flashes?
- when: Editor.text.length > 140
- target: Editor
+ when: editor.text.length > 140
+ target: editor
property: "text"
- value: Editor.text.slice(0,140)
+ value: editor.text.slice(0,140)
}
TextEdit {
- id: Editor
- anchors.left: parent.left;
+ id: editor
+ anchors.left: parent.left;
anchors.leftMargin: 8;
anchors.bottom: parent.bottom
anchors.bottomMargin: 4;
@@ -94,9 +94,9 @@ Item {
wrap:true
color: "#151515"; selectionColor: "green"
}
- Keys.forwardTo: [(ReturnKey), (Editor)]
+ Keys.forwardTo: [(returnKey), (editor)]
Item {
- id: ReturnKey
+ id: returnKey
Keys.onReturnPressed: accept()
Keys.onEscapePressed: titleBar.state = ""
}
@@ -105,11 +105,11 @@ Item {
states: [
State {
name: "Posting"
- PropertyChanges { target: Container; x: -TagButton.x + 5 }
+ PropertyChanges { target: container; x: -tagButton.x + 5 }
PropertyChanges { target: titleBar; height: 80 }
- PropertyChanges { target: TagButton; text: "OK" }
- PropertyChanges { target: TagButton; width: 28 }
- PropertyChanges { target: TagButton; height: 24 }
+ PropertyChanges { target: tagButton; text: "OK" }
+ PropertyChanges { target: tagButton; width: 28 }
+ PropertyChanges { target: tagButton; height: 24 }
PropertyChanges { target: txtEdit; focus: true }
}
]
diff --git a/demos/declarative/twitter/content/MultiTitleBar.qml b/demos/declarative/twitter/content/MultiTitleBar.qml
index 6a6a28f..da0794d 100644
--- a/demos/declarative/twitter/content/MultiTitleBar.qml
+++ b/demos/declarative/twitter/content/MultiTitleBar.qml
@@ -2,20 +2,20 @@ import Qt 4.6
import "../../flickr/mobile"
Item {
- height: HomeBar.height
- HomeTitleBar { id: HomeBar; width: parent.width; height: 60;
- onUpdate: RssModel.reload()
+ height: homeBar.height
+ HomeTitleBar { id: homeBar; width: parent.width; height: 60;
+ onUpdate: rssModel.reload()
}
- TitleBar { id: TitleBar; width: parent.width; height: 60;
+ TitleBar { id: titleBar; width: parent.width; height: 60;
y: -80
untaggedString: "Latest tweets from everyone"
taggedString: "Latest tweets from "
}
states: [
State {
- name: "search"; when: Screen.userView
- PropertyChanges { target: TitleBar; y: 0 }
- PropertyChanges { target: HomeBar; y: -80 }
+ name: "search"; when: screen.userView
+ PropertyChanges { target: titleBar; y: 0 }
+ PropertyChanges { target: homeBar; y: -80 }
}
]
transitions: [
diff --git a/demos/declarative/twitter/twitter.qml b/demos/declarative/twitter/twitter.qml
index eb9f5d6..e9752ff 100644
--- a/demos/declarative/twitter/twitter.qml
+++ b/demos/declarative/twitter/twitter.qml
@@ -4,43 +4,44 @@ import "../flickr/common" as Common
import "../flickr/mobile" as Mobile
Item {
- id: Screen; width: 320; height: 480
- property bool userView : false
+ id: screen; width: 320; height: 480
+ property bool userView : false
+ property var tmpStr
function setMode(m){
- Screen.userView = m;
- if(m == false){
- RssModel.tags='my timeline';
- RssModel.reload();
- ToolBar.button2Label = "View others";
+ screen.userView = m;
+ if(m == false){
+ rssModel.tags='my timeline';
+ rssModel.reload();
+ toolBar.button2Label = "View others";
} else {
- ToolBar.button2Label = "Return home";
+ toolBar.button2Label = "Return home";
}
}
//Workaround for bug 260266
Timer{ interval: 1; running: false; repeat: false; onTriggered: reallySetUser(); id:hack }
- Script{
- var tmpStr;
+ Script {
+// var tmpStr;
function setUser(str){hack.running = true; tmpStr = str}
- function reallySetUser(){RssModel.tags = tmpStr;}
+ function reallySetUser(){rssModel.tags = tmpStr;}
}
Rectangle {
- id: Background
+ id: background
anchors.fill: parent; color: "#343434";
Image { source: "mobile/images/stripes.png"; fillMode: "Tile"; anchors.fill: parent; opacity: 0.3 }
- Twitter.RssModel { id: RssModel }
- Common.Loading { anchors.centerIn: parent; visible: RssModel.status==XmlListModel.Loading && state!='unauthed'}
- Text {
+ Twitter.RssModel { id: rssModel }
+ Common.Loading { anchors.centerIn: parent; visible: rssModel.status==XmlListModel.Loading && state!='unauthed'}
+ Text {
width: 180
- text: "Could not access twitter using this screen name and password pair.";
+ text: "Could not access twitter using this screen name and password pair.";
color: "white"; color: "#cccccc"; style: "Raised"; styleColor: "black"; wrap: true
- visible: RssModel.status==XmlListModel.Error; anchors.centerIn: parent
+ visible: rssModel.status==XmlListModel.Error; anchors.centerIn: parent
}
Item {
- id: Views
+ id: views
x: 2; width: parent.width - 4
y:60 //Below the title bars
height: 380
@@ -48,44 +49,44 @@ Item {
Twitter.AuthView{
id: authView
anchors.verticalCenter: parent.verticalCenter
- width: parent.width; height: parent.height-60;
- x: -(Screen.width * 1.5)
+ width: parent.width; height: parent.height-60;
+ x: -(screen.width * 1.5)
}
- Twitter.FatDelegate { id: FatDelegate }
+ Twitter.FatDelegate { id: fatDelegate }
ListView {
- id: MainView; model: RssModel.model; delegate: FatDelegate;
+ id: mainView; model: rssModel.model; delegate: fatDelegate;
width: parent.width; height: parent.height; x: 0; cacheBuffer: 100;
}
}
- Twitter.MultiTitleBar { id: TitleBar; width: parent.width }
- Mobile.ToolBar { id: ToolBar; height: 40;
- //anchors.bottom: parent.bottom;
+ Twitter.MultiTitleBar { id: titleBar; width: parent.width }
+ Mobile.ToolBar { id: toolBar; height: 40;
+ //anchors.bottom: parent.bottom;
//TODO: Use anchor changes instead of hard coding
y: 440
- width: parent.width; opacity: 0.9
+ width: parent.width; opacity: 0.9
button1Label: "Update"
button2Label: "View others"
- onButton1Clicked: RssModel.reload();
- onButton2Clicked:
+ onButton1Clicked: rssModel.reload();
+ onButton2Clicked:
{
- if(Screen.userView == true){
- Screen.setMode(false);
+ if(screen.userView == true){
+ screen.setMode(false);
}else{
- RssModel.tags='';
- Screen.setMode(true);
+ rssModel.tags='';
+ screen.setMode(true);
}
}
}
states: [
State {
- name: "unauthed"; when: RssModel.authName==""
+ name: "unauthed"; when: rssModel.authName==""
PropertyChanges { target: authView; x: 0 }
- PropertyChanges { target: MainView; x: -(parent.width * 1.5) }
- PropertyChanges { target: TitleBar; y: -80 }
- PropertyChanges { target: ToolBar; y: Screen.height + 80 }
+ PropertyChanges { target: mainView; x: -(parent.width * 1.5) }
+ PropertyChanges { target: titleBar; y: -80 }
+ PropertyChanges { target: toolBar; y: screen.height + 80 }
}
]
transitions: [
diff --git a/demos/declarative/webbrowser/content/RectSoftShadow.qml b/demos/declarative/webbrowser/content/RectSoftShadow.qml
index 5b278ac..6bba98e 100644
--- a/demos/declarative/webbrowser/content/RectSoftShadow.qml
+++ b/demos/declarative/webbrowser/content/RectSoftShadow.qml
@@ -26,7 +26,7 @@ Item {
source: "pics/softshadow-bottom.png"
x: 0
y: parent.height
- width: WebView.width*WebView.scale
+ width: webView.width*webView.scale
height: 16
}
}
diff --git a/demos/declarative/webbrowser/webbrowser.qml b/demos/declarative/webbrowser/webbrowser.qml
index 3f23d83..53ac214 100644
--- a/demos/declarative/webbrowser/webbrowser.qml
+++ b/demos/declarative/webbrowser/webbrowser.qml
@@ -4,7 +4,7 @@ import "content"
import "fieldtext"
Item {
- id: WebBrowser
+ id: webBrowser
property string urlString : "http://qt.nokia.com/"
@@ -14,7 +14,7 @@ Item {
height: 480
Item {
- id: WebPanel
+ id: webPanel
anchors.fill: parent
clip: true
Rectangle {
@@ -23,48 +23,48 @@ Item {
}
Image {
source: "content/pics/softshadow-bottom.png"
- width: WebPanel.width
+ width: webPanel.width
height: 16
}
Image {
source: "content/pics/softshadow-top.png"
- width: WebPanel.width
+ width: webPanel.width
height: 16
- anchors.bottom: Footer.top
+ anchors.bottom: footer.top
}
RectSoftShadow {
- x: -Flick.viewportX
- y: -Flick.viewportY
- width: MyWebView.width*MyWebView.scale
- height: Flick.y+MyWebView.height*MyWebView.scale
+ x: -flickable.viewportX
+ y: -flickable.viewportY
+ width: webView.width*webView.scale
+ height: flickable.y+webView.height*webView.scale
}
Item {
- id: HeaderSpace
+ id: headerSpace
width: parent.width
height: 60
z: 1
Rectangle {
- id: HeaderSpaceTint
+ id: headerSpaceTint
color: "black"
opacity: 0
anchors.fill: parent
}
Image {
- id: Header
+ id: header
source: "content/pics/header.png"
width: parent.width
height: 60
state: "Normal"
- x: Flick.viewportX < 0 ? -Flick.viewportX : Flick.viewportX > Flick.viewportWidth-Flick.width
- ? -Flick.viewportX+Flick.viewportWidth-Flick.width : 0
- y: Flick.viewportY < 0 ? -Flick.viewportY : progressOff*
- (Flick.viewportY>height?-height:-Flick.viewportY)
+ x: flickable.viewportX < 0 ? -flickable.viewportX : flickable.viewportX > flickable.viewportWidth-flickable.width
+ ? -flickable.viewportX+flickable.viewportWidth-flickable.width : 0
+ y: flickable.viewportY < 0 ? -flickable.viewportY : progressOff*
+ (flickable.viewportY>height?-height:-flickable.viewportY)
Text {
- id: HeaderText
+ id: headerText
- text: MyWebView.title!='' || MyWebView.progress == 1.0 ? MyWebView.title : 'Loading...'
+ text: webView.title!='' || webView.progress == 1.0 ? webView.title : 'Loading...'
elide: "ElideRight"
color: "white"
@@ -75,22 +75,22 @@ Item {
font.pointSize: 10
font.bold: true
- anchors.left: Header.left
- anchors.right: Header.right
+ anchors.left: header.left
+ anchors.right: header.right
anchors.leftMargin: 4
anchors.rightMargin: 4
- anchors.top: Header.top
+ anchors.top: header.top
anchors.topMargin: 4
horizontalAlignment: "AlignHCenter"
}
Item {
width: parent.width
- anchors.top: HeaderText.bottom
+ anchors.top: headerText.bottom
anchors.topMargin: 2
anchors.bottom: parent.bottom
Item {
- id: UrlBox
+ id: urlBox
height: 31
anchors.left: parent.left
anchors.leftMargin: 12
@@ -102,32 +102,32 @@ Item {
BorderImage {
source: "content/pics/addressbar.sci"
- anchors.fill: UrlBox
+ anchors.fill: urlBox
}
-
+
BorderImage {
- id: UrlBoxhl
+ id: urlBoxhl
source: "content/pics/addressbar-filled.sci"
- width: parent.width*MyWebView.progress
+ width: parent.width*webView.progress
height: parent.height
- opacity: 1-Header.progressOff
+ opacity: 1-header.progressOff
clip: true
}
FieldText {
- id: EditUrl
+ id: editUrl
mouseGrabbed: parent.mouseGrabbed
- text: WebBrowser.urlString
+ text: webBrowser.urlString
label: "url:"
- onConfirmed: { WebBrowser.urlString = EditUrl.text; MyWebView.focus=true }
- onCancelled: { MyWebView.focus=true }
- onStartEdit: { MyWebView.focus=false }
+ onConfirmed: { webBrowser.urlString = editUrl.text; webView.focus=true }
+ onCancelled: { webView.focus=true }
+ onStartEdit: { webView.focus=false }
- anchors.left: UrlBox.left
- anchors.right: UrlBox.right
+ anchors.left: urlBox.left
+ anchors.right: urlBox.right
anchors.leftMargin: 6
- anchors.verticalCenter: UrlBox.verticalCenter
+ anchors.verticalCenter: urlBox.verticalCenter
anchors.verticalCenterOffset: 1
}
}
@@ -137,19 +137,19 @@ Item {
states: [
State {
name: "Normal"
- when: MyWebView.progress == 1.0
- PropertyChanges { target: Header; progressOff: 1 }
+ when: webView.progress == 1.0
+ PropertyChanges { target: header; progressOff: 1 }
},
State {
name: "ProgressShown"
- when: MyWebView.progress < 1.0
- PropertyChanges { target: Header; progressOff: 0; }
+ when: webView.progress < 1.0
+ PropertyChanges { target: header; progressOff: 0; }
}
]
transitions: [
Transition {
NumberAnimation {
- target: Header
+ target: header
properties: "progressOff"
easing: "easeInOutQuad"
duration: 300
@@ -159,18 +159,18 @@ Item {
}
}
Flickable {
- id: Flick
+ id: flickable
width: parent.width
- viewportWidth: Math.max(parent.width,MyWebView.width*MyWebView.scale)
- viewportHeight: Math.max(parent.height,MyWebView.height*MyWebView.scale)
- anchors.top: HeaderSpace.bottom
- anchors.bottom: Footer.top
+ viewportWidth: Math.max(parent.width,webView.width*webView.scale)
+ viewportHeight: Math.max(parent.height,webView.height*webView.scale)
+ anchors.top: headerSpace.bottom
+ anchors.bottom: footer.top
anchors.left: parent.left
anchors.right: parent.right
pressDelay: 200
WebView {
- id: MyWebView
+ id: webView
pixelCacheSize: 4000000
Script {
@@ -190,29 +190,29 @@ Item {
}
}
- url: fixUrl(WebBrowser.urlString)
+ url: fixUrl(webBrowser.urlString)
smooth: true
fillColor: "white"
focus: true
- preferredWidth: Flick.width
+ preferredWidth: flickable.width
webPageWidth: 980
- onUrlChanged: { if (url != null) { WebBrowser.urlString = url.toString(); } }
+ onUrlChanged: { if (url != null) { webBrowser.urlString = url.toString(); } }
onDoubleClick: { heuristicZoom(clickX,clickY) }
SequentialAnimation {
- id: QuickZoom
+ id: quickZoom
PropertyAction {
- target: MyWebView
+ target: webView
property: "renderingEnabled"
value: false
}
ParallelAnimation {
NumberAnimation {
- id: ScaleAnim
- target: MyWebView
+ id: scaleAnim
+ target: webView
property: "scale"
from: 1
to: 0 // set before calling
@@ -220,8 +220,8 @@ Item {
duration: 200
}
NumberAnimation {
- id: FlickVX
- target: Flick
+ id: flickVX
+ target: flickable
property: "viewportX"
easing: "easeLinear"
duration: 200
@@ -229,8 +229,8 @@ Item {
to: 0 // set before calling
}
NumberAnimation {
- id: FlickVY
- target: Flick
+ id: flickVY
+ target: flickable
property: "viewportY"
easing: "easeLinear"
duration: 200
@@ -239,12 +239,12 @@ Item {
}
}
PropertyAction {
- id: FinalZoom
- target: MyWebView
+ id: finalZoom
+ target: webView
property: "zoomFactor"
}
PropertyAction {
- target: MyWebView
+ target: webView
property: "scale"
value: 1.0
}
@@ -252,19 +252,19 @@ Item {
// size changes may have started a correction if
// zoomFactor < 1.0.
PropertyAction {
- id: FinalX
- target: Flick
+ id: finalX
+ target: flickable
property: "viewportX"
value: 0 // set before calling
}
PropertyAction {
- id: FinalY
- target: Flick
+ id: finalY
+ target: flickable
property: "viewportY"
value: 0 // set before calling
}
PropertyAction {
- target: MyWebView
+ target: webView
property: "renderingEnabled"
value: true
}
@@ -272,23 +272,23 @@ Item {
onZooming: {
if (centerX) {
sc = zoom/zoomFactor;
- ScaleAnim.to = sc;
- FlickVX.from = Flick.viewportX
- FlickVX.to = Math.min(Math.max(0,centerX-Flick.width/2),MyWebView.width*sc-Flick.width)
- FinalX.value = Math.min(Math.max(0,centerX-Flick.width/2),MyWebView.width*sc-Flick.width)
- FlickVY.from = Flick.viewportY
- FlickVY.to = Math.min(Math.max(0,centerY-Flick.height/2),MyWebView.height*sc-Flick.height)
- FinalY.value = Math.min(Math.max(0,centerY-Flick.height/2),MyWebView.height*sc-Flick.height)
- FinalZoom.value = zoom
- QuickZoom.start()
+ scaleAnim.to = sc;
+ flickVX.from = flickable.viewportX
+ flickVX.to = Math.min(Math.max(0,centerX-flickable.width/2),webView.width*sc-flickable.width)
+ finalX.value = Math.min(Math.max(0,centerX-flickable.width/2),webView.width*sc-flickable.width)
+ flickVY.from = flickable.viewportY
+ flickVY.to = Math.min(Math.max(0,centerY-flickable.height/2),webView.height*sc-flickable.height)
+ finalY.value = Math.min(Math.max(0,centerY-flickable.height/2),webView.height*sc-flickable.height)
+ finalZoom.value = zoom
+ quickZoom.start()
}
}
}
Rectangle {
- id: WebViewTint
+ id: webViewTint
color: "black"
opacity: 0
- anchors.fill: MyWebView
+ anchors.fill: webView
/*MouseRegion {
anchors.fill: WebViewTint
onClicked: { proxy.focus=false }
@@ -296,7 +296,7 @@ Item {
}
}
BorderImage {
- id: Footer
+ id: footer
source: "content/pics/footer.sci"
width: parent.width
height: 43
@@ -327,13 +327,13 @@ Item {
states: [
State {
name: "Enabled"
- when: MyWebView.back.enabled==true
+ when: webView.back.enabled==true
PropertyChanges { target: back_e; opacity: 1 }
PropertyChanges { target: back_d; opacity: 0 }
},
State {
name: "Disabled"
- when: MyWebView.back.enabled==false
+ when: webView.back.enabled==false
PropertyChanges { target: back_e; opacity: 0 }
PropertyChanges { target: back_d; opacity: 1 }
}
@@ -349,7 +349,7 @@ Item {
]
MouseRegion {
anchors.fill: back_e
- onClicked: { if (MyWebView.back.enabled) MyWebView.back.trigger() }
+ onClicked: { if (webView.back.enabled) webView.back.trigger() }
}
}
Image {
@@ -360,7 +360,7 @@ Item {
}
MouseRegion {
anchors.fill: reload
- onClicked: { MyWebView.reload.trigger() }
+ onClicked: { webView.reload.trigger() }
}
Item {
id: forwardbutton
@@ -383,13 +383,13 @@ Item {
states: [
State {
name: "Enabled"
- when: MyWebView.forward.enabled==true
+ when: webView.forward.enabled==true
PropertyChanges { target: forward_e; opacity: 1 }
PropertyChanges { target: forward_d; opacity: 0 }
},
State {
name: "Disabled"
- when: MyWebView.forward.enabled==false
+ when: webView.forward.enabled==false
PropertyChanges { target: forward_e; opacity: 0 }
PropertyChanges { target: forward_d; opacity: 1 }
}
@@ -405,7 +405,7 @@ Item {
]
MouseRegion {
anchors.fill: parent
- onClicked: { if (MyWebView.forward.enabled) MyWebView.forward.trigger() }
+ onClicked: { if (webView.forward.enabled) webView.forward.trigger() }
}
}
}
diff --git a/doc/src/declarative/binding.qdoc b/doc/src/declarative/binding.qdoc
index 37b4c97..e6835ee 100644
--- a/doc/src/declarative/binding.qdoc
+++ b/doc/src/declarative/binding.qdoc
@@ -38,7 +38,8 @@ The QML mechanisms of data binding can also be used to bind Qt C++ objects.
The data binding framework is based on Qt's property system (see the Qt documentation for more details on this system). If a binding is meant to be dynamic (where changes in one object are reflected in another object), \c NOTIFY must be specified for the property being tracked. If \c NOTIFY is not specified, any binding to that property will be an 'intialization' binding (the tracking object will be updated only once with the initial value of the tracked object).
-Relevant items can also be bound to the contents of a Qt model. For example, ListView can make use of data from a QListModelInterface-derived model. (QListModelInterface is part of the next generation Model/View architecture being developed for Qt.)
+Relevant items can also be bound to the contents of a Qt model.
+For example, ListView can make use of data from a QAbstractItemModel-derived model.
\section1 Passing Data Between C++ and QML
@@ -107,4 +108,6 @@ Binding { target: screen; property: "brightness"; value: slider.value }
The \l QBindableMap class provides a convenient way to make data visible to the bind engine.
+C++ \l {qmlmodels}{Data Models} may also be provided to QML.
+
*/
diff --git a/doc/src/declarative/qmlmodels.qdoc b/doc/src/declarative/qmlmodels.qdoc
new file mode 100644
index 0000000..4712de1
--- /dev/null
+++ b/doc/src/declarative/qmlmodels.qdoc
@@ -0,0 +1,61 @@
+/*!
+\page qmlmodels.html
+\target qmlmodels
+\title Data Models
+
+Some QML Items use Data Models to provide the data to be displayed.
+These items typically require a \e delegate component that
+creates an instance for each item in the model. Models may be static, or
+have items modified, inserted, removed or moved dynamically.
+
+Data is provided to the delegate via named data roles which the
+delegate may bind to. A special \e index role containing the
+index of the item in the model is also available. Models that do
+not have named roles will have the data provided via the \e modelData
+role. The \e modelData role is also provided for Models that have
+only one role. In this case the \e modelData role contains the same
+data as the named role.
+
+There are a number of QML elements that operate using data models:
+
+\list
+\o ListView
+\o GridView
+\o PathView
+\o \l {qml-repeater}{Repeater}
+\endlist
+
+QML supports several types of data model, which may be provided by QML
+or C++ (via QmlContext::setContextProperty(), for example).
+
+\section1 QML Data Models
+
+\list
+\o ListModel is a simple hierarchy of elements specified in QML. The
+available roles are specified by the \l ListElement properties.
+\o XmlListModel allows construction of a model from an XML data source. The roles
+are specified via the \l XmlRole element.
+\o VisualItemModel allows QML items to be provided as a model. This model contains
+both the data and delegate (its child items). This model does not provide any roles.
+\endlist
+
+
+\section1 C++ Data Models
+
+\list
+\o QAbstractItemModel provides the roles set via the QAbstractItemModel::setRoleNames() method.
+\o QStringList provides the contents of the list via the \e modelData role.
+\o QList<QObject*> provides the properties of the objects in the list as roles.
+\endlist
+
+
+\section1 Other Data Models
+
+\list
+\o An Integer specifies a model containing the integer number of elements.
+There are no data roles.
+\o An Object Instance specifies a model with a single Object element. The
+properties of the object are provided as roles.
+\endlist
+
+*/
diff --git a/doc/src/declarative/qtdeclarative.qdoc b/doc/src/declarative/qtdeclarative.qdoc
index 460819a..06cba15 100644
--- a/doc/src/declarative/qtdeclarative.qdoc
+++ b/doc/src/declarative/qtdeclarative.qdoc
@@ -71,6 +71,7 @@
Core QML Features:
\list
\o \l {binding}{Data Binding}
+ \o \l {qmlmodels}{Data Models}
\o \l {anchor-layout}{Layout Anchors}
\o \l {qmlanimation}{Animation}
\o \l {qmlmodules}{Modules}
diff --git a/doc/src/snippets/declarative/GroupBox.qml b/doc/src/snippets/declarative/GroupBox.qml
index 13e7eb6..6c5431e 100644
--- a/doc/src/snippets/declarative/GroupBox.qml
+++ b/doc/src/snippets/declarative/GroupBox.qml
@@ -1,12 +1,12 @@
import Qt 4.6
ContentWrapper {
- id: Container; width: parent.width; height: contents.height
+ id: container; width: parent.width; height: contents.height
children: [
Rectangle {
width: parent.width; height: contents.height
color: "white"; pen.width: 2; pen.color: "#adaeb0"; radius: 10
- VerticalLayout {
+ Column {
id: layout; width: parent.width; margin: 5; spacing: 2
Content { }
}
diff --git a/doc/src/snippets/declarative/gridview/dummydata/ContactModel.qml b/doc/src/snippets/declarative/gridview/dummydata/ContactModel.qml
index 6868385..3cf9ba7 100644
--- a/doc/src/snippets/declarative/gridview/dummydata/ContactModel.qml
+++ b/doc/src/snippets/declarative/gridview/dummydata/ContactModel.qml
@@ -1,7 +1,7 @@
import Qt 4.6
ListModel {
- id: ContactModel
+ id: contactModel
ListElement {
name: "Bill Smith"
number: "555 3264"
diff --git a/doc/src/snippets/declarative/gridview/gridview.qml b/doc/src/snippets/declarative/gridview/gridview.qml
index d0f0623..1a2021c 100644
--- a/doc/src/snippets/declarative/gridview/gridview.qml
+++ b/doc/src/snippets/declarative/gridview/gridview.qml
@@ -11,11 +11,11 @@ Rectangle {
// instantiated for each visible item in the list.
//! [0]
Component {
- id: Delegate
+ id: delegate
Item {
- id: Wrapper
+ id: wrapper
width: 80; height: 78
- VerticalLayout {
+ Column {
Image { source: portrait; anchors.horizontalCenter: parent.horizontalCenter }
Text { text: name; anchors.horizontalCenter: parent.horizontalCenter }
}
@@ -26,7 +26,7 @@ Rectangle {
// by each ListView and placed behind the current item.
//! [1]
Component {
- id: Highlight
+ id: highlight
Rectangle {
color: "lightsteelblue"
radius: 5
@@ -37,9 +37,9 @@ Rectangle {
//! [2]
GridView {
width: parent.width; height: parent.height
- model: ContactModel; delegate: Delegate
+ model: ContactModel; delegate: delegate
cellWidth: 80; cellHeight: 80
- highlight: Highlight
+ highlight: highlight
focus: true
}
//! [2]
diff --git a/doc/src/snippets/declarative/listview/highlight.qml b/doc/src/snippets/declarative/listview/highlight.qml
index 97eac45..2234ee7 100644
--- a/doc/src/snippets/declarative/listview/highlight.qml
+++ b/doc/src/snippets/declarative/listview/highlight.qml
@@ -11,9 +11,9 @@ Rectangle {
// instantiated for each visible item in the list.
//! [0]
Component {
- id: Delegate
+ id: delegate
Item {
- id: Wrapper
+ id: wrapper
width: 180; height: 40
Column {
x: 5; y: 5
@@ -28,22 +28,22 @@ Rectangle {
// highlight moves to the current item.
//! [1]
Component {
- id: Highlight
+ id: highlight
Rectangle {
width: 180; height: 40
color: "lightsteelblue"; radius: 5
y: SpringFollow {
- source: List.currentItem.y
+ source: list.currentItem.y
spring: 3
damping: 0.2
}
}
}
ListView {
- id: List
+ id: list
width: parent.height; height: parent.height
- model: ContactModel; delegate: Delegate
- highlight: Highlight
+ model: ContactModel; delegate: delegate
+ highlight: highlight
highlightFollowsCurrentItem: false
focus: true
}
diff --git a/doc/src/snippets/declarative/listview/listview.qml b/doc/src/snippets/declarative/listview/listview.qml
index c907077..be0f3ad 100644
--- a/doc/src/snippets/declarative/listview/listview.qml
+++ b/doc/src/snippets/declarative/listview/listview.qml
@@ -12,11 +12,11 @@ Rectangle {
// instantiated for each visible item in the list.
//! [0]
Component {
- id: Delegate
+ id: delegate
Item {
- id: Wrapper
+ id: wrapper
width: 180; height: 40
- VerticalLayout {
+ Column {
x: 5; y: 5
Text { text: '<b>Name:</b> ' + name }
Text { text: '<b>Number:</b> ' + number }
@@ -28,7 +28,7 @@ Rectangle {
// by each ListView and placed behind the current item.
//! [1]
Component {
- id: Highlight
+ id: highlight
Rectangle {
color: "lightsteelblue"
radius: 5
@@ -40,8 +40,8 @@ Rectangle {
ListView {
width: parent.width; height: parent.height
model: ContactModel
- delegate: Delegate
- highlight: Highlight
+ delegate: delegate
+ highlight: highlight
focus: true
}
//! [2]
diff --git a/doc/src/snippets/declarative/pathview/pathattributes.qml b/doc/src/snippets/declarative/pathview/pathattributes.qml
index 92d6966..19a192c 100644
--- a/doc/src/snippets/declarative/pathview/pathattributes.qml
+++ b/doc/src/snippets/declarative/pathview/pathattributes.qml
@@ -5,22 +5,22 @@ Rectangle {
//! [0]
//! [1]
Component {
- id: Delegate
+ id: delegate
Item {
- id: Wrapper
+ id: wrapper
width: 80; height: 80
scale: PathView.scale
opacity: PathView.opacity
- VerticalLayout {
- Image { anchors.horizontalCenter: Name.horizontalCenter; width: 64; height: 64; source: icon }
- Text { id: Name; text: name; font.pointSize: 16}
+ Column {
+ Image { anchors.horizontalCenter: name.horizontalCenter; width: 64; height: 64; source: icon }
+ Text { id: name; text: name; font.pointSize: 16}
}
}
}
//! [1]
//! [2]
PathView {
- anchors.fill: parent; model: MenuModel; delegate: Delegate
+ anchors.fill: parent; model: MenuModel; delegate: delegate
path: Path {
startX: 120; startY: 100
PathAttribute { name: "scale"; value: 1.0 }
diff --git a/doc/src/snippets/declarative/pathview/pathview.qml b/doc/src/snippets/declarative/pathview/pathview.qml
index 004a1d2..5605139 100644
--- a/doc/src/snippets/declarative/pathview/pathview.qml
+++ b/doc/src/snippets/declarative/pathview/pathview.qml
@@ -5,20 +5,20 @@ Rectangle {
//! [0]
//! [1]
Component {
- id: Delegate
+ id: delegate
Item {
- id: Wrapper
+ id: wrapper
width: 80; height: 80
- VerticalLayout {
- Image { anchors.horizontalCenter: Name.horizontalCenter; width: 64; height: 64; source: icon }
- Text { id: Name; text: name; font.pointSize: 16}
+ Column {
+ Image { anchors.horizontalCenter: name.horizontalCenter; width: 64; height: 64; source: icon }
+ Text { id: name; text: name; font.pointSize: 16}
}
}
}
//! [1]
//! [2]
PathView {
- anchors.fill: parent; model: MenuModel; delegate: Delegate
+ anchors.fill: parent; model: MenuModel; delegate: delegate
path: Path {
startX: 120; startY: 100
PathQuad { x: 120; y: 25; controlX: 260; controlY: 75 }
diff --git a/examples/declarative/anchors/anchor-changes.qml b/examples/declarative/anchors/anchor-changes.qml
index 8996439..f6fd35d 100644
--- a/examples/declarative/anchors/anchor-changes.qml
+++ b/examples/declarative/anchors/anchor-changes.qml
@@ -1,24 +1,24 @@
import Qt 4.6
Item {
- id: Window
+ id: window
width: 200; height: 450
Rectangle {
- id: TitleBar; color: "Gray"
+ id: titleBar; color: "Gray"
anchors.top: parent.top; height: 50
width: parent.width
}
Rectangle {
- id: StatusBar; color: "Gray"
+ id: statusBar; color: "Gray"
height: 50; anchors.bottom: parent.bottom
width: parent.width
}
Rectangle {
- id: Content
- anchors.top: TitleBar.bottom; anchors.bottom: StatusBar.top
+ id: content
+ anchors.top: titleBar.bottom; anchors.bottom: statusBar.top
width: parent.width
Text { text: "Top"; anchors.top: parent.top }
@@ -26,16 +26,16 @@ Item {
}
MouseRegion {
- anchors.fill: Content
- onPressed: Window.state = "FullScreen"
- onReleased: Window.state = ""
+ anchors.fill: content
+ onPressed: window.state = "FullScreen"
+ onReleased: window.state = ""
}
states : State {
name: "FullScreen"
//! [0]
AnchorChanges {
- target: Content; top: Window.top; bottom: Window.bottom
+ target: content; top: window.top; bottom: window.bottom
}
//! [0]
}
diff --git a/examples/declarative/aspectratio/face_fit.qml b/examples/declarative/aspectratio/face_fit.qml
index 8d38cca..3d1451c 100644
--- a/examples/declarative/aspectratio/face_fit.qml
+++ b/examples/declarative/aspectratio/face_fit.qml
@@ -8,13 +8,13 @@ import Qt 4.6
//
Rectangle {
// default size: whole image, unscaled
- width: Face.width
- height: Face.height
+ width: face.width
+ height: face.height
color: "gray"
clip: true
Image {
- id: Face
+ id: face
source: "pics/face.png"
x: (parent.width-width*scale)/2
y: (parent.height-height*scale)/2
diff --git a/examples/declarative/aspectratio/face_fit_animated.qml b/examples/declarative/aspectratio/face_fit_animated.qml
index 9d63e69..f004a6c 100644
--- a/examples/declarative/aspectratio/face_fit_animated.qml
+++ b/examples/declarative/aspectratio/face_fit_animated.qml
@@ -6,19 +6,19 @@ import Qt 4.6
//
Rectangle {
// default size: whole image, unscaled
- width: Face.width
- height: Face.height
+ width: face.width
+ height: face.height
color: "gray"
clip: true
Image {
- id: Face
+ id: face
source: "pics/face.png"
x: (parent.width-width*scale)/2
y: (parent.height-height*scale)/2
scale: SpringFollow {
- source: Math.max(Math.min(Face.parent.width/Face.width*1.333,Face.parent.height/Face.height),
- Math.min(Face.parent.width/Face.width,Face.parent.height/Face.height*1.333))
+ source: Math.max(Math.min(face.parent.width/face.width*1.333,face.parent.height/face.height),
+ Math.min(face.parent.width/face.width,face.parent.height/face.height*1.333))
spring: 1
damping: 0.05
}
diff --git a/examples/declarative/aspectratio/scale_and_crop.qml b/examples/declarative/aspectratio/scale_and_crop.qml
index 3cace8d..2c9477e 100644
--- a/examples/declarative/aspectratio/scale_and_crop.qml
+++ b/examples/declarative/aspectratio/scale_and_crop.qml
@@ -4,13 +4,13 @@ import Qt 4.6
//
Rectangle {
// default size: whole image, unscaled
- width: Face.width
- height: Face.height
+ width: face.width
+ height: face.height
color: "gray"
clip: true
Image {
- id: Face
+ id: face
source: "pics/face.png"
x: (parent.width-width*scale)/2
y: (parent.height-height*scale)/2
diff --git a/examples/declarative/aspectratio/scale_and_crop_simple.qml b/examples/declarative/aspectratio/scale_and_crop_simple.qml
index 26758e6..9cc9c19 100644
--- a/examples/declarative/aspectratio/scale_and_crop_simple.qml
+++ b/examples/declarative/aspectratio/scale_and_crop_simple.qml
@@ -5,13 +5,13 @@ import Qt 4.6
//
Rectangle {
// default size: whole image, unscaled
- width: Face.width
- height: Face.height
+ width: face.width
+ height: face.height
color: "gray"
clip: true
Image {
- id: Face
+ id: face
source: "pics/face.png"
fillMode: "PreserveAspectCrop"
anchors.fill: parent
diff --git a/examples/declarative/aspectratio/scale_and_sidecrop.qml b/examples/declarative/aspectratio/scale_and_sidecrop.qml
index 18cc110..67c7e29 100644
--- a/examples/declarative/aspectratio/scale_and_sidecrop.qml
+++ b/examples/declarative/aspectratio/scale_and_sidecrop.qml
@@ -5,13 +5,13 @@ import Qt 4.6
//
Rectangle {
// default size: whole image, unscaled
- width: Face.width
- height: Face.height
+ width: face.width
+ height: face.height
color: "gray"
clip: true
Image {
- id: Face
+ id: face
source: "pics/face.png"
x: (parent.width-width*scale)/2
y: (parent.height-height*scale)/2
diff --git a/examples/declarative/aspectratio/scale_to_fit.qml b/examples/declarative/aspectratio/scale_to_fit.qml
index 7450ea4..c4efc29 100644
--- a/examples/declarative/aspectratio/scale_to_fit.qml
+++ b/examples/declarative/aspectratio/scale_to_fit.qml
@@ -5,13 +5,13 @@ import Qt 4.6
//
Rectangle {
// default size: whole image, unscaled
- width: Face.width
- height: Face.height
+ width: face.width
+ height: face.height
color: "gray"
clip: true
Image {
- id: Face
+ id: face
source: "pics/face.png"
x: (parent.width-width*scale)/2
y: (parent.height-height*scale)/2
diff --git a/examples/declarative/aspectratio/scale_to_fit_simple.qml b/examples/declarative/aspectratio/scale_to_fit_simple.qml
index dcccd69..f7fcd8b 100644
--- a/examples/declarative/aspectratio/scale_to_fit_simple.qml
+++ b/examples/declarative/aspectratio/scale_to_fit_simple.qml
@@ -5,13 +5,13 @@ import Qt 4.6
//
Rectangle {
// default size: whole image, unscaled
- width: Face.width
- height: Face.height
+ width: face.width
+ height: face.height
color: "gray"
clip: true
Image {
- id: Face
+ id: face
source: "pics/face.png"
fillMode: "PreserveAspectFit"
anchors.fill: parent
diff --git a/examples/declarative/behaviours/MyRect.qml b/examples/declarative/behaviours/MyRect.qml
index fca1f70..a272e1f 100644
--- a/examples/declarative/behaviours/MyRect.qml
+++ b/examples/declarative/behaviours/MyRect.qml
@@ -5,9 +5,9 @@ Rectangle {
border.color: "black"
width: 100
height: 100
- id: Page
+ id: page
MouseRegion {
anchors.fill: parent
- onClicked: { bluerect.parent = Page; bluerect.x=0 }
+ onClicked: { bluerect.parent = page; bluerect.x=0 }
}
}
diff --git a/examples/declarative/behaviours/test.qml b/examples/declarative/behaviours/test.qml
index 1dd0658..a15d05d 100644
--- a/examples/declarative/behaviours/test.qml
+++ b/examples/declarative/behaviours/test.qml
@@ -4,10 +4,10 @@ Rectangle {
color: "lightsteelblue"
width: 800
height: 600
- id: Page
+ id: page
MouseRegion {
anchors.fill: parent
- onClicked: { bluerect.parent = Page; bluerect.x = mouseX; }
+ onClicked: { bluerect.parent = page; bluerect.x = mouseX; }
}
MyRect {
color: "green"
diff --git a/examples/declarative/border-image/MyBorderImage.qml b/examples/declarative/border-image/MyBorderImage.qml
index 395b648..d64bfb2 100644
--- a/examples/declarative/border-image/MyBorderImage.qml
+++ b/examples/declarative/border-image/MyBorderImage.qml
@@ -3,35 +3,35 @@ import Qt 4.6
Item {
property var horizontalMode : BorderImage.Stretch
property var verticalMode : BorderImage.Stretch
- property alias source: MyImage.source
+ property alias source: image.source
property int minWidth
property int minHeight
property int maxWidth
property int maxHeight
property int margin
- id: Container
+ id: container
width: 240; height: 240
BorderImage {
- id: MyImage; x: Container.width / 2 - width / 2; y: Container.height / 2 - height / 2
+ id: image; x: container.width / 2 - width / 2; y: container.height / 2 - height / 2
width: SequentialAnimation {
running: true; repeat: true
- NumberAnimation { from: Container.minWidth; to: Container.maxWidth; duration: 2000; easing: "easeInOutQuad"}
- NumberAnimation { from: Container.maxWidth; to: Container.minWidth; duration: 2000; easing: "easeInOutQuad" }
+ NumberAnimation { from: container.minWidth; to: container.maxWidth; duration: 2000; easing: "easeInOutQuad"}
+ NumberAnimation { from: container.maxWidth; to: container.minWidth; duration: 2000; easing: "easeInOutQuad" }
}
height: SequentialAnimation {
running: true; repeat: true
- NumberAnimation { from: Container.minHeight; to: Container.maxHeight; duration: 2000; easing: "easeInOutQuad"}
- NumberAnimation { from: Container.maxHeight; to: Container.minHeight; duration: 2000; easing: "easeInOutQuad" }
+ NumberAnimation { from: container.minHeight; to: container.maxHeight; duration: 2000; easing: "easeInOutQuad"}
+ NumberAnimation { from: container.maxHeight; to: container.minHeight; duration: 2000; easing: "easeInOutQuad" }
}
- horizontalTileMode: Container.horizontalMode
- verticalTileMode: Container.verticalMode
- border.top: Container.margin
- border.left: Container.margin
- border.bottom: Container.margin
- border.right: Container.margin
+ horizontalTileMode: container.horizontalMode
+ verticalTileMode: container.verticalMode
+ border.top: container.margin
+ border.left: container.margin
+ border.bottom: container.margin
+ border.right: container.margin
}
}
diff --git a/examples/declarative/border-image/animated.qml b/examples/declarative/border-image/animated.qml
index b34753f..aaaf495 100644
--- a/examples/declarative/border-image/animated.qml
+++ b/examples/declarative/border-image/animated.qml
@@ -1,7 +1,7 @@
import Qt 4.6
Rectangle {
- id: Page
+ id: page
color: "white"
width: 1030; height: 540
diff --git a/examples/declarative/border-image/borders.qml b/examples/declarative/border-image/borders.qml
index 73758f2..e90abe6 100644
--- a/examples/declarative/border-image/borders.qml
+++ b/examples/declarative/border-image/borders.qml
@@ -1,7 +1,7 @@
import Qt 4.6
Rectangle {
- id: Page
+ id: page
color: "white"
width: 520; height: 280
diff --git a/examples/declarative/border-image/example.qml b/examples/declarative/border-image/example.qml
index a0b02b7..25c19d9 100644
--- a/examples/declarative/border-image/example.qml
+++ b/examples/declarative/border-image/example.qml
@@ -1,7 +1,7 @@
import Qt 4.6
Rectangle {
- id: Page
+ id: page
color: "white"
width: 520; height: 280
diff --git a/examples/declarative/clock/Clock.qml b/examples/declarative/clock/Clock.qml
index 6064dd4..a061488 100644
--- a/examples/declarative/clock/Clock.qml
+++ b/examples/declarative/clock/Clock.qml
@@ -1,7 +1,7 @@
import Qt 4.6
Item {
- id: Clock
+ id: clock
width: 200; height: 200
property var time
property var hours
@@ -15,7 +15,7 @@ Item {
}
Timer {
interval: 100; running: true; repeat: true; triggeredOnStart: true
- onTriggered: Clock.time = new Date()
+ onTriggered: clock.time = new Date()
}
Image { source: "background.png" }
@@ -25,13 +25,13 @@ Item {
source: "hour.png"
smooth: true
transform: Rotation {
- id: HourRotation
+ id: hourRotation
origin.x: 4; origin.y: 45
angle: 0
angle: SpringFollow {
spring: 2
damping: .2
- source: Clock.hours * 50 * 3 + Clock.minutes / 2
+ source: clock.hours * 50 * 3 + clock.minutes / 2
}
}
}
@@ -41,13 +41,13 @@ Item {
source: "minute.png"
smooth: true
transform: Rotation {
- id: MinuteRotation
+ id: minuteRotation
origin.x: 4; origin.y: 70
angle: 0
angle: SpringFollow {
spring: 2
damping: .2
- source: Clock.minutes * 6
+ source: clock.minutes * 6
}
}
}
@@ -57,14 +57,14 @@ Item {
source: "second.png"
smooth: true
transform: Rotation {
- id: SecondRotation
+ id: secondRotation
origin.x: 2; origin.y: 60
angle: 0
angle: SpringFollow {
spring: 5
damping: .25
modulus: 360
- source: Clock.seconds * 6
+ source: clock.seconds * 6
}
}
}
diff --git a/examples/declarative/clock/display.qml b/examples/declarative/clock/display.qml
index 59f4763..20e254d 100644
--- a/examples/declarative/clock/display.qml
+++ b/examples/declarative/clock/display.qml
@@ -3,5 +3,5 @@ import Qt 4.6
Rectangle {
width: childrenRect.width
height: childrenRect.height
- Clock { id: Clock }
+ Clock { id: clock }
}
diff --git a/examples/declarative/dial/DialLibrary/Dial.qml b/examples/declarative/dial/DialLibrary/Dial.qml
index 1a163a8..c1e9770 100644
--- a/examples/declarative/dial/DialLibrary/Dial.qml
+++ b/examples/declarative/dial/DialLibrary/Dial.qml
@@ -1,12 +1,12 @@
import Qt 4.6
Item {
- id: Root
+ id: root
property real value : 0
width: 210; height: 210
- Image { id: Background; source: "background.png" }
+ Image { source: "background.png" }
Image {
x: 93
@@ -14,23 +14,22 @@ Item {
source: "needle_shadow.png"
transform: Rotation {
origin.x: 11; origin.y: 67
- angle: NeedleRotation.angle
+ angle: needleRotation.angle
}
}
Image {
- id: Needle
+ id: needle
x: 95; y: 33
smooth: true
source: "needle.png"
transform: Rotation {
- id: NeedleRotation
+ id: needleRotation
origin.x: 7; origin.y: 65
angle: -130
angle: SpringFollow {
- id: MyFollow
spring: 1.4
damping: .15
- source: Math.min(Math.max(-130, Root.value*2.2 - 130), 133)
+ source: Math.min(Math.max(-130, root.value*2.2 - 130), 133)
}
}
}
diff --git a/examples/declarative/dial/dial.qml b/examples/declarative/dial/dial.qml
index 472ac66..c7baf25 100644
--- a/examples/declarative/dial/dial.qml
+++ b/examples/declarative/dial/dial.qml
@@ -6,10 +6,10 @@ Rectangle {
width: 210; height: 240
// Dial with a slider to adjust it
- Dial { id: Dial; value: Slider.x-2 }
+ Dial { id: dial; value: slider.x-2 }
Rectangle {
- anchors.top: Dial.bottom
+ anchors.top: dial.bottom
x: 20; width: 160; height: 16
gradient: Gradient {
GradientStop { position: 0.0; color: "steelblue" }
@@ -17,7 +17,7 @@ Rectangle {
}
radius: 8; opacity: 0.7; smooth: true
Rectangle {
- id: Slider
+ id: slider
x: 2; y: 2; width: 30; height: 12
radius: 6; smooth: true
gradient: Gradient {
diff --git a/examples/declarative/easing/easing.qml b/examples/declarative/easing/easing.qml
index 1909e00..23d7b29 100644
--- a/examples/declarative/easing/easing.qml
+++ b/examples/declarative/easing/easing.qml
@@ -1,13 +1,13 @@
import Qt 4.6
Rectangle {
- id: Window
+ id: window
width: 640
- height: Layout.height
+ height: layout.height
color: "white"
ListModel {
- id: EasingTypes
+ id: easingTypes
ListElement { type: "easeLinear" }
ListElement { type: "easeInQuad" }
ListElement { type: "easeOutQuad" }
@@ -50,23 +50,23 @@ Rectangle {
ListElement { type: "easeInOutBounce" }
ListElement { type: "easeOutInBounce" }
}
-
+
Column {
- id: Layout
- anchors.left: Window.left
- anchors.right: Window.right
+ id: layout
+ anchors.left: window.left
+ anchors.right: window.right
Repeater {
- model: EasingTypes
+ model: easingTypes
Component {
Text {
text: type
height: 18
font.italic: true
x: SequentialAnimation {
- id: Anim
+ id: anim
NumberAnimation {
from: 0
- to: Window.width / 2
+ to: window.width / 2
easing: type
duration: 1000
}
@@ -75,14 +75,14 @@ Rectangle {
}
NumberAnimation {
to: 0
- from: Window.width / 2
+ from: window.width / 2
easing: type
duration: 1000
}
}
children: [
MouseRegion {
- onClicked: { Anim.running=true }
+ onClicked: { anim.running=true }
anchors.fill: parent
}
]
diff --git a/examples/declarative/effects/test.qml b/examples/declarative/effects/test.qml
index ad03ef9..83bfde2 100644
--- a/examples/declarative/effects/test.qml
+++ b/examples/declarative/effects/test.qml
@@ -9,10 +9,10 @@ Rectangle {
source: "pic.jpg"
effect: Blur {
- blurRadius: NumberAnimation { id: BS; from: 0; to: 10; duration: 200; repeat: true }
+ blurRadius: NumberAnimation { id: blur; from: 0; to: 10; duration: 200; repeat: true }
}
- MouseRegion { anchors.fill: parent; onClicked: BS.running = !BS.running }
+ MouseRegion { anchors.fill: parent; onClicked: blur.running = !blur.running }
Text { color: "white"; text: "Blur" }
}
@@ -39,11 +39,11 @@ Rectangle {
source: "pic.jpg"
y: 300
- effect: Pixelize {
- pixelSize: NumberAnimation { id: PS; from: 0; to: 10; duration: 200; repeat: true }
+ effect: Pixelize {
+ pixelSize: NumberAnimation { id: pixelize; from: 0; to: 10; duration: 200; repeat: true }
}
- MouseRegion { anchors.fill: parent; onClicked: PS.running = !PS.running }
+ MouseRegion { anchors.fill: parent; onClicked: pixelize.running = !pixelize.running }
Text { color: "white"; text: "Pixelize" }
}
@@ -54,13 +54,13 @@ Rectangle {
x: 200
y: 300
- effect: DropShadow {
+ effect: DropShadow {
blurRadius: 3
offset.x: 3
- offset.y: NumberAnimation { id: DS; from: 0; to: 10; duration: 200; repeat: true; }
+ offset.y: NumberAnimation { id: dropShadow; from: 0; to: 10; duration: 200; repeat: true; }
}
- MouseRegion { anchors.fill: parent; onClicked: DS.running = !DS.running }
+ MouseRegion { anchors.fill: parent; onClicked: dropShadow.running = !dropShadow.running }
Text { color: "white"; text: "DropShadow" }
}
@@ -74,10 +74,10 @@ Rectangle {
effect: Bloom {
blurRadius: 3
brightness: 128
- strength: NumberAnimation { id: BLS; from: 0; to: 1; duration: 200; repeat: true; }
+ strength: NumberAnimation { id: bloom; from: 0; to: 1; duration: 200; repeat: true; }
}
- MouseRegion { anchors.fill: parent; onClicked: BLS.running = !BLS.running }
+ MouseRegion { anchors.fill: parent; onClicked: bloom.running = !bloom.running }
Text { color: "white"; text: "Bloom" }
}
diff --git a/examples/declarative/extending/binding/example.qml b/examples/declarative/extending/binding/example.qml
index 1651b7a..352bb70 100644
--- a/examples/declarative/extending/binding/example.qml
+++ b/examples/declarative/extending/binding/example.qml
@@ -2,9 +2,9 @@ import People 1.0
// ![0]
BirthdayParty {
- id: TheParty
+ id: theParty
- speaker: HappyBirthday { name: TheParty.celebrant.name }
+ speaker: HappyBirthday { name: theParty.celebrant.name }
celebrant: Boy {
name: "Bob Jones"
@@ -14,22 +14,22 @@ BirthdayParty {
onPartyStarted: print("This party started rockin' at " + time);
- Boy {
- name: "Joan Hodges"
+ Boy {
+ name: "Joan Hodges"
BirthdayParty.rsvp: "2009-07-06"
shoe { size: 10; color: "black"; brand: "Reebok"; price: 59.95 }
}
- Boy {
- name: "Jack Smith"
+ Boy {
+ name: "Jack Smith"
shoe { size: 8; color: "blue"; brand: "Puma"; price: 19.95 }
}
- Girl {
- name: "Anne Brown"
+ Girl {
+ name: "Anne Brown"
BirthdayParty.rsvp: "2009-07-01"
shoe.size: 7
shoe.color: "red"
shoe.brand: "Marc Jacobs"
- shoe.price: 699.99
+ shoe.price: 699.99
}
// ![1]
diff --git a/examples/declarative/fillmode/fillmode.qml b/examples/declarative/fillmode/fillmode.qml
index 94b0782..0fdacbf 100644
--- a/examples/declarative/fillmode/fillmode.qml
+++ b/examples/declarative/fillmode/fillmode.qml
@@ -8,26 +8,26 @@ Image {
running: true
repeat: true
PropertyAction { value: "Stretch" }
- PropertyAction { target: Label; property: "text"; value: "Stretch" }
+ PropertyAction { target: label; property: "text"; value: "Stretch" }
PauseAnimation { duration: 1000 }
PropertyAction { value: "PreserveAspectFit" }
- PropertyAction { target: Label; property: "text"; value: "PreserveAspectFit" }
+ PropertyAction { target: label; property: "text"; value: "PreserveAspectFit" }
PauseAnimation { duration: 1000 }
PropertyAction { value: "PreserveAspectCrop" }
- PropertyAction { target: Label; property: "text"; value: "PreserveAspectCrop" }
+ PropertyAction { target: label; property: "text"; value: "PreserveAspectCrop" }
PauseAnimation { duration: 1000 }
PropertyAction { value: "Tile" }
- PropertyAction { target: Label; property: "text"; value: "Tile" }
+ PropertyAction { target: label; property: "text"; value: "Tile" }
PauseAnimation { duration: 1000 }
PropertyAction { value: "TileHorizontally" }
- PropertyAction { target: Label; property: "text"; value: "TileHorizontally" }
+ PropertyAction { target: label; property: "text"; value: "TileHorizontally" }
PauseAnimation { duration: 1000 }
PropertyAction { value: "TileVertically" }
- PropertyAction { target: Label; property: "text"; value: "TileVertically" }
+ PropertyAction { target: label; property: "text"; value: "TileVertically" }
PauseAnimation { duration: 1000 }
}
Text {
- id: Label
+ id: label
font.pointSize: 24
color: "blue"
style: "Outline"
diff --git a/examples/declarative/flowview/FlickrView.qml b/examples/declarative/flowview/FlickrView.qml
index 1cdb132..b73ae1a 100644
--- a/examples/declarative/flowview/FlickrView.qml
+++ b/examples/declarative/flowview/FlickrView.qml
@@ -1,14 +1,14 @@
import Qt 4.6
-Rectangle {
- radius: 5;
- border.width: 1;
- width:400;
- height: 120;
- color: background;
+Rectangle {
+ radius: 5;
+ border.width: 1;
+ width:400;
+ height: 120;
+ color: background;
XmlListModel {
- id: FeedModel
+ id: feedModel
source: "http://api.flickr.com/services/feeds/photos_public.gne?format=rss2"
query: "/rss/channel/item"
namespaceDeclarations: "declare namespace media=\"http://search.yahoo.com/mrss/\";"
@@ -31,12 +31,12 @@ Rectangle {
width: parent.width
height: 86
y: 17
- model: FeedModel
- delegate:
- Item { width: 90; height: 86
+ model: feedModel
+ delegate:
+ Item { width: 90; height: 86
Rectangle {
anchors.centerIn: parent
- width: 86; height: 86;
+ width: 86; height: 86;
color: "white"; radius: 5
Image { source: imagePath; x: 5; y: 5 }
}
diff --git a/examples/declarative/flowview/flowview.qml b/examples/declarative/flowview/flowview.qml
index 85c20d9..f6b042d 100644
--- a/examples/declarative/flowview/flowview.qml
+++ b/examples/declarative/flowview/flowview.qml
@@ -6,34 +6,34 @@ Rectangle {
color: "black"
Rectangle {
- id: MyPhone
+ id: myPhone
transformOrigin: "Center"
anchors.centerIn: parent
width: 800
height: 480
clip: true
- states: State {
+ states: State {
name: "rotated"
- PropertyChanges { target: MyListView; z: 2 }
- PropertyChanges { target: TopBar; y: -30 }
- PropertyChanges { target: BottomBar; y: 480 }
- PropertyChanges { target: LeftBar; x: 0 }
- PropertyChanges { target: RightBar; x: 770 }
+ PropertyChanges { target: myListView; z: 2 }
+ PropertyChanges { target: topBar; y: -30 }
+ PropertyChanges { target: bottomBar; y: 480 }
+ PropertyChanges { target: leftBar; x: 0 }
+ PropertyChanges { target: rightBar; x: 770 }
}
transitions: Transition {
from: "" ; to: "rotated"
reversible: true
SequentialAnimation {
- NumberAnimation { targets: [TopBar, BottomBar]; properties: "x,y"; easing: "easeInOutQuad" }
- NumberAnimation { targets: [LeftBar, RightBar]; properties: "x,y"; easing: "easeInOutQuad"}
+ NumberAnimation { targets: [topBar, bottomBar]; properties: "x,y"; easing: "easeInOutQuad" }
+ NumberAnimation { targets: [leftBar, rightBar]; properties: "x,y"; easing: "easeInOutQuad"}
}
}
color: "lightsteelblue"
VisualDataModel {
- id: Model
+ id: model
model: ListModel {
ListElement { background: "red"; weblet: "RoundedRect.qml" }
ListElement { background: "yellow"; weblet: "RoundedRect.qml" }
@@ -43,41 +43,41 @@ Rectangle {
ListElement { background: "lightblue"; weblet: "RoundedRect.qml" }
}
delegate: Package {
- Item { id: List; Package.name: "list"; width:120; height: 400; }
- Item { id: GridItem; Package.name: "grid"; width:400; height: 120; }
- Loader { id: MyContent; width:400; height: 120; source: weblet }
+ Item { id: list; Package.name: "list"; width:120; height: 400; }
+ Item { id: gridItem; Package.name: "grid"; width:400; height: 120; }
+ Loader { id: myContent; width:400; height: 120; source: weblet }
StateGroup {
states: [
- State {
+ State {
name: "InList"
- when: MyPhone.state == "rotated"
- ParentChange { target: MyContent; parent: List }
- PropertyChanges { target: MyContent; x: 120; y: 0; rotation: 90}
+ when: myPhone.state == "rotated"
+ ParentChange { target: myContent; parent: list }
+ PropertyChanges { target: myContent; x: 120; y: 0; rotation: 90}
},
- State {
+ State {
name: "InGrid"
- when: MyPhone.state != "rotated"
- ParentChange { target: MyContent; parent: GridItem }
- PropertyChanges { target: MyContent; x: 0; y: 0; }
+ when: myPhone.state != "rotated"
+ ParentChange { target: myContent; parent: gridItem }
+ PropertyChanges { target: myContent; x: 0; y: 0; }
}
]
transitions: [
Transition {
from: "*"; to: "InGrid"
- SequentialAnimation {
- ParentAction{}
- PauseAnimation { duration: 50 * List.FlowView.column }
- NumberAnimation { properties: "x,y,rotation"; easing: "easeInOutQuad" }
- }
+ SequentialAnimation {
+ ParentAction{}
+ PauseAnimation { duration: 50 * list.FlowView.column }
+ NumberAnimation { properties: "x,y,rotation"; easing: "easeInOutQuad" }
+ }
},
Transition {
from: "*"; to: "InList"
- SequentialAnimation {
- ParentAction{}
- PauseAnimation { duration: 50 * (GridItem.FlowView.row * 2 + GridItem.FlowView.column) }
- NumberAnimation { properties: "x,y,rotation"; easing: "easeInOutQuad" }
- }
+ SequentialAnimation {
+ ParentAction{}
+ PauseAnimation { duration: 50 * (gridItem.FlowView.row * 2 + gridItem.FlowView.column) }
+ NumberAnimation { properties: "x,y,rotation"; easing: "easeInOutQuad" }
+ }
}
]
}
@@ -87,14 +87,14 @@ Rectangle {
Item {
FlowView {
- id: MyListView
+ id: myListView
vertical: true
y: 40
x: 40
width: 800
height: 400
column: 1
- model: Model.parts.list
+ model: model.parts.list
}
FlowView {
@@ -103,29 +103,29 @@ Rectangle {
width: 800
height: 400
column: 2
- model: Model.parts.grid
+ model: model.parts.grid
}
}
Rectangle {
- id: TopBar
+ id: topBar
width: 800
height: 30
}
Rectangle {
- id: BottomBar
+ id: bottomBar
width: 800
height: 30
y: 450
}
Rectangle {
- id: LeftBar
+ id: leftBar
x: -30
width: 30
height: 480
}
Rectangle {
- id: RightBar
+ id: rightBar
x: 800
width: 30
height: 480
@@ -140,7 +140,7 @@ Rectangle {
Text { text: "Switch" }
MouseRegion {
anchors.fill: parent
- onClicked: if(MyPhone.state == "rotated") MyPhone.state=""; else MyPhone.state = "rotated";
+ onClicked: if(myPhone.state == "rotated") myPhone.state=""; else myPhone.state = "rotated";
}
}
diff --git a/examples/declarative/focusscope/test.qml b/examples/declarative/focusscope/test.qml
index 77ffb84..ab5a143 100644
--- a/examples/declarative/focusscope/test.qml
+++ b/examples/declarative/focusscope/test.qml
@@ -8,28 +8,28 @@ Rectangle {
Keys.onDigit9Pressed: print("Error - Root")
FocusScope {
- id: MyScope
+ id: myScope
focus: true
Keys.onDigit9Pressed: print("Error - FocusScope")
-
+
Rectangle {
height: 120
width: 420
color: "transparent"
border.width: 5
- border.color: MyScope.wantsFocus?"blue":"black"
+ border.color: myScope.wantsFocus?"blue":"black"
Rectangle {
- id: Item1
- x: 10; y: 10
+ id: item1
+ x: 10; y: 10
width: 100; height: 100; color: "green"
border.width: 5
border.color: wantsFocus?"blue":"black"
Keys.onDigit9Pressed: print("Top Left");
- KeyNavigation.right: Item2
- focus: true
+ KeyNavigation.right: item2
+ focus: true
Rectangle {
width: 50; height: 50; anchors.centerIn: parent
@@ -38,12 +38,12 @@ Rectangle {
}
Rectangle {
- id: Item2
+ id: item2
x: 310; y: 10
width: 100; height: 100; color: "green"
border.width: 5
border.color: wantsFocus?"blue":"black"
- KeyNavigation.left: Item1
+ KeyNavigation.left: item1
Keys.onDigit9Pressed: print("Top Right");
Rectangle {
@@ -52,20 +52,20 @@ Rectangle {
}
}
}
- KeyNavigation.down: Item3
+ KeyNavigation.down: item3
}
Text { x:100; y:170; text: "Blue border indicates scoped focus\nBlack border indicates NOT scoped focus\nRed box indicates active focus\nUse arrow keys to navigate\nPress \"9\" to print currently focused item" }
Rectangle {
- id: Item3
+ id: item3
x: 10; y: 300
width: 100; height: 100; color: "green"
border.width: 5
border.color: wantsFocus?"blue":"black"
Keys.onDigit9Pressed: print("Bottom Left");
- KeyNavigation.up: MyScope
+ KeyNavigation.up: myScope
Rectangle {
width: 50; height: 50; anchors.centerIn: parent
diff --git a/examples/declarative/focusscope/test3.qml b/examples/declarative/focusscope/test3.qml
index 8a53c3a..e5aa7b6 100644
--- a/examples/declarative/focusscope/test3.qml
+++ b/examples/declarative/focusscope/test3.qml
@@ -6,7 +6,7 @@ Rectangle {
height: 600
ListModel {
- id: Model
+ id: model
ListElement { name: "1" }
ListElement { name: "2" }
ListElement { name: "3" }
@@ -19,16 +19,16 @@ Rectangle {
}
Component {
- id: VerticalDelegate
+ id: verticalDelegate
FocusScope {
- id: Root
- width: 50; height: 50;
+ id: root
+ width: 50; height: 50;
Keys.onDigit9Pressed: print("Error - " + name)
- Rectangle {
+ Rectangle {
focus: true
Keys.onDigit9Pressed: print(name)
- width: 50; height: 50;
- color: Root.ListView.isCurrentItem?"red":"green"
+ width: 50; height: 50;
+ color: root.ListView.isCurrentItem?"red":"green"
Text { text: name; anchors.centerIn: parent }
}
}
@@ -37,8 +37,8 @@ Rectangle {
ListView {
width: 800; height: 50; orientation: "Horizontal"
focus: true
- model: Model
- delegate: VerticalDelegate
+ model: model
+ delegate: verticalDelegate
preferredHighlightBegin: 100
preferredHighlightEnd: 101
strictlyEnforceHighlightRange: true
diff --git a/examples/declarative/focusscope/test4.qml b/examples/declarative/focusscope/test4.qml
index f366543..5d4fe35 100644
--- a/examples/declarative/focusscope/test4.qml
+++ b/examples/declarative/focusscope/test4.qml
@@ -8,27 +8,27 @@ Rectangle {
Keys.onDigit9Pressed: print("Error - Root")
FocusScope {
- id: MyScope
+ id: myScope
Keys.onDigit9Pressed: print("Error - FocusScope")
-
+
Rectangle {
height: 120
width: 420
color: "transparent"
border.width: 5
- border.color: MyScope.wantsFocus?"blue":"black"
+ border.color: myScope.wantsFocus?"blue":"black"
Rectangle {
- id: Item1
- x: 10; y: 10
+ id: item1
+ x: 10; y: 10
width: 100; height: 100; color: "green"
border.width: 5
border.color: wantsFocus?"blue":"black"
Keys.onDigit9Pressed: print("Error - Top Left");
- KeyNavigation.right: Item2
- focus: true
+ KeyNavigation.right: item2
+ focus: true
Rectangle {
width: 50; height: 50; anchors.centerIn: parent
@@ -37,12 +37,12 @@ Rectangle {
}
Rectangle {
- id: Item2
+ id: item2
x: 310; y: 10
width: 100; height: 100; color: "green"
border.width: 5
border.color: wantsFocus?"blue":"black"
- KeyNavigation.left: Item1
+ KeyNavigation.left: item1
Keys.onDigit9Pressed: print("Error - Top Right");
Rectangle {
@@ -51,20 +51,20 @@ Rectangle {
}
}
}
- KeyNavigation.down: Item3
+ KeyNavigation.down: item3
}
Text { x:100; y:170; text: "There should be no blue borders, or red squares.\nPressing \"9\" should do nothing.\nArrow keys should have no effect." }
Rectangle {
- id: Item3
+ id: item3
x: 10; y: 300
width: 100; height: 100; color: "green"
border.width: 5
border.color: wantsFocus?"blue":"black"
Keys.onDigit9Pressed: print("Error - Bottom Left");
- KeyNavigation.up: MyScope
+ KeyNavigation.up: myScope
Rectangle {
width: 50; height: 50; anchors.centerIn: parent
diff --git a/examples/declarative/follow/follow.qml b/examples/declarative/follow/follow.qml
index 1f585e2..3e164f9 100644
--- a/examples/declarative/follow/follow.qml
+++ b/examples/declarative/follow/follow.qml
@@ -4,7 +4,7 @@ Rectangle {
color: "#ffffff"
width: 320; height: 240
Rectangle {
- id: Rect
+ id: rect
color: "#00ff00"
y: 200; width: 60; height: 20
y: SequentialAnimation {
@@ -24,43 +24,43 @@ Rectangle {
// Velocity
Rectangle {
color: "#ff0000"
- x: Rect.width; width: Rect.width; height: 20
+ x: rect.width; width: rect.width; height: 20
y: 200
- y: SpringFollow { source: Rect.y; velocity: 200 }
+ y: SpringFollow { source: rect.y; velocity: 200 }
}
- Text { x: Rect.width; y: 220; text: "Velocity" }
+ Text { x: rect.width; y: 220; text: "Velocity" }
// Spring
Rectangle {
color: "#ff0000"
- x: Rect.width * 2; width: Rect.width/2; height: 20
+ x: rect.width * 2; width: rect.width/2; height: 20
y: 200
- y: SpringFollow { source: Rect.y; spring: 1.0; damping: 0.2 }
+ y: SpringFollow { source: rect.y; spring: 1.0; damping: 0.2 }
}
Rectangle {
color: "#880000"
- x: Rect.width * 2.5; width: Rect.width/2; height: 20
+ x: rect.width * 2.5; width: rect.width/2; height: 20
y: 200
- y: SpringFollow { source: Rect.y; spring: 1.0; damping: 0.2; mass: 3.0 } // "heavier" object
+ y: SpringFollow { source: rect.y; spring: 1.0; damping: 0.2; mass: 3.0 } // "heavier" object
}
- Text { x: Rect.width * 2; y: 220; text: "Spring" }
+ Text { x: rect.width * 2; y: 220; text: "Spring" }
// Follow mouse
MouseRegion {
- id: Mouse
+ id: mouseRegion
anchors.fill: parent
Rectangle {
- id: "Ball"
+ id: ball
width: 20; height: 20
radius: 10
color: "#0000ff"
- x: SpringFollow { id: "F1"; source: Mouse.mouseX-10; spring: 1.0; damping: 0.05; epsilon: 0.25 }
- y: SpringFollow { id: "F2"; source: Mouse.mouseY-10; spring: 1.0; damping: 0.05; epsilon: 0.25 }
+ x: SpringFollow { id: f1; source: mouseRegion.mouseX-10; spring: 1.0; damping: 0.05; epsilon: 0.25 }
+ y: SpringFollow { id: f2; source: mouseRegion.mouseY-10; spring: 1.0; damping: 0.05; epsilon: 0.25 }
states: [
State {
name: "following"
- when: !F1.inSync || !F2.inSync
- PropertyChanges { target: Ball; color: "#ff0000" }
+ when: !f1.inSync || !f2.inSync
+ PropertyChanges { target: ball; color: "#ff0000" }
}
]
transitions: [
diff --git a/examples/declarative/follow/pong.qml b/examples/declarative/follow/pong.qml
index b51c0d0..10ded36 100644
--- a/examples/declarative/follow/pong.qml
+++ b/examples/declarative/follow/pong.qml
@@ -1,37 +1,37 @@
import Qt 4.6
Rectangle {
- id: Page
+ id: page
width: 640; height: 480
color: "#000000"
// Make a ball to bounce
Rectangle {
// Add a property for the target y coordinate
- property var targetY : Page.height-10
+ property var targetY : page.height-10
property var direction : "right"
- id: Ball
+ id: ball
color: "#00ee00"
x: 20; width: 20; height: 20; z: 1
// Move the ball to the right and back to the left repeatedly
x: SequentialAnimation {
running: true; repeat: true
- NumberAnimation { to: Page.width-40; duration: 2000 }
- PropertyAction { target: Ball; property: "direction"; value: "left" }
+ NumberAnimation { to: page.width-40; duration: 2000 }
+ PropertyAction { target: ball; property: "direction"; value: "left" }
NumberAnimation { to: 20; duration: 2000 }
- PropertyAction { target: Ball; property: "direction"; value: "right" }
+ PropertyAction { target: ball; property: "direction"; value: "right" }
}
// Make y follow the target y coordinate, with a velocity of 200
- y: SpringFollow { source: Ball.targetY; velocity: 200 }
+ y: SpringFollow { source: ball.targetY; velocity: 200 }
// Detect the ball hitting the top or bottom of the view and bounce it
onYChanged: {
if (y <= 0)
- targetY = Page.height-20;
- else if (y >= Page.height-20)
+ targetY = page.height-20;
+ else if (y >= page.height-20)
targetY = 0;
}
}
@@ -39,31 +39,31 @@ Rectangle {
// Place bats to the left and right of the view, following the y
// coordinates of the ball.
Rectangle {
- id: LeftBat
+ id: leftBat
color: "#00ee00"
x: 2; width: 20; height: 90
y: SpringFollow {
- source: Ball.y-45; velocity: 300
- enabled: Ball.direction == 'left'
+ source: ball.y-45; velocity: 300
+ enabled: ball.direction == 'left'
}
}
Rectangle {
- id: RightBat
+ id: rightBat
color: "#00ee00"
- x: Page.width-22; width: 20; height: 90
+ x: page.width-22; width: 20; height: 90
y: SpringFollow {
- source: Ball.y-45; velocity: 300
- enabled: Ball.direction == 'right'
+ source: ball.y-45; velocity: 300
+ enabled: ball.direction == 'right'
}
}
// The rest, to make it look realistic, if neither ever scores...
- Rectangle { color: "#00ee00"; x: Page.width/2-80; y: 0; width: 40; height: 60 }
- Rectangle { color: "#000000"; x: Page.width/2-70; y: 10; width: 20; height: 40 }
- Rectangle { color: "#00ee00"; x: Page.width/2+40; y: 0; width: 40; height: 60 }
- Rectangle { color: "#000000"; x: Page.width/2+50; y: 10; width: 20; height: 40 }
+ Rectangle { color: "#00ee00"; x: page.width/2-80; y: 0; width: 40; height: 60 }
+ Rectangle { color: "#000000"; x: page.width/2-70; y: 10; width: 20; height: 40 }
+ Rectangle { color: "#00ee00"; x: page.width/2+40; y: 0; width: 40; height: 60 }
+ Rectangle { color: "#000000"; x: page.width/2+50; y: 10; width: 20; height: 40 }
Repeater {
- model: Page.height/20
- Rectangle { color: "#00ee00"; x: Page.width/2-5; y: index*20; width: 10; height: 10 }
+ model: page.height/20
+ Rectangle { color: "#00ee00"; x: page.width/2-5; y: index*20; width: 10; height: 10 }
}
}
diff --git a/examples/declarative/fonts/fonts.qml b/examples/declarative/fonts/fonts.qml
index f7ed494..4029f8b 100644
--- a/examples/declarative/fonts/fonts.qml
+++ b/examples/declarative/fonts/fonts.qml
@@ -4,62 +4,62 @@ Rectangle {
property string myText: "Lorem ipsum dolor sit amet, consectetur adipisicing elit"
width: 800; height: 600
- color: Palette.base
+ color: palette.base
- SystemPalette { id: Palette; colorGroup: Qt.Active }
+ SystemPalette { id: palette; colorGroup: Qt.Active }
- FontLoader { id: FixedFont; name: "Courier" }
+ FontLoader { id: fixedFont; name: "Courier" }
- FontLoader { id: LocalFont; source: "fonts/Fontin-Bold.ttf" }
+ FontLoader { id: localFont; source: "fonts/Fontin-Bold.ttf" }
/* A font by Jos Buivenga (exljbris) -> www.exljbris.nl */
- FontLoader { id: WebFont; source: "http://www.princexml.com/fonts/steffmann/Starburst.ttf" }
- FontLoader { id: WebFont2; source: "http://wrong.address.org" }
+ FontLoader { id: webFont; source: "http://www.princexml.com/fonts/steffmann/Starburst.ttf" }
+ FontLoader { id: webFont2; source: "http://wrong.address.org" }
Column {
anchors.fill: parent
anchors.leftMargin: 10; anchors.rightMargin: 10
Text {
text: myText
- color: Palette.windowText
+ color: palette.windowText
width: parent.width; elide: "ElideRight"
font.family: "Times"
font.pointSize: 32
}
Text {
text: myText
- color: Palette.windowText
+ color: palette.windowText
width: parent.width; elide: "ElideRight"
- font.family: FixedFont.name
+ font.family: fixedFont.name
font.pointSize: 32
}
Text {
text: myText
- color: Palette.windowText
+ color: palette.windowText
width: parent.width; elide: "ElideRight"
- font.family: LocalFont.name
+ font.family: localFont.name
font.pointSize: 32
}
Text {
text: {
- if (WebFont.status == 1) myText
- else if (WebFont.status == 2) "Loading..."
- else if (WebFont.status == 3) "Error loading font"
+ if (webFont.status == 1) myText
+ else if (webFont.status == 2) "Loading..."
+ else if (webFont.status == 3) "Error loading font"
}
- color: Palette.windowText
+ color: palette.windowText
width: parent.width; elide: "ElideRight"
- font.family: WebFont.name
+ font.family: webFont.name
font.pointSize: 32
}
Text {
text: {
- if (WebFont2.status == 1) myText
- else if (WebFont2.status == 2) "Loading..."
- else if (WebFont2.status == 3) "Error loading font"
+ if (webFont2.status == 1) myText
+ else if (webFont2.status == 2) "Loading..."
+ else if (webFont2.status == 3) "Error loading font"
}
- color: Palette.windowText
+ color: palette.windowText
width: parent.width; elide: "ElideRight"
- font.family: WebFont2.name
+ font.family: webFont2.name
font.pointSize: 32
}
}
diff --git a/examples/declarative/gridview/gridview.qml b/examples/declarative/gridview/gridview.qml
new file mode 100644
index 0000000..2e5110a
--- /dev/null
+++ b/examples/declarative/gridview/gridview.qml
@@ -0,0 +1,60 @@
+import Qt 4.6
+
+Rectangle {
+ width: 300; height: 400; color: "white"
+
+ ListModel {
+ id: AppModel
+ ListElement {
+ name: "Music"
+ icon: "AudioPlayer_48.png"
+ }
+ ListElement {
+ name: "Movies"
+ icon: "VideoPlayer_48.png"
+ }
+ ListElement {
+ name: "Camera"
+ icon: "Camera_48.png"
+ }
+ ListElement {
+ name: "Calendar"
+ icon: "DateBook_48.png"
+ }
+ ListElement {
+ name: "Messaging"
+ icon: "EMail_48.png"
+ }
+ ListElement {
+ name: "Todo List"
+ icon: "TodoList_48.png"
+ }
+ ListElement {
+ name: "Contacts"
+ icon: "AddressBook_48.png"
+ }
+ }
+
+ Component {
+ id: AppDelegate
+ Item {
+ width: 100; height: 100
+ Image { id: Icon; y: 20; anchors.horizontalCenter: parent.horizontalCenter; source: icon }
+ Text { anchors.top: Icon.bottom; anchors.horizontalCenter: parent.horizontalCenter; text: name }
+ }
+ }
+
+ Component {
+ id: AppHighlight
+ Rectangle { width: 80; height: 80; color: "#FFFF88" }
+ }
+
+ GridView {
+ id: List1
+ anchors.fill: parent
+ cellWidth: 100; cellHeight: 100
+ model: AppModel; delegate: AppDelegate
+ highlight: AppHighlight
+ focus: true
+ }
+}
diff --git a/examples/declarative/gridview/pics/AddressBook_48.png b/examples/declarative/gridview/pics/AddressBook_48.png
new file mode 100644
index 0000000..1ab7c8e
--- /dev/null
+++ b/examples/declarative/gridview/pics/AddressBook_48.png
Binary files differ
diff --git a/examples/declarative/gridview/pics/AudioPlayer_48.png b/examples/declarative/gridview/pics/AudioPlayer_48.png
new file mode 100644
index 0000000..f4b8689
--- /dev/null
+++ b/examples/declarative/gridview/pics/AudioPlayer_48.png
Binary files differ
diff --git a/examples/declarative/gridview/pics/Camera_48.png b/examples/declarative/gridview/pics/Camera_48.png
new file mode 100644
index 0000000..c76b524
--- /dev/null
+++ b/examples/declarative/gridview/pics/Camera_48.png
Binary files differ
diff --git a/examples/declarative/gridview/pics/DateBook_48.png b/examples/declarative/gridview/pics/DateBook_48.png
new file mode 100644
index 0000000..58f5787
--- /dev/null
+++ b/examples/declarative/gridview/pics/DateBook_48.png
Binary files differ
diff --git a/examples/declarative/gridview/pics/EMail_48.png b/examples/declarative/gridview/pics/EMail_48.png
new file mode 100644
index 0000000..d6d84a6
--- /dev/null
+++ b/examples/declarative/gridview/pics/EMail_48.png
Binary files differ
diff --git a/examples/declarative/gridview/pics/TodoList_48.png b/examples/declarative/gridview/pics/TodoList_48.png
new file mode 100644
index 0000000..0988448
--- /dev/null
+++ b/examples/declarative/gridview/pics/TodoList_48.png
Binary files differ
diff --git a/examples/declarative/gridview/pics/VideoPlayer_48.png b/examples/declarative/gridview/pics/VideoPlayer_48.png
new file mode 100644
index 0000000..52638c5
--- /dev/null
+++ b/examples/declarative/gridview/pics/VideoPlayer_48.png
Binary files differ
diff --git a/examples/declarative/listview/content/ClickAutoRepeating.qml b/examples/declarative/listview/content/ClickAutoRepeating.qml
index 19dd6f6..f0e7df1 100644
--- a/examples/declarative/listview/content/ClickAutoRepeating.qml
+++ b/examples/declarative/listview/content/ClickAutoRepeating.qml
@@ -1,7 +1,7 @@
import Qt 4.6
Item {
- id: Page
+ id: page
property int repeatdelay: 300
property int repeatperiod: 75
property bool pressed: false
@@ -9,21 +9,20 @@ Item {
signal released
signal clicked
pressed: SequentialAnimation {
- id: AutoRepeat
- PropertyAction { target: Page; property: "pressed"; value: true }
- ScriptAction { script: Page.onPressed }
- ScriptAction { script: Page.onClicked }
+ id: autoRepeat
+ PropertyAction { target: page; property: "pressed"; value: true }
+ ScriptAction { script: page.onPressed }
+ ScriptAction { script: page.onClicked }
PauseAnimation { duration: repeatdelay }
SequentialAnimation {
repeat: true
- ScriptAction { script: Page.onClicked }
+ ScriptAction { script: page.onClicked }
PauseAnimation { duration: repeatperiod }
}
}
MouseRegion {
- id: MR
anchors.fill: parent
- onPressed: AutoRepeat.start()
- onReleased: { AutoRepeat.stop(); parent.pressed = false; Page.released }
+ onPressed: autoRepeat.start()
+ onReleased: { autoRepeat.stop(); parent.pressed = false; page.released }
}
}
diff --git a/examples/declarative/listview/content/MediaButton.qml b/examples/declarative/listview/content/MediaButton.qml
index 3b0ef1e..1c88844 100644
--- a/examples/declarative/listview/content/MediaButton.qml
+++ b/examples/declarative/listview/content/MediaButton.qml
@@ -4,36 +4,32 @@ Item {
property var text
signal clicked
- id: Container
+ id: container
Image {
- id: Normal
+ id: normal
source: "pics/button.png"
}
Image {
- id: Pressed
+ id: pressed
source: "pics/button-pressed.png"
opacity: 0
}
MouseRegion {
- id: ClickRegion
- anchors.fill: Normal
- onClicked: { Container.clicked(); }
+ id: clickRegion
+ anchors.fill: normal
+ onClicked: { container.clicked(); }
}
Text {
font.bold: true
color: "white"
- anchors.centerIn: Normal
- text: Container.text
+ anchors.centerIn: normal
+ text: container.text
+ }
+ width: normal.width
+
+ states: State {
+ name: "Pressed"
+ when: clickRegion.pressed == true
+ PropertyChanges { target: pressed; opacity: 1 }
}
- width: Normal.width
- states: [
- State {
- name: "Pressed"
- when: ClickRegion.pressed == true
- PropertyChanges {
- target: Pressed
- opacity: 1
- }
- }
- ]
}
diff --git a/examples/declarative/listview/dynamic.qml b/examples/declarative/listview/dynamic.qml
index 52c3c0b..4f8e483 100644
--- a/examples/declarative/listview/dynamic.qml
+++ b/examples/declarative/listview/dynamic.qml
@@ -6,7 +6,7 @@ Item {
height: 500
ListModel {
- id: FruitModel
+ id: fruitModel
ListElement {
name: "Apple"
cost: 2.45
@@ -56,13 +56,13 @@ Item {
}
Component {
- id: FruitDelegate
+ id: fruitDelegate
Item {
width: parent.width; height: 55
- Text { id: Label; font.pixelSize: 24; text: name; elide: "ElideRight"; anchors.right: Cost.left; anchors.left:parent.left }
- Text { id: Cost; font.pixelSize: 24; text: '$'+Number(cost).toFixed(2); anchors.right: ItemButtons.left }
- Row {
- anchors.top: Label.bottom
+ Text { id: label; font.pixelSize: 24; text: name; elide: "ElideRight"; anchors.right: cost.left; anchors.left:parent.left }
+ Text { id: cost; font.pixelSize: 24; text: '$'+Number(cost).toFixed(2); anchors.right: itemButtons.left }
+ Row {
+ anchors.top: label.bottom
spacing: 5
Repeater {
model: attributes
@@ -72,27 +72,27 @@ Item {
}
}
Row {
- id: ItemButtons
+ id: itemButtons
anchors.right: parent.right
width: childrenRect.width
Image { source: "content/pics/add.png"
- ClickAutoRepeating { id: ClickUp; anchors.fill: parent; onClicked: FruitModel.set(index,"cost",Number(cost)+0.25) }
- scale: ClickUp.pressed ? 0.9 : 1
+ ClickAutoRepeating { id: clickUp; anchors.fill: parent; onClicked: fruitModel.set(index,"cost",Number(cost)+0.25) }
+ scale: clickUp.pressed ? 0.9 : 1
}
Image { source: "content/pics/del.png"
- ClickAutoRepeating { id: ClickDown; anchors.fill: parent; onClicked: FruitModel.set(index,"cost",Math.max(0,Number(cost)-0.25)) }
- scale: ClickDown.pressed ? 0.9 : 1
+ ClickAutoRepeating { id: clickDown; anchors.fill: parent; onClicked: fruitModel.set(index,"cost",Math.max(0,Number(cost)-0.25)) }
+ scale: clickDown.pressed ? 0.9 : 1
}
Image { source: "content/pics/trash.png"
- MouseRegion { anchors.fill: parent; onClicked: FruitModel.remove(index) }
+ MouseRegion { anchors.fill: parent; onClicked: fruitModel.remove(index) }
}
Column {
width: childrenRect.width
Image { source: "content/pics/moreUp.png"
- MouseRegion { anchors.fill: parent; onClicked: FruitModel.move(index,index-1,1) }
+ MouseRegion { anchors.fill: parent; onClicked: fruitModel.move(index,index-1,1) }
}
Image { source: "content/pics/moreDown.png"
- MouseRegion { anchors.fill: parent; onClicked: FruitModel.move(index,index+1,1) }
+ MouseRegion { anchors.fill: parent; onClicked: fruitModel.move(index,index+1,1) }
}
}
}
@@ -100,23 +100,23 @@ Item {
}
ListView {
- model: FruitModel
- delegate: FruitDelegate
+ model: fruitModel
+ delegate: fruitDelegate
anchors.top: parent.top
anchors.left: parent.left
anchors.right: parent.right
- anchors.bottom: Buttons.top
+ anchors.bottom: buttons.top
}
Row {
width: childrenRect.width
height: childrenRect.height
anchors.bottom: parent.bottom
- id: Buttons
+ id: buttons
Image { source: "content/pics/add.png"
MouseRegion { anchors.fill: parent;
onClicked: {
- FruitModel.append({
+ fruitModel.append({
"name":"Pizza Margarita",
"cost":5.95,
"attributes":[{"description": "Cheese"},{"description": "Tomato"}]
@@ -127,7 +127,7 @@ Item {
Image { source: "content/pics/add.png"
MouseRegion { anchors.fill: parent;
onClicked: {
- FruitModel.insert(0,{
+ fruitModel.insert(0,{
"name":"Pizza Supreme",
"cost":9.95,
"attributes":[{"description": "Cheese"},{"description": "Tomato"},{"description": "The Works"}]
@@ -136,7 +136,7 @@ Item {
}
}
Image { source: "content/pics/trash.png"
- MouseRegion { anchors.fill: parent; onClicked: FruitModel.clear() }
+ MouseRegion { anchors.fill: parent; onClicked: fruitModel.clear() }
}
}
}
diff --git a/examples/declarative/listview/highlight.qml b/examples/declarative/listview/highlight.qml
index b6db453..be1f62d 100644
--- a/examples/declarative/listview/highlight.qml
+++ b/examples/declarative/listview/highlight.qml
@@ -10,9 +10,9 @@ Rectangle {
// Define a delegate component. A component will be
// instantiated for each visible item in the list.
Component {
- id: PetDelegate
+ id: petDelegate
Item {
- id: Wrapper
+ id: wrapper
width: 200; height: 50
Column {
Text { text: 'Name: ' + name }
@@ -24,8 +24,8 @@ Rectangle {
states: [
State {
name: "Current"
- when: Wrapper.ListView.isCurrentItem
- PropertyChanges { target: Wrapper; x: 10 }
+ when: wrapper.ListView.isCurrentItem
+ PropertyChanges { target: wrapper; x: 10 }
}
]
transitions: [
@@ -41,17 +41,17 @@ Rectangle {
// is set to false in the ListView so that we can control how the
// highlight moves to the current item.
Component {
- id: PetHighlight
+ id: petHighlight
Rectangle {
width: 200; height: 50; color: "#FFFF88"
- y: SpringFollow { source: List1.currentItem.y; spring: 3; damping: 0.1 }
+ y: SpringFollow { source: list1.currentItem.y; spring: 3; damping: 0.1 }
}
}
ListView {
- id: List1
+ id: list1
width: 200; height: parent.height
- model: MyPetsModel; delegate: PetDelegate
- highlight: PetHighlight; highlightFollowsCurrentItem: false
+ model: MyPetsModel; delegate: petDelegate
+ highlight: petHighlight; highlightFollowsCurrentItem: false
focus: true
}
}
diff --git a/examples/declarative/listview/itemlist.qml b/examples/declarative/listview/itemlist.qml
index 01781ec..6dfc90b 100644
--- a/examples/declarative/listview/itemlist.qml
+++ b/examples/declarative/listview/itemlist.qml
@@ -9,26 +9,26 @@ Rectangle {
height: 320
VisualItemModel {
- id: ItemModel
+ id: itemModel
Rectangle {
- height: View.height; width: View.width; color: "#FFFEF0"
+ height: view.height; width: view.width; color: "#FFFEF0"
Text { text: "Page 1"; font.bold: true; anchors.centerIn: parent }
}
Rectangle {
- height: View.height; width: View.width; color: "#F0FFF7"
+ height: view.height; width: view.width; color: "#F0FFF7"
Text { text: "Page 2"; font.bold: true; anchors.centerIn: parent }
}
Rectangle {
- height: View.height; width: View.width; color: "#F4F0FF"
+ height: view.height; width: view.width; color: "#F4F0FF"
Text { text: "Page 3"; font.bold: true; anchors.centerIn: parent }
}
}
ListView {
- id: View
+ id: view
anchors.fill: parent
anchors.bottomMargin: 30
- model: ItemModel
+ model: itemModel
preferredHighlightBegin: 0
preferredHighlightEnd: 1
strictlyEnforceHighlightRange: true
@@ -37,7 +37,7 @@ Rectangle {
Rectangle {
color: "gray"
- anchors.top: View.bottom
+ anchors.top: view.bottom
anchors.bottom: parent.bottom
height: 30
width: 240
@@ -46,12 +46,12 @@ Rectangle {
anchors.centerIn: parent
spacing: 20
Repeater {
- model: ItemModel.count
+ model: itemModel.count
Rectangle {
width: 5; height: 5
radius: 3
- MouseRegion { width: 20; height: 20; anchors.centerIn: parent; onClicked: View.currentIndex = index }
- color: View.currentIndex == index ? "blue" : "white"
+ MouseRegion { width: 20; height: 20; anchors.centerIn: parent; onClicked: view.currentIndex = index }
+ color: view.currentIndex == index ? "blue" : "white"
}
}
}
diff --git a/examples/declarative/listview/listview.qml b/examples/declarative/listview/listview.qml
index ac1cef1..98974fd 100644
--- a/examples/declarative/listview/listview.qml
+++ b/examples/declarative/listview/listview.qml
@@ -10,9 +10,8 @@ Rectangle {
// Define a delegate component. A component will be
// instantiated for each visible item in the list.
Component {
- id: PetDelegate
+ id: petDelegate
Item {
- id: Wrapper
width: 200; height: 50
Column {
Text { text: 'Name: ' + name }
@@ -25,7 +24,7 @@ Rectangle {
// Define a highlight component. Just one of these will be instantiated
// by each ListView and placed behind the current item.
Component {
- id: PetHighlight
+ id: petHighlight
Rectangle { color: "#FFFF88" }
}
@@ -50,25 +49,25 @@ Rectangle {
// the third ListView's currentIndex. By flicking List3 with
// the mouse, the current index of List1 will be changed.
ListView {
- id: List1
+ id: list1
width: 200; height: parent.height
- model: MyPetsModel; delegate: PetDelegate
- highlight: PetHighlight; currentIndex: List3.currentIndex
+ model: MyPetsModel; delegate: petDelegate
+ highlight: petHighlight; currentIndex: list3.currentIndex
focus: true
}
ListView {
- id: List2
+ id: list2
x: 200; width: 200; height: parent.height
- model: MyPetsModel; delegate: PetDelegate; highlight: PetHighlight
+ model: MyPetsModel; delegate: petDelegate; highlight: petHighlight
preferredHighlightBegin: 80
preferredHighlightEnd: 220
- currentIndex: List1.currentIndex
+ currentIndex: list1.currentIndex
}
ListView {
- id: List3
+ id: list3
x: 400; width: 200; height: parent.height
- model: MyPetsModel; delegate: PetDelegate; highlight: PetHighlight
- currentIndex: List1.currentIndex
+ model: MyPetsModel; delegate: petDelegate; highlight: petHighlight
+ currentIndex: list1.currentIndex
preferredHighlightBegin: 125
preferredHighlightEnd: 126
strictlyEnforceHighlightRange: true
diff --git a/examples/declarative/listview/recipes.qml b/examples/declarative/listview/recipes.qml
index 2148ef4..4ccb344 100644
--- a/examples/declarative/listview/recipes.qml
+++ b/examples/declarative/listview/recipes.qml
@@ -13,7 +13,7 @@ Rectangle {
id: recipeDelegate
Item {
id: wrapper
- width: List.width
+ width: list.width
// Create a property to contain the visibility of the details.
// We can bind multiple element's opacity to this one property,
// rather than having a "PropertyChanges" line for each element we
@@ -102,7 +102,7 @@ Rectangle {
// Make details visible
PropertyChanges { target: wrapper; detailsOpacity: 1; x: 0 }
// Make the detailed view fill the entire list area
- PropertyChanges { target: wrapper; height: List.height }
+ PropertyChanges { target: wrapper; height: list.height }
// Move the list so that this item is at the top.
PropertyChanges { target: wrapper.ListView.view; explicit: true; viewportY: wrapper.y }
// Disallow flicking while we're in detailed view
@@ -125,7 +125,7 @@ Rectangle {
]
// The actual list
ListView {
- id: List
+ id: list
model: Recipes; delegate: recipeDelegate
anchors.fill: parent; clip: true
}
diff --git a/examples/declarative/listview/sections.qml b/examples/declarative/listview/sections.qml
index ddb4931..6b1a589 100644
--- a/examples/declarative/listview/sections.qml
+++ b/examples/declarative/listview/sections.qml
@@ -12,32 +12,32 @@ Rectangle {
// Define a delegate component that includes a separator for sections.
Component {
- id: PetDelegate
+ id: petDelegate
Item {
- id: Wrapper
+ id: wrapper
width: 200
// My height is the combined height of the description and the section separator
- height: Separator.height + Desc.height
+ height: separator.height + desc.height
Rectangle {
- id: Separator
+ id: separator
color: "lightsteelblue"
width: parent.width
// Only show the section separator when we are the beginning of a new section
// Note that for this to work nicely, the list must be ordered by section.
- height: Wrapper.ListView.prevSection != Wrapper.ListView.section ? 20 : 0
- opacity: Wrapper.ListView.prevSection != Wrapper.ListView.section ? 1 : 0
+ height: wrapper.ListView.prevSection != wrapper.ListView.section ? 20 : 0
+ opacity: wrapper.ListView.prevSection != wrapper.ListView.section ? 1 : 0
Text {
- text: Wrapper.ListView.section; font.bold: true
+ text: wrapper.ListView.section; font.bold: true
x: 2; height: parent.height; verticalAlignment: 'AlignVCenter'
}
}
Item {
- id: Desc
+ id: desc
x: 5
- height: Layout.height + 4
- anchors.top: Separator.bottom
+ height: layout.height + 4
+ anchors.top: separator.bottom
Column {
- id: Layout
+ id: layout
y: 2
Text { text: 'Name: ' + name }
Text { text: 'Type: ' + type }
@@ -49,7 +49,7 @@ Rectangle {
// Define a highlight component. Just one of these will be instantiated
// by each ListView and placed behind the current item.
Component {
- id: PetHighlight
+ id: petHighlight
Rectangle {
color: "#FFFF88"
}
@@ -60,8 +60,8 @@ Rectangle {
width: 200
height: parent.height
model: MyPetsModel
- delegate: PetDelegate
- highlight: PetHighlight
+ delegate: petDelegate
+ highlight: petHighlight
// The sectionExpression is simply the size of the pet.
// We use this to determine which section we are in above.
sectionExpression: "size"
diff --git a/examples/declarative/loader/Browser.qml b/examples/declarative/loader/Browser.qml
index 6711de4..5f972f1 100644
--- a/examples/declarative/loader/Browser.qml
+++ b/examples/declarative/loader/Browser.qml
@@ -1,22 +1,22 @@
import Qt 4.6
Rectangle {
- id: Root
+ id: root
width: parent.width
height: parent.height
- color: Palette.base
+ color: palette.base
FolderListModel {
id: folders
nameFilters: [ "*.qml" ]
// folder: "E:"
}
- SystemPalette { id: Palette; colorGroup: Qt.Active }
+ SystemPalette { id: palette; colorGroup: Qt.Active }
Component {
- id: FolderDelegate
+ id: folderDelegate
Rectangle {
- id: Wrapper
+ id: wrapper
function launch() {
if (folders.isFolder(index)) {
folders.folder = filePath;
@@ -24,15 +24,15 @@ Rectangle {
qmlLauncher.launch(filePath);
}
}
- width: Root.width
+ width: root.width
height: 32
color: "transparent"
Rectangle {
- id: Highlight; visible: false
+ id: highlight; visible: false
anchors.fill: parent
gradient: Gradient {
- GradientStop { id: t1; position: 0.0; color: Palette.highlight }
- GradientStop { id: t2; position: 1.0; color: Palette.lighter(Palette.highlight) }
+ GradientStop { id: t1; position: 0.0; color: palette.highlight }
+ GradientStop { id: t2; position: 1.0; color: palette.lighter(palette.highlight) }
}
}
Item {
@@ -40,23 +40,23 @@ Rectangle {
Image { source: "images/fileopen.png"; anchors.centerIn: parent; visible: folders.isFolder(index)}
}
Text {
- id: NameText
+ id: nameText
anchors.fill: parent; verticalAlignment: "AlignVCenter"
text: fileName; anchors.leftMargin: 32
font.pointSize: 10
- color: Palette.windowText
+ color: palette.windowText
}
MouseRegion {
- id: Mouse
+ id: mouseRegion
anchors.fill: parent
onClicked: { launch() }
}
states: [
State {
name: "pressed"
- when: Mouse.pressed
- PropertyChanges { target: Highlight; visible: true }
- PropertyChanges { target: NameText; color: Palette.highlightedText }
+ when: mouseRegion.pressed
+ PropertyChanges { target: highlight; visible: true }
+ PropertyChanges { target: nameText; color: palette.highlightedText }
}
]
}
@@ -70,43 +70,43 @@ Rectangle {
}
ListView {
- id: View
- anchors.top: TitleBar.bottom
+ id: view
+ anchors.top: titleBar.bottom
anchors.left: parent.left
anchors.right: parent.right
anchors.bottom: parent.bottom
model: folders
- delegate: FolderDelegate
+ delegate: folderDelegate
highlight: Rectangle { color: "#FFFBAF" }
clip: true
focus: true
Keys.onPressed: {
if (event.key == Qt.Key_Return || event.key == Qt.Key_Select) {
- View.currentItem.launch();
+ view.currentItem.launch();
event.accepted = true;
}
}
}
Rectangle {
- id: TitleBar
+ id: titleBar
width: parent.width
height: 32
- color: Palette.button; border.color: Palette.mid
+ color: palette.button; border.color: palette.mid
Rectangle {
- id: UpButton
+ id: upButton
width: 30
- height: TitleBar.height
- border.color: Palette.mid; color: "transparent"
+ height: titleBar.height
+ border.color: palette.mid; color: "transparent"
MouseRegion { anchors.fill: parent; onClicked: folders.folder = up(folders.folder) }
Image { anchors.centerIn: parent; source: "images/up.png" }
}
Text {
- anchors.left: UpButton.right; anchors.right: parent.right; height: parent.height
+ anchors.left: upButton.right; anchors.right: parent.right; height: parent.height
anchors.leftMargin: 4; anchors.rightMargin: 4
- text: folders.folder; color: Palette.buttonText
+ text: folders.folder; color: palette.buttonText
elide: "ElideLeft"; horizontalAlignment: "AlignRight"; verticalAlignment: "AlignVCenter"
}
}
diff --git a/examples/declarative/loader/Button.qml b/examples/declarative/loader/Button.qml
index d01a658..928ff06 100644
--- a/examples/declarative/loader/Button.qml
+++ b/examples/declarative/loader/Button.qml
@@ -1,16 +1,16 @@
import Qt 4.6
Rectangle {
- id: Container
+ id: container
property var text
signal clicked
- height: Text.height + 10
- width: Text.width + 20
+ height: text.height + 10
+ width: text.width + 20
border.width: 1
radius: 4
color: "grey"
- MouseRegion { anchors.fill: parent; onClicked: Container.clicked() }
- Text { id: Text; anchors.centerIn:parent; font.pointSize: 10; text: parent.text }
+ MouseRegion { anchors.fill: parent; onClicked: container.clicked() }
+ Text { id: text; anchors.centerIn:parent; font.pointSize: 10; text: parent.text }
}
diff --git a/examples/declarative/scrollbar/ScrollBar.qml b/examples/declarative/scrollbar/ScrollBar.qml
index b42563d..802b537 100644
--- a/examples/declarative/scrollbar/ScrollBar.qml
+++ b/examples/declarative/scrollbar/ScrollBar.qml
@@ -1,7 +1,7 @@
import Qt 4.6
Item {
- id: ScrollBar
+ id: scrollBar
// The properties that define the scrollbar's state.
// 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%
@@ -13,7 +13,7 @@ Item {
// A light, semi-transparent background
Rectangle {
- id: Background
+ id: background
radius: orientation == 'Vertical' ? (width/2 - 1) : (height/2 - 1)
color: "white"; opacity: 0.3
anchors.fill: parent
@@ -23,9 +23,9 @@ Item {
opacity: 0.7
color: "black"
radius: orientation == 'Vertical' ? (width/2 - 1) : (height/2 - 1)
- 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)
+ 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)
}
}
diff --git a/examples/declarative/scrollbar/display.qml b/examples/declarative/scrollbar/display.qml
index 0180bda..536a8b7 100644
--- a/examples/declarative/scrollbar/display.qml
+++ b/examples/declarative/scrollbar/display.qml
@@ -5,21 +5,21 @@ Rectangle {
height: 480
// Create a flickable to view a large image.
Flickable {
- id: View
+ id: view
anchors.fill: parent
Image {
- id: Picture
+ id: picture
source: "pics/niagara_falls.jpg"
}
- viewportWidth: Picture.width
- viewportHeight: Picture.height
+ viewportWidth: picture.width
+ viewportHeight: picture.height
// Only show the scrollbars when the view is moving.
states: [
State {
name: "ShowBars"
- when: View.moving
- PropertyChanges { target: SBV; opacity: 1 }
- PropertyChanges { target: SBH; opacity: 1 }
+ when: view.moving
+ PropertyChanges { target: verticalScrollBar; opacity: 1 }
+ PropertyChanges { target: horizontalScrollBar; opacity: 1 }
}
]
transitions: [
@@ -35,23 +35,23 @@ Rectangle {
}
// Attach scrollbars to the right and bottom edges of the view.
ScrollBar {
- id: SBV
+ id: verticalScrollBar
opacity: 0
orientation: "Vertical"
- position: View.visibleArea.yPosition
- pageSize: View.visibleArea.heightRatio
+ position: view.visibleArea.yPosition
+ pageSize: view.visibleArea.heightRatio
width: 12
- height: View.height-12
- anchors.right: View.right
+ height: view.height-12
+ anchors.right: view.right
}
ScrollBar {
- id: SBH
+ id: horizontalScrollBar
opacity: 0
orientation: "Horizontal"
- position: View.visibleArea.xPosition
- pageSize: View.visibleArea.widthRatio
+ position: view.visibleArea.xPosition
+ pageSize: view.visibleArea.widthRatio
height: 12
- width: View.width-12
- anchors.bottom: View.bottom
+ width: view.width-12
+ anchors.bottom: view.bottom
}
}
diff --git a/examples/declarative/slideswitch/Switch.qml b/examples/declarative/slideswitch/Switch.qml
index a778c1a..1620805 100644
--- a/examples/declarative/slideswitch/Switch.qml
+++ b/examples/declarative/slideswitch/Switch.qml
@@ -1,53 +1,53 @@
import Qt 4.6
Item {
- id: Switch
- width: Groove.width; height: Groove.height
+ id: mySwitch
+ width: groove.width; height: groove.height
property var on
Script {
function toggle() {
- if(Switch.state == "On")
- Switch.state = "Off";
+ if(mySwitch.state == "On")
+ mySwitch.state = "Off";
else
- Switch.state = "On";
+ mySwitch.state = "On";
}
function dorelease() {
- if(Knob.x == 1) {
- if(Switch.state == "Off")
+ if(knob.x == 1) {
+ if(mySwitch.state == "Off")
return;
}
- if(Knob.x == 78) {
- if(Switch.state == "On")
+ if(knob.x == 78) {
+ if(mySwitch.state == "On")
return;
}
toggle();
}
-
+
}
- Image { id: Groove; source: "background.svg" }
- MouseRegion { anchors.fill: Groove; onClicked: { toggle() } }
- Image { id: Knob; source: "knob.svg"; x: 1; y: 2 }
+ Image { id: groove; source: "background.svg" }
+ MouseRegion { anchors.fill: groove; onClicked: { toggle() } }
+ Image { id: knob; source: "knob.svg"; x: 1; y: 2 }
MouseRegion {
- anchors.fill: Knob
+ anchors.fill: knob
onClicked: { toggle() }
onReleased: { dorelease() }
- drag.target: Knob; drag.axis: "XAxis"; drag.minimumX: 1; drag.maximumX: 78
+ drag.target: knob; drag.axis: "XAxis"; drag.minimumX: 1; drag.maximumX: 78
}
states: [
State {
name: "On"
- PropertyChanges { target: Knob; x: 78 }
- PropertyChanges { target: Switch; on: true }
+ PropertyChanges { target: knob; x: 78 }
+ PropertyChanges { target: mySwitch; on: true }
},
State {
name: "Off"
- PropertyChanges { target: Knob; x: 1 }
- PropertyChanges { target: Switch; on: false }
+ PropertyChanges { target: knob; x: 1 }
+ PropertyChanges { target: mySwitch; on: false }
}
]
transitions: [
diff --git a/examples/declarative/smooth/GradientRect.qml b/examples/declarative/smooth/GradientRect.qml
index c4a287c..ed56418 100644
--- a/examples/declarative/smooth/GradientRect.qml
+++ b/examples/declarative/smooth/GradientRect.qml
@@ -1,7 +1,7 @@
import Qt 4.6
Item {
- id: MyRect
+ id: rect
property string color
property string border : ""
property int rotation
@@ -11,13 +11,13 @@ Item {
width: 80; height: 80
Item {
- anchors.centerIn: parent; rotation: MyRect.rotation;
+ anchors.centerIn: parent; rotation: rect.rotation;
Rectangle {
anchors.centerIn: parent; width: 80; height: 80
- border.color: MyRect.border; border.width: MyRect.border != "" ? 2 : 0
- radius: MyRect.radius; smooth: MyRect.smooth
+ border.color: rect.border; border.width: rect.border != "" ? 2 : 0
+ radius: rect.radius; smooth: rect.smooth
gradient: Gradient {
- GradientStop { position: 0.0; color: MyRect.color }
+ GradientStop { position: 0.0; color: rect.color }
GradientStop { position: 1.0; color: "white" }
}
}
diff --git a/examples/declarative/smooth/MyRect.qml b/examples/declarative/smooth/MyRect.qml
index 3b68307..9b6c3ae 100644
--- a/examples/declarative/smooth/MyRect.qml
+++ b/examples/declarative/smooth/MyRect.qml
@@ -1,7 +1,7 @@
import Qt 4.6
Item {
- id: MyRect
+ id: rect
property string color
property string border : ""
property int rotation
@@ -11,11 +11,11 @@ Item {
width: 80; height: 80
Item {
- anchors.centerIn: parent; rotation: MyRect.rotation;
+ anchors.centerIn: parent; rotation: rect.rotation;
Rectangle {
anchors.centerIn: parent; width: 80; height: 80
- color: MyRect.color; border.color: MyRect.border; border.width: MyRect.border != "" ? 2 : 0
- radius: MyRect.radius; smooth: MyRect.smooth
+ color: rect.color; border.color: rect.border; border.width: rect.border != "" ? 2 : 0
+ radius: rect.radius; smooth: rect.smooth
}
}
}
diff --git a/examples/declarative/snow/ImageBatch.qml b/examples/declarative/snow/ImageBatch.qml
index 8980034..62f986c 100644
--- a/examples/declarative/snow/ImageBatch.qml
+++ b/examples/declarative/snow/ImageBatch.qml
@@ -1,7 +1,7 @@
import Qt 4.6
GridView {
- id: MyGrid
+ id: grid
property int offset: 0
property var ref
property bool isSelected: ref.selectedItemColumn >= offset && ref.selectedItemColumn < offset + 5
@@ -17,10 +17,10 @@ GridView {
cellHeight: imageHeight
states: State {
- name: "selected"; when: MyGrid.isSelected
- PropertyChanges { target: MyGrid; z: 150 }
+ name: "selected"; when: grid.isSelected
+ PropertyChanges { target: grid; z: 150 }
}
- transitions: Transition {
+ transitions: Transition {
SequentialAnimation {
PauseAnimation { duration: 150 }
PropertyAction { properties: "z" }
@@ -35,20 +35,20 @@ GridView {
XmlRole { name: "url"; query: "media:content/@url/string()" }
}
- Item {
- id: Root
- property bool isSelected: GridView.isCurrentItem && MyGrid.isSelected
+ Item {
+ id: root
+ property bool isSelected: GridView.isCurrentItem && grid.isSelected
transformOrigin: "Center"
- width: MyGrid.imageWidth; height: MyGrid.imageHeight;
+ width: grid.imageWidth; height: grid.imageHeight;
- Image { id: FlickrImage; source: url; fillMode: "PreserveAspectFit"; smooth: true; anchors.fill: parent;
- opacity: (status == 1)?1:0; opacity: Behavior { NumberAnimation { properties: "opacity" } } }
- Loading { anchors.centerIn: parent; visible: FlickrImage.status!=1 }
+ Image { id: flickrImage; source: url; fillMode: "PreserveAspectFit"; smooth: true; anchors.fill: parent;
+ opacity: (status == 1)?1:0; opacity: Behavior { NumberAnimation { properties: "opacity" } } }
+ Loading { anchors.centerIn: parent; visible: flickrImage.status!=1 }
states: State {
name: "selected"
- when: Root.isSelected
- PropertyChanges { target: Root; scale: 3; z: 100 }
+ when: root.isSelected
+ PropertyChanges { target: root; scale: 3; z: 100 }
}
transitions: [
Transition {
diff --git a/examples/declarative/snow/Loading.qml b/examples/declarative/snow/Loading.qml
index ff2c829..054656a 100644
--- a/examples/declarative/snow/Loading.qml
+++ b/examples/declarative/snow/Loading.qml
@@ -1,8 +1,8 @@
import Qt 4.6
Image {
- id: Loading; source: "pics/loading.png"; transformOrigin: "Center"
+ id: loading; source: "pics/loading.png"; transformOrigin: "Center"
rotation: NumberAnimation {
- id: "RotationAnimation"; from: 0; to: 360; running: Loading.visible == true; repeat: true; duration: 900
+ id: rotationAnimation; from: 0; to: 360; running: loading.visible == true; repeat: true; duration: 900
}
}
diff --git a/examples/declarative/snow/create.js b/examples/declarative/snow/create.js
index 9def7a7..2bdae4a 100644
--- a/examples/declarative/snow/create.js
+++ b/examples/declarative/snow/create.js
@@ -1,12 +1,12 @@
var myComponent = null;
function createNewBlock() {
- if (myComponent == null)
+ if (myComponent == null)
myComponent = createComponent("ImageBatch.qml");
var obj = myComponent.createObject();
- obj.parent = MyLayout;
+ obj.parent = layout;
obj.offset = maximumColumn + 1;
- obj.ref = ImagePanel;
+ obj.ref = imagePanel;
maximumColumn += 5;
}
diff --git a/examples/declarative/snow/snow.qml b/examples/declarative/snow/snow.qml
index 2241c3f..39c9c43 100644
--- a/examples/declarative/snow/snow.qml
+++ b/examples/declarative/snow/snow.qml
@@ -1,7 +1,7 @@
import Qt 4.6
Rectangle {
- id: ImagePanel
+ id: imagePanel
width: 1024
height: 768
color: "black"
@@ -23,7 +23,7 @@ Rectangle {
Item {
anchors.centerIn: parent
Row {
- id: MyLayout
+ id: layout
property real targetX: -(selectedX + imageWidth / 2)
property real targetDeform: 0
@@ -31,19 +31,19 @@ Rectangle {
property real deform: 0
deform: SpringFollow {
- id: "DeformFollow"; source: MyLayout.targetDeform; velocity: MyLayout.slowDeform?0.1:2
- onSyncChanged: if(inSync) { MyLayout.slowDeform = true; MyLayout.targetDeform = 0; }
+ id: deformFollow; source: layout.targetDeform; velocity: layout.slowDeform?0.1:2
+ onSyncChanged: if(inSync) { layout.slowDeform = true; layout.targetDeform = 0; }
}
-
- ImageBatch { offset: 0; ref: ImagePanel }
- x: SpringFollow { source: MyLayout.targetX; velocity: 1000 }
+ ImageBatch { offset: 0; ref: imagePanel }
+
+ x: SpringFollow { source: layout.targetX; velocity: 1000 }
y: SpringFollow { source: -(selectedY + imageHeight / 2); velocity: 500 }
}
transform: Rotation {
axis.y: 1; axis.z: 0
- angle: MyLayout.deform * -100
+ angle: layout.deform * -100
}
}
@@ -51,13 +51,13 @@ Rectangle {
function left() {
if (selectedItemColumn <= 0) return;
selectedItemColumn -= 1;
- MyLayout.slowDeform = false;
- MyLayout.targetDeform = Math.max(Math.min(MyLayout.deform - 0.1, -0.1), -0.4);
+ layout.slowDeform = false;
+ layout.targetDeform = Math.max(Math.min(layout.deform - 0.1, -0.1), -0.4);
}
function right() {
selectedItemColumn += 1;
- MyLayout.slowDeform = false;
- MyLayout.targetDeform = Math.min(Math.max(MyLayout.deform + 0.1, 0.1), 0.4);
+ layout.slowDeform = false;
+ layout.targetDeform = Math.min(Math.max(layout.deform + 0.1, 0.1), 0.4);
}
}
diff --git a/examples/declarative/states/states.qml b/examples/declarative/states/states.qml
index d91b558..acab2f0 100644
--- a/examples/declarative/states/states.qml
+++ b/examples/declarative/states/states.qml
@@ -1,25 +1,25 @@
import Qt 4.6
Rectangle {
- id: Page
+ id: page
width: 300; height: 300; color: "white"
// A target region. Clicking in here sets the state to '' - the default state
Rectangle {
x: 0; y: 0; width: 50; height: 50
color: "transparent"; border.color: "black"
- MouseRegion { anchors.fill: parent; onClicked: { Page.state='' } }
+ MouseRegion { anchors.fill: parent; onClicked: { page.state='' } }
}
// Another target region. Clicking in here sets the state to 'Position1'
Rectangle {
x: 150; y: 50; width: 50; height: 50
color: "transparent"; border.color: "black"
- MouseRegion { anchors.fill: parent; onClicked: { Page.state='Position1' } }
+ MouseRegion { anchors.fill: parent; onClicked: { page.state='Position1' } }
}
// Another target region. Clicking in here sets the state to 'Position2'
Rectangle {
x: 0; y: 200; width: 50; height: 50
color: "transparent"; border.color: "black"
- MouseRegion { anchors.fill: parent; onClicked: { Page.state='Position2' } }
+ MouseRegion { anchors.fill: parent; onClicked: { page.state='Position2' } }
}
// Rect which will be moved when my state changes
Rectangle { id: myrect; width: 50; height: 50; color: "red" }
@@ -34,7 +34,7 @@ Rectangle {
y: 50
}
},
- // In state 'Position2', change y to 100. We do not specify 'x' here -
+ // In state 'Position2', change y to 100. We do not specify 'x' here -
// it will therefore be restored to its default value of 0, if it
// had been changed.
State {
diff --git a/examples/declarative/states/transitions.qml b/examples/declarative/states/transitions.qml
index be1419d..cc6894d 100644
--- a/examples/declarative/states/transitions.qml
+++ b/examples/declarative/states/transitions.qml
@@ -1,25 +1,25 @@
import Qt 4.6
Rectangle {
- id: Page
+ id: page
width: 300; height: 300; color: "white"
// A target region. Clicking in here sets the state to '' - the default state
Rectangle {
x: 0; y: 0; width: 50; height: 50
color: "transparent"; border.color: "black"
- MouseRegion { anchors.fill: parent; onClicked: { Page.state='' } }
+ MouseRegion { anchors.fill: parent; onClicked: { page.state='' } }
}
// Another target region. Clicking in here sets the state to 'Position1'
Rectangle {
x: 150; y: 50; width: 50; height: 50
color: "transparent"; border.color: "black"
- MouseRegion { anchors.fill: parent; onClicked: { Page.state='Position1' } }
+ MouseRegion { anchors.fill: parent; onClicked: { page.state='Position1' } }
}
// Another target region. Clicking in here sets the state to 'Position2'
Rectangle {
x: 0; y: 200; width: 50; height: 50
color: "transparent"; border.color: "black"
- MouseRegion { anchors.fill: parent; onClicked: { Page.state='Position2' } }
+ MouseRegion { anchors.fill: parent; onClicked: { page.state='Position2' } }
}
// Rect which will be moved when my state changes
Rectangle { id: myrect; width: 50; height: 50; color: "red" }
@@ -34,7 +34,7 @@ Rectangle {
y: 50
}
},
- // In state 'Position2', change y to 100. We do not specify 'x' here -
+ // In state 'Position2', change y to 100. We do not specify 'x' here -
// it will therefore be restored to its default value of 0, if it
// had been changed.
State {
diff --git a/examples/declarative/tutorials/helloworld/t1/tutorial1.qml b/examples/declarative/tutorials/helloworld/t1/tutorial1.qml
index f09dcd1..e2c6650 100644
--- a/examples/declarative/tutorials/helloworld/t1/tutorial1.qml
+++ b/examples/declarative/tutorials/helloworld/t1/tutorial1.qml
@@ -1,16 +1,16 @@
import Qt 4.6
Rectangle {
- id: Page
+ id: page
width: 480
height: 200
color: "LightGrey"
Text {
- id: HelloText
+ id: helloText
text: "Hello world!"
font.pointSize: 24
font.bold: true
y: 30
- anchors.horizontalCenter: Page.horizontalCenter
+ anchors.horizontalCenter: page.horizontalCenter
}
}
diff --git a/examples/declarative/tutorials/helloworld/t2/Cell.qml b/examples/declarative/tutorials/helloworld/t2/Cell.qml
index b3c52b7..bfd835d 100644
--- a/examples/declarative/tutorials/helloworld/t2/Cell.qml
+++ b/examples/declarative/tutorials/helloworld/t2/Cell.qml
@@ -3,16 +3,16 @@ import Qt 4.6
Item {
property var color
- id: CellContainer
+ id: cellContainer
width: 40
height: 25
Rectangle {
anchors.fill: parent
- color: CellContainer.color
+ color: cellContainer.color
}
MouseRegion {
anchors.fill: parent
- onClicked: { HelloText.color = CellContainer.color }
+ onClicked: { helloText.color = cellContainer.color }
}
}
diff --git a/examples/declarative/tutorials/helloworld/t2/tutorial2.qml b/examples/declarative/tutorials/helloworld/t2/tutorial2.qml
index 458e302..aee9032 100644
--- a/examples/declarative/tutorials/helloworld/t2/tutorial2.qml
+++ b/examples/declarative/tutorials/helloworld/t2/tutorial2.qml
@@ -1,22 +1,22 @@
import Qt 4.6
Rectangle {
- id: Page
+ id: page
width: 480
height: 200
color: "LightGrey"
Text {
- id: HelloText
+ id: helloText
text: "Hello world!"
font.pointSize: 24
font.bold: true
y: 30
- anchors.horizontalCenter: Page.horizontalCenter
+ anchors.horizontalCenter: page.horizontalCenter
}
Grid {
- id: ColorPicker
+ id: colorPicker
x: 0
- anchors.bottom: Page.bottom
+ anchors.bottom: page.bottom
width: 120; height: 50
rows: 2; columns: 3
Cell { color: "#ff0000" }
diff --git a/examples/declarative/tutorials/helloworld/t3/Cell.qml b/examples/declarative/tutorials/helloworld/t3/Cell.qml
index 4b1a220..6feb7a9 100644
--- a/examples/declarative/tutorials/helloworld/t3/Cell.qml
+++ b/examples/declarative/tutorials/helloworld/t3/Cell.qml
@@ -3,15 +3,15 @@ import Qt 4.6
Item {
property var color
- id: CellContainer
+ id: cellContainer
width: 40
height: 25
Rectangle {
anchors.fill: parent
- color: CellContainer.color
+ color: cellContainer.color
}
MouseRegion {
anchors.fill: parent
- onClicked: { HelloText.color = CellContainer.color }
+ onClicked: { helloText.color = cellContainer.color }
}
}
diff --git a/examples/declarative/tutorials/helloworld/t3/tutorial3.qml b/examples/declarative/tutorials/helloworld/t3/tutorial3.qml
index 426640d..b80065d 100644
--- a/examples/declarative/tutorials/helloworld/t3/tutorial3.qml
+++ b/examples/declarative/tutorials/helloworld/t3/tutorial3.qml
@@ -1,23 +1,23 @@
import Qt 4.6
Rectangle {
- id: Page
+ id: page
width: 480
height: 200
color: "LightGrey"
Text {
- id: HelloText
+ id: helloText
text: "Hello world!"
font.pointSize: 24
font.bold: true
y: 30
- anchors.horizontalCenter: Page.horizontalCenter
+ anchors.horizontalCenter: page.horizontalCenter
states: [
State {
name: "down"
- when: MouseRegionId.pressed == true
+ when: mouseRegion.pressed == true
PropertyChanges {
- target: HelloText
+ target: helloText
y: 160
color: "red"
}
@@ -39,11 +39,11 @@ Rectangle {
}
]
}
- MouseRegion { id: MouseRegionId; anchors.fill: HelloText }
+ MouseRegion { id: mouseRegion; anchors.fill: helloText }
Grid {
- id: ColorPicker
+ id: colorPicker
x: 0
- anchors.bottom: Page.bottom
+ anchors.bottom: page.bottom
width: 120; height: 50
rows: 2; columns: 3
Cell { color: "#ff0000" }
diff --git a/examples/declarative/velocity/Day.qml b/examples/declarative/velocity/Day.qml
index 052f690..b0d4dd9 100644
--- a/examples/declarative/velocity/Day.qml
+++ b/examples/declarative/velocity/Day.qml
@@ -8,7 +8,7 @@ Rectangle {
height: 500
radius: 7
border.color: "black"
- id: Page
+ id: page
Image {
x: 10
y: 10
@@ -26,21 +26,21 @@ Rectangle {
styleColor: "#dedede"
}
Repeater {
- model: Page.stickies
+ model: page.stickies
Item {
x: Math.random() * 200 + 100
y: Math.random() * 300 + 50
- id: StickyPage
+ id: stickyPage
rotation: SpringFollow {
- source: -Flick.horizontalVelocity / 100
+ source: -flickable.horizontalVelocity / 100
spring: 2.0
damping: 0.1
}
Item {
- id: Sticky
+ id: sticky
scale: 0.5
Image {
- id: StickyImage
+ id: stickyImage
source: "sticky.png"
smooth: true
y: -20
@@ -48,7 +48,7 @@ Rectangle {
scale: 0.6
}
TextEdit {
- id: MyText
+ id: myText
smooth: true
font.pointSize: 28
readOnly: false
@@ -62,14 +62,14 @@ Rectangle {
}
Item {
y: -20
- x: StickyImage.x
- width: StickyImage.width * StickyImage.scale
- height: StickyImage.height * StickyImage.scale
+ x: stickyImage.x
+ width: stickyImage.width * stickyImage.scale
+ height: stickyImage.height * stickyImage.scale
MouseRegion {
- id: Mouse
- onClicked: { MyText.focus = true }
+ id: mouse
+ onClicked: { myText.focus = true }
anchors.fill: parent
- drag.target: StickyPage
+ drag.target: stickyPage
drag.axis: "XandYAxis"
drag.minimumY: 0
drag.maximumY: 500
@@ -87,14 +87,14 @@ Rectangle {
states: [
State {
name: "pressed"
- when: Mouse.pressed
+ when: mouse.pressed
PropertyChanges {
- target: Sticky
+ target: sticky
rotation: 8
scale: 1
}
PropertyChanges {
- target: Page
+ target: page
z: 8
}
}
diff --git a/examples/declarative/velocity/velocity.qml b/examples/declarative/velocity/velocity.qml
index 8ac42e1..b132965 100644
--- a/examples/declarative/velocity/velocity.qml
+++ b/examples/declarative/velocity/velocity.qml
@@ -5,7 +5,7 @@ Rectangle {
width: 800
height: 600
ListModel {
- id: List
+ id: list
ListElement {
name: "Sunday"
dayColor: "#808080"
@@ -95,13 +95,13 @@ Rectangle {
}
}
Flickable {
- id: Flick
+ id: flickable
anchors.fill: parent
- viewportWidth: Lay.width
+ viewportWidth: lay.width
Row {
- id: Lay
+ id: lay
Repeater {
- model: List
+ model: list
Component {
Day {
day: name
diff --git a/examples/declarative/webview/autosize.qml b/examples/declarative/webview/autosize.qml
index dbd94e1..74c6844 100644
--- a/examples/declarative/webview/autosize.qml
+++ b/examples/declarative/webview/autosize.qml
@@ -3,22 +3,21 @@ import Qt 4.6
// The WebView size is determined by the width, height,
// preferredWidth, and preferredHeight properties.
Rectangle {
- id: Rect
+ id: rect
color: "white"
width: 200
- height: Layout.height
+ height: layout.height
Column {
- id: Layout
+ id: layout
spacing: 2
WebView {
html: "No width defined."
- Rectangle {
- color: "#10000000"
+ Rectangle { color: "#10000000"
anchors.fill: parent
}
}
WebView {
- width: Rect.width
+ width: rect.width
html: "The width is full."
Rectangle {
color: "#10000000"
@@ -26,7 +25,7 @@ Rectangle {
}
}
WebView {
- width: Rect.width/2
+ width: rect.width/2
html: "The width is half."
Rectangle {
color: "#10000000"
@@ -34,7 +33,7 @@ Rectangle {
}
}
WebView {
- preferredWidth: Rect.width/2
+ preferredWidth: rect.width/2
html: "The preferredWidth is half."
Rectangle {
color: "#10000000"
@@ -42,7 +41,7 @@ Rectangle {
}
}
WebView {
- preferredWidth: Rect.width/2
+ preferredWidth: rect.width/2
html: "The_preferredWidth_is_half."
Rectangle {
color: "#10000000"
@@ -50,7 +49,7 @@ Rectangle {
}
}
WebView {
- width: Rect.width/2
+ width: rect.width/2
html: "The_width_is_half."
Rectangle {
color: "#10000000"
diff --git a/examples/declarative/webview/content/SpinSquare.qml b/examples/declarative/webview/content/SpinSquare.qml
index 95159b6..5ccdeb6 100644
--- a/examples/declarative/webview/content/SpinSquare.qml
+++ b/examples/declarative/webview/content/SpinSquare.qml
@@ -3,16 +3,16 @@ import Qt 4.6
Item {
property var period : 250
property var color : "black"
- id: Root
+ id: root
Item {
- x: Root.width/2
- y: Root.height/2
+ x: root.width/2
+ y: root.height/2
Rectangle {
- color: Root.color
+ color: root.color
x: -width/2
y: -height/2
- width: Root.width
+ width: root.width
height: width
}
rotation: NumberAnimation {
@@ -20,7 +20,7 @@ Item {
to: 360
repeat: true
running: true
- duration: Root.period
+ duration: root.period
}
}
}
diff --git a/examples/declarative/webview/newwindows.qml b/examples/declarative/webview/newwindows.qml
index 57cbf4e..59e3b3e 100644
--- a/examples/declarative/webview/newwindows.qml
+++ b/examples/declarative/webview/newwindows.qml
@@ -6,23 +6,23 @@
import Qt 4.6
Row {
- id: Pages
+ id: pages
height: 200
resources: [
Component {
- id: WebViewPage
+ id: webViewPage
Rectangle {
- width: WV.width
- height: WV.height
+ width: webView.width
+ height: webView.height
WebView {
- id: WV
- newWindowComponent: WebViewPage
- newWindowParent: Pages
+ id: webView
+ newWindowComponent: webViewPage
+ newWindowParent: pages
url: "newwindows.html"
}
}
}
]
width: 500
- Loader { sourceComponent: WebViewPage }
+ Loader { sourceComponent: webViewPage }
}
diff --git a/examples/declarative/webview/qml-in-html.qml b/examples/declarative/webview/qml-in-html.qml
index b9c8d94..43cc61b 100644
--- a/examples/declarative/webview/qml-in-html.qml
+++ b/examples/declarative/webview/qml-in-html.qml
@@ -6,10 +6,10 @@ Rectangle {
Flickable {
width: parent.width
height: parent.height/2
- viewportWidth: Web.width*Web.scale
- viewportHeight: Web.height*Web.scale
+ viewportWidth: web.width*web.scale
+ viewportHeight: web.height*web.scale
WebView {
- id: Web
+ id: web
width: 250
height: 420
scale: 0.75
diff --git a/examples/declarative/webview/transparent.qml b/examples/declarative/webview/transparent.qml
index 0807cc5..9332f3e 100644
--- a/examples/declarative/webview/transparent.qml
+++ b/examples/declarative/webview/transparent.qml
@@ -4,10 +4,10 @@ import Qt 4.6
// if the HTML does not specify a background
Rectangle {
color: "green"
- width: Web.width
- height: Web.height
+ width: web.width
+ height: web.height
WebView {
- id: Web
+ id: web
html: "Hello <b>World!</b>"
}
}
diff --git a/examples/declarative/xmldata/daringfireball.qml b/examples/declarative/xmldata/daringfireball.qml
index e0e53ef..bea38c8 100644
--- a/examples/declarative/xmldata/daringfireball.qml
+++ b/examples/declarative/xmldata/daringfireball.qml
@@ -29,20 +29,20 @@ Rectangle {
height: childrenRect.height + 20
Text {
x: 10
- id: TitleText
+ id: titleText
text: title
font.bold: true
}
Text {
text: 'by ' + tagline
- anchors.left: TitleText.right
+ anchors.left: titleText.right
anchors.leftMargin: 10
font.italic: true
}
Text {
x: 10
text: content
- anchors.top: TitleText.bottom
+ anchors.top: titleText.bottom
width: 580
wrap: true
onLinkActivated: { print('link clicked: ' + link) }
diff --git a/examples/declarative/xmldata/yahoonews.qml b/examples/declarative/xmldata/yahoonews.qml
index 7ebc2b2..bad1d88 100644
--- a/examples/declarative/xmldata/yahoonews.qml
+++ b/examples/declarative/xmldata/yahoonews.qml
@@ -28,24 +28,24 @@ Rectangle {
Component {
id: feedDelegate
Item {
- id: Delegate
- height: Wrapper.height + 10
+ id: delegate
+ height: wrapper.height + 10
MouseRegion {
- anchors.fill: Wrapper
- onPressed: { Delegate.ListView.list.currentIndex = index; }
- onClicked: { if (Wrapper.state == 'Details') { Wrapper.state = '';} else {Wrapper.state = 'Details';} }
+ anchors.fill: wrapper
+ onPressed: { delegate.ListView.list.currentIndex = index; }
+ onClicked: { if (wrapper.state == 'Details') { wrapper.state = '';} else {wrapper.state = 'Details';} }
}
Rectangle {
- id: Wrapper
+ id: wrapper
y: 5
- height: TitleText.height + 10
+ height: titleText.height + 10
width: 580
color: "#F0F0F0"
radius: 5
Text {
x: 10
y: 5
- id: TitleText
+ id: titleText
text: '<a href=\'' + link + '\'>' + title + '</a>'
font.bold: true
font.family: "Helvetica"
@@ -54,20 +54,20 @@ Rectangle {
}
Text {
x: 10
- id: Description
+ id: description
text: description
width: 560
wrap: true
font.family: "Helvetica"
- anchors.top: TitleText.bottom
+ anchors.top: titleText.bottom
anchors.topMargin: 5
opacity: 0
}
states: [
State {
name: "Details"
- PropertyChanges { target: Wrapper; height: childrenRect.height + 10 }
- PropertyChanges { target: Description; opacity: 1 }
+ PropertyChanges { target: wrapper; height: childrenRect.height + 10 }
+ PropertyChanges { target: description; opacity: 1 }
}
]
transitions: [
diff --git a/src/declarative/fx/qfxgridview.cpp b/src/declarative/fx/qfxgridview.cpp
index 1095dc1..9aa1198 100644
--- a/src/declarative/fx/qfxgridview.cpp
+++ b/src/declarative/fx/qfxgridview.cpp
@@ -593,11 +593,11 @@ void QFxGridViewPrivate::createHighlight()
highlight = new FxGridItem(item, q);
highlightXAnimator = new QmlEaseFollow(q);
highlightXAnimator->setTarget(QmlMetaProperty(highlight->item, QLatin1String("x")));
- highlightXAnimator->setVelocity(400);
+ highlightXAnimator->setDuration(150);
highlightXAnimator->setEnabled(autoHighlight);
highlightYAnimator = new QmlEaseFollow(q);
highlightYAnimator->setTarget(QmlMetaProperty(highlight->item, QLatin1String("y")));
- highlightYAnimator->setVelocity(400);
+ highlightYAnimator->setDuration(150);
highlightYAnimator->setEnabled(autoHighlight);
} else {
delete highlightContext;
@@ -710,6 +710,8 @@ QFxGridView::~QFxGridView()
for the view. For large or dynamic datasets the model is usually
provided by a C++ model object. The C++ model object must be a \l
{QAbstractItemModel} subclass, a VisualModel, or a simple list.
+
+ \sa {qmlmodels}{Data Models}
*/
QVariant QFxGridView::model() const
{
@@ -1064,54 +1066,134 @@ qreal QFxGridView::maxXExtent() const
Q_D(const QFxGridView);
if (d->flow == QFxGridView::LeftToRight)
return QFxFlickable::maxXExtent();
- return -(d->endPosition() - height());
+ return -(d->endPosition() - width());
}
void QFxGridView::keyPressEvent(QKeyEvent *event)
{
Q_D(QFxGridView);
+ QFxFlickable::keyPressEvent(event);
+ if (event->isAccepted())
+ return;
+
if (d->model && d->model->count() && d->interactive) {
- if ((d->flow == QFxGridView::LeftToRight && event->key() == Qt::Key_Up)
- || (d->flow == QFxGridView::TopToBottom && event->key() == Qt::Key_Left)) {
- if (currentIndex() >= d->columns || d->wrap) {
- d->moveReason = QFxGridViewPrivate::Key;
- int index = currentIndex() - d->columns;
- setCurrentIndex(index >= 0 ? index : d->model->count()-1);
- event->accept();
- return;
- }
- } else if ((d->flow == QFxGridView::LeftToRight && event->key() == Qt::Key_Down)
- || (d->flow == QFxGridView::TopToBottom && event->key() == Qt::Key_Right)) {
- if (currentIndex() < d->model->count() - d->columns || d->wrap) {
- d->moveReason = QFxGridViewPrivate::Key;
- int index = currentIndex()+d->columns;
- setCurrentIndex(index < d->model->count() ? index : 0);
- event->accept();
- return;
- }
- } else if ((d->flow == QFxGridView::LeftToRight && event->key() == Qt::Key_Left)
- || (d->flow == QFxGridView::TopToBottom && event->key() == Qt::Key_Up)) {
- if (currentIndex() > 0 || d->wrap) {
- d->moveReason = QFxGridViewPrivate::Key;
- int index = currentIndex() - 1;
- setCurrentIndex(index >= 0 ? index : d->model->count()-1);
- event->accept();
- return;
- }
- } else if ((d->flow == QFxGridView::LeftToRight && event->key() == Qt::Key_Right)
- || (d->flow == QFxGridView::TopToBottom && event->key() == Qt::Key_Down)) {
- if (currentIndex() < d->model->count() - 1 || d->wrap) {
- d->moveReason = QFxGridViewPrivate::Key;
- int index = currentIndex() + 1;
- setCurrentIndex(index < d->model->count() ? index : 0);
- event->accept();
- return;
- }
+ d->moveReason = QFxGridViewPrivate::Key;
+ int oldCurrent = currentIndex();
+ switch (event->key()) {
+ case Qt::Key_Up:
+ moveCurrentIndexUp();
+ break;
+ case Qt::Key_Down:
+ moveCurrentIndexDown();
+ break;
+ case Qt::Key_Left:
+ moveCurrentIndexLeft();
+ break;
+ case Qt::Key_Right:
+ moveCurrentIndexRight();
+ break;
+ default:
+ break;
+ }
+ if (oldCurrent != currentIndex()) {
+ event->accept();
+ return;
}
}
d->moveReason = QFxGridViewPrivate::Other;
event->ignore();
- QFxFlickable::keyPressEvent(event);
+}
+
+/*!
+ \qmlmethod GridView::moveCurrentIndexUp
+
+ Move the currentIndex up one item in the view.
+ The current index will wrap if keyNavigationWraps is true and it
+ is currently at the end.
+*/
+void QFxGridView::moveCurrentIndexUp()
+{
+ Q_D(QFxGridView);
+ if (d->flow == QFxGridView::LeftToRight) {
+ if (currentIndex() >= d->columns || d->wrap) {
+ int index = currentIndex() - d->columns;
+ setCurrentIndex(index >= 0 ? index : d->model->count()-1);
+ }
+ } else {
+ if (currentIndex() > 0 || d->wrap) {
+ int index = currentIndex() - 1;
+ setCurrentIndex(index >= 0 ? index : d->model->count()-1);
+ }
+ }
+}
+
+/*!
+ \qmlmethod GridView::moveCurrentIndexDown
+
+ Move the currentIndex down one item in the view.
+ The current index will wrap if keyNavigationWraps is true and it
+ is currently at the end.
+*/
+void QFxGridView::moveCurrentIndexDown()
+{
+ Q_D(QFxGridView);
+ if (d->flow == QFxGridView::LeftToRight) {
+ if (currentIndex() < d->model->count() - d->columns || d->wrap) {
+ int index = currentIndex()+d->columns;
+ setCurrentIndex(index < d->model->count() ? index : 0);
+ }
+ } else {
+ if (currentIndex() < d->model->count() - 1 || d->wrap) {
+ int index = currentIndex() + 1;
+ setCurrentIndex(index < d->model->count() ? index : 0);
+ }
+ }
+}
+
+/*!
+ \qmlmethod GridView::moveCurrentIndexLeft
+
+ Move the currentIndex left one item in the view.
+ The current index will wrap if keyNavigationWraps is true and it
+ is currently at the end.
+*/
+void QFxGridView::moveCurrentIndexLeft()
+{
+ Q_D(QFxGridView);
+ if (d->flow == QFxGridView::LeftToRight) {
+ if (currentIndex() > 0 || d->wrap) {
+ int index = currentIndex() - 1;
+ setCurrentIndex(index >= 0 ? index : d->model->count()-1);
+ }
+ } else {
+ if (currentIndex() >= d->columns || d->wrap) {
+ int index = currentIndex() - d->columns;
+ setCurrentIndex(index >= 0 ? index : d->model->count()-1);
+ }
+ }
+}
+
+/*!
+ \qmlmethod GridView::moveCurrentIndexRight
+
+ Move the currentIndex right one item in the view.
+ The current index will wrap if keyNavigationWraps is true and it
+ is currently at the end.
+*/
+void QFxGridView::moveCurrentIndexRight()
+{
+ Q_D(QFxGridView);
+ if (d->flow == QFxGridView::LeftToRight) {
+ if (currentIndex() < d->model->count() - 1 || d->wrap) {
+ int index = currentIndex() + 1;
+ setCurrentIndex(index < d->model->count() ? index : 0);
+ }
+ } else {
+ if (currentIndex() < d->model->count() - d->columns || d->wrap) {
+ int index = currentIndex()+d->columns;
+ setCurrentIndex(index < d->model->count() ? index : 0);
+ }
+ }
}
void QFxGridView::componentComplete()
diff --git a/src/declarative/fx/qfxgridview.h b/src/declarative/fx/qfxgridview.h
index 996141f..08a7565 100644
--- a/src/declarative/fx/qfxgridview.h
+++ b/src/declarative/fx/qfxgridview.h
@@ -112,6 +112,12 @@ public:
static QFxGridViewAttached *qmlAttachedProperties(QObject *);
+public Q_SLOTS:
+ void moveCurrentIndexUp();
+ void moveCurrentIndexDown();
+ void moveCurrentIndexLeft();
+ void moveCurrentIndexRight();
+
Q_SIGNALS:
void countChanged();
void currentIndexChanged();
diff --git a/src/declarative/fx/qfxlistview.cpp b/src/declarative/fx/qfxlistview.cpp
index 3584892..1247021 100644
--- a/src/declarative/fx/qfxlistview.cpp
+++ b/src/declarative/fx/qfxlistview.cpp
@@ -178,6 +178,7 @@ public:
, moveReason(Other), buffer(0), highlightPosAnimator(0), highlightSizeAnimator(0), spacing(0.0)
, ownModel(false), wrap(false), autoHighlight(true)
, haveHighlightRange(false), strictHighlightRange(false)
+ , highlightMoveSpeed(400), highlightResizeSpeed(400)
{}
void init();
@@ -390,6 +391,8 @@ public:
QString sectionExpression;
QString currentSection;
qreal spacing;
+ qreal highlightMoveSpeed;
+ qreal highlightResizeSpeed;
bool ownModel : 1;
bool wrap : 1;
@@ -667,11 +670,11 @@ void QFxListViewPrivate::createHighlight()
const QLatin1String posProp(orient == Qt::Vertical ? "y" : "x");
highlightPosAnimator = new QmlEaseFollow(q);
highlightPosAnimator->setTarget(QmlMetaProperty(highlight->item, posProp));
- highlightPosAnimator->setVelocity(400);
+ highlightPosAnimator->setVelocity(highlightMoveSpeed);
highlightPosAnimator->setEnabled(autoHighlight);
const QLatin1String sizeProp(orient == Qt::Vertical ? "height" : "width");
highlightSizeAnimator = new QmlEaseFollow(q);
- highlightSizeAnimator->setVelocity(400);
+ highlightSizeAnimator->setVelocity(highlightResizeSpeed);
highlightSizeAnimator->setTarget(QmlMetaProperty(highlight->item, sizeProp));
highlightSizeAnimator->setEnabled(autoHighlight);
}
@@ -876,6 +879,8 @@ QFxListView::~QFxListView()
Models can also be created directly in QML, using a \l{ListModel},
\l{XmlListModel} or \l{VisualItemModel}.
+
+ \sa {qmlmodels}{Data Models}
*/
QVariant QFxListView::model() const
{
@@ -1257,6 +1262,48 @@ QString QFxListView::currentSection() const
return d->currentSection;
}
+/*!
+ \qmlproperty real ListView::highlightMoveSpeed
+
+ This property holds the moving animation speed of the highlight delegate.
+*/
+qreal QFxListView::highlightMoveSpeed() const
+{
+ Q_D(const QFxListView);\
+ return d->highlightMoveSpeed;
+}
+
+void QFxListView::setHighlightMoveSpeed(qreal speed)
+{
+ Q_D(QFxListView);\
+ if (d->highlightMoveSpeed != speed)
+ {
+ d->highlightMoveSpeed = speed;
+ emit highlightMoveSpeedChanged();
+ }
+}
+
+/*!
+ \qmlproperty real ListView::highlightResizeSpeed
+
+ This property holds the resizing animation speed of the highlight delegate.
+*/
+qreal QFxListView::highlightResizeSpeed() const
+{
+ Q_D(const QFxListView);\
+ return d->highlightResizeSpeed;
+}
+
+void QFxListView::setHighlightResizeSpeed(qreal speed)
+{
+ Q_D(QFxListView);\
+ if (d->highlightResizeSpeed != speed)
+ {
+ d->highlightResizeSpeed = speed;
+ emit highlightResizeSpeedChanged();
+ }
+}
+
void QFxListView::viewportMoved()
{
Q_D(QFxListView);
@@ -1372,6 +1419,12 @@ void QFxListView::keyPressEvent(QKeyEvent *event)
event->ignore();
}
+/*!
+ \qmlmethod ListView::incrementCurrentIndex
+
+ Increments the current index. The current index will wrap
+ if keyNavigationWraps is true and it is currently at the end.
+*/
void QFxListView::incrementCurrentIndex()
{
Q_D(QFxListView);
@@ -1381,6 +1434,12 @@ void QFxListView::incrementCurrentIndex()
}
}
+/*!
+ \qmlmethod ListView::decrementCurrentIndex
+
+ Decrements the current index. The current index will wrap
+ if keyNavigationWraps is true and it is currently at the beginning.
+*/
void QFxListView::decrementCurrentIndex()
{
Q_D(QFxListView);
diff --git a/src/declarative/fx/qfxlistview.h b/src/declarative/fx/qfxlistview.h
index fc15967..3cff422 100644
--- a/src/declarative/fx/qfxlistview.h
+++ b/src/declarative/fx/qfxlistview.h
@@ -77,6 +77,9 @@ class Q_DECLARATIVE_EXPORT QFxListView : public QFxFlickable
Q_PROPERTY(int cacheBuffer READ cacheBuffer WRITE setCacheBuffer)
Q_PROPERTY(QString sectionExpression READ sectionExpression WRITE setSectionExpression NOTIFY sectionExpressionChanged)
Q_PROPERTY(QString currentSection READ currentSection NOTIFY currentSectionChanged)
+
+ Q_PROPERTY(qreal highlightMoveSpeed READ highlightMoveSpeed WRITE setHighlightMoveSpeed NOTIFY highlightMoveSpeedChanged)
+ Q_PROPERTY(qreal highlightResizeSpeed READ highlightResizeSpeed WRITE setHighlightResizeSpeed NOTIFY highlightResizeSpeedChanged)
Q_CLASSINFO("DefaultProperty", "data")
public:
@@ -126,6 +129,12 @@ public:
void setSectionExpression(const QString &);
QString currentSection() const;
+ qreal highlightMoveSpeed() const;
+ void setHighlightMoveSpeed(qreal);
+
+ qreal highlightResizeSpeed() const;
+ void setHighlightResizeSpeed(qreal);
+
static QFxListViewAttached *qmlAttachedProperties(QObject *);
public Q_SLOTS:
@@ -138,6 +147,8 @@ Q_SIGNALS:
void currentIndexChanged();
void currentSectionChanged();
void sectionExpressionChanged();
+ void highlightMoveSpeedChanged();
+ void highlightResizeSpeedChanged();
protected:
virtual void viewportMoved();
diff --git a/src/declarative/fx/qfxpathview.cpp b/src/declarative/fx/qfxpathview.cpp
index 86bc9a2..b127f39 100644
--- a/src/declarative/fx/qfxpathview.cpp
+++ b/src/declarative/fx/qfxpathview.cpp
@@ -140,6 +140,8 @@ QFxPathView::~QFxPathView()
The model provides a set of data that is used to create the items for the view.
For large or dynamic datasets the model is usually provided by a C++ model object.
Models can also be created directly in XML, using the ListModel element.
+
+ \sa {qmlmodels}{Data Models}
*/
QVariant QFxPathView::model() const
{
diff --git a/src/declarative/fx/qfxrepeater.cpp b/src/declarative/fx/qfxrepeater.cpp
index bc34839..182dcc7 100644
--- a/src/declarative/fx/qfxrepeater.cpp
+++ b/src/declarative/fx/qfxrepeater.cpp
@@ -143,6 +143,8 @@ QFxRepeater::~QFxRepeater()
based on the order they are created.
Models can also be created directly in QML, using a \l{ListModel} or \l{XmlListModel}.
+
+ \sa {qmlmodels}{Data Models}
*/
QVariant QFxRepeater::model() const
{
@@ -154,15 +156,15 @@ void QFxRepeater::setModel(const QVariant &model)
{
Q_D(QFxRepeater);
clear();
- /*
if (d->model) {
disconnect(d->model, SIGNAL(itemsInserted(int,int)), this, SLOT(itemsInserted(int,int)));
disconnect(d->model, SIGNAL(itemsRemoved(int,int)), this, SLOT(itemsRemoved(int,int)));
disconnect(d->model, SIGNAL(itemsMoved(int,int,int)), this, SLOT(itemsMoved(int,int,int)));
+ /*
disconnect(d->model, SIGNAL(createdItem(int, QFxItem*)), this, SLOT(createdItem(int,QFxItem*)));
disconnect(d->model, SIGNAL(destroyingItem(QFxItem*)), this, SLOT(destroyingItem(QFxItem*)));
- }
*/
+ }
d->dataSource = model;
QObject *object = qvariant_cast<QObject*>(model);
QFxVisualModel *vim = 0;
@@ -181,10 +183,10 @@ void QFxRepeater::setModel(const QVariant &model)
dataModel->setModel(model);
}
if (d->model) {
- /*
connect(d->model, SIGNAL(itemsInserted(int,int)), this, SLOT(itemsInserted(int,int)));
connect(d->model, SIGNAL(itemsRemoved(int,int)), this, SLOT(itemsRemoved(int,int)));
connect(d->model, SIGNAL(itemsMoved(int,int,int)), this, SLOT(itemsMoved(int,int,int)));
+ /*
connect(d->model, SIGNAL(createdItem(int, QFxItem*)), this, SLOT(createdItem(int,QFxItem*)));
connect(d->model, SIGNAL(destroyingItem(QFxItem*)), this, SLOT(destroyingItem(QFxItem*)));
*/
@@ -291,4 +293,20 @@ void QFxRepeater::regenerate()
}
}
}
+
+void QFxRepeater::itemsInserted(int, int)
+{
+ regenerate();
+}
+
+void QFxRepeater::itemsRemoved(int, int)
+{
+ regenerate();
+}
+
+void QFxRepeater::itemsMoved(int,int,int)
+{
+ regenerate();
+}
+
QT_END_NAMESPACE
diff --git a/src/declarative/fx/qfxrepeater.h b/src/declarative/fx/qfxrepeater.h
index 7d64d86..7a0318b 100644
--- a/src/declarative/fx/qfxrepeater.h
+++ b/src/declarative/fx/qfxrepeater.h
@@ -84,6 +84,11 @@ protected:
QVariant itemChange(GraphicsItemChange change, const QVariant &value);
QFxRepeater(QFxRepeaterPrivate &dd, QFxItem *parent);
+private Q_SLOTS:
+ void itemsInserted(int,int);
+ void itemsRemoved(int,int);
+ void itemsMoved(int,int,int);
+
private:
Q_DISABLE_COPY(QFxRepeater)
Q_DECLARE_PRIVATE_D(QGraphicsItem::d_ptr.data(), QFxRepeater)
diff --git a/src/declarative/fx/qfxvisualitemmodel.cpp b/src/declarative/fx/qfxvisualitemmodel.cpp
index 45166de..fb1cfcf 100644
--- a/src/declarative/fx/qfxvisualitemmodel.cpp
+++ b/src/declarative/fx/qfxvisualitemmodel.cpp
@@ -132,7 +132,11 @@ public:
\brief The VisualItemModel allows items to be provided to a view.
The children of the VisualItemModel are provided in a model which
- can be used in a view. An item can determine its index within the
+ can be used in a view. Note that no delegate should be
+ provided to a view since the VisualItemModel contains the
+ visual delegate (items).
+
+ An item can determine its index within the
model via the VisualItemModel.index attached property.
The example below places three colored rectangles in a ListView.
diff --git a/src/declarative/qml/qmlengine.cpp b/src/declarative/qml/qmlengine.cpp
index 72603ed..f34d790 100644
--- a/src/declarative/qml/qmlengine.cpp
+++ b/src/declarative/qml/qmlengine.cpp
@@ -114,43 +114,9 @@ QScriptValue desktopOpenUrl(QScriptContext *ctxt, QScriptEngine *e)
return e->newVariant(QVariant(ret));
}
-// XXX Something like this should be exported by Qt.
static QString userLocalDataPath(const QString& app)
{
- QString result;
-
-#ifdef Q_OS_WIN
-#ifndef Q_OS_WINCE
- QLibrary library(QLatin1String("shell32"));
-#else
- QLibrary library(QLatin1String("coredll"));
-#endif // Q_OS_WINCE
- typedef BOOL (WINAPI*GetSpecialFolderPath)(HWND, LPWSTR, int, BOOL);
- GetSpecialFolderPath SHGetSpecialFolderPath = (GetSpecialFolderPath)library.resolve("SHGetSpecialFolderPathW");
- if (SHGetSpecialFolderPath) {
- wchar_t path[MAX_PATH];
- SHGetSpecialFolderPath(0, path, CSIDL_APPDATA, FALSE);
- result = QString::fromWCharArray(path);
- }
-#endif // Q_OS_WIN
-
-#ifdef Q_OS_MAC
- result = QLatin1String(qgetenv("HOME"));
- result += "/Library/Application Support";
-#else
- if (result.isEmpty()) {
- // Fallback: UNIX style
- result = QLatin1String(qgetenv("XDG_DATA_HOME"));
- if (result.isEmpty()) {
- result = QLatin1String(qgetenv("HOME"));
- result += QLatin1String("/.local/share");
- }
- }
-#endif
-
- result += QLatin1Char('/');
- result += app;
- return result;
+ return QDesktopServices::storageLocation(QDesktopServices::DataLocation) + QLatin1String("/") + app;
}
QmlEnginePrivate::QmlEnginePrivate(QmlEngine *e)
@@ -166,7 +132,7 @@ QmlEnginePrivate::QmlEnginePrivate(QmlEngine *e)
qtObject.setProperty(QLatin1String("DesktopServices"), desktopObject);
scriptEngine.globalObject().setProperty(QLatin1String("Qt"), qtObject);
- offlineStoragePath = userLocalDataPath(QLatin1String("Nokia/Qt/QML/OfflineStorage"));
+ offlineStoragePath = userLocalDataPath(QLatin1String("QML/OfflineStorage"));
qt_add_qmlxmlhttprequest(&scriptEngine);
qt_add_qmlsqldatabase(&scriptEngine);
@@ -1602,7 +1568,7 @@ public:
if (s->find(unqualifiedtype,vmajor,vminor,type_return,url_return))
return true;
if (s->urls.count() == 1 && !s->isBuiltin[0] && !s->isLibrary[0] && url_return) {
- *url_return = QUrl(s->urls[0]+"/").resolved(QUrl(QLatin1String(unqualifiedtype + ".qml")));
+ *url_return = QUrl(s->urls[0]+QLatin1String("/")).resolved(QUrl(QLatin1String(unqualifiedtype + ".qml")));
return true;
}
}
@@ -1697,7 +1663,7 @@ void QmlEngine::addImportPath(const QString& path)
QFxWebView and the SQL databases created with openDatabase()
are stored here.
- The default is Nokia/Qt/QML/Databases/ in the platform-standard
+ The default is QML/OfflineStorage/ in the platform-standard
user application data directory.
*/
void QmlEngine::setOfflineStoragePath(const QString& dir)
diff --git a/src/declarative/util/qmllistaccessor.cpp b/src/declarative/util/qmllistaccessor.cpp
index ef21ebf..578646b 100644
--- a/src/declarative/util/qmllistaccessor.cpp
+++ b/src/declarative/util/qmllistaccessor.cpp
@@ -76,7 +76,6 @@ void QmlListAccessor::setList(const QVariant &v, QmlEngine *engine)
} else if (d.type() == QMetaType::QVariantList) {
m_type = VariantList;
} else if (d.canConvert(QVariant::Int)) {
- qDebug() << "integer";
m_type = Integer;
} else if (d.type() != QVariant::UserType) {
m_type = Instance;
@@ -90,7 +89,6 @@ void QmlListAccessor::setList(const QVariant &v, QmlEngine *engine)
(enginePrivate && enginePrivate->isQmlList(d.userType()))) {
m_type = QmlList;
} else if (QmlMetaType::isList(d.userType())) {
- qDebug() << "list";
m_type = QList;
} else {
m_type = Invalid;
diff --git a/tests/auto/declarative/qfxwebview/data/basic.html b/tests/auto/declarative/qfxwebview/data/basic.html
new file mode 100644
index 0000000..254317c
--- /dev/null
+++ b/tests/auto/declarative/qfxwebview/data/basic.html
@@ -0,0 +1,12 @@
+<html>
+<head><title>Basic</title>
+<link rel="shortcut icon" type="image/x-icon" href="basic.ico">
+</head>
+<body leftmargin="0" marginwidth="0">
+<table width="123">
+<tbody>
+<tr><td>This is a basic test.</td></tr>
+</tbody>
+</table>
+</body>
+</html>
diff --git a/tests/auto/declarative/qfxwebview/data/basic.qml b/tests/auto/declarative/qfxwebview/data/basic.qml
new file mode 100644
index 0000000..5394837
--- /dev/null
+++ b/tests/auto/declarative/qfxwebview/data/basic.qml
@@ -0,0 +1,5 @@
+import Qt 4.6
+
+WebView {
+ url: "basic.html"
+}
diff --git a/tests/auto/declarative/qfxwebview/qfxwebview.pro b/tests/auto/declarative/qfxwebview/qfxwebview.pro
new file mode 100644
index 0000000..ee78950
--- /dev/null
+++ b/tests/auto/declarative/qfxwebview/qfxwebview.pro
@@ -0,0 +1,6 @@
+load(qttest_p4)
+contains(QT_CONFIG,declarative): QT += declarative
+SOURCES += tst_qfxwebview.cpp
+
+# Define SRCDIR equal to test's source directory
+DEFINES += SRCDIR=\\\"$$PWD\\\"
diff --git a/tests/auto/declarative/qfxwebview/tst_qfxwebview.cpp b/tests/auto/declarative/qfxwebview/tst_qfxwebview.cpp
new file mode 100644
index 0000000..834c07f
--- /dev/null
+++ b/tests/auto/declarative/qfxwebview/tst_qfxwebview.cpp
@@ -0,0 +1,100 @@
+#include <qtest.h>
+#include "../../../shared/util.h"
+#include <QtDeclarative/qmlengine.h>
+#include <QtDeclarative/qmlcomponent.h>
+#include <QtDeclarative/qfxwebview.h>
+#include <QtWebKit/qwebpage.h>
+#include <QtWebKit/qwebframe.h>
+#include <QtCore/qdir.h>
+#include <QtCore/qfile.h>
+
+class tst_qfxwebview : public QObject
+{
+ Q_OBJECT
+public:
+ tst_qfxwebview() {}
+
+private slots:
+ void testBasicProperties();
+ void cleanupTestCase();
+
+
+private:
+ void checkNoErrors(const QmlComponent& component);
+ QmlEngine engine;
+ QString tmpDir() const
+ {
+ static QString tmpd = QDir::tempPath()+"/tst_qfxwebview-"
+ + QDateTime::currentDateTime().toString(QLatin1String("yyyyMMddhhmmss"));
+ return tmpd;
+ }
+};
+
+void removeRecursive(const QString& dirname)
+{
+ QDir dir(dirname);
+ QFileInfoList entries(dir.entryInfoList(QDir::Dirs|QDir::Files|QDir::NoDotAndDotDot));
+ for (int i = 0; i < entries.count(); ++i)
+ if (entries[i].isDir())
+ removeRecursive(entries[i].filePath());
+ else
+ dir.remove(entries[i].fileName());
+ QDir().rmdir(dirname);
+}
+
+void tst_qfxwebview::cleanupTestCase()
+{
+ removeRecursive(tmpDir());
+}
+
+void tst_qfxwebview::checkNoErrors(const QmlComponent& component)
+{
+ if (component.isError()) {
+ QList<QmlError> errors = component.errors();
+ for (int ii = 0; ii < errors.count(); ++ii) {
+ const QmlError &error = errors.at(ii);
+ QByteArray errorStr = QByteArray::number(error.line()) + ":" +
+ QByteArray::number(error.column()) + ":" +
+ error.description().toUtf8();
+ qWarning() << errorStr;
+ }
+ }
+ QVERIFY(!component.isError());
+}
+
+void tst_qfxwebview::testBasicProperties()
+{
+ QmlComponent component(&engine, QUrl::fromLocalFile(SRCDIR "/data/basic.qml"));
+ checkNoErrors(component);
+ QWebSettings::enablePersistentStorage(tmpDir());
+
+ QFxWebView *wv = qobject_cast<QFxWebView*>(component.create());
+ QVERIFY(wv != 0);
+ QTRY_COMPARE(wv->progress(), 1.0);
+ QCOMPARE(wv->title(),QString("Basic"));
+ wv->icon().save("test.png");
+ //QCOMPARE(wv->icon(),QPixmap(SRCDIR "/data/basic.ico"));
+ QCOMPARE(wv->statusText(),QString(""));
+ QFile htmlfile(SRCDIR "/data/basic.html");
+ QVERIFY(htmlfile.open(QIODevice::ReadOnly));
+ QString actualhtml____ = wv->html(); // "____" is to make errors line up for easier reading
+ QString expectedhtml = htmlfile.readAll();
+ actualhtml____.replace(QRegExp("\\s+"),"");
+ expectedhtml.replace(QRegExp("\\s+"),"");
+ QCOMPARE(actualhtml____,expectedhtml); // same, ignoring whitespace
+ QCOMPARE(wv->width(), 123.0);
+ QCOMPARE(wv->url(), QUrl::fromLocalFile(SRCDIR "/data/basic.html"));
+ QCOMPARE(wv->status(), QFxWebView::Ready);
+ QVERIFY(wv->reloadAction());
+ QVERIFY(wv->reloadAction()->isEnabled());
+ QVERIFY(wv->backAction());
+ QVERIFY(!wv->backAction()->isEnabled());
+ QVERIFY(wv->forwardAction());
+ QVERIFY(!wv->forwardAction()->isEnabled());
+ QVERIFY(wv->stopAction());
+ QVERIFY(!wv->stopAction()->isEnabled());
+}
+
+QTEST_MAIN(tst_qfxwebview)
+
+#include "tst_qfxwebview.moc"
diff --git a/tests/auto/declarative/sql/tst_sql.cpp b/tests/auto/declarative/sql/tst_sql.cpp
index 10ce6d8..22e9ba4 100644
--- a/tests/auto/declarative/sql/tst_sql.cpp
+++ b/tests/auto/declarative/sql/tst_sql.cpp
@@ -14,7 +14,18 @@ class tst_sql : public QObject
{
Q_OBJECT
public:
- tst_sql() {}
+ tst_sql()
+ {
+ qApp->setApplicationName("tst_sql");
+ qApp->setOrganizationName("Nokia");
+ qApp->setOrganizationDomain("nokia.com");
+ engine = new QmlEngine;
+ }
+
+ ~tst_sql()
+ {
+ delete engine;
+ }
private slots:
void initTestCase();
@@ -31,7 +42,7 @@ private slots:
private:
QString dbDir() const;
- QmlEngine engine;
+ QmlEngine *engine;
};
class QWebPageWithJavaScriptConsoleMessages : public QWebPage {
@@ -67,14 +78,16 @@ void tst_sql::cleanupTestCase()
QString tst_sql::dbDir() const
{
- return QString(SRCDIR)+"/output";
+ static QString tmpd = QDir::tempPath()+"/tst_sql_output-"
+ + QDateTime::currentDateTime().toString(QLatin1String("yyyyMMddhhmmss"));
+ return tmpd;
}
void tst_sql::checkDatabasePath()
{
// Check default storage path (we can't use it since we don't want to mess with user's data)
- QVERIFY(engine.offlineStoragePath().contains("Nokia"));
- QVERIFY(engine.offlineStoragePath().contains("OfflineStorage"));
+ QVERIFY(engine->offlineStoragePath().contains("Nokia"));
+ QVERIFY(engine->offlineStoragePath().contains("OfflineStorage"));
}
void tst_sql::testQml_data()
@@ -142,8 +155,8 @@ void tst_sql::testQml()
"import Qt 4.6\n"
"Text { Script { source: \""+jsfile+"\" } text: test() }";
- engine.setOfflineStoragePath(dbDir());
- QmlComponent component(&engine, qml.toUtf8(), QUrl::fromLocalFile(SRCDIR "/empty.qml")); // just a file for relative local imports
+ engine->setOfflineStoragePath(dbDir());
+ QmlComponent component(engine, qml.toUtf8(), QUrl::fromLocalFile(SRCDIR "/empty.qml")); // just a file for relative local imports
QFxText *text = qobject_cast<QFxText*>(component.create());
QVERIFY(text != 0);
QCOMPARE(text->text(),result);