summaryrefslogtreecommitdiffstats
path: root/examples
diff options
context:
space:
mode:
Diffstat (limited to 'examples')
-rw-r--r--examples/dbus/remotecontrolledcar/car/car.h6
-rw-r--r--examples/declarative/animation/basics/property-animation.qml6
-rw-r--r--examples/declarative/animation/behaviors/behavior-example.qml7
-rw-r--r--examples/declarative/cppextensions/imageprovider/imageprovider.pro1
-rw-r--r--examples/declarative/cppextensions/qwidgets/qwidgets.pro1
-rw-r--r--examples/declarative/i18n/i18n.qml2
-rw-r--r--examples/declarative/keyinteraction/focus/Core/qmldir4
-rw-r--r--examples/declarative/modelviews/listview/content/PetsModel.qml (renamed from examples/declarative/modelviews/listview/PetsModel.qml)3
-rw-r--r--examples/declarative/modelviews/listview/content/PressAndHoldButton.qml11
-rw-r--r--examples/declarative/modelviews/listview/content/RecipesModel.qml (renamed from examples/declarative/modelviews/listview/RecipesModel.qml)1
-rw-r--r--examples/declarative/modelviews/listview/content/pics/archive-insert.pngbin896 -> 0 bytes
-rw-r--r--examples/declarative/modelviews/listview/content/pics/arrow-down.png (renamed from examples/declarative/modelviews/listview/content/pics/go-down.png)bin892 -> 892 bytes
-rw-r--r--examples/declarative/modelviews/listview/content/pics/arrow-up.png (renamed from examples/declarative/modelviews/listview/content/pics/go-up.png)bin929 -> 929 bytes
-rw-r--r--examples/declarative/modelviews/listview/content/pics/button-pressed.pngbin571 -> 0 bytes
-rw-r--r--examples/declarative/modelviews/listview/content/pics/button.pngbin564 -> 0 bytes
-rw-r--r--examples/declarative/modelviews/listview/content/pics/list-delete.png (renamed from examples/declarative/modelviews/listview/content/pics/archive-remove.png)bin1074 -> 1074 bytes
-rw-r--r--examples/declarative/modelviews/listview/content/pics/minus-sign.png (renamed from examples/declarative/modelviews/listview/content/pics/list-remove.png)bin498 -> 498 bytes
-rw-r--r--examples/declarative/modelviews/listview/content/pics/plus-sign.png (renamed from examples/declarative/modelviews/listview/content/pics/list-add.png)bin907 -> 907 bytes
-rw-r--r--examples/declarative/modelviews/listview/dynamiclist.qml16
-rw-r--r--examples/declarative/modelviews/listview/expandingdelegates.qml4
-rw-r--r--examples/declarative/modelviews/listview/highlight.qml5
-rw-r--r--examples/declarative/modelviews/listview/highlightranges.qml21
-rw-r--r--examples/declarative/modelviews/listview/sections.qml3
-rw-r--r--examples/declarative/modelviews/parallax/parallax.qml7
-rw-r--r--examples/declarative/modelviews/parallax/qml/ParallaxView.qml30
-rw-r--r--examples/declarative/modelviews/parallax/qml/Smiley.qml18
-rw-r--r--examples/declarative/modelviews/webview/alerts.qml17
-rw-r--r--examples/declarative/modelviews/webview/autosize.qml16
-rw-r--r--examples/declarative/modelviews/webview/content/FieldText.qml195
-rw-r--r--examples/declarative/modelviews/webview/content/Mapping/Map.qml13
-rw-r--r--examples/declarative/modelviews/webview/content/SpinSquare.qml65
-rw-r--r--examples/declarative/modelviews/webview/googlemaps.qml (renamed from examples/declarative/modelviews/webview/googleMaps.qml)2
-rw-r--r--examples/declarative/modelviews/webview/inlinehtml.qml (renamed from examples/declarative/modelviews/webview/inline-html.qml)14
-rw-r--r--examples/declarative/modelviews/webview/newwindows.qml2
-rw-r--r--examples/declarative/modelviews/webview/transparent.qml55
-rw-r--r--examples/declarative/text/textselection/pics/endHandle.png (renamed from examples/declarative/text/edit/pics/endHandle.png)bin185 -> 185 bytes
-rw-r--r--examples/declarative/text/textselection/pics/endHandle.sci (renamed from examples/declarative/text/edit/pics/endHandle.sci)0
-rw-r--r--examples/declarative/text/textselection/pics/startHandle.png (renamed from examples/declarative/text/edit/pics/startHandle.png)bin178 -> 178 bytes
-rw-r--r--examples/declarative/text/textselection/pics/startHandle.sci (renamed from examples/declarative/text/edit/pics/startHandle.sci)0
-rw-r--r--examples/declarative/text/textselection/textselection.qml (renamed from examples/declarative/text/edit/edit.qml)71
-rw-r--r--examples/declarative/text/textselection/textselection.qmlproject16
-rw-r--r--examples/declarative/touchinteraction/mousearea/mousearea-example.qml (renamed from examples/declarative/touchinteraction/mousearea/mouse.qml)49
-rw-r--r--examples/declarative/ui-components/flipable/content/Card.qml4
-rw-r--r--examples/declarative/ui-components/scrollbar/ScrollBar.qml1
-rw-r--r--examples/declarative/ui-components/scrollbar/main.qml1
-rw-r--r--examples/declarative/ui-components/searchbox/SearchBox.qml7
-rw-r--r--examples/declarative/ui-components/searchbox/images/clear.png (renamed from examples/declarative/ui-components/searchbox/images/edit-clear-locationbar-rtl.png)bin429 -> 429 bytes
-rw-r--r--examples/declarative/ui-components/slideswitch/content/Switch.qml7
-rw-r--r--examples/declarative/ui-components/spinner/content/Spinner.qml5
-rw-r--r--examples/declarative/ui-components/spinner/main.qml3
-rw-r--r--examples/declarative/ui-components/tabwidget/TabWidget.qml8
-rw-r--r--examples/declarative/xml/xmlhttprequest/data.xml (renamed from examples/declarative/xml/xmlhttprequest/test.xml)0
-rw-r--r--examples/declarative/xml/xmlhttprequest/xmlhttprequest-example.qml (renamed from examples/declarative/xml/xmlhttprequest/test.qml)67
-rw-r--r--examples/examples.pro2
-rw-r--r--examples/graphicsview/dragdroprobot/coloritem.cpp2
-rw-r--r--examples/graphicsview/simpleanchorlayout/main.cpp2
-rw-r--r--examples/multimedia/audiodevices/audiodevices.cpp2
-rw-r--r--examples/multimedia/audioinput/audioinput.cpp5
58 files changed, 291 insertions, 486 deletions
diff --git a/examples/dbus/remotecontrolledcar/car/car.h b/examples/dbus/remotecontrolledcar/car/car.h
index 5ef046e..c611018 100644
--- a/examples/dbus/remotecontrolledcar/car/car.h
+++ b/examples/dbus/remotecontrolledcar/car/car.h
@@ -41,14 +41,12 @@
#ifndef CAR_H
#define CAR_H
-#include <QGraphicsItem>
-#include <QObject>
+#include <QGraphicsObject>
#include <QBrush>
-class Car : public QObject, public QGraphicsItem
+class Car : public QGraphicsObject
{
Q_OBJECT
-
public:
Car();
QRectF boundingRect() const;
diff --git a/examples/declarative/animation/basics/property-animation.qml b/examples/declarative/animation/basics/property-animation.qml
index 0fb253a..69d166a 100644
--- a/examples/declarative/animation/basics/property-animation.qml
+++ b/examples/declarative/animation/basics/property-animation.qml
@@ -65,7 +65,8 @@ Item {
// The shadow for the smiley face
Image {
anchors.horizontalCenter: parent.horizontalCenter
- source: "images/shadow.png"; y: smiley.minHeight + 58
+ y: smiley.minHeight + 58
+ source: "images/shadow.png"
// The scale property depends on the y position of the smiley face.
scale: smiley.y * 0.5 / (smiley.minHeight - smiley.maxHeight)
@@ -77,7 +78,8 @@ Item {
property int minHeight: 2 * window.height / 3
anchors.horizontalCenter: parent.horizontalCenter
- source: "images/face-smile.png"; y: minHeight
+ y: minHeight
+ source: "images/face-smile.png"
// Animate the y property. Setting loops to Animation.Infinite makes the
// animation repeat indefinitely, otherwise it would only run once.
diff --git a/examples/declarative/animation/behaviors/behavior-example.qml b/examples/declarative/animation/behaviors/behavior-example.qml
index 91845fc..d187fbf 100644
--- a/examples/declarative/animation/behaviors/behavior-example.qml
+++ b/examples/declarative/animation/behaviors/behavior-example.qml
@@ -87,12 +87,12 @@ Rectangle {
border.width: 4; border.color: "white"
color: "firebrick"
- // Setting an 'elastic' behavior on the focusRect's x property.
+ // Set an 'elastic' behavior on the focusRect's x property.
Behavior on x {
NumberAnimation { easing.type: Easing.OutElastic; easing.amplitude: 3.0; easing.period: 2.0; duration: 300 }
}
- // Setting an 'elastic' behavior on the focusRect's y property.
+ // Set an 'elastic' behavior on the focusRect's y property.
Behavior on y {
NumberAnimation { easing.type: Easing.OutElastic; easing.amplitude: 3.0; easing.period: 2.0; duration: 300 }
}
@@ -104,12 +104,11 @@ Rectangle {
color: "white"
font.pixelSize: 16; font.bold: true
- // Setting a behavior on the focusText's x property:
+ // Set a behavior on the focusText's x property:
// Set the opacity to 0, set the new text value, then set the opacity back to 1.
Behavior on text {
SequentialAnimation {
NumberAnimation { target: focusText; property: "opacity"; to: 0; duration: 150 }
- PropertyAction { }
NumberAnimation { target: focusText; property: "opacity"; to: 1; duration: 150 }
}
}
diff --git a/examples/declarative/cppextensions/imageprovider/imageprovider.pro b/examples/declarative/cppextensions/imageprovider/imageprovider.pro
index f218c30..c7e7843 100644
--- a/examples/declarative/cppextensions/imageprovider/imageprovider.pro
+++ b/examples/declarative/cppextensions/imageprovider/imageprovider.pro
@@ -19,7 +19,6 @@ ImageProviderCore_sources.path = $$[QT_INSTALL_EXAMPLES]/declarative/imageprovid
INSTALLS = sources ImageProviderCore_sources target
symbian:{
- load(data_caging_paths)
include($$QT_SOURCE_TREE/examples/symbianpkgrules.pri)
TARGET.EPOCALLOWDLLDATA = 1
diff --git a/examples/declarative/cppextensions/qwidgets/qwidgets.pro b/examples/declarative/cppextensions/qwidgets/qwidgets.pro
index 8d87804..3ec7d29 100644
--- a/examples/declarative/cppextensions/qwidgets/qwidgets.pro
+++ b/examples/declarative/cppextensions/qwidgets/qwidgets.pro
@@ -14,7 +14,6 @@ target.path += $$[QT_INSTALL_EXAMPLES]/declarative/plugins
INSTALLS += sources target
symbian:{
- load(data_caging_paths)
include($$QT_SOURCE_TREE/examples/symbianpkgrules.pri)
TARGET.EPOCALLOWDLLDATA = 1
diff --git a/examples/declarative/i18n/i18n.qml b/examples/declarative/i18n/i18n.qml
index 7bbb19c..5c2702c 100644
--- a/examples/declarative/i18n/i18n.qml
+++ b/examples/declarative/i18n/i18n.qml
@@ -65,7 +65,7 @@ Rectangle {
anchors.fill: parent; spacing: 20
Text {
- text: "If a translation is available for the system language (eg. French) then the string below will translated (eg. 'Bonjour'). Otherwise is will show 'Hello'."
+ text: "If a translation is available for the system language (eg. French) then the string below will translated (eg. 'Bonjour'). Otherwise it will show 'Hello'."
width: parent.width; wrapMode: Text.WordWrap
}
diff --git a/examples/declarative/keyinteraction/focus/Core/qmldir b/examples/declarative/keyinteraction/focus/Core/qmldir
deleted file mode 100644
index e25d63c..0000000
--- a/examples/declarative/keyinteraction/focus/Core/qmldir
+++ /dev/null
@@ -1,4 +0,0 @@
-ContextMenu ContextMenu.qml
-GridMenu GridMenu.qml
-ListViews ListViews.qml
-ListViewDelegate ListViewDelegate.qml
diff --git a/examples/declarative/modelviews/listview/PetsModel.qml b/examples/declarative/modelviews/listview/content/PetsModel.qml
index 70cdcdd..b77557d 100644
--- a/examples/declarative/modelviews/listview/PetsModel.qml
+++ b/examples/declarative/modelviews/listview/content/PetsModel.qml
@@ -40,10 +40,7 @@
import Qt 4.7
-// ListModel allows free form list models to be defined and populated.
-
ListModel {
- id: petsModel
ListElement {
name: "Polly"
type: "Parrot"
diff --git a/examples/declarative/modelviews/listview/content/PressAndHoldButton.qml b/examples/declarative/modelviews/listview/content/PressAndHoldButton.qml
index 7c174e3..0d5a255 100644
--- a/examples/declarative/modelviews/listview/content/PressAndHoldButton.qml
+++ b/examples/declarative/modelviews/listview/content/PressAndHoldButton.qml
@@ -51,6 +51,11 @@ Image {
scale: pressed ? 0.9 : 1
+ function release() {
+ autoRepeatClicks.stop()
+ container.pressed = false
+ }
+
SequentialAnimation on pressed {
id: autoRepeatClicks
running: false
@@ -70,10 +75,8 @@ Image {
anchors.fill: parent
onPressed: autoRepeatClicks.start()
- onReleased: {
- autoRepeatClicks.stop()
- container.pressed = false
- }
+ onReleased: container.release()
+ onCanceled: container.release()
}
}
diff --git a/examples/declarative/modelviews/listview/RecipesModel.qml b/examples/declarative/modelviews/listview/content/RecipesModel.qml
index 03ab961..e6d829f 100644
--- a/examples/declarative/modelviews/listview/RecipesModel.qml
+++ b/examples/declarative/modelviews/listview/content/RecipesModel.qml
@@ -41,7 +41,6 @@
import Qt 4.7
ListModel {
- id: recipesModel
ListElement {
title: "Pancakes"
picture: "content/pics/pancakes.jpg"
diff --git a/examples/declarative/modelviews/listview/content/pics/archive-insert.png b/examples/declarative/modelviews/listview/content/pics/archive-insert.png
deleted file mode 100644
index b706248..0000000
--- a/examples/declarative/modelviews/listview/content/pics/archive-insert.png
+++ /dev/null
Binary files differ
diff --git a/examples/declarative/modelviews/listview/content/pics/go-down.png b/examples/declarative/modelviews/listview/content/pics/arrow-down.png
index 63331a5..63331a5 100644
--- a/examples/declarative/modelviews/listview/content/pics/go-down.png
+++ b/examples/declarative/modelviews/listview/content/pics/arrow-down.png
Binary files differ
diff --git a/examples/declarative/modelviews/listview/content/pics/go-up.png b/examples/declarative/modelviews/listview/content/pics/arrow-up.png
index 4459024..4459024 100644
--- a/examples/declarative/modelviews/listview/content/pics/go-up.png
+++ b/examples/declarative/modelviews/listview/content/pics/arrow-up.png
Binary files differ
diff --git a/examples/declarative/modelviews/listview/content/pics/button-pressed.png b/examples/declarative/modelviews/listview/content/pics/button-pressed.png
deleted file mode 100644
index e434d32..0000000
--- a/examples/declarative/modelviews/listview/content/pics/button-pressed.png
+++ /dev/null
Binary files differ
diff --git a/examples/declarative/modelviews/listview/content/pics/button.png b/examples/declarative/modelviews/listview/content/pics/button.png
deleted file mode 100644
index 56a63ce..0000000
--- a/examples/declarative/modelviews/listview/content/pics/button.png
+++ /dev/null
Binary files differ
diff --git a/examples/declarative/modelviews/listview/content/pics/archive-remove.png b/examples/declarative/modelviews/listview/content/pics/list-delete.png
index 9640f6b..9640f6b 100644
--- a/examples/declarative/modelviews/listview/content/pics/archive-remove.png
+++ b/examples/declarative/modelviews/listview/content/pics/list-delete.png
Binary files differ
diff --git a/examples/declarative/modelviews/listview/content/pics/list-remove.png b/examples/declarative/modelviews/listview/content/pics/minus-sign.png
index 2bb1a59..2bb1a59 100644
--- a/examples/declarative/modelviews/listview/content/pics/list-remove.png
+++ b/examples/declarative/modelviews/listview/content/pics/minus-sign.png
Binary files differ
diff --git a/examples/declarative/modelviews/listview/content/pics/list-add.png b/examples/declarative/modelviews/listview/content/pics/plus-sign.png
index e029787..e029787 100644
--- a/examples/declarative/modelviews/listview/content/pics/list-add.png
+++ b/examples/declarative/modelviews/listview/content/pics/plus-sign.png
Binary files differ
diff --git a/examples/declarative/modelviews/listview/dynamiclist.qml b/examples/declarative/modelviews/listview/dynamiclist.qml
index 0e290f5..3c1af37 100644
--- a/examples/declarative/modelviews/listview/dynamiclist.qml
+++ b/examples/declarative/modelviews/listview/dynamiclist.qml
@@ -45,7 +45,7 @@ import "content"
Rectangle {
id: container
- width: 640; height: 480
+ width: 500; height: 400
color: "#343434"
// The model:
@@ -96,11 +96,11 @@ Rectangle {
Column {
Image {
- source: "content/pics/go-up.png"
- MouseArea { anchors.fill: parent; onClicked: fruitModel.move(index,index-1,1) }
+ source: "content/pics/arrow-up.png"
+ MouseArea { anchors.fill: parent; onClicked: fruitModel.move(index, index-1, 1) }
}
- Image { source: "content/pics/go-down.png"
- MouseArea { anchors.fill: parent; onClicked: fruitModel.move(index,index+1,1) }
+ Image { source: "content/pics/arrow-down.png"
+ MouseArea { anchors.fill: parent; onClicked: fruitModel.move(index, index+1, 1) }
}
}
@@ -129,7 +129,7 @@ Rectangle {
PressAndHoldButton {
anchors.verticalCenter: parent.verticalCenter
- source: "content/pics/list-add.png"
+ source: "content/pics/plus-sign.png"
onClicked: fruitModel.setProperty(index, "cost", cost + 0.25)
}
@@ -144,12 +144,12 @@ Rectangle {
PressAndHoldButton {
anchors.verticalCenter: parent.verticalCenter
- source: "content/pics/list-remove.png"
+ source: "content/pics/minus-sign.png"
onClicked: fruitModel.setProperty(index, "cost", Math.max(0,cost-0.25))
}
Image {
- source: "content/pics/archive-remove.png"
+ source: "content/pics/list-delete.png"
MouseArea { anchors.fill:parent; onClicked: fruitModel.remove(index) }
}
}
diff --git a/examples/declarative/modelviews/listview/expandingdelegates.qml b/examples/declarative/modelviews/listview/expandingdelegates.qml
index 94ea48f..24d6386 100644
--- a/examples/declarative/modelviews/listview/expandingdelegates.qml
+++ b/examples/declarative/modelviews/listview/expandingdelegates.qml
@@ -138,7 +138,8 @@ Rectangle {
id: flick
width: parent.width
anchors { top: methodTitle.bottom; bottom: parent.bottom }
- contentHeight: methodText.height; clip: true
+ contentHeight: methodText.height
+ clip: true
Text { id: methodText; text: method; wrapMode: Text.WordWrap; width: details.width }
}
@@ -197,6 +198,5 @@ Rectangle {
anchors.fill: parent
model: RecipesModel {}
delegate: recipeDelegate
- clip: true
}
}
diff --git a/examples/declarative/modelviews/listview/highlight.qml b/examples/declarative/modelviews/listview/highlight.qml
index 5748974..4c14f2a 100644
--- a/examples/declarative/modelviews/listview/highlight.qml
+++ b/examples/declarative/modelviews/listview/highlight.qml
@@ -38,7 +38,12 @@
**
****************************************************************************/
+// This example shows how to create your own highlight delegate for a ListView
+// that uses a SpringFollow animation to provide custom movement when the
+// highlight bar is moved between items.
+
import Qt 4.7
+import "content"
Rectangle {
width: 200; height: 300
diff --git a/examples/declarative/modelviews/listview/highlightranges.qml b/examples/declarative/modelviews/listview/highlightranges.qml
index 162d8b7..30976f4 100644
--- a/examples/declarative/modelviews/listview/highlightranges.qml
+++ b/examples/declarative/modelviews/listview/highlightranges.qml
@@ -39,35 +39,36 @@
****************************************************************************/
import Qt 4.7
+import "content"
Rectangle {
width: 600; height: 300
- // Show the model in three lists, with different highlight ranges.
- // preferredHighlightBegin and preferredHighlightEnd set the
- // range in which to attempt to maintain the highlight.
+ // This example shows the same model in three different ListView items,
+ // with different highlight ranges. The highlight ranges are set by the
+ // preferredHighlightBegin and preferredHighlightEnd properties in ListView.
//
- // The second and third ListView set their currentIndex to be the
- // same as the first, and the first ListView is given keyboard focus.
+ // The second and third ListViews set their currentIndex to be the
+ // same as the first. The first ListView is given keyboard focus.
//
- // The first list does not set a highlight range, so its currentItem
+ // The first ListView does not set a highlight range, so its currentItem
// can move freely within the visible area. If it moves outside the
// visible area, the view is automatically scrolled to keep the current
// item visible.
//
- // The second list sets a highlight range which attempts to keep the
+ // The second ListView sets a highlight range which attempts to keep the
// current item within the the bounds of the range. However,
// items will not scroll beyond the beginning or end of the view,
// forcing the highlight to move outside the range at the ends.
//
- // The third list sets the highlightRangeMode to StrictlyEnforceRange
+ // The third ListView sets the highlightRangeMode to StrictlyEnforceRange
// and sets a range smaller than the height of an item. This
// forces the current item to change when the view is flicked,
// since the highlight is unable to move.
//
// Note that the first ListView sets its currentIndex to be equal to
- // the third ListView's currentIndex. By flicking List3 with
- // the mouse, the current index of List1 will be changed.
+ // the third ListView's currentIndex. By flicking the third ListView with
+ // the mouse, the current index of the first ListView will be changed.
ListView {
id: list1
diff --git a/examples/declarative/modelviews/listview/sections.qml b/examples/declarative/modelviews/listview/sections.qml
index 8c038a0..8e0a49f 100644
--- a/examples/declarative/modelviews/listview/sections.qml
+++ b/examples/declarative/modelviews/listview/sections.qml
@@ -38,6 +38,9 @@
**
****************************************************************************/
+// This example shows how a ListView can be separated into sections using
+// the ListView.section attached property.
+
import Qt 4.7
//! [0]
diff --git a/examples/declarative/modelviews/parallax/parallax.qml b/examples/declarative/modelviews/parallax/parallax.qml
index ec52a24..19eadd0 100644
--- a/examples/declarative/modelviews/parallax/parallax.qml
+++ b/examples/declarative/modelviews/parallax/parallax.qml
@@ -39,12 +39,10 @@
****************************************************************************/
import Qt 4.7
-import "../../toys/clocks/content"
+import "../../toys/clocks/content" // for loading the Clock element
import "qml"
Rectangle {
- id: root
-
width: 320; height: 480
ParallaxView {
@@ -73,9 +71,8 @@ Rectangle {
width: 300; height: 400
clip: true;
source: "../../../../demos/declarative/samegame/samegame.qml"
+ Component.onCompleted: item.inAnotherDemo = true;
}
}
-
- currentIndex: root.currentIndex
}
}
diff --git a/examples/declarative/modelviews/parallax/qml/ParallaxView.qml b/examples/declarative/modelviews/parallax/qml/ParallaxView.qml
index adf0885..ac479f4 100644
--- a/examples/declarative/modelviews/parallax/qml/ParallaxView.qml
+++ b/examples/declarative/modelviews/parallax/qml/ParallaxView.qml
@@ -44,8 +44,8 @@ Item {
id: root
property alias background: background.source
- default property alias content: visualModel.children
property int currentIndex: 0
+ default property alias content: visualModel.children
Image {
id: background
@@ -56,13 +56,13 @@ Item {
ListView {
id: list
+ anchors.fill: parent
currentIndex: root.currentIndex
onCurrentIndexChanged: root.currentIndex = currentIndex
orientation: Qt.Horizontal
boundsBehavior: Flickable.DragOverBounds
- anchors.fill: parent
model: VisualItemModel { id: visualModel }
highlightRangeMode: ListView.StrictlyEnforceRange
@@ -72,14 +72,6 @@ Item {
ListView {
id: selector
- Rectangle {
- color: "#60FFFFFF"
- x: -10; y: -10; radius: 10; z: -1
- width: parent.width + 20; height: parent.height + 20
- }
- currentIndex: root.currentIndex
- onCurrentIndexChanged: root.currentIndex = currentIndex
-
height: 50
anchors.bottom: parent.bottom
anchors.horizontalCenter: parent.horizontalCenter
@@ -87,6 +79,10 @@ Item {
interactive: width == parent.width - 20
orientation: Qt.Horizontal
+ currentIndex: root.currentIndex
+ onCurrentIndexChanged: root.currentIndex = currentIndex
+
+ model: visualModel.children
delegate: Item {
width: 50; height: 50
id: delegateRoot
@@ -113,11 +109,15 @@ Item {
}
}
transitions: Transition {
- NumberAnimation {
- properties: "scale,y"
- }
- }
+ NumberAnimation { properties: "scale,y" }
+ }
+ }
+
+ Rectangle {
+ color: "#60FFFFFF"
+ x: -10; y: -10; z: -1
+ width: parent.width + 20; height: parent.height + 20
+ radius: 10
}
- model: visualModel.children
}
}
diff --git a/examples/declarative/modelviews/parallax/qml/Smiley.qml b/examples/declarative/modelviews/parallax/qml/Smiley.qml
index 8399664..3ca672a 100644
--- a/examples/declarative/modelviews/parallax/qml/Smiley.qml
+++ b/examples/declarative/modelviews/parallax/qml/Smiley.qml
@@ -40,16 +40,18 @@
import Qt 4.7
+// This is taken from the declarative animation/basics/property-animation.qml
+// example
+
Item {
id: window
width: 320; height: 480
- // The shadow for the smiley face
Image {
anchors.horizontalCenter: parent.horizontalCenter
- source: "../pics/shadow.png"; y: smiley.minHeight + 58
+ y: smiley.minHeight + 58
+ source: "../pics/shadow.png"
- // The scale property depends on the y position of the smiley face.
scale: smiley.y * 0.5 / (smiley.minHeight - smiley.maxHeight)
}
@@ -59,26 +61,22 @@ Item {
property int minHeight: 2 * window.height / 3
anchors.horizontalCenter: parent.horizontalCenter
- source: "../pics/face-smile.png"; y: minHeight
+ y: minHeight
+ source: "../pics/face-smile.png"
- // Animate the y property. Setting repeat to true makes the
- // animation repeat indefinitely, otherwise it would only run once.
- SequentialAnimation on y {
+ SequentialAnimation on y {
loops: Animation.Infinite
- // Move from minHeight to maxHeight in 300ms, using the OutExpo easing function
NumberAnimation {
from: smiley.minHeight; to: smiley.maxHeight
easing.type: Easing.OutExpo; duration: 300
}
- // Then move back to minHeight in 1 second, using the OutBounce easing function
NumberAnimation {
from: smiley.maxHeight; to: smiley.minHeight
easing.type: Easing.OutBounce; duration: 1000
}
- // Then pause for 500ms
PauseAnimation { duration: 500 }
}
}
diff --git a/examples/declarative/modelviews/webview/alerts.qml b/examples/declarative/modelviews/webview/alerts.qml
index 7303450..9e3c925 100644
--- a/examples/declarative/modelviews/webview/alerts.qml
+++ b/examples/declarative/modelviews/webview/alerts.qml
@@ -39,11 +39,11 @@
****************************************************************************/
import Qt 4.7
-import org.webkit 1.0
+import QtWebKit 1.0
WebView {
id: webView
- width: 120
+ width: 200
height: 150
url: "alerts.html"
@@ -58,13 +58,13 @@ WebView {
y: parent.height // off "screen"
anchors.horizontalCenter: parent.horizontalCenter
- width: label.width+5
- height: label.height+5
+ width: label.width + 5
+ height: label.height + 5
opacity: 0
- function show(t) {
- label.text = t
+ function show(text) {
+ label.text = text
popup.state = "visible"
timer.start()
}
@@ -82,17 +82,20 @@ WebView {
Timer {
id: timer
interval: 1000
+
onTriggered: popup.state = ""
}
Text {
id: label
anchors.centerIn: parent
+ width: webView.width *0.75
+
color: "white"
font.pixelSize: 20
- width: webView.width*0.75
wrapMode: Text.WordWrap
horizontalAlignment: Text.AlignHCenter
+ smooth: true
}
}
}
diff --git a/examples/declarative/modelviews/webview/autosize.qml b/examples/declarative/modelviews/webview/autosize.qml
index 556b429..4a5096e 100644
--- a/examples/declarative/modelviews/webview/autosize.qml
+++ b/examples/declarative/modelviews/webview/autosize.qml
@@ -39,7 +39,7 @@
****************************************************************************/
import Qt 4.7
-import org.webkit 1.0
+import QtWebKit 1.0
// The WebView size is determined by the width, height,
// preferredWidth, and preferredHeight properties.
@@ -51,6 +51,7 @@ Rectangle {
Column {
id: layout
spacing: 2
+
WebView {
html: "No width defined."
Rectangle {
@@ -58,6 +59,7 @@ Rectangle {
anchors.fill: parent
}
}
+
WebView {
width: rect.width
html: "The width is full."
@@ -66,6 +68,7 @@ Rectangle {
anchors.fill: parent
}
}
+
WebView {
width: rect.width/2
html: "The width is half."
@@ -75,24 +78,25 @@ Rectangle {
}
}
WebView {
- preferredWidth: rect.width/2
- html: "The preferredWidth is half."
+ width: rect.width/2
+ html: "The_width_is_half." // not wrapped
Rectangle {
color: "#10000000"
anchors.fill: parent
}
}
+
WebView {
preferredWidth: rect.width/2
- html: "The_preferredWidth_is_half."
+ html: "The preferredWidth is half."
Rectangle {
color: "#10000000"
anchors.fill: parent
}
}
WebView {
- width: rect.width/2
- html: "The_width_is_half."
+ preferredWidth: rect.width/2
+ html: "The_preferredWidth_is_half." // not wrapped
Rectangle {
color: "#10000000"
anchors.fill: parent
diff --git a/examples/declarative/modelviews/webview/content/FieldText.qml b/examples/declarative/modelviews/webview/content/FieldText.qml
deleted file mode 100644
index 17fa4cd..0000000
--- a/examples/declarative/modelviews/webview/content/FieldText.qml
+++ /dev/null
@@ -1,195 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the QtDeclarative module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** You may use this file under the terms of the BSD license as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
-** the names of its contributors may be used to endorse or promote
-** products derived from this software without specific prior written
-** permission.
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-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
- }
- 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/examples/declarative/modelviews/webview/content/Mapping/Map.qml b/examples/declarative/modelviews/webview/content/Mapping/Map.qml
index be708ee..c2489c5 100644
--- a/examples/declarative/modelviews/webview/content/Mapping/Map.qml
+++ b/examples/declarative/modelviews/webview/content/Mapping/Map.qml
@@ -39,18 +39,21 @@
****************************************************************************/
import Qt 4.7
-import org.webkit 1.0
+import QtWebKit 1.0
Item {
id: page
+
property real latitude: -34.397
property real longitude: 150.644
property string address: ""
property alias status: js.status
+
WebView {
id: map
anchors.fill: parent
url: "map.html"
+ pressGrabTime: 0
javaScriptWindowObjects: QtObject {
id: js
WebView.windowObjectName: "qml"
@@ -58,9 +61,13 @@ Item {
property real lng: page.longitude
property string address: page.address
property string status: "Loading"
- onAddressChanged: { if (map.url != "" && map.progress==1) map.evaluateJavaScript("goToAddress()") }
+
+ onAddressChanged: {
+ if (map.url != "" && map.progress == 1)
+ map.evaluateJavaScript("goToAddress()")
+ }
}
- pressGrabTime: 0
+
onLoadFinished: { evaluateJavaScript("goToAddress()"); }
}
}
diff --git a/examples/declarative/modelviews/webview/content/SpinSquare.qml b/examples/declarative/modelviews/webview/content/SpinSquare.qml
deleted file mode 100644
index ec83056..0000000
--- a/examples/declarative/modelviews/webview/content/SpinSquare.qml
+++ /dev/null
@@ -1,65 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the QtDeclarative module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** You may use this file under the terms of the BSD license as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
-** the names of its contributors may be used to endorse or promote
-** products derived from this software without specific prior written
-** permission.
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-import Qt 4.7
-
-Item {
- property variant period : 250
- property variant color : "black"
- id: root
-
- Item {
- x: root.width/2
- y: root.height/2
- Rectangle {
- color: root.color
- x: -width/2
- y: -height/2
- width: root.width
- height: width
- }
- NumberAnimation on rotation {
- from: 0
- to: 360
- loops: Animation.Infinite
- duration: root.period
- }
- }
-}
diff --git a/examples/declarative/modelviews/webview/googleMaps.qml b/examples/declarative/modelviews/webview/googlemaps.qml
index 1c99940..361b40c 100644
--- a/examples/declarative/modelviews/webview/googleMaps.qml
+++ b/examples/declarative/modelviews/webview/googlemaps.qml
@@ -46,7 +46,7 @@
// order to create a Map.
import Qt 4.7
-import org.webkit 1.0
+import QtWebKit 1.0
import "content/Mapping"
Map {
diff --git a/examples/declarative/modelviews/webview/inline-html.qml b/examples/declarative/modelviews/webview/inlinehtml.qml
index 875c903..0448ff3 100644
--- a/examples/declarative/modelviews/webview/inline-html.qml
+++ b/examples/declarative/modelviews/webview/inlinehtml.qml
@@ -39,17 +39,17 @@
****************************************************************************/
import Qt 4.7
-import org.webkit 1.0
+import QtWebKit 1.0
// Inline HTML with loose formatting can be
// set on the html property.
WebView {
html:"\
- <body bgcolor=white>\
- <table border=1>\
- <tr><th><th>One<th>Two<th>Three\
- <tr><th>1<td>X<td>1<td>X\
- <tr><th>2<td>0<td>X<td>0\
- <tr><th>3<td>X<td>1<td>X\
+ <body>
+ <table border=1>
+ <tr><th><th>One<th>Two<th>Three
+ <tr><th>1<td>X<td>1<td>X
+ <tr><th>2<td>0<td>X<td>0
+ <tr><th>3<td>X<td>1<td>X
</table>"
}
diff --git a/examples/declarative/modelviews/webview/newwindows.qml b/examples/declarative/modelviews/webview/newwindows.qml
index 4ea3e68..c09b2a9 100644
--- a/examples/declarative/modelviews/webview/newwindows.qml
+++ b/examples/declarative/modelviews/webview/newwindows.qml
@@ -44,7 +44,7 @@
// allow it on WebView with settings.javascriptCanOpenWindows: true
import Qt 4.7
-import org.webkit 1.0
+import QtWebKit 1.0
Grid {
columns: 3
diff --git a/examples/declarative/modelviews/webview/transparent.qml b/examples/declarative/modelviews/webview/transparent.qml
deleted file mode 100644
index 92c1578..0000000
--- a/examples/declarative/modelviews/webview/transparent.qml
+++ /dev/null
@@ -1,55 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the QtDeclarative module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** You may use this file under the terms of the BSD license as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
-** the names of its contributors may be used to endorse or promote
-** products derived from this software without specific prior written
-** permission.
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-import Qt 4.7
-import org.webkit 1.0
-
-// The WebView background is transparent
-// if the HTML does not specify a background
-Rectangle {
- color: "green"
- width: web.width
- height: web.height
-
- WebView {
- id: web
- html: "Hello <b>World!</b>"
- }
-}
diff --git a/examples/declarative/text/edit/pics/endHandle.png b/examples/declarative/text/textselection/pics/endHandle.png
index 1a4bc5d..1a4bc5d 100644
--- a/examples/declarative/text/edit/pics/endHandle.png
+++ b/examples/declarative/text/textselection/pics/endHandle.png
Binary files differ
diff --git a/examples/declarative/text/edit/pics/endHandle.sci b/examples/declarative/text/textselection/pics/endHandle.sci
index 4f51f24..4f51f24 100644
--- a/examples/declarative/text/edit/pics/endHandle.sci
+++ b/examples/declarative/text/textselection/pics/endHandle.sci
diff --git a/examples/declarative/text/edit/pics/startHandle.png b/examples/declarative/text/textselection/pics/startHandle.png
index deedcd5..deedcd5 100644
--- a/examples/declarative/text/edit/pics/startHandle.png
+++ b/examples/declarative/text/textselection/pics/startHandle.png
Binary files differ
diff --git a/examples/declarative/text/edit/pics/startHandle.sci b/examples/declarative/text/textselection/pics/startHandle.sci
index f9eae20..f9eae20 100644
--- a/examples/declarative/text/edit/pics/startHandle.sci
+++ b/examples/declarative/text/textselection/pics/startHandle.sci
diff --git a/examples/declarative/text/edit/edit.qml b/examples/declarative/text/textselection/textselection.qml
index 4668ab2..1ba3e18 100644
--- a/examples/declarative/text/edit/edit.qml
+++ b/examples/declarative/text/textselection/textselection.qml
@@ -55,8 +55,8 @@ Rectangle {
source: "pics/startHandle.sci"
opacity: 0.0
width: 10
- x: edit.positionToRectangle(edit.selectionStart).x-flick.contentX-width
- y: edit.positionToRectangle(edit.selectionStart).y-flick.contentY
+ x: edit.positionToRectangle(edit.selectionStart).x - flick.contentX-width
+ y: edit.positionToRectangle(edit.selectionStart).y - flick.contentY
height: edit.positionToRectangle(edit.selectionStart).height
}
@@ -65,8 +65,8 @@ Rectangle {
source: "pics/endHandle.sci"
opacity: 0.0
width: 10
- x: edit.positionToRectangle(edit.selectionEnd).x-flick.contentX
- y: edit.positionToRectangle(edit.selectionEnd).y-flick.contentY
+ x: edit.positionToRectangle(edit.selectionEnd).x - flick.contentX
+ y: edit.positionToRectangle(edit.selectionEnd).y - flick.contentY
height: edit.positionToRectangle(edit.selectionEnd).height
}
@@ -79,8 +79,7 @@ Rectangle {
interactive: true
clip: true
- function ensureVisible(r)
- {
+ function ensureVisible(r) {
if (contentX >= r.x)
contentX = r.x;
else if (contentX+width <= r.x+r.width)
@@ -97,20 +96,25 @@ Rectangle {
height: flick.height
focus: true
wrapMode: TextEdit.Wrap
+
onCursorRectangleChanged: flick.ensureVisible(cursorRectangle)
+
text: "<h1>Text Selection</h1>"
+"<p>This example is a whacky text selection mechanisms, showing how these can be implemented in the TextEdit element, to cater for whatever style is appropriate for the target platform."
+"<p><b>Press-and-hold</b> to select a word, then drag the selection handles."
+"<p><b>Drag outside the selection</b> to scroll the text."
+"<p><b>Click inside the selection</b> to cut/copy/paste/cancel selection."
+"<p>It's too whacky to let you paste if there is no current selection."
+
MouseArea {
+ property string drag: ""
+ property int pressPos
+
x: -startHandle.width
y: 0
width: parent.width+startHandle.width+endHandle.width
height: parent.height
- property string drag: "";
- property int pressPos;
+
onPressAndHold: {
if (editor.state == "") {
edit.cursorPosition = edit.positionAt(mouse.x+x,mouse.y+y);
@@ -118,6 +122,7 @@ Rectangle {
editor.state = "selection"
}
}
+
onClicked: {
if (editor.state == "") {
edit.cursorPosition = edit.positionAt(mouse.x+x,mouse.y+y);
@@ -126,7 +131,11 @@ Rectangle {
edit.openSoftwareInputPanel();
}
}
- function hitHandle(h,x,y) { return x>=h.x+flick.contentX && x<h.x+flick.contentX+h.width && y>=h.y+flick.contentY && y<h.y+flick.contentY+h.height }
+
+ function hitHandle(h,x,y) {
+ return x>=h.x+flick.contentX && x<h.x+flick.contentX+h.width && y>=h.y+flick.contentY && y<h.y+flick.contentY+h.height
+ }
+
onPressed: {
if (editor.state == "selection") {
if (hitHandle(startHandle,mouse.x+x,mouse.y+y)) {
@@ -147,6 +156,7 @@ Rectangle {
}
}
}
+
onReleased: {
if (editor.state == "selection") {
if (drag == "selection") {
@@ -156,6 +166,7 @@ Rectangle {
}
flick.interactive = true
}
+
onPositionChanged: {
if (editor.state == "selection" && drag != "") {
if (drag == "start") {
@@ -183,6 +194,7 @@ Rectangle {
width: 100
height: 120
anchors.centerIn: parent
+
Rectangle {
border.width: 1
border.color: "darkBlue"
@@ -190,48 +202,73 @@ Rectangle {
color: "#806080FF"
anchors.fill: parent
}
+
Column {
anchors.centerIn: parent
spacing: 8
+
Rectangle {
border.width: 1
border.color: "darkBlue"
color: "#ff7090FF"
width: 60
height: 16
+
Text { anchors.centerIn: parent; text: "Cut" }
- MouseArea { anchors.fill: parent;
- onClicked: { edit.cut(); editor.state = "" } }
+
+ MouseArea {
+ anchors.fill: parent
+ onClicked: { edit.cut(); editor.state = "" }
+ }
}
+
Rectangle {
border.width: 1
border.color: "darkBlue"
color: "#ff7090FF"
width: 60
height: 16
+
Text { anchors.centerIn: parent; text: "Copy" }
- MouseArea { anchors.fill: parent;
- onClicked: { edit.copy(); editor.state = "selection" } }
+
+ MouseArea {
+ anchors.fill: parent
+ onClicked: { edit.copy(); editor.state = "selection" }
+ }
}
+
Rectangle {
border.width: 1
border.color: "darkBlue"
color: "#ff7090FF"
width: 60
height: 16
+
Text { anchors.centerIn: parent; text: "Paste" }
- MouseArea { anchors.fill: parent;
- onClicked: { edit.paste(); edit.cursorPosition = edit.selectionEnd; editor.state = "" } }
+
+ MouseArea {
+ anchors.fill: parent
+ onClicked: { edit.paste(); edit.cursorPosition = edit.selectionEnd; editor.state = "" }
+ }
}
+
Rectangle {
border.width: 1
border.color: "darkBlue"
color: "#ff7090FF"
width: 60
height: 16
+
Text { anchors.centerIn: parent; text: "Deselect" }
- MouseArea { anchors.fill: parent;
- onClicked: { edit.cursorPosition = edit.selectionEnd; edit.select(edit.cursorPosition,edit.cursorPosition); editor.state = "" } }
+
+ MouseArea {
+ anchors.fill: parent
+ onClicked: {
+ edit.cursorPosition = edit.selectionEnd;
+ edit.select(edit.cursorPosition, edit.cursorPosition);
+ editor.state = ""
+ }
+ }
}
}
}
diff --git a/examples/declarative/text/textselection/textselection.qmlproject b/examples/declarative/text/textselection/textselection.qmlproject
new file mode 100644
index 0000000..d4909f8
--- /dev/null
+++ b/examples/declarative/text/textselection/textselection.qmlproject
@@ -0,0 +1,16 @@
+import QmlProject 1.0
+
+Project {
+ /* Include .qml, .js, and image files from current directory and subdirectories */
+ QmlFiles {
+ directory: "."
+ }
+ JavaScriptFiles {
+ directory: "."
+ }
+ ImageFiles {
+ directory: "."
+ }
+ /* List of plugin directories passed to QML runtime */
+ // importPaths: [ " ../exampleplugin " ]
+}
diff --git a/examples/declarative/touchinteraction/mousearea/mouse.qml b/examples/declarative/touchinteraction/mousearea/mousearea-example.qml
index 9d2ace3..64f72a9 100644
--- a/examples/declarative/touchinteraction/mousearea/mouse.qml
+++ b/examples/declarative/touchinteraction/mousearea/mousearea-example.qml
@@ -41,34 +41,42 @@
import Qt 4.7
Rectangle {
- width: 200; height: 200
+ id: box
+ width: 350; height: 250
+
+ function showInfo(text) {
+ statusText.text = text
+ }
Rectangle {
- width: 50; height: 50
+ width: 80; height: 80
color: "red"
- Text { text: "Click"; anchors.centerIn: parent }
+ Text { text: "Click"; font.pixelSize: 16; anchors.centerIn: parent }
MouseArea {
anchors.fill: parent
hoverEnabled: true
acceptedButtons: Qt.LeftButton | Qt.RightButton
- onPressed: console.log('press (x: ' + mouse.x + ' y: ' + mouse.y + ' button: ' + (mouse.button == Qt.RightButton ? 'right' : 'left') + ' Shift: ' + (mouse.modifiers & Qt.ShiftModifier ? 'true' : 'false') + ')')
- onReleased: console.log('release (x: ' + mouse.x + ' y: ' + mouse.y + ' isClick: ' + mouse.isClick + ' wasHeld: ' + mouse.wasHeld + ')')
- onClicked: console.log('click (x: ' + mouse.x + ' y: ' + mouse.y + ' wasHeld: ' + mouse.wasHeld + ')')
- onDoubleClicked: console.log('double click (x: ' + mouse.x + ' y: ' + mouse.y + ')')
- onPressAndHold: console.log('press and hold')
- onEntered: console.log('entered ' + pressed)
- onExited: console.log('exited ' + pressed)
+ onPressed: box.showInfo('Pressed (x=' + mouse.x + ' y=' + mouse.y + ' button='
+ + (mouse.button == Qt.RightButton ? 'right' : 'left')
+ + ' Shift=' + (mouse.modifiers & Qt.ShiftModifier ? 'true' : 'false') + ')')
+ onReleased: box.showInfo('Released (x=' + mouse.x + ' y=' + mouse.y
+ + ' isClick=' + mouse.isClick + ' wasHeld=' + mouse.wasHeld + ')')
+ onClicked: box.showInfo('Clicked (x=' + mouse.x + ' y=' + mouse.y + ' wasHeld=' + mouse.wasHeld + ')')
+ onDoubleClicked: box.showInfo('Double clicked (x=' + mouse.x + ' y=' + mouse.y + ')')
+ onPressAndHold: box.showInfo('Press and hold')
+ onEntered: box.showInfo('Entered (pressed=' + pressed + ')')
+ onExited: box.showInfo('Exited (pressed=' + pressed + ')')
}
}
Rectangle {
- y: 100; width: 50; height: 50
+ width: 80; height: 80; anchors.right: parent.right
color: "blue"
- Text { text: "Drag"; anchors.centerIn: parent }
+ Text { text: "Drag"; font.pixelSize: 16; color: "white"; anchors.centerIn: parent }
MouseArea {
anchors.fill: parent
@@ -77,11 +85,18 @@ Rectangle {
drag.minimumX: 0
drag.maximumX: 150
- onPressed: console.log('press')
- onReleased: console.log('release (isClick: ' + mouse.isClick + ') (wasHeld: ' + mouse.wasHeld + ')')
- onClicked: console.log('click' + '(wasHeld: ' + mouse.wasHeld + ')')
- onDoubleClicked: console.log('double click')
- onPressAndHold: console.log('press and hold')
+ onPressed: box.showInfo('Pressed')
+ onReleased: box.showInfo('Released (isClick=' + mouse.isClick + ' wasHeld=' + mouse.wasHeld + ')')
+ onClicked: box.showInfo('Clicked' + ' (wasHeld=' + mouse.wasHeld + ')')
+ onDoubleClicked: box.showInfo('Double clicked')
+ onPressAndHold: box.showInfo('Press and hold')
}
}
+
+ Text {
+ id: statusText
+ anchors.bottom: parent.bottom; anchors.horizontalCenter: parent.horizontalCenter; anchors.margins: 30
+
+ onTextChanged: console.log(text)
+ }
}
diff --git a/examples/declarative/ui-components/flipable/content/Card.qml b/examples/declarative/ui-components/flipable/content/Card.qml
index 91a442b..fc60ce4 100644
--- a/examples/declarative/ui-components/flipable/content/Card.qml
+++ b/examples/declarative/ui-components/flipable/content/Card.qml
@@ -49,11 +49,13 @@ Flipable {
property int yAxis: 0
property int angle: 0
- width: front.width; height: front.height; state: "back"
+ width: front.width; height: front.height
front: Image { id: frontImage; smooth: true }
back: Image { source: "back.png"; smooth: true }
+ state: "back"
+
MouseArea { anchors.fill: parent; onClicked: container.flipped = !container.flipped }
transform: Rotation {
diff --git a/examples/declarative/ui-components/scrollbar/ScrollBar.qml b/examples/declarative/ui-components/scrollbar/ScrollBar.qml
index ba9a52a..9927ecb 100644
--- a/examples/declarative/ui-components/scrollbar/ScrollBar.qml
+++ b/examples/declarative/ui-components/scrollbar/ScrollBar.qml
@@ -60,6 +60,7 @@ Item {
color: "white"
opacity: 0.3
}
+
// Size the bar to the required size, depending upon the orientation.
Rectangle {
x: orientation == Qt.Vertical ? 1 : (scrollBar.position * (scrollBar.width-2) + 1)
diff --git a/examples/declarative/ui-components/scrollbar/main.qml b/examples/declarative/ui-components/scrollbar/main.qml
index 1f7992b..8f5033b 100644
--- a/examples/declarative/ui-components/scrollbar/main.qml
+++ b/examples/declarative/ui-components/scrollbar/main.qml
@@ -66,7 +66,6 @@ Rectangle {
}
transitions: Transition {
- from: "*"; to: "*"
NumberAnimation { properties: "opacity"; duration: 400 }
}
}
diff --git a/examples/declarative/ui-components/searchbox/SearchBox.qml b/examples/declarative/ui-components/searchbox/SearchBox.qml
index eaa6b6b..e6b9c8f 100644
--- a/examples/declarative/ui-components/searchbox/SearchBox.qml
+++ b/examples/declarative/ui-components/searchbox/SearchBox.qml
@@ -66,7 +66,10 @@ FocusScope {
font.italic: true
}
- MouseArea { anchors.fill: parent; onClicked: { focusScope.focus = true; textInput.openSoftwareInputPanel(); } }
+ MouseArea {
+ anchors.fill: parent
+ onClicked: { focusScope.focus = true; textInput.openSoftwareInputPanel(); }
+ }
TextInput {
id: textInput
@@ -77,7 +80,7 @@ FocusScope {
Image {
id: clear
anchors { right: parent.right; rightMargin: 8; verticalCenter: parent.verticalCenter }
- source: "images/edit-clear-locationbar-rtl.png"
+ source: "images/clear.png"
opacity: 0
MouseArea {
diff --git a/examples/declarative/ui-components/searchbox/images/edit-clear-locationbar-rtl.png b/examples/declarative/ui-components/searchbox/images/clear.png
index 91eb270..91eb270 100644
--- a/examples/declarative/ui-components/searchbox/images/edit-clear-locationbar-rtl.png
+++ b/examples/declarative/ui-components/searchbox/images/clear.png
Binary files differ
diff --git a/examples/declarative/ui-components/slideswitch/content/Switch.qml b/examples/declarative/ui-components/slideswitch/content/Switch.qml
index b0ce0c0..2a89177 100644
--- a/examples/declarative/ui-components/slideswitch/content/Switch.qml
+++ b/examples/declarative/ui-components/slideswitch/content/Switch.qml
@@ -53,12 +53,13 @@ Item {
function toggle() {
if (toggleswitch.state == "on")
toggleswitch.state = "off";
- else toggleswitch.state = "on";
+ else
+ toggleswitch.state = "on";
}
//![2]
//![3]
- function dorelease() {
+ function releaseSwitch() {
if (knob.x == 1) {
if (toggleswitch.state == "off") return;
}
@@ -87,7 +88,7 @@ Item {
anchors.fill: parent
drag.target: knob; drag.axis: Drag.XAxis; drag.minimumX: 1; drag.maximumX: 78
onClicked: toggle()
- onReleased: dorelease()
+ onReleased: releaseSwitch()
}
}
//![5]
diff --git a/examples/declarative/ui-components/spinner/content/Spinner.qml b/examples/declarative/ui-components/spinner/content/Spinner.qml
index 55fc542..1c41239 100644
--- a/examples/declarative/ui-components/spinner/content/Spinner.qml
+++ b/examples/declarative/ui-components/spinner/content/Spinner.qml
@@ -45,21 +45,26 @@ Image {
property alias delegate: view.delegate
property alias currentIndex: view.currentIndex
property real itemHeight: 30
+
source: "spinner-bg.png"
clip: true
+
PathView {
id: view
anchors.fill: parent
+
pathItemCount: height/itemHeight
preferredHighlightBegin: 0.5
preferredHighlightEnd: 0.5
highlight: Image { source: "spinner-select.png"; width: view.width; height: itemHeight+4 }
dragMargin: view.width/2
+
path: Path {
startX: view.width/2; startY: -itemHeight/2
PathLine { x: view.width/2; y: view.pathItemCount*itemHeight + itemHeight }
}
}
+
Keys.onDownPressed: view.incrementCurrentIndex()
Keys.onUpPressed: view.decrementCurrentIndex()
}
diff --git a/examples/declarative/ui-components/spinner/main.qml b/examples/declarative/ui-components/spinner/main.qml
index 4403ada..37dd912 100644
--- a/examples/declarative/ui-components/spinner/main.qml
+++ b/examples/declarative/ui-components/spinner/main.qml
@@ -43,8 +43,10 @@ import "content"
Rectangle {
width: 240; height: 320
+
Column {
y: 20; x: 20; spacing: 20
+
Spinner {
id: spinner
width: 200; height: 240
@@ -53,6 +55,7 @@ Rectangle {
itemHeight: 30
delegate: Text { font.pixelSize: 25; text: index; height: 30 }
}
+
Text { text: "Current item index: " + spinner.currentIndex }
}
}
diff --git a/examples/declarative/ui-components/tabwidget/TabWidget.qml b/examples/declarative/ui-components/tabwidget/TabWidget.qml
index 93db4ff..9642e04 100644
--- a/examples/declarative/ui-components/tabwidget/TabWidget.qml
+++ b/examples/declarative/ui-components/tabwidget/TabWidget.qml
@@ -49,16 +49,17 @@ Item {
onCurrentChanged: setOpacities()
Component.onCompleted: setOpacities()
- function setOpacities()
- {
+ function setOpacities() {
for (var i = 0; i < stack.children.length; ++i) {
- stack.children[i].opacity = i == current ? 1 : 0
+ stack.children[i].opacity = (i == current ? 1 : 0)
}
}
Row {
id: header
+
Repeater {
+ model: stack.children.length
delegate: Rectangle {
width: tabWidget.width / stack.children.length; height: 36
@@ -85,7 +86,6 @@ Item {
onClicked: tabWidget.current = index
}
}
- model: stack.children.length
}
}
diff --git a/examples/declarative/xml/xmlhttprequest/test.xml b/examples/declarative/xml/xmlhttprequest/data.xml
index 8b7f1e1..8b7f1e1 100644
--- a/examples/declarative/xml/xmlhttprequest/test.xml
+++ b/examples/declarative/xml/xmlhttprequest/data.xml
diff --git a/examples/declarative/xml/xmlhttprequest/test.qml b/examples/declarative/xml/xmlhttprequest/xmlhttprequest-example.qml
index e5f0875..b302729 100644
--- a/examples/declarative/xml/xmlhttprequest/test.qml
+++ b/examples/declarative/xml/xmlhttprequest/xmlhttprequest-example.qml
@@ -41,36 +41,55 @@
import Qt 4.7
Rectangle {
- width: 800; height: 600
+ width: 350; height: 400
- MouseArea {
- anchors.fill: parent
+ function showRequestInfo(text) {
+ log.text = log.text + "\n" + text
+ console.log(text)
+ }
- onClicked: {
- var doc = new XMLHttpRequest();
- doc.onreadystatechange = function() {
- if (doc.readyState == XMLHttpRequest.HEADERS_RECEIVED) {
- console.log("Headers -->");
- console.log(doc.getAllResponseHeaders ());
- console.log("Last modified -->");
- console.log(doc.getResponseHeader ("Last-Modified"));
- }
- else if (doc.readyState == XMLHttpRequest.DONE) {
+ Text { id: log; anchors.fill: parent; anchors.margins: 10 }
- var a = doc.responseXML.documentElement;
- for (var ii = 0; ii < a.childNodes.length; ++ii) {
- console.log(a.childNodes[ii].nodeName);
- }
- console.log("Headers -->");
- console.log(doc.getAllResponseHeaders ());
- console.log("Last modified -->");
- console.log(doc.getResponseHeader ("Last-Modified"));
+ Rectangle {
+ id: button
+ anchors.horizontalCenter: parent.horizontalCenter; anchors.bottom: parent.bottom; anchors.margins: 10
+ width: buttonText.width + 10; height: buttonText.height + 10
+ border.width: mouseArea.pressed ? 2 : 1
+ radius : 5; smooth: true
+
+ Text { id: buttonText; anchors.centerIn: parent; text: "Request data.xml" }
+
+ MouseArea {
+ id: mouseArea
+ anchors.fill: parent
+ onClicked: {
+ log.text = ""
+ console.log("\n")
+ var doc = new XMLHttpRequest();
+ doc.onreadystatechange = function() {
+ if (doc.readyState == XMLHttpRequest.HEADERS_RECEIVED) {
+ showRequestInfo("Headers -->");
+ showRequestInfo(doc.getAllResponseHeaders ());
+ showRequestInfo("Last modified -->");
+ showRequestInfo(doc.getResponseHeader ("Last-Modified"));
+
+ } else if (doc.readyState == XMLHttpRequest.DONE) {
+ var a = doc.responseXML.documentElement;
+ for (var ii = 0; ii < a.childNodes.length; ++ii) {
+ showRequestInfo(a.childNodes[ii].nodeName);
+ }
+ showRequestInfo("Headers -->");
+ showRequestInfo(doc.getAllResponseHeaders ());
+ showRequestInfo("Last modified -->");
+ showRequestInfo(doc.getResponseHeader ("Last-Modified"));
+ }
}
- }
- doc.open("GET", "test.xml");
- doc.send();
+ doc.open("GET", "data.xml");
+ doc.send();
+ }
}
}
}
+
diff --git a/examples/examples.pro b/examples/examples.pro
index 43cad55..9a83216 100644
--- a/examples/examples.pro
+++ b/examples/examples.pro
@@ -30,6 +30,8 @@ SUBDIRS = \
gestures
}
+contains(QT_CONFIG, webkit):SUBDIRS += webkit
+
symbian: SUBDIRS = \
graphicsview \
itemviews \
diff --git a/examples/graphicsview/dragdroprobot/coloritem.cpp b/examples/graphicsview/dragdroprobot/coloritem.cpp
index b6113fd..327fa87 100644
--- a/examples/graphicsview/dragdroprobot/coloritem.cpp
+++ b/examples/graphicsview/dragdroprobot/coloritem.cpp
@@ -76,7 +76,7 @@ void ColorItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *option,
//! [2]
//! [3]
-void ColorItem::mousePressEvent(QGraphicsSceneMouseEvent *event)
+void ColorItem::mousePressEvent(QGraphicsSceneMouseEvent *)
{
setCursor(Qt::ClosedHandCursor);
}
diff --git a/examples/graphicsview/simpleanchorlayout/main.cpp b/examples/graphicsview/simpleanchorlayout/main.cpp
index 9cb4006..942cdc4 100644
--- a/examples/graphicsview/simpleanchorlayout/main.cpp
+++ b/examples/graphicsview/simpleanchorlayout/main.cpp
@@ -49,7 +49,7 @@ public:
{
}
- void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget = 0)
+ void paint(QPainter *painter, const QStyleOptionGraphicsItem *, QWidget * = 0)
{
QFont font;
font.setPixelSize(0.75 * qMin(boundingRect().width(), boundingRect().height()));
diff --git a/examples/multimedia/audiodevices/audiodevices.cpp b/examples/multimedia/audiodevices/audiodevices.cpp
index 5dc2ef1..5ab4918 100644
--- a/examples/multimedia/audiodevices/audiodevices.cpp
+++ b/examples/multimedia/audiodevices/audiodevices.cpp
@@ -58,6 +58,8 @@ QString toString(QAudioFormat::SampleType sampleType)
case QAudioFormat::Float:
result = "Float";
break;
+ case QAudioFormat::Unknown:
+ break;
}
return result;
}
diff --git a/examples/multimedia/audioinput/audioinput.cpp b/examples/multimedia/audioinput/audioinput.cpp
index 4a408a0..4e5f2a3 100644
--- a/examples/multimedia/audioinput/audioinput.cpp
+++ b/examples/multimedia/audioinput/audioinput.cpp
@@ -315,6 +315,11 @@ void InputTest::readMore()
void InputTest::toggleMode()
{
// Change bewteen pull and push modes
+ if (m_input != 0) {
+ disconnect(m_input, 0, this, 0);
+ m_input = 0;
+ }
+
m_audioInput->stop();
if (m_pullMode) {