summaryrefslogtreecommitdiffstats
path: root/demos
diff options
context:
space:
mode:
authorAndrew den Exter <andrew.den-exter@nokia.com>2010-05-18 04:09:47 (GMT)
committerAndrew den Exter <andrew.den-exter@nokia.com>2010-05-18 04:09:47 (GMT)
commit183afaf48fdaeeacde009cd3f497152f89d8e0af (patch)
treee6fcc88a20e8af694c7c5020b2050c76add26de7 /demos
parentcb03c8cad2a40272c9cc8d0998246fb74a49e671 (diff)
parent379b4dc81177b95c15de30c5925efca1136e4041 (diff)
downloadQt-183afaf48fdaeeacde009cd3f497152f89d8e0af.zip
Qt-183afaf48fdaeeacde009cd3f497152f89d8e0af.tar.gz
Qt-183afaf48fdaeeacde009cd3f497152f89d8e0af.tar.bz2
Merge branch '4.7' of scm.dev.nokia.troll.no:qt/qt into 4.7
Conflicts: configure.exe src/imports/multimedia/qdeclarativeaudio.cpp src/imports/multimedia/qdeclarativeaudio_p.h src/multimedia/mediaservices/mediaservices.pro src/plugins/mediaservices/mediaservices.pro src/plugins/mediaservices/symbian/mediaplayer/s60audioplayersession.h src/plugins/mediaservices/symbian/mediaplayer/s60videoplayersession.h src/s60installs/s60installs.pro src/src.pro
Diffstat (limited to 'demos')
-rw-r--r--demos/declarative/calculator/calculator.qml4
-rw-r--r--demos/declarative/flickr/common/ScrollBar.qml2
-rw-r--r--demos/declarative/flickr/common/Slider.qml2
-rw-r--r--demos/declarative/flickr/flickr.qml4
-rw-r--r--demos/declarative/flickr/mobile/GridDelegate.qml8
-rw-r--r--demos/declarative/flickr/mobile/ImageDetails.qml18
-rw-r--r--demos/declarative/flickr/mobile/TitleBar.qml15
-rw-r--r--demos/declarative/flickr/mobile/images/quit.pngbin0 -> 2369 bytes
-rw-r--r--demos/declarative/minehunt/MinehuntCore/Tile.qml2
-rw-r--r--demos/declarative/minehunt/minehunt.cpp2
-rw-r--r--demos/declarative/photoviewer/PhotoViewerCore/AlbumDelegate.qml10
-rw-r--r--demos/declarative/photoviewer/i18n/base.ts30
-rw-r--r--demos/declarative/photoviewer/i18n/qml_fr.qmbin0 -> 268 bytes
-rw-r--r--demos/declarative/photoviewer/i18n/qml_fr.ts30
-rw-r--r--demos/declarative/photoviewer/photoviewer.qml6
-rw-r--r--demos/declarative/rssnews/content/BusyIndicator.qml12
-rw-r--r--demos/declarative/rssnews/content/CategoryDelegate.qml41
-rw-r--r--demos/declarative/rssnews/content/NewsDelegate.qml29
-rw-r--r--demos/declarative/rssnews/content/RssFeeds.qml18
-rw-r--r--demos/declarative/rssnews/content/ScrollBar.qml66
-rw-r--r--demos/declarative/rssnews/content/images/busy.pngbin0 -> 2629 bytes
-rw-r--r--demos/declarative/rssnews/content/images/scrollbar.pngbin0 -> 161 bytes
-rw-r--r--demos/declarative/rssnews/rssnews.qml52
-rwxr-xr-xdemos/declarative/samegame/SamegameCore/samegame.js5
-rw-r--r--demos/declarative/snake/content/snake.js14
-rw-r--r--demos/declarative/snake/snake.qml6
-rw-r--r--demos/declarative/twitter/TwitterCore/FatDelegate.qml2
-rw-r--r--demos/declarative/twitter/TwitterCore/HomeTitleBar.qml4
-rw-r--r--demos/declarative/twitter/TwitterCore/MultiTitleBar.qml2
-rw-r--r--demos/declarative/twitter/TwitterCore/TitleBar.qml2
-rw-r--r--demos/declarative/twitter/twitter.qml2
-rw-r--r--demos/declarative/webbrowser/content/Button.qml18
-rw-r--r--demos/declarative/webbrowser/content/FlickableWebView.qml43
-rw-r--r--demos/declarative/webbrowser/content/Header.qml69
-rw-r--r--demos/declarative/webbrowser/content/RectSoftShadow.qml32
-rw-r--r--demos/declarative/webbrowser/content/RetractingWebBrowserHeader.qml113
-rw-r--r--demos/declarative/webbrowser/content/ScrollBar.qml66
-rw-r--r--demos/declarative/webbrowser/content/UrlInput.qml44
-rw-r--r--demos/declarative/webbrowser/content/fieldtext/FieldText.qml157
-rw-r--r--demos/declarative/webbrowser/content/fieldtext/pics/cancel.pngbin1038 -> 0 bytes
-rw-r--r--demos/declarative/webbrowser/content/fieldtext/pics/ok.pngbin655 -> 0 bytes
-rw-r--r--demos/declarative/webbrowser/content/pics/addressbar-filled.pngbin694 -> 0 bytes
-rw-r--r--demos/declarative/webbrowser/content/pics/addressbar-filled.sci6
-rw-r--r--demos/declarative/webbrowser/content/pics/addressbar.pngbin467 -> 0 bytes
-rw-r--r--demos/declarative/webbrowser/content/pics/addressbar.sci6
-rw-r--r--demos/declarative/webbrowser/content/pics/back-disabled.pngbin475 -> 0 bytes
-rw-r--r--demos/declarative/webbrowser/content/pics/back.pngbin707 -> 0 bytes
-rw-r--r--demos/declarative/webbrowser/content/pics/display.pngbin0 -> 998 bytes
-rw-r--r--demos/declarative/webbrowser/content/pics/edit-delete.pngbin0 -> 1333 bytes
-rw-r--r--demos/declarative/webbrowser/content/pics/footer.pngbin200 -> 0 bytes
-rw-r--r--demos/declarative/webbrowser/content/pics/footer.sci6
-rw-r--r--demos/declarative/webbrowser/content/pics/forward-disabled.pngbin471 -> 0 bytes
-rw-r--r--demos/declarative/webbrowser/content/pics/forward.pngbin682 -> 0 bytes
-rw-r--r--demos/declarative/webbrowser/content/pics/go-next-view.pngbin0 -> 1187 bytes
-rw-r--r--demos/declarative/webbrowser/content/pics/go-previous-view.pngbin0 -> 1226 bytes
-rw-r--r--demos/declarative/webbrowser/content/pics/header.pngbin193 -> 0 bytes
-rw-r--r--demos/declarative/webbrowser/content/pics/reload.pngbin1283 -> 0 bytes
-rw-r--r--demos/declarative/webbrowser/content/pics/scrollbar.pngbin0 -> 161 bytes
-rw-r--r--demos/declarative/webbrowser/content/pics/softshadow-bottom.pngbin186 -> 0 bytes
-rw-r--r--demos/declarative/webbrowser/content/pics/softshadow-left.pngbin598 -> 0 bytes
-rw-r--r--demos/declarative/webbrowser/content/pics/softshadow-left.sci5
-rw-r--r--demos/declarative/webbrowser/content/pics/softshadow-right.pngbin636 -> 0 bytes
-rw-r--r--demos/declarative/webbrowser/content/pics/softshadow-right.sci5
-rw-r--r--demos/declarative/webbrowser/content/pics/softshadow-top.pngbin186 -> 0 bytes
-rw-r--r--demos/declarative/webbrowser/content/pics/titlebar-bg.pngbin0 -> 213 bytes
-rw-r--r--demos/declarative/webbrowser/content/pics/view-refresh.pngbin0 -> 2182 bytes
-rw-r--r--demos/declarative/webbrowser/webbrowser.qml181
67 files changed, 578 insertions, 561 deletions
diff --git a/demos/declarative/calculator/calculator.qml b/demos/declarative/calculator/calculator.qml
index 286a4d1..75f5735 100644
--- a/demos/declarative/calculator/calculator.qml
+++ b/demos/declarative/calculator/calculator.qml
@@ -98,8 +98,8 @@ Rectangle {
transitions: Transition {
SequentialAnimation {
PropertyAction { target: rotateButton; property: "operation" }
- NumberAnimation { properties: "rotation"; duration: 300; easing.type: "InOutQuint" }
- NumberAnimation { properties: "x,y,width,height"; duration: 300; easing.type: "InOutQuint" }
+ NumberAnimation { properties: "rotation"; duration: 300; easing.type: Easing.InOutQuint }
+ NumberAnimation { properties: "x,y,width,height"; duration: 300; easing.type: Easing.InOutQuint }
}
}
}
diff --git a/demos/declarative/flickr/common/ScrollBar.qml b/demos/declarative/flickr/common/ScrollBar.qml
index 4022d23..d70cd3c 100644
--- a/demos/declarative/flickr/common/ScrollBar.qml
+++ b/demos/declarative/flickr/common/ScrollBar.qml
@@ -19,7 +19,7 @@ Item {
states: [
State {
name: "show"
- when: flickableArea.moving
+ when: flickableArea.movingVertically
PropertyChanges {
target: container
opacity: 1
diff --git a/demos/declarative/flickr/common/Slider.qml b/demos/declarative/flickr/common/Slider.qml
index 4da370e..76f6303 100644
--- a/demos/declarative/flickr/common/Slider.qml
+++ b/demos/declarative/flickr/common/Slider.qml
@@ -29,7 +29,7 @@ Item {
MouseArea {
anchors.fill: parent; drag.target: parent
- drag.axis: "XAxis"; drag.minimumX: 2; drag.maximumX: slider.xMax+2
+ drag.axis: Drag.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/flickr.qml b/demos/declarative/flickr/flickr.qml
index 8b73beb..29763d4 100644
--- a/demos/declarative/flickr/flickr.qml
+++ b/demos/declarative/flickr/flickr.qml
@@ -38,7 +38,7 @@ Item {
}
transitions: Transition {
- NumberAnimation { properties: "x"; duration: 500; easing.type: "InOutQuad" }
+ NumberAnimation { properties: "x"; duration: 500; easing.type: Easing.InOutQuad }
}
}
@@ -76,7 +76,7 @@ Item {
}
transitions: Transition {
- NumberAnimation { properties: "x"; duration: 500; easing.type: "InOutQuad" }
+ NumberAnimation { properties: "x"; duration: 500; easing.type: Easing.InOutQuad }
}
}
}
diff --git a/demos/declarative/flickr/mobile/GridDelegate.qml b/demos/declarative/flickr/mobile/GridDelegate.qml
index 5ab7b87..df608bc 100644
--- a/demos/declarative/flickr/mobile/GridDelegate.qml
+++ b/demos/declarative/flickr/mobile/GridDelegate.qml
@@ -21,7 +21,7 @@
Item {
anchors.centerIn: parent
scale: 0.0
- Behavior on scale { NumberAnimation { easing.type: "InOutQuad"} }
+ Behavior on scale { NumberAnimation { easing.type: Easing.InOutQuad} }
id: scaleMe
Rectangle { height: 79; width: 79; id: blackRect; anchors.centerIn: parent; color: "black"; smooth: true }
@@ -38,7 +38,7 @@
states: [
State {
- name: "Show"; when: thumb.status == 1
+ name: "Show"; when: thumb.status == Image.Ready
PropertyChanges { target: scaleMe; scale: 1 }
},
State {
@@ -53,14 +53,14 @@
Transition {
from: "Show"; to: "Details"
ParentAnimation {
- NumberAnimation { properties: "x,y"; duration: 500; easing.type: "InOutQuad" }
+ NumberAnimation { properties: "x,y"; duration: 500; easing.type: Easing.InOutQuad }
}
},
Transition {
from: "Details"; to: "Show"
SequentialAnimation {
ParentAnimation {
- NumberAnimation { properties: "x,y"; duration: 500; easing.type: "InOutQuad" }
+ NumberAnimation { properties: "x,y"; duration: 500; easing.type: Easing.InOutQuad }
}
PropertyAction { targets: wrapper; properties: "z" }
}
diff --git a/demos/declarative/flickr/mobile/ImageDetails.qml b/demos/declarative/flickr/mobile/ImageDetails.qml
index 58b0b83..79d7cab 100644
--- a/demos/declarative/flickr/mobile/ImageDetails.qml
+++ b/demos/declarative/flickr/mobile/ImageDetails.qml
@@ -54,7 +54,11 @@ Flipable {
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 != Image.Ready
+ }
+
Flickable {
id: flickable; anchors.fill: parent; clip: true
contentWidth: imageContainer.width; contentHeight: imageContainer.height
@@ -66,10 +70,10 @@ Flipable {
Image {
id: bigImage; source: container.photoUrl; scale: slider.value
- anchors.centerIn: parent; smooth: !flickable.moving
+ anchors.centerIn: parent; smooth: !flickable.movingVertically
onStatusChanged : {
// Default scale shows the entire image.
- if (status == 1 && width != 0) {
+ if (status == Image.Ready && width != 0) {
slider.minimum = Math.min(flickable.width / width, flickable.height / height);
prevScale = Math.min(slider.minimum, 1);
slider.value = prevScale;
@@ -81,12 +85,12 @@ Flipable {
Text {
text: "Image Unavailable"
- visible: bigImage.status == 'Error'
+ visible: bigImage.status == Image.Error
anchors.centerIn: parent; color: "white"; font.bold: true
}
Common.Slider {
- id: slider; visible: { bigImage.status == 1 && maximum > minimum }
+ id: slider; visible: { bigImage.status == Image.Ready && maximum > minimum }
anchors {
bottom: parent.bottom; bottomMargin: 65
left: parent.left; leftMargin: 25
@@ -114,8 +118,8 @@ Flipable {
transitions: Transition {
SequentialAnimation {
PropertyAction { target: bigImage; property: "smooth"; value: false }
- NumberAnimation { easing.type: "InOutQuad"; properties: "angle"; duration: 500 }
- PropertyAction { target: bigImage; property: "smooth"; value: !flickable.moving }
+ NumberAnimation { easing.type: Easing.InOutQuad; properties: "angle"; duration: 500 }
+ PropertyAction { target: bigImage; property: "smooth"; value: !flickable.movingVertically }
}
}
}
diff --git a/demos/declarative/flickr/mobile/TitleBar.qml b/demos/declarative/flickr/mobile/TitleBar.qml
index 71d9385..025b897 100644
--- a/demos/declarative/flickr/mobile/TitleBar.qml
+++ b/demos/declarative/flickr/mobile/TitleBar.qml
@@ -18,10 +18,21 @@ Item {
rssModel.tags = editor.text
}
+ Image {
+ id: quitButton
+ anchors.left: parent.left//; anchors.leftMargin: 0
+ anchors.verticalCenter: parent.verticalCenter
+ source: "images/quit.png"
+ MouseArea {
+ anchors.fill: parent
+ onClicked: Qt.quit()
+ }
+ }
+
Text {
id: categoryText
anchors {
- left: parent.left; right: tagButton.left; leftMargin: 10; rightMargin: 10
+ left: quitButton.right; right: tagButton.left; leftMargin: 10; rightMargin: 10
verticalCenter: parent.verticalCenter
}
elide: Text.ElideLeft
@@ -70,6 +81,6 @@ Item {
}
transitions: Transition {
- NumberAnimation { properties: "x"; easing.type: "InOutQuad" }
+ NumberAnimation { properties: "x"; easing.type: Easing.InOutQuad }
}
}
diff --git a/demos/declarative/flickr/mobile/images/quit.png b/demos/declarative/flickr/mobile/images/quit.png
new file mode 100644
index 0000000..5bda1b6
--- /dev/null
+++ b/demos/declarative/flickr/mobile/images/quit.png
Binary files differ
diff --git a/demos/declarative/minehunt/MinehuntCore/Tile.qml b/demos/declarative/minehunt/MinehuntCore/Tile.qml
index f3620f4..98b2017 100644
--- a/demos/declarative/minehunt/MinehuntCore/Tile.qml
+++ b/demos/declarative/minehunt/MinehuntCore/Tile.qml
@@ -57,7 +57,7 @@ Flipable {
PauseAnimation {
duration: pauseDur
}
- RotationAnimation { easing.type: "InOutQuad" }
+ RotationAnimation { easing.type: Easing.InOutQuad }
ScriptAction { script: if (modelData.hasMine && modelData.flipped) { expl.explode = true } }
}
}
diff --git a/demos/declarative/minehunt/minehunt.cpp b/demos/declarative/minehunt/minehunt.cpp
index 93cd1c1..2a4ed10 100644
--- a/demos/declarative/minehunt/minehunt.cpp
+++ b/demos/declarative/minehunt/minehunt.cpp
@@ -212,6 +212,8 @@ void MinehuntGame::reset()
}
nMines = 12;
nFlags = 0;
+ emit numMinesChanged();
+ emit numFlagsChanged();
setPlaying(false);
QTimer::singleShot(600,this, SLOT(setBoard()));
}
diff --git a/demos/declarative/photoviewer/PhotoViewerCore/AlbumDelegate.qml b/demos/declarative/photoviewer/PhotoViewerCore/AlbumDelegate.qml
index d39b7bc..71d3cdc 100644
--- a/demos/declarative/photoviewer/PhotoViewerCore/AlbumDelegate.qml
+++ b/demos/declarative/photoviewer/PhotoViewerCore/AlbumDelegate.qml
@@ -56,7 +56,7 @@ Component {
Tag {
anchors { horizontalCenter: parent.horizontalCenter; bottom: parent.bottom; bottomMargin: 10 }
- frontLabel: tag; backLabel: "Delete"; flipped: mainWindow.editMode
+ frontLabel: tag; backLabel: qsTr("Remove"); flipped: mainWindow.editMode
onTagChanged: rssModel.tags = tag
onBackClicked: if (mainWindow.editMode) photosModel.remove(index);
}
@@ -78,11 +78,11 @@ Component {
]
GridView.onAdd: NumberAnimation {
- target: albumWrapper; properties: "scale"; from: 0.0; to: 1.0; easing.type: "OutQuad"
+ target: albumWrapper; properties: "scale"; from: 0.0; to: 1.0; easing.type: Easing.OutQuad
}
GridView.onRemove: SequentialAnimation {
PropertyAction { target: albumWrapper; property: "GridView.delayRemove"; value: true }
- NumberAnimation { target: albumWrapper; property: "scale"; from: 1.0; to: 0.0; easing.type: "OutQuad" }
+ NumberAnimation { target: albumWrapper; property: "scale"; from: 1.0; to: 0.0; easing.type: Easing.OutQuad }
PropertyAction { target: albumWrapper; property: "GridView.delayRemove"; value: false }
}
@@ -92,12 +92,12 @@ Component {
SequentialAnimation {
NumberAnimation { properties: 'opacity'; duration: 250 }
PauseAnimation { duration: 350 }
- NumberAnimation { target: backButton; properties: "y"; duration: 200; easing.type: "OutQuad" }
+ NumberAnimation { target: backButton; properties: "y"; duration: 200; easing.type: Easing.OutQuad }
}
},
Transition {
from: 'inGrid'; to: '*'
- NumberAnimation { properties: "y,opacity"; easing.type: "OutQuad"; duration: 300 }
+ NumberAnimation { properties: "y,opacity"; easing.type: Easing.OutQuad; duration: 300 }
}
]
}
diff --git a/demos/declarative/photoviewer/i18n/base.ts b/demos/declarative/photoviewer/i18n/base.ts
new file mode 100644
index 0000000..1accfd2
--- /dev/null
+++ b/demos/declarative/photoviewer/i18n/base.ts
@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE TS>
+<TS version="2.0">
+<context>
+ <name>AlbumDelegate</name>
+ <message>
+ <location filename="../PhotoViewerCore/AlbumDelegate.qml" line="59"/>
+ <source>Remove</source>
+ <translation type="unfinished"></translation>
+ </message>
+</context>
+<context>
+ <name>photoviewer</name>
+ <message>
+ <location filename="../photoviewer.qml" line="30"/>
+ <source>Add</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location filename="../photoviewer.qml" line="39"/>
+ <source>Edit</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location filename="../photoviewer.qml" line="52"/>
+ <source>Back</source>
+ <translation type="unfinished"></translation>
+ </message>
+</context>
+</TS>
diff --git a/demos/declarative/photoviewer/i18n/qml_fr.qm b/demos/declarative/photoviewer/i18n/qml_fr.qm
new file mode 100644
index 0000000..c24fcbc
--- /dev/null
+++ b/demos/declarative/photoviewer/i18n/qml_fr.qm
Binary files differ
diff --git a/demos/declarative/photoviewer/i18n/qml_fr.ts b/demos/declarative/photoviewer/i18n/qml_fr.ts
new file mode 100644
index 0000000..9f892db
--- /dev/null
+++ b/demos/declarative/photoviewer/i18n/qml_fr.ts
@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE TS>
+<TS version="2.0" language="fr_FR">
+<context>
+ <name>AlbumDelegate</name>
+ <message>
+ <location filename="../PhotoViewerCore/AlbumDelegate.qml" line="59"/>
+ <source>Remove</source>
+ <translation>Supprimer</translation>
+ </message>
+</context>
+<context>
+ <name>photoviewer</name>
+ <message>
+ <location filename="../photoviewer.qml" line="30"/>
+ <source>Add</source>
+ <translation>Ajouter</translation>
+ </message>
+ <message>
+ <location filename="../photoviewer.qml" line="39"/>
+ <source>Edit</source>
+ <translation>Éditer</translation>
+ </message>
+ <message>
+ <location filename="../photoviewer.qml" line="52"/>
+ <source>Back</source>
+ <translation>Retour</translation>
+ </message>
+</context>
+</TS>
diff --git a/demos/declarative/photoviewer/photoviewer.qml b/demos/declarative/photoviewer/photoviewer.qml
index 4094294..e384f46 100644
--- a/demos/declarative/photoviewer/photoviewer.qml
+++ b/demos/declarative/photoviewer/photoviewer.qml
@@ -27,7 +27,7 @@ Rectangle {
Column {
spacing: 20; anchors { bottom: parent.bottom; right: parent.right; rightMargin: 20; bottomMargin: 20 }
Button {
- id: newButton; label: "New"; rotation: 3
+ id: newButton; label: qsTr("Add"); rotation: 3
anchors.horizontalCenter: parent.horizontalCenter
onClicked: {
mainWindow.editMode = false
@@ -36,7 +36,7 @@ Rectangle {
}
}
Button {
- id: deleteButton; label: "Delete"; rotation: -2;
+ id: deleteButton; label: qsTr("Edit"); rotation: -2;
onClicked: mainWindow.editMode = !mainWindow.editMode
anchors.horizontalCenter: parent.horizontalCenter
}
@@ -49,7 +49,7 @@ Rectangle {
ListView { anchors.fill: parent; model: albumVisualModel.parts.browser; interactive: false }
- Button { id: backButton; label: "Back"; rotation: 3; x: parent.width - backButton.width - 6; y: -backButton.height - 8 }
+ Button { id: backButton; label: qsTr("Back"); rotation: 3; x: parent.width - backButton.width - 6; y: -backButton.height - 8 }
Rectangle { id: photosShade; color: 'black'; width: parent.width; height: parent.height; opacity: 0; visible: opacity != 0.0 }
diff --git a/demos/declarative/rssnews/content/BusyIndicator.qml b/demos/declarative/rssnews/content/BusyIndicator.qml
new file mode 100644
index 0000000..4be59a8
--- /dev/null
+++ b/demos/declarative/rssnews/content/BusyIndicator.qml
@@ -0,0 +1,12 @@
+import Qt 4.7
+
+Image {
+ id: container
+ property bool on: false
+
+ source: "images/busy.png"; visible: container.on
+
+ NumberAnimation on rotation {
+ running: container.on; from: 0; to: 360; loops: Animation.Infinite; duration: 1200
+ }
+}
diff --git a/demos/declarative/rssnews/content/CategoryDelegate.qml b/demos/declarative/rssnews/content/CategoryDelegate.qml
new file mode 100644
index 0000000..1400c36
--- /dev/null
+++ b/demos/declarative/rssnews/content/CategoryDelegate.qml
@@ -0,0 +1,41 @@
+import Qt 4.7
+
+Item {
+ id: delegate
+
+ width: delegate.ListView.view.width; height: 60
+
+ Text {
+ text: name
+ color: delegate.ListView.isCurrentItem ? "white" : "black"
+ font { family: "Helvetica"; pixelSize: 16; bold: true }
+ anchors {
+ left: parent.left; leftMargin: 15
+ verticalCenter: parent.verticalCenter
+ }
+ }
+
+ BusyIndicator {
+ scale: 0.6
+ on: delegate.ListView.isCurrentItem && window.loading
+ anchors { right: parent.right; rightMargin: 10; verticalCenter: parent.verticalCenter }
+ }
+
+ Rectangle {
+ width: delegate.width; height: 1; color: "#cccccc"
+ anchors.bottom: delegate.bottom
+ visible: delegate.ListView.isCurrentItem ? false : true
+ }
+ Rectangle {
+ width: delegate.width; height: 1; color: "white"
+ visible: delegate.ListView.isCurrentItem ? false : true
+ }
+
+ MouseArea {
+ anchors.fill: delegate
+ onClicked: {
+ delegate.ListView.view.currentIndex = index
+ window.currentFeed = feed
+ }
+ }
+}
diff --git a/demos/declarative/rssnews/content/NewsDelegate.qml b/demos/declarative/rssnews/content/NewsDelegate.qml
new file mode 100644
index 0000000..0d03880
--- /dev/null
+++ b/demos/declarative/rssnews/content/NewsDelegate.qml
@@ -0,0 +1,29 @@
+import Qt 4.7
+
+Item {
+ id: delegate
+ height: childrenRect.height + 20
+ width: delegate.ListView.view.width
+
+ Column {
+ x: 20; y: 20
+ width: parent.width - 40
+
+ Text {
+ id: titleText
+ text: title; width: parent.width; wrapMode: Text.WordWrap
+ font { bold: true; family: "Helvetica"; pointSize: 16 }
+ }
+
+ Text {
+ id: descriptionText
+ width: parent.width; text: description
+ wrapMode: Text.WordWrap; font.family: "Helvetica"
+ }
+ }
+
+ Rectangle {
+ width: parent.width; height: 1; color: "#cccccc"
+ anchors.bottom: parent.bottom
+ }
+}
diff --git a/demos/declarative/rssnews/content/RssFeeds.qml b/demos/declarative/rssnews/content/RssFeeds.qml
new file mode 100644
index 0000000..21e59fe
--- /dev/null
+++ b/demos/declarative/rssnews/content/RssFeeds.qml
@@ -0,0 +1,18 @@
+import Qt 4.7
+
+ListModel {
+ id: rssFeeds
+
+ ListElement { name: "Top Stories"; feed: "rss.news.yahoo.com/rss/topstories" }
+ ListElement { name: "World"; feed: "rss.news.yahoo.com/rss/world" }
+ ListElement { name: "Europe"; feed: "rss.news.yahoo.com/rss/europe" }
+ ListElement { name: "Oceania"; feed: "rss.news.yahoo.com/rss/oceania" }
+ ListElement { name: "U.S. National"; feed: "rss.news.yahoo.com/rss/us" }
+ ListElement { name: "Politics"; feed: "rss.news.yahoo.com/rss/politics" }
+ ListElement { name: "Business"; feed: "rss.news.yahoo.com/rss/business" }
+ ListElement { name: "Technology"; feed: "rss.news.yahoo.com/rss/tech" }
+ ListElement { name: "Entertainment"; feed: "rss.news.yahoo.com/rss/entertainment" }
+ ListElement { name: "Health"; feed: "rss.news.yahoo.com/rss/health" }
+ ListElement { name: "Science"; feed: "rss.news.yahoo.com/rss/science" }
+ ListElement { name: "Sports"; feed: "rss.news.yahoo.com/rss/sports" }
+}
diff --git a/demos/declarative/rssnews/content/ScrollBar.qml b/demos/declarative/rssnews/content/ScrollBar.qml
new file mode 100644
index 0000000..d0b08dd
--- /dev/null
+++ b/demos/declarative/rssnews/content/ScrollBar.qml
@@ -0,0 +1,66 @@
+import Qt 4.7
+
+Item {
+ id: container
+
+ property variant scrollArea
+ property variant orientation: Qt.Vertical
+
+ opacity: 0
+
+ function position()
+ {
+ var ny = 0;
+ if (container.orientation == Qt.Vertical)
+ ny = scrollArea.visibleArea.yPosition * container.height;
+ else
+ ny = scrollArea.visibleArea.xPosition * container.width;
+ if (ny > 2) return ny; else return 2;
+ }
+
+ function size()
+ {
+ var nh, ny;
+
+ if (container.orientation == Qt.Vertical)
+ nh = scrollArea.visibleArea.heightRatio * container.height;
+ else
+ nh = scrollArea.visibleArea.widthRatio * container.width;
+
+ if (container.orientation == Qt.Vertical)
+ ny = scrollArea.visibleArea.yPosition * container.height;
+ else
+ ny = scrollArea.visibleArea.xPosition * container.width;
+
+ if (ny > 3) {
+ var t;
+ if (container.orientation == Qt.Vertical)
+ t = Math.ceil(container.height - 3 - ny);
+ else
+ t = Math.ceil(container.width - 3 - ny);
+ if (nh > t) return t; else return nh;
+ } else return nh + ny;
+ }
+
+ Rectangle { anchors.fill: parent; color: "Black"; opacity: 0.3 }
+
+ BorderImage {
+ source: "images/scrollbar.png"
+ border { left: 1; right: 1; top: 1; bottom: 1 }
+ x: container.orientation == Qt.Vertical ? 2 : position()
+ width: container.orientation == Qt.Vertical ? container.width - 4 : size()
+ y: container.orientation == Qt.Vertical ? position() : 2
+ height: container.orientation == Qt.Vertical ? size() : container.height - 4
+ }
+
+ states: State {
+ name: "visible"
+ when: container.orientation == Qt.Vertical ? scrollArea.movingVertically : scrollArea.movingHorizontally
+ PropertyChanges { target: container; opacity: 1.0 }
+ }
+
+ transitions: Transition {
+ from: "visible"; to: ""
+ NumberAnimation { properties: "opacity"; duration: 600 }
+ }
+}
diff --git a/demos/declarative/rssnews/content/images/busy.png b/demos/declarative/rssnews/content/images/busy.png
new file mode 100644
index 0000000..664c2b1
--- /dev/null
+++ b/demos/declarative/rssnews/content/images/busy.png
Binary files differ
diff --git a/demos/declarative/rssnews/content/images/scrollbar.png b/demos/declarative/rssnews/content/images/scrollbar.png
new file mode 100644
index 0000000..0228dcf
--- /dev/null
+++ b/demos/declarative/rssnews/content/images/scrollbar.png
Binary files differ
diff --git a/demos/declarative/rssnews/rssnews.qml b/demos/declarative/rssnews/rssnews.qml
new file mode 100644
index 0000000..29a530f
--- /dev/null
+++ b/demos/declarative/rssnews/rssnews.qml
@@ -0,0 +1,52 @@
+import Qt 4.7
+import "content"
+
+Rectangle {
+ id: window
+ width: 800; height: 480
+
+ property string currentFeed: "rss.news.yahoo.com/rss/topstories"
+ property bool loading: feedModel.status == XmlListModel.Loading
+
+ RssFeeds { id: rssFeeds }
+
+ XmlListModel {
+ id: feedModel
+ source: "http://" + window.currentFeed
+ query: "/rss/channel/item"
+
+ XmlRole { name: "title"; query: "title/string()" }
+ XmlRole { name: "link"; query: "link/string()" }
+ XmlRole { name: "description"; query: "description/string()" }
+ }
+
+ Row {
+ Rectangle {
+ width: 220; height: window.height
+ color: "#efefef"
+
+ ListView {
+ focus: true
+ id: categories
+ anchors.fill: parent
+ model: rssFeeds
+ delegate: CategoryDelegate {}
+ highlight: Rectangle { color: "steelblue" }
+ highlightMoveSpeed: 9999999
+ }
+ ScrollBar {
+ scrollArea: categories; height: categories.height; width: 8
+ anchors.right: categories.right
+ }
+ }
+ ListView {
+ id: list
+ width: window.width - 220; height: window.height
+ model: feedModel
+ delegate: NewsDelegate {}
+ }
+ }
+
+ ScrollBar { scrollArea: list; height: list.height; width: 8; anchors.right: window.right }
+ Rectangle { x: 220; height: window.height; width: 1; color: "#cccccc" }
+}
diff --git a/demos/declarative/samegame/SamegameCore/samegame.js b/demos/declarative/samegame/SamegameCore/samegame.js
index bf99ca3..f9c6184 100755
--- a/demos/declarative/samegame/SamegameCore/samegame.js
+++ b/demos/declarative/samegame/SamegameCore/samegame.js
@@ -175,15 +175,14 @@ function createBlock(column,row){
// only work if the block QML is a local file. Otherwise the component will
// not be ready immediately. There is a statusChanged signal on the
// component you could use if you want to wait to load remote files.
- if(component.isReady){
- var dynamicObject = component.createObject();
+ if(component.status == Component.Ready){
+ var dynamicObject = component.createObject(gameCanvas);
if(dynamicObject == null){
console.log("error creating block");
console.log(component.errorsString());
return false;
}
dynamicObject.type = Math.floor(Math.random() * 3);
- dynamicObject.parent = gameCanvas;
dynamicObject.x = column*gameCanvas.blockSize;
dynamicObject.targetX = column*gameCanvas.blockSize;
dynamicObject.targetY = row*gameCanvas.blockSize;
diff --git a/demos/declarative/snake/content/snake.js b/demos/declarative/snake/content/snake.js
index 02f9757..f5c231e 100644
--- a/demos/declarative/snake/content/snake.js
+++ b/demos/declarative/snake/content/snake.js
@@ -52,15 +52,14 @@ function startNewGame()
link.spawned = false;
link.dying = false;
} else {
- if(linkComponent.isReady == false){
- if(linkComponent.isError == true)
+ if(linkComponent.status != Component.Ready) {
+ if(linkComponent.status == Component.Error)
console.log(linkComponent.errorsString());
else
console.log("Still loading linkComponent");
continue;//TODO: Better error handling?
}
- var link = linkComponent.createObject();
- link.parent = playfield;
+ var link = linkComponent.createObject(playfield);
link.z = numRows * numColumns + 1 - i;
link.type = i == 0 ? 2 : 0;
link.spawned = false;
@@ -293,15 +292,14 @@ function createCookie(value) {
}
}
- if(cookieComponent.isReady == false){
- if(cookieComponent.isError == true)
+ if(cookieComponent.status != Component.Ready) {
+ if(cookieComponent.status == Component.Error)
console.log(cookieComponent.errorsString());
else
console.log("Still loading cookieComponent");
return;//TODO: Better error handling?
}
- cookie = cookieComponent.createObject();
- cookie.parent = head.parent;
+ cookie = cookieComponent.createObject(head.parent);
cookie.value = value;
cookie.row = row;
cookie.column = column;
diff --git a/demos/declarative/snake/snake.qml b/demos/declarative/snake/snake.qml
index 47bced4..bc4a974 100644
--- a/demos/declarative/snake/snake.qml
+++ b/demos/declarative/snake/snake.qml
@@ -60,7 +60,7 @@ Rectangle {
Image {
id: title
source: "content/pics/snake.jpg"
- fillMode: "PreserveAspectCrop"
+ fillMode: Image.PreserveAspectCrop
anchors.fill: parent
anchors.horizontalCenter: parent.horizontalCenter
anchors.verticalCenter: parent.verticalCenter
@@ -69,7 +69,7 @@ Rectangle {
Text {
color: "white"
font.pointSize: 24
- horizontalAlignment: "AlignHCenter"
+ horizontalAlignment: Text.AlignHCenter
text: "Last Score:\t" + lastScore + "\nHighscore:\t" + highScores.topScore;
anchors.horizontalCenter: parent.horizontalCenter
anchors.bottom: parent.bottom
@@ -78,7 +78,7 @@ Rectangle {
}
source: "content/pics/background.png"
- fillMode: "PreserveAspectCrop"
+ fillMode: Image.PreserveAspectCrop
anchors.left: parent.left
anchors.right: parent.right
diff --git a/demos/declarative/twitter/TwitterCore/FatDelegate.qml b/demos/declarative/twitter/TwitterCore/FatDelegate.qml
index 62ee11a..72e5ecc 100644
--- a/demos/declarative/twitter/TwitterCore/FatDelegate.qml
+++ b/demos/declarative/twitter/TwitterCore/FatDelegate.qml
@@ -27,7 +27,7 @@ Component {
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 }
+ Loading { x: 1; y: 1; width: 48; height: 48; visible: realImage.status != Image.Ready }
Image { id: realImage; source: userImage; x: 1; y: 1; width:48; height:48 }
}
Text { id:txt; y:4; x: 56
diff --git a/demos/declarative/twitter/TwitterCore/HomeTitleBar.qml b/demos/declarative/twitter/TwitterCore/HomeTitleBar.qml
index c1ae3e5..26ad1a9 100644
--- a/demos/declarative/twitter/TwitterCore/HomeTitleBar.qml
+++ b/demos/declarative/twitter/TwitterCore/HomeTitleBar.qml
@@ -37,7 +37,7 @@ Item {
UserModel { user: rssModel.authName; id: userModel }
Component { id: imgDelegate;
Item {
- Loading { width:48; height:48; visible: realImage.status != 1 }
+ Loading { width:48; height:48; visible: realImage.status != Image.Ready }
Image { source: image; width:48; height:48; id: realImage }
}
}
@@ -113,7 +113,7 @@ Item {
transitions: [
Transition {
from: "*"; to: "*"
- NumberAnimation { properties: "x,y,width,height"; easing.type: "InOutQuad" }
+ NumberAnimation { properties: "x,y,width,height"; easing.type: Easing.InOutQuad }
}
]
}
diff --git a/demos/declarative/twitter/TwitterCore/MultiTitleBar.qml b/demos/declarative/twitter/TwitterCore/MultiTitleBar.qml
index 8c27e2b..445eda4 100644
--- a/demos/declarative/twitter/TwitterCore/MultiTitleBar.qml
+++ b/demos/declarative/twitter/TwitterCore/MultiTitleBar.qml
@@ -18,7 +18,7 @@ Item {
}
]
transitions: [
- Transition { NumberAnimation { properties: "x,y"; duration: 500; easing.type: "InOutQuad" } }
+ Transition { NumberAnimation { properties: "x,y"; duration: 500; easing.type: Easing.InOutQuad } }
]
}
diff --git a/demos/declarative/twitter/TwitterCore/TitleBar.qml b/demos/declarative/twitter/TwitterCore/TitleBar.qml
index 87ceec5..5256de4 100644
--- a/demos/declarative/twitter/TwitterCore/TitleBar.qml
+++ b/demos/declarative/twitter/TwitterCore/TitleBar.qml
@@ -70,6 +70,6 @@ Item {
}
transitions: Transition {
- NumberAnimation { properties: "x"; easing.type: "InOutQuad" }
+ NumberAnimation { properties: "x"; easing.type: Easing.InOutQuad }
}
}
diff --git a/demos/declarative/twitter/twitter.qml b/demos/declarative/twitter/twitter.qml
index 0e3ec3e..f86388e 100644
--- a/demos/declarative/twitter/twitter.qml
+++ b/demos/declarative/twitter/twitter.qml
@@ -88,7 +88,7 @@ Item {
}
]
transitions: [
- Transition { NumberAnimation { properties: "x,y"; duration: 500; easing.type: "InOutQuad" } }
+ Transition { NumberAnimation { properties: "x,y"; duration: 500; easing.type: Easing.InOutQuad } }
]
}
}
diff --git a/demos/declarative/webbrowser/content/Button.qml b/demos/declarative/webbrowser/content/Button.qml
new file mode 100644
index 0000000..a1baf16
--- /dev/null
+++ b/demos/declarative/webbrowser/content/Button.qml
@@ -0,0 +1,18 @@
+import Qt 4.7
+
+Item {
+ property alias image: icon.source
+ property variant action
+
+ width: 40; height: parent.height
+
+ Image {
+ id: icon; anchors.centerIn: parent
+ opacity: action.enabled ? 1.0 : 0.4
+ }
+
+ MouseArea {
+ anchors { fill: parent; topMargin: -10; bottomMargin: -10 }
+ onClicked: action.trigger()
+ }
+}
diff --git a/demos/declarative/webbrowser/content/FlickableWebView.qml b/demos/declarative/webbrowser/content/FlickableWebView.qml
index 46f45e0..32d69d8 100644
--- a/demos/declarative/webbrowser/content/FlickableWebView.qml
+++ b/demos/declarative/webbrowser/content/FlickableWebView.qml
@@ -12,17 +12,22 @@ Flickable {
id: flickable
width: parent.width
- contentWidth: Math.max(parent.width,webView.width*webView.scale)
- contentHeight: Math.max(parent.height,webView.height*webView.scale)
+ contentWidth: Math.max(parent.width,webView.width)
+ contentHeight: Math.max(parent.height,webView.height)
anchors.top: headerSpace.bottom
- anchors.bottom: footer.top
+ anchors.bottom: parent.top
anchors.left: parent.left
anchors.right: parent.right
pressDelay: 200
+ onWidthChanged : {
+ // Expand (but not above 1:1) if otherwise would be smaller that available width.
+ if (width > webView.width*webView.contentsScale && webView.contentsScale < 1.0)
+ webView.contentsScale = width / webView.width * webView.contentsScale;
+ }
+
WebView {
id: webView
- pixelCacheSize: 4000000
transformOrigin: Item.TopLeft
function fixUrl(url)
@@ -42,8 +47,6 @@ Flickable {
url: fixUrl(webBrowser.urlString)
smooth: false // We don't want smooth scaling, since we only scale during (fast) transitions
- smoothCache: true // We do want smooth rendering
- fillColor: "white"
focus: true
zoomFactor: 1
@@ -53,14 +56,13 @@ Flickable {
{
if (centerX) {
var sc = zoom/contentsScale;
- scaleAnim.to = sc;
+ scaleAnim.to = zoom;
flickVX.from = flickable.contentX
flickVX.to = Math.max(0,Math.min(centerX-flickable.width/2,webView.width*sc-flickable.width))
finalX.value = flickVX.to
flickVY.from = flickable.contentY
flickVY.to = Math.max(0,Math.min(centerY-flickable.height/2,webView.height*sc-flickable.height))
finalY.value = flickVY.to
- finalZoom.value = zoom
quickZoom.start()
}
}
@@ -68,8 +70,8 @@ Flickable {
Keys.onLeftPressed: webView.contentsScale -= 0.1
Keys.onRightPressed: webView.contentsScale += 0.1
- preferredWidth: flickable.width*zoomFactor
- preferredHeight: flickable.height*zoomFactor
+ preferredWidth: flickable.width
+ preferredHeight: flickable.height
contentsScale: 1/zoomFactor
onContentsSizeChanged: {
// zoom out
@@ -102,17 +104,16 @@ Flickable {
NumberAnimation {
id: scaleAnim
target: webView
- property: "scale"
- from: 1
- to: 0 // set before calling
- easing.type: "Linear"
+ property: "contentsScale"
+ // the to property is set before calling
+ easing.type: Easing.Linear
duration: 200
}
NumberAnimation {
id: flickVX
target: flickable
property: "contentX"
- easing.type: "Linear"
+ easing.type: Easing.Linear
duration: 200
from: 0 // set before calling
to: 0 // set before calling
@@ -121,22 +122,12 @@ Flickable {
id: flickVY
target: flickable
property: "contentY"
- easing.type: "Linear"
+ easing.type: Easing.Linear
duration: 200
from: 0 // set before calling
to: 0 // set before calling
}
}
- PropertyAction {
- id: finalZoom
- target: webView
- property: "contentsScale"
- }
- PropertyAction {
- target: webView
- property: "scale"
- value: 1.0
- }
// Have to set the contentXY, since the above 2
// size changes may have started a correction if
// contentsScale < 1.0.
diff --git a/demos/declarative/webbrowser/content/Header.qml b/demos/declarative/webbrowser/content/Header.qml
new file mode 100644
index 0000000..7c93580
--- /dev/null
+++ b/demos/declarative/webbrowser/content/Header.qml
@@ -0,0 +1,69 @@
+import Qt 4.7
+
+Image {
+ property alias editUrl: urlInput.url
+
+ source: "pics/titlebar-bg.png"; fillMode: Image.TileHorizontally
+
+ x: webView.contentX < 0 ? -webView.contentX : webView.contentX > webView.contentWidth-webView.width
+ ? -webView.contentX+webView.contentWidth-webView.width : 0
+
+ y: {
+ if (webView.progress < 1.0)
+ return 0;
+ else {
+ webView.contentY < 0 ? -webView.contentY : webView.contentY > height ? -height : -webView.contentY
+ }
+ }
+
+ Column {
+ width: parent.width
+
+ Item {
+ width: parent.width; height: 20
+ Text {
+ anchors.centerIn: parent
+ text: webView.title; font.pixelSize: 14; font.bold: true
+ color: "white"; styleColor: "black"; style: Text.Sunken
+ }
+ }
+
+ Item {
+ width: parent.width; height: 40
+
+ Button {
+ id: backButton
+ action: webView.back; image: "pics/go-previous-view.png"
+ anchors { left: parent.left; bottom: parent.bottom }
+ }
+
+ Button {
+ id: nextButton
+ anchors.left: backButton.right
+ action: webView.forward; image: "pics/go-next-view.png"
+ }
+
+ UrlInput {
+ id: urlInput
+ anchors { left: nextButton.right; right: reloadButton.left }
+ image: "pics/display.png"
+ onUrlEntered: {
+ webBrowser.urlString = url
+ webBrowser.focus = true
+ }
+ }
+
+ Button {
+ id: reloadButton
+ anchors { right: parent.right; rightMargin: 4 }
+ action: webView.reload; image: "pics/view-refresh.png"; visible: webView.progress == 1.0
+ }
+
+ Button {
+ id: stopButton
+ anchors { right: parent.right; rightMargin: 4 }
+ action: webView.stop; image: "pics/edit-delete.png"; visible: webView.progress < 1.0
+ }
+ }
+ }
+}
diff --git a/demos/declarative/webbrowser/content/RectSoftShadow.qml b/demos/declarative/webbrowser/content/RectSoftShadow.qml
deleted file mode 100644
index 53d098c..0000000
--- a/demos/declarative/webbrowser/content/RectSoftShadow.qml
+++ /dev/null
@@ -1,32 +0,0 @@
-import Qt 4.7
-
-Item {
- BorderImage {
- source: "pics/softshadow-left.sci"
- x: -16
- y: -16
- width: 16
- height: parent.height+32
- }
- BorderImage {
- source: "pics/softshadow-right.sci"
- x: parent.width
- y: -16
- width: 16
- height: parent.height+32
- }
- Image {
- source: "pics/softshadow-top.png"
- x: 0
- y: -16
- width: parent.width
- height: 16
- }
- Image {
- source: "pics/softshadow-bottom.png"
- x: 0
- y: parent.height
- width: parent.width
- height: 16
- }
-}
diff --git a/demos/declarative/webbrowser/content/RetractingWebBrowserHeader.qml b/demos/declarative/webbrowser/content/RetractingWebBrowserHeader.qml
deleted file mode 100644
index f5bfadf..0000000
--- a/demos/declarative/webbrowser/content/RetractingWebBrowserHeader.qml
+++ /dev/null
@@ -1,113 +0,0 @@
-import Qt 4.7
-
-import "fieldtext"
-
-Image {
- property alias editUrl: editUrl.text
-
- id: header
- source: "pics/header.png"
- width: parent.width
- height: 60
- x: webView.contentX < 0 ? -webView.contentX : webView.contentX > webView.contentWidth-webView.width
- ? -webView.contentX+webView.contentWidth-webView.width : 0
- y: webView.contentY < 0 ? -webView.contentY : progressOff*
- (webView.contentY>height?-height:-webView.contentY)
- Row {
- id: headerTitle
-
- anchors.top: header.top
- anchors.topMargin: 4
- x: parent.width > headerIcon.width+headerText.width+6 ? (parent.width-headerIcon.width-headerText.width-6)/2 : 0
- spacing: 6
-
- Image {
- id: headerIcon
- pixmap: webView.icon
- }
-
- Text {
- id: headerText
-
- text: webView.title!='' || webView.progress == 1.0 ? webView.title : 'Loading...'
-
- color: "white"
- styleColor: "black"
- style: Text.Raised
-
- font.family: "Helvetica"
- font.pointSize: 10
- font.bold: true
-
- horizontalAlignment: Text.AlignHCenter
- }
- }
- Item {
- width: parent.width
- anchors.top: headerTitle.bottom
- anchors.topMargin: 2
- anchors.bottom: parent.bottom
-
- Item {
- id: urlBox
- height: 31
- anchors.left: parent.left
- anchors.leftMargin: 12
- anchors.right: parent.right
- anchors.rightMargin: 12
- anchors.top: parent.top
- clip: true
- property bool mouseGrabbed: false
-
- BorderImage {
- source: "pics/addressbar.sci"
- anchors.fill: urlBox
- }
-
- BorderImage {
- id: urlBoxhl
- source: "pics/addressbar-filled.sci"
- width: parent.width*webView.progress
- height: parent.height
- opacity: 1-header.progressOff
- clip: true
- }
-
- FieldText {
- id: editUrl
- mouseGrabbed: parent.mouseGrabbed
-
- text: webBrowser.urlString
- label: "url:"
- 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.leftMargin: 6
- anchors.verticalCenter: urlBox.verticalCenter
- anchors.verticalCenterOffset: 1
- }
- }
- }
-
- property real progressOff : 1
- states: [
- State {
- name: "ProgressShown"
- when: webView.progress < 1.0
- PropertyChanges { target: header; progressOff: 0; }
- }
- ]
- transitions: [
- Transition {
- NumberAnimation {
- targets: header
- properties: "progressOff"
- easing.type: "InOutQuad"
- duration: 300
- }
- }
- ]
-}
diff --git a/demos/declarative/webbrowser/content/ScrollBar.qml b/demos/declarative/webbrowser/content/ScrollBar.qml
new file mode 100644
index 0000000..aa79d35
--- /dev/null
+++ b/demos/declarative/webbrowser/content/ScrollBar.qml
@@ -0,0 +1,66 @@
+import Qt 4.7
+
+Item {
+ id: container
+
+ property variant scrollArea
+ property variant orientation: Qt.Vertical
+
+ opacity: 0
+
+ function position()
+ {
+ var ny = 0;
+ if (container.orientation == Qt.Vertical)
+ ny = scrollArea.visibleArea.yPosition * container.height;
+ else
+ ny = scrollArea.visibleArea.xPosition * container.width;
+ if (ny > 2) return ny; else return 2;
+ }
+
+ function size()
+ {
+ var nh, ny;
+
+ if (container.orientation == Qt.Vertical)
+ nh = scrollArea.visibleArea.heightRatio * container.height;
+ else
+ nh = scrollArea.visibleArea.widthRatio * container.width;
+
+ if (container.orientation == Qt.Vertical)
+ ny = scrollArea.visibleArea.yPosition * container.height;
+ else
+ ny = scrollArea.visibleArea.xPosition * container.width;
+
+ if (ny > 3) {
+ var t;
+ if (container.orientation == Qt.Vertical)
+ t = Math.ceil(container.height - 3 - ny);
+ else
+ t = Math.ceil(container.width - 3 - ny);
+ if (nh > t) return t; else return nh;
+ } else return nh + ny;
+ }
+
+ Rectangle { anchors.fill: parent; color: "Black"; opacity: 0.5 }
+
+ BorderImage {
+ source: "pics/scrollbar.png"
+ border { left: 1; right: 1; top: 1; bottom: 1 }
+ x: container.orientation == Qt.Vertical ? 2 : position()
+ width: container.orientation == Qt.Vertical ? container.width - 4 : size()
+ y: container.orientation == Qt.Vertical ? position() : 2
+ height: container.orientation == Qt.Vertical ? size() : container.height - 4
+ }
+
+ states: State {
+ name: "visible"
+ when: container.orientation == Qt.Vertical ? scrollArea.movingVertically : scrollArea.movingHorizontally
+ PropertyChanges { target: container; opacity: 1.0 }
+ }
+
+ transitions: Transition {
+ from: "visible"; to: ""
+ NumberAnimation { properties: "opacity"; duration: 600 }
+ }
+}
diff --git a/demos/declarative/webbrowser/content/UrlInput.qml b/demos/declarative/webbrowser/content/UrlInput.qml
new file mode 100644
index 0000000..9f7fc38
--- /dev/null
+++ b/demos/declarative/webbrowser/content/UrlInput.qml
@@ -0,0 +1,44 @@
+import Qt 4.7
+
+Item {
+ id: container
+
+ property alias image: bg.source
+ property alias url: urlText.text
+
+ signal urlEntered(string url)
+
+ width: parent.height; height: parent.height
+
+ BorderImage {
+ id: bg; rotation: 180
+ x: 8; width: parent.width - 16; height: 30;
+ anchors.verticalCenter: parent.verticalCenter
+ border { left: 10; top: 10; right: 10; bottom: 10 }
+ }
+
+ Rectangle {
+ anchors.bottom: bg.bottom
+ x: 18; height: 4; color: "#63b1ed"
+ width: (bg.width - 20) * webView.progress
+ opacity: webView.progress == 1.0 ? 0.0 : 1.0
+ }
+
+ TextInput {
+ id: urlText
+ horizontalAlignment: TextEdit.AlignLeft
+ font.pixelSize: 14; focusOnPress: true
+ Keys.onEscapePressed: {
+ urlText.text = webView.url
+ webView.focus = true
+ }
+ Keys.onReturnPressed: {
+ container.urlEntered(urlText.text)
+ webView.focus = true
+ }
+ anchors {
+ left: parent.left; right: parent.right; leftMargin: 18; rightMargin: 18
+ verticalCenter: parent.verticalCenter
+ }
+ }
+}
diff --git a/demos/declarative/webbrowser/content/fieldtext/FieldText.qml b/demos/declarative/webbrowser/content/fieldtext/FieldText.qml
deleted file mode 100644
index d1d003f..0000000
--- a/demos/declarative/webbrowser/content/fieldtext/FieldText.qml
+++ /dev/null
@@ -1,157 +0,0 @@
-import Qt 4.7
-
-Item {
- id: fieldText
- height: 30
- property string text: ""
- property string label: ""
- property bool mouseGrabbed: false
- signal confirmed
- signal cancelled
- signal startEdit
-
- function edit() {
- if (!mouseGrabbed) {
- fieldText.startEdit();
- fieldText.state='editing';
- mouseGrabbed=true;
- }
- }
-
- function confirm() {
- fieldText.state='';
- fieldText.text = textEdit.text;
- mouseGrabbed=false;
- fieldText.confirmed();
- }
-
- function reset() {
- textEdit.text = fieldText.text;
- fieldText.state='';
- mouseGrabbed=false;
- fieldText.cancelled();
- }
-
- Image {
- id: cancelIcon
- width: 22
- height: 22
- anchors.right: parent.right
- anchors.rightMargin: 4
- anchors.verticalCenter: parent.verticalCenter
- source: "pics/cancel.png"
- opacity: 0
- }
-
- Image {
- id: confirmIcon
- width: 22
- height: 22
- anchors.left: parent.left
- anchors.leftMargin: 4
- anchors.verticalCenter: parent.verticalCenter
- source: "pics/ok.png"
- opacity: 0
- }
-
- TextInput {
- id: textEdit
- text: fieldText.text
- focus: false
- anchors.left: parent.left
- anchors.leftMargin: 0
- anchors.right: parent.right
- anchors.rightMargin: 0
- anchors.verticalCenter: parent.verticalCenter
- color: "black"
- font.bold: true
- readOnly: true
- onAccepted: confirm()
- Keys.onEscapePressed: reset()
- }
-
- Text {
- id: textLabel
- x: 5
- width: parent.width-10
- anchors.verticalCenter: parent.verticalCenter
- horizontalAlignment: Text.AlignHCenter
- color: fieldText.state == "editing" ? "#505050" : "#AAAAAA"
- font.italic: true
- font.bold: true
- text: label
- opacity: textEdit.text == '' ? 1 : 0
- Behavior on opacity {
- NumberAnimation {
- property: "opacity"
- duration: 250
- }
- }
- }
-
- MouseArea {
- anchors.fill: cancelIcon
- onClicked: { reset() }
- }
-
- MouseArea {
- anchors.fill: confirmIcon
- onClicked: { confirm() }
- }
-
- MouseArea {
- id: editRegion
- anchors.fill: textEdit
- onClicked: { edit() }
- }
-
- states: [
- State {
- name: "editing"
- PropertyChanges {
- target: confirmIcon
- opacity: 1
- }
- PropertyChanges {
- target: cancelIcon
- opacity: 1
- }
- PropertyChanges {
- target: textEdit
- color: "black"
- readOnly: false
- focus: true
- selectionStart: 0
- selectionEnd: -1
- }
- PropertyChanges {
- target: editRegion
- opacity: 0
- }
- PropertyChanges {
- target: textEdit.anchors
- leftMargin: 34
- }
- PropertyChanges {
- target: textEdit.anchors
- rightMargin: 34
- }
- }
- ]
-
- transitions: [
- Transition {
- from: ""
- to: "*"
- reversible: true
- NumberAnimation {
- properties: "opacity,leftMargin,rightMargin"
- duration: 200
- }
- ColorAnimation {
- property: "color"
- duration: 150
- }
- }
- ]
-}
diff --git a/demos/declarative/webbrowser/content/fieldtext/pics/cancel.png b/demos/declarative/webbrowser/content/fieldtext/pics/cancel.png
deleted file mode 100644
index ecc9533..0000000
--- a/demos/declarative/webbrowser/content/fieldtext/pics/cancel.png
+++ /dev/null
Binary files differ
diff --git a/demos/declarative/webbrowser/content/fieldtext/pics/ok.png b/demos/declarative/webbrowser/content/fieldtext/pics/ok.png
deleted file mode 100644
index 5795f04..0000000
--- a/demos/declarative/webbrowser/content/fieldtext/pics/ok.png
+++ /dev/null
Binary files differ
diff --git a/demos/declarative/webbrowser/content/pics/addressbar-filled.png b/demos/declarative/webbrowser/content/pics/addressbar-filled.png
deleted file mode 100644
index d8452ec..0000000
--- a/demos/declarative/webbrowser/content/pics/addressbar-filled.png
+++ /dev/null
Binary files differ
diff --git a/demos/declarative/webbrowser/content/pics/addressbar-filled.sci b/demos/declarative/webbrowser/content/pics/addressbar-filled.sci
deleted file mode 100644
index 96c5efb..0000000
--- a/demos/declarative/webbrowser/content/pics/addressbar-filled.sci
+++ /dev/null
@@ -1,6 +0,0 @@
-border.left: 7
-border.top: 7
-border.bottom: 7
-border.right: 7
-source: addressbar-filled.png
-
diff --git a/demos/declarative/webbrowser/content/pics/addressbar.png b/demos/declarative/webbrowser/content/pics/addressbar.png
deleted file mode 100644
index 3278f58..0000000
--- a/demos/declarative/webbrowser/content/pics/addressbar.png
+++ /dev/null
Binary files differ
diff --git a/demos/declarative/webbrowser/content/pics/addressbar.sci b/demos/declarative/webbrowser/content/pics/addressbar.sci
deleted file mode 100644
index 8f1cd18..0000000
--- a/demos/declarative/webbrowser/content/pics/addressbar.sci
+++ /dev/null
@@ -1,6 +0,0 @@
-border.left: 7
-border.top: 7
-border.bottom: 7
-border.right: 7
-source: addressbar.png
-
diff --git a/demos/declarative/webbrowser/content/pics/back-disabled.png b/demos/declarative/webbrowser/content/pics/back-disabled.png
deleted file mode 100644
index 91b9e76..0000000
--- a/demos/declarative/webbrowser/content/pics/back-disabled.png
+++ /dev/null
Binary files differ
diff --git a/demos/declarative/webbrowser/content/pics/back.png b/demos/declarative/webbrowser/content/pics/back.png
deleted file mode 100644
index 9988dd3..0000000
--- a/demos/declarative/webbrowser/content/pics/back.png
+++ /dev/null
Binary files differ
diff --git a/demos/declarative/webbrowser/content/pics/display.png b/demos/declarative/webbrowser/content/pics/display.png
new file mode 100644
index 0000000..9507f43
--- /dev/null
+++ b/demos/declarative/webbrowser/content/pics/display.png
Binary files differ
diff --git a/demos/declarative/webbrowser/content/pics/edit-delete.png b/demos/declarative/webbrowser/content/pics/edit-delete.png
new file mode 100644
index 0000000..351659b
--- /dev/null
+++ b/demos/declarative/webbrowser/content/pics/edit-delete.png
Binary files differ
diff --git a/demos/declarative/webbrowser/content/pics/footer.png b/demos/declarative/webbrowser/content/pics/footer.png
deleted file mode 100644
index 8391a93..0000000
--- a/demos/declarative/webbrowser/content/pics/footer.png
+++ /dev/null
Binary files differ
diff --git a/demos/declarative/webbrowser/content/pics/footer.sci b/demos/declarative/webbrowser/content/pics/footer.sci
deleted file mode 100644
index 7be58f1..0000000
--- a/demos/declarative/webbrowser/content/pics/footer.sci
+++ /dev/null
@@ -1,6 +0,0 @@
-border.left: 5
-border.top: 0
-border.bottom: 0
-border.right: 5
-source: footer.png
-
diff --git a/demos/declarative/webbrowser/content/pics/forward-disabled.png b/demos/declarative/webbrowser/content/pics/forward-disabled.png
deleted file mode 100644
index cb87f4f..0000000
--- a/demos/declarative/webbrowser/content/pics/forward-disabled.png
+++ /dev/null
Binary files differ
diff --git a/demos/declarative/webbrowser/content/pics/forward.png b/demos/declarative/webbrowser/content/pics/forward.png
deleted file mode 100644
index 83870ee..0000000
--- a/demos/declarative/webbrowser/content/pics/forward.png
+++ /dev/null
Binary files differ
diff --git a/demos/declarative/webbrowser/content/pics/go-next-view.png b/demos/declarative/webbrowser/content/pics/go-next-view.png
new file mode 100644
index 0000000..3bce02d
--- /dev/null
+++ b/demos/declarative/webbrowser/content/pics/go-next-view.png
Binary files differ
diff --git a/demos/declarative/webbrowser/content/pics/go-previous-view.png b/demos/declarative/webbrowser/content/pics/go-previous-view.png
new file mode 100644
index 0000000..3ec011e
--- /dev/null
+++ b/demos/declarative/webbrowser/content/pics/go-previous-view.png
Binary files differ
diff --git a/demos/declarative/webbrowser/content/pics/header.png b/demos/declarative/webbrowser/content/pics/header.png
deleted file mode 100644
index 26588c3..0000000
--- a/demos/declarative/webbrowser/content/pics/header.png
+++ /dev/null
Binary files differ
diff --git a/demos/declarative/webbrowser/content/pics/reload.png b/demos/declarative/webbrowser/content/pics/reload.png
deleted file mode 100644
index 45b5535..0000000
--- a/demos/declarative/webbrowser/content/pics/reload.png
+++ /dev/null
Binary files differ
diff --git a/demos/declarative/webbrowser/content/pics/scrollbar.png b/demos/declarative/webbrowser/content/pics/scrollbar.png
new file mode 100644
index 0000000..0228dcf
--- /dev/null
+++ b/demos/declarative/webbrowser/content/pics/scrollbar.png
Binary files differ
diff --git a/demos/declarative/webbrowser/content/pics/softshadow-bottom.png b/demos/declarative/webbrowser/content/pics/softshadow-bottom.png
deleted file mode 100644
index 85b0b44..0000000
--- a/demos/declarative/webbrowser/content/pics/softshadow-bottom.png
+++ /dev/null
Binary files differ
diff --git a/demos/declarative/webbrowser/content/pics/softshadow-left.png b/demos/declarative/webbrowser/content/pics/softshadow-left.png
deleted file mode 100644
index 02926d1..0000000
--- a/demos/declarative/webbrowser/content/pics/softshadow-left.png
+++ /dev/null
Binary files differ
diff --git a/demos/declarative/webbrowser/content/pics/softshadow-left.sci b/demos/declarative/webbrowser/content/pics/softshadow-left.sci
deleted file mode 100644
index 45c88d5..0000000
--- a/demos/declarative/webbrowser/content/pics/softshadow-left.sci
+++ /dev/null
@@ -1,5 +0,0 @@
-border.left: 0
-border.top: 16
-border.bottom: 16
-border.right: 0
-source: softshadow-left.png
diff --git a/demos/declarative/webbrowser/content/pics/softshadow-right.png b/demos/declarative/webbrowser/content/pics/softshadow-right.png
deleted file mode 100644
index e459f4f..0000000
--- a/demos/declarative/webbrowser/content/pics/softshadow-right.png
+++ /dev/null
Binary files differ
diff --git a/demos/declarative/webbrowser/content/pics/softshadow-right.sci b/demos/declarative/webbrowser/content/pics/softshadow-right.sci
deleted file mode 100644
index 4d459c0..0000000
--- a/demos/declarative/webbrowser/content/pics/softshadow-right.sci
+++ /dev/null
@@ -1,5 +0,0 @@
-border.left: 0
-border.top: 16
-border.bottom: 16
-border.right: 0
-source: softshadow-right.png
diff --git a/demos/declarative/webbrowser/content/pics/softshadow-top.png b/demos/declarative/webbrowser/content/pics/softshadow-top.png
deleted file mode 100644
index 9a9e232..0000000
--- a/demos/declarative/webbrowser/content/pics/softshadow-top.png
+++ /dev/null
Binary files differ
diff --git a/demos/declarative/webbrowser/content/pics/titlebar-bg.png b/demos/declarative/webbrowser/content/pics/titlebar-bg.png
new file mode 100644
index 0000000..06961e8
--- /dev/null
+++ b/demos/declarative/webbrowser/content/pics/titlebar-bg.png
Binary files differ
diff --git a/demos/declarative/webbrowser/content/pics/view-refresh.png b/demos/declarative/webbrowser/content/pics/view-refresh.png
new file mode 100644
index 0000000..afa2a9d
--- /dev/null
+++ b/demos/declarative/webbrowser/content/pics/view-refresh.png
Binary files differ
diff --git a/demos/declarative/webbrowser/webbrowser.qml b/demos/declarative/webbrowser/webbrowser.qml
index fbbe7b2..f539e21 100644
--- a/demos/declarative/webbrowser/webbrowser.qml
+++ b/demos/declarative/webbrowser/webbrowser.qml
@@ -3,168 +3,35 @@ import org.webkit 1.0
import "content"
-Item {
+Rectangle {
id: webBrowser
property string urlString : "http://qt.nokia.com/"
- width: 640
- height: 480
+ width: 800; height: 600
+ color: "#343434"
- Item {
- id: webPanel
- anchors.fill: parent
- clip: true
- Rectangle {
- color: "#555555"
- anchors.fill: parent
- }
- Image {
- source: "content/pics/softshadow-bottom.png"
- width: webPanel.width
- height: 16
- }
- Image {
- source: "content/pics/softshadow-top.png"
- width: webPanel.width
- height: 16
- anchors.bottom: footer.top
- }
- RectSoftShadow {
- x: -webView.contentX
- y: -webView.contentY
- width: webView.contentWidth
- height: webView.contentHeight+headerSpace.height
- }
- Item {
- id: headerSpace
- width: parent.width
- height: 60
- z: 1
+ FlickableWebView {
+ id: webView
+ url: webBrowser.urlString
+ anchors { top: headerSpace.bottom; left: parent.left; right: parent.right; bottom: parent.bottom }
+ }
+
+ Item { id: headerSpace; width: parent.width; height: 62 }
+
+ Header {
+ id: header
+ editUrl: webBrowser.urlString
+ width: headerSpace.width; height: headerSpace.height
+ }
+
+ ScrollBar {
+ scrollArea: webView; width: 8
+ anchors { right: parent.right; top: header.bottom; bottom: parent.bottom }
+ }
- RetractingWebBrowserHeader { id: header }
- }
- FlickableWebView {
- id: webView
- width: parent.width
- anchors.top: headerSpace.bottom
- anchors.bottom: footer.top
- anchors.left: parent.left
- anchors.right: parent.right
- }
- BorderImage {
- id: footer
- source: "content/pics/footer.sci"
- width: parent.width
- height: 43
- anchors.bottom: parent.bottom
- Rectangle {
- y: -1
- width: parent.width
- height: 1
- color: "#555555"
- }
- Item {
- id: backbutton
- width: back_e.width
- height: back_e.height
- anchors.right: reload.left
- anchors.rightMargin: 10
- anchors.verticalCenter: parent.verticalCenter
- Image {
- id: back_e
- source: "content/pics/back.png"
- anchors.fill: parent
- }
- Image {
- id: back_d
- source: "content/pics/back-disabled.png"
- anchors.fill: parent
- }
- states: [
- State {
- name: "Enabled"
- when: webView.back.enabled==true
- PropertyChanges { target: back_e; opacity: 1 }
- PropertyChanges { target: back_d; opacity: 0 }
- },
- State {
- name: "Disabled"
- when: webView.back.enabled==false
- PropertyChanges { target: back_e; opacity: 0 }
- PropertyChanges { target: back_d; opacity: 1 }
- }
- ]
- transitions: [
- Transition {
- NumberAnimation {
- properties: "opacity"
- easing.type: "InOutQuad"
- duration: 300
- }
- }
- ]
- MouseArea {
- anchors.fill: back_e
- onClicked: { if (webView.back.enabled) webView.back.trigger() }
- }
- }
- Image {
- id: reload
- source: "content/pics/reload.png"
- anchors.horizontalCenter: parent.horizontalCenter
- anchors.verticalCenter: parent.verticalCenter
- }
- MouseArea {
- anchors.fill: reload
- onClicked: { webView.reload.trigger() }
- }
- Item {
- id: forwardbutton
- width: forward_e.width
- height: forward_e.height
- anchors.left: reload.right
- anchors.leftMargin: 10
- anchors.verticalCenter: parent.verticalCenter
- Image {
- id: forward_e
- source: "content/pics/forward.png"
- anchors.fill: parent
- anchors.verticalCenter: parent.verticalCenter
- }
- Image {
- id: forward_d
- source: "content/pics/forward-disabled.png"
- anchors.fill: parent
- }
- states: [
- State {
- name: "Enabled"
- when: webView.forward.enabled==true
- PropertyChanges { target: forward_e; opacity: 1 }
- PropertyChanges { target: forward_d; opacity: 0 }
- },
- State {
- name: "Disabled"
- when: webView.forward.enabled==false
- PropertyChanges { target: forward_e; opacity: 0 }
- PropertyChanges { target: forward_d; opacity: 1 }
- }
- ]
- transitions: [
- Transition {
- NumberAnimation {
- properties: "opacity"
- easing.type: "InOutQuad"
- duration: 320
- }
- }
- ]
- MouseArea {
- anchors.fill: parent
- onClicked: { if (webView.forward.enabled) webView.forward.trigger() }
- }
- }
- }
+ ScrollBar {
+ scrollArea: webView; height: 8; orientation: Qt.Horizontal
+ anchors { right: parent.right; rightMargin: 8; left: parent.left; bottom: parent.bottom }
}
}