summaryrefslogtreecommitdiffstats
path: root/demos
diff options
context:
space:
mode:
authorWarwick Allison <warwick.allison@nokia.com>2009-05-08 02:28:36 (GMT)
committerWarwick Allison <warwick.allison@nokia.com>2009-05-08 02:28:36 (GMT)
commit54e7c7d8990a792e7f5bb4429dd48fba108ba24a (patch)
treef0426e5c1990fdfb3f44b6a67038dfaef742d946 /demos
parent9a69890dee24a26efde615e18f1ed7aa79eb441c (diff)
parent1e71ce9f221c739f03c9e6d49faf7cd7b0c85ae2 (diff)
downloadQt-54e7c7d8990a792e7f5bb4429dd48fba108ba24a.zip
Qt-54e7c7d8990a792e7f5bb4429dd48fba108ba24a.tar.gz
Qt-54e7c7d8990a792e7f5bb4429dd48fba108ba24a.tar.bz2
Merge branch 'kinetic-declarativeui' of git@scm.dev.nokia.troll.no:qt/kinetic into kinetic-declarativeui
Diffstat (limited to 'demos')
-rw-r--r--demos/declarative/contacts/Contact.qml69
-rw-r--r--demos/declarative/contacts/ContactField.qml2
-rw-r--r--demos/declarative/contacts/RemoveButton.qml6
-rw-r--r--demos/declarative/contacts/contacts.qml22
-rw-r--r--demos/declarative/flickr/content/ImageDetails.qml3
-rw-r--r--demos/declarative/flickr/content/Slider.qml1
-rw-r--r--demos/declarative/flickr/flickr.qml3
-rw-r--r--demos/declarative/flickr/flickr2.qml129
8 files changed, 133 insertions, 102 deletions
diff --git a/demos/declarative/contacts/Contact.qml b/demos/declarative/contacts/Contact.qml
index 7297fa6..50c9d1c 100644
--- a/demos/declarative/contacts/Contact.qml
+++ b/demos/declarative/contacts/Contact.qml
@@ -16,41 +16,53 @@ Item {
id: updateContactQuery
connection: contactDatabase
query: "UPDATE contacts SET label = :l, email = :e, phone = :p WHERE recid = :r"
- bindings: SqlBind {
- name: ":r"
- value: contactId
- }
- bindings: SqlBind {
- name: ":l"
- value: labelField.value
- }
- bindings: SqlBind {
- name: ":e"
- value: emailField.value
- }
- bindings: SqlBind {
- name: ":p"
- value: phoneField.value
- }
+ bindings: [
+ SqlBind {
+ name: ":r"
+ value: contactId
+ },
+ SqlBind {
+ name: ":l"
+ value: labelField.value
+ },
+ SqlBind {
+ name: ":e"
+ value: emailField.value
+ },
+ SqlBind {
+ name: ":p"
+ value: phoneField.value
+ }
+ ]
},
SqlQuery {
id: insertContactQuery
connection: contactDatabase
query: "INSERT INTO contacts (label, email, phone) VALUES(:l, :e, :p)"
+ bindings: [
+ SqlBind {
+ name: ":l"
+ value: labelField.value
+ },
+ SqlBind {
+ name: ":e"
+ value: emailField.value
+ },
+ SqlBind {
+ name: ":p"
+ value: phoneField.value
+ }
+ ]
+ },
+ SqlQuery {
+ id: removeContactQuery
+ connection: contactDatabase
+ query: "DELETE FROM contacts WHERE recid = :r"
bindings: SqlBind {
- name: ":l"
- value: labelField.value
- }
- bindings: SqlBind {
- name: ":e"
- value: emailField.value
- }
- bindings: SqlBind {
- name: ":p"
- value: phoneField.value
+ name: ":r"
+ value: contactId
}
}
-
]
function refresh() {
labelField.value = label;
@@ -63,6 +75,9 @@ Item {
function insert() {
insertContactQuery.exec();
}
+ function remove() {
+ removeContactQuery.exec();
+ }
VerticalLayout {
id: layout
anchors.fill: parent
diff --git a/demos/declarative/contacts/ContactField.qml b/demos/declarative/contacts/ContactField.qml
index cb319ae..003e723 100644
--- a/demos/declarative/contacts/ContactField.qml
+++ b/demos/declarative/contacts/ContactField.qml
@@ -3,7 +3,7 @@ Item {
clip: true
height: 30
property var label: "Name"
- property var icon: "pics/phone.png"
+ property var icon: ""
property var value: ""
onValueChanged: { fieldText.text = contactField.value }
RemoveButton {
diff --git a/demos/declarative/contacts/RemoveButton.qml b/demos/declarative/contacts/RemoveButton.qml
index 114db2e..59e3fcb 100644
--- a/demos/declarative/contacts/RemoveButton.qml
+++ b/demos/declarative/contacts/RemoveButton.qml
@@ -76,6 +76,12 @@ Rect {
text: "Remove"
opacity: 0
}
+ opacity: Behaviour {
+ NumericAnimation {
+ property: "opacity"
+ duration: 250
+ }
+ }
states: [
State {
name: "opened"
diff --git a/demos/declarative/contacts/contacts.qml b/demos/declarative/contacts/contacts.qml
index 4582bd1..b38e02e 100644
--- a/demos/declarative/contacts/contacts.qml
+++ b/demos/declarative/contacts/contacts.qml
@@ -127,13 +127,26 @@ Rect {
sender: cancelEditButton
signal: "clicked()"
script: {
- if (wrapper.state == 'opened' && !contacts.mouseGrabbed) {
+ if (wrapper.state == 'opened' && !contacts.mouseGrabbed) {
wrapper.state = '';
contacts.mode = 'list';
}
}
}
+ Connection {
+ sender: removeContactButton
+ signal: "confirmed()"
+ script: {
+ if (wrapper.state == 'opened' && !contacts.mouseGrabbed) {
+ Details.qmlItem.remove();
+ wrapper.state = '';
+ contacts.mode = 'list';
+ contactList.exec();
+ }
+
+ }
+ }
}
}
]
@@ -165,6 +178,13 @@ Rect {
icon: "pics/cancel.png"
opacity: contacts.mode == 'list' || contacts.mouseGrabbed ? 0 : 1
}
+ RemoveButton {
+ id: removeContactButton
+ anchors.top: parent.top
+ anchors.topMargin: 5
+ anchors.horizontalCenter: parent.horizontalCenter
+ opacity: (contacts.mode == 'edit' && (!contacts.mouseGrabbed || removeContactButton.state =='opened')) ? 1 : 0
+ }
ListView {
id: contactListView
anchors.left: parent.left
diff --git a/demos/declarative/flickr/content/ImageDetails.qml b/demos/declarative/flickr/content/ImageDetails.qml
index 6ef65db..8677efc 100644
--- a/demos/declarative/flickr/content/ImageDetails.qml
+++ b/demos/declarative/flickr/content/ImageDetails.qml
@@ -3,6 +3,7 @@ Flipable {
property var frontContainer: ContainerFront
property var flickableArea: Flickable
+ property var slider: Slider
property string photoTitle: ""
property string photoDescription: ""
property string photoTags: ""
@@ -96,7 +97,7 @@ Flipable {
anchors.centeredIn: parent; color: "white"; font.bold: true
}
- Slider { id: Slider; x: 25; y: 374; imageWidth: Container.photoWidth; imageHeight: Container.photoHeight }
+ Slider { id: Slider; x: 25; y: 374; visible: BigImage.status == 0; imageWidth: Container.photoWidth; imageHeight: Container.photoHeight }
}
states: [
diff --git a/demos/declarative/flickr/content/Slider.qml b/demos/declarative/flickr/content/Slider.qml
index ba9d842..c6a3e5e 100644
--- a/demos/declarative/flickr/content/Slider.qml
+++ b/demos/declarative/flickr/content/Slider.qml
@@ -3,6 +3,7 @@ Item {
property var value: Handle.x / Slider.xMax
property int xMax: Slider.width - Handle.width - 2
+ property var handle: Handle
property int imageWidth
property int imageHeight
diff --git a/demos/declarative/flickr/flickr.qml b/demos/declarative/flickr/flickr.qml
index 8828651..cbe6534 100644
--- a/demos/declarative/flickr/flickr.qml
+++ b/demos/declarative/flickr/flickr.qml
@@ -58,6 +58,7 @@ Item {
ImageDetails.photoDate = photoDate;
ImageDetails.photoUrl = url;
ImageDetails.rating = 0;
+ ImageDetails.slider.handle.x = ImageDetails.slider.xMax;
Wrapper.state = "Details";
}
}
@@ -121,7 +122,7 @@ Item {
Image { source: "content/pics/background.png"; opaque: true }
GridView {
- id: PhotoGridView; model: FeedModel; delegate: PhotoDelegate
+ id: PhotoGridView; model: FeedModel; delegate: PhotoDelegate; cacheBuffer: 100
cellWidth: 105; cellHeight: 105; x:32; y: 80; width: 800; height: 330; z: 1
}
diff --git a/demos/declarative/flickr/flickr2.qml b/demos/declarative/flickr/flickr2.qml
index 3b1208c..f5f569e 100644
--- a/demos/declarative/flickr/flickr2.qml
+++ b/demos/declarative/flickr/flickr2.qml
@@ -29,11 +29,15 @@ Item {
delegate: Package {
Item {
- id: Wrapper; width: 85; height: 85
- scale: Wrapper.PathView.scale; z: Wrapper.PathView.z
+ id: Wrapper; width: 85; height: 85; scale: {1.0}
+ z: RightBox.PathView.z
+ property real angle: 0 * 0
transform: [
- Rotation3D { id: Rotation; axis.startX: 30; axis.endX: 30; axis.endY: 60; angle: Wrapper.PathView.angle }
+ Rotation3D {
+ id: Rotation; axis.startX: 30; axis.endX: 30; axis.endY: 60
+ angle: Wrapper.angle
+ }
]
Connection {
@@ -111,7 +115,7 @@ Item {
Item {
Package.name: "rightBox"
- id: RightBox; x: 200; width: 85; height: 85
+ id: RightBox; width: 85; height: 85
}
Item {
@@ -120,73 +124,58 @@ Item {
}
Item {
- id: MyItem
- states: [
- State {
- name: "left"
- when: MainWindow.showPathView == true
- SetProperty {
- target: Wrapper
- property: "moveToParent"
- value: LeftBox
- }
- },
- State {
- name: "right"
- when: MainWindow.showPathView == false
- SetProperty {
- target: Wrapper
- property: "moveToParent"
- value: RightBox
+ id: MyItem
+ state: MainWindow.showPathView ? "right" : "left"
+ states: [
+ State {
+ name: "left"
+ SetProperty { target: Wrapper; property: "moveToParent"; value: LeftBox }
+ },
+ State {
+ name: "right"
+ SetProperty { target: Wrapper; property: "scale"; value: RightBox.PathView.scale }
+ SetProperty { target: Wrapper; property: "scale"; binding: "RightBox.PathView.scale" }
+ SetProperty { target: Wrapper; property: "angle"; value: RightBox.PathView.angle }
+ SetProperty { target: Wrapper; property: "angle"; binding: "RightBox.PathView.angle" }
+ SetProperty { target: Wrapper; property: "moveToParent"; value: RightBox }
}
- }
- ]
- transitions: [
- Transition {
- fromState: "left"
- toState: "right"
- SequentialAnimation {
- SetPropertyAction {
- target: Wrapper
- property: "moveToParent"
- }
- ParallelAnimation {
- NumericAnimation {
- target: Wrapper
- properties: "x,y"
- to: 0
- easing: "easeOutQuad"
- duration: 350
+ ]
+ transitions: [
+ Transition {
+ toState: "right"
+ SequentialAnimation {
+ SetPropertyAction { target: Wrapper; property: "moveToParent" }
+ ParallelAnimation {
+ NumericAnimation {
+ target: Wrapper
+ properties: "x,y"
+ to: 0
+ easing: "easeOutQuad"
+ duration: 350
+ }
+ NumericAnimation { target: Wrapper; properties: "scale,angle"; duration: 350 }
}
}
- }
- },
- Transition {
- fromState: "right"
- toState: "left"
- SequentialAnimation {
- PauseAnimation {
- duration: Math.floor(index/7)*100
- }
- SetPropertyAction {
- target: Wrapper
- property: "moveToParent"
- }
- ParallelAnimation {
- NumericAnimation {
- target: Wrapper
- properties: "x,y"
- to: 0
- easing: "easeOutQuad"
- duration: 250
+ },
+ Transition {
+ toState: "left"
+ SequentialAnimation {
+ PauseAnimation { duration: Math.floor(index/7)*100 }
+ SetPropertyAction { target: Wrapper; property: "moveToParent" }
+ ParallelAnimation {
+ NumericAnimation {
+ target: Wrapper
+ properties: "x,y"
+ to: 0
+ easing: "easeOutQuad"
+ duration: 250
+ }
+ NumericAnimation { target: Wrapper; properties: "scale,angle"; duration: 250 }
}
}
}
- }
- ]
- state: "right"
- }
-
+ ]
+ }
}
}
@@ -209,12 +198,12 @@ Item {
path: Path {
startX: -150; startY: 40;
+ PathAttribute { name: "scale"; value: 0.9 }
+ PathAttribute { name: "angle"; value: -45 }
PathPercent { value: 0 }
PathLine { x: -50; y: 40 }
PathPercent { value: 0.001 }
- PathAttribute { name: "scale"; value: 1 }
- PathAttribute { name: "angle"; value: -45 }
PathCubic {
x: 400; y: 220
@@ -232,14 +221,12 @@ Item {
control1X: 590; control1Y: 220
}
- PathAttribute { name: "scale"; value: 1 }
- PathAttribute { name: "angle"; value: -45 }
-
PathPercent { value: 0.999 }
PathLine { x: 950; y: 40 }
PathPercent { value: 1.0 }
+ PathAttribute { name: "scale"; value: 0.9 }
+ PathAttribute { name: "angle"; value: -45 }
}
-
}
ImageDetails { id: ImageDetails; width: 750; x: 25; y: 500; height: 410 }