summaryrefslogtreecommitdiffstats
path: root/examples
diff options
context:
space:
mode:
authorRoland Wolf <ext-roland.wolf@nokia.com>2010-09-06 09:59:32 (GMT)
committerRoland Wolf <ext-roland.wolf@nokia.com>2010-09-06 09:59:32 (GMT)
commit03b787cdadb966898c86a06747deb39e2f7dae2f (patch)
tree188d10557683fb95defc966829ff3d14bc404e37 /examples
parent5180a674358d5b295e5f7e01f28649176ec0d33a (diff)
parentfded09d4e2983d7eed82c9fa5b678f70074473ba (diff)
downloadQt-03b787cdadb966898c86a06747deb39e2f7dae2f.zip
Qt-03b787cdadb966898c86a06747deb39e2f7dae2f.tar.gz
Qt-03b787cdadb966898c86a06747deb39e2f7dae2f.tar.bz2
Merge remote branch 'upstream/4.7' into 4.7
Diffstat (limited to 'examples')
-rw-r--r--examples/declarative/animation/easing/content/QuitButton.qml52
-rw-r--r--examples/declarative/animation/easing/content/quit.pngbin0 -> 583 bytes
-rw-r--r--examples/declarative/animation/easing/easing.qml19
-rw-r--r--examples/declarative/toys/clocks/clocks.qml5
-rw-r--r--examples/declarative/toys/clocks/content/QuitButton.qml52
-rw-r--r--examples/declarative/toys/clocks/content/quit.pngbin0 -> 583 bytes
-rwxr-xr-xexamples/declarative/tutorials/samegame/samegame4/content/samegame.js4
-rw-r--r--examples/declarative/ui-components/dialcontrol/content/QuitButton.qml52
-rw-r--r--examples/declarative/ui-components/dialcontrol/content/quit.pngbin0 -> 583 bytes
-rw-r--r--examples/declarative/ui-components/dialcontrol/dialcontrol.qml5
-rw-r--r--examples/sql/masterdetail/mainwindow.cpp6
-rw-r--r--examples/tools/treemodelcompleter/mainwindow.cpp2
-rwxr-xr-xexamples/tutorials/modelview/2_formatting/mymodel.cpp2
-rw-r--r--examples/xmlpatterns/filetree/mainwindow.cpp2
14 files changed, 190 insertions, 11 deletions
diff --git a/examples/declarative/animation/easing/content/QuitButton.qml b/examples/declarative/animation/easing/content/QuitButton.qml
new file mode 100644
index 0000000..039694d
--- /dev/null
+++ b/examples/declarative/animation/easing/content/QuitButton.qml
@@ -0,0 +1,52 @@
+/****************************************************************************
+**
+** 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
+Image {
+ source: "quit.png"
+ scale: quitMouse.pressed ? 0.8 : 1.0
+ smooth: quitMouse.pressed
+ MouseArea {
+ id: quitMouse
+ anchors.fill: parent
+ anchors.margins: -10
+ onClicked: Qt.quit()
+ }
+} \ No newline at end of file
diff --git a/examples/declarative/animation/easing/content/quit.png b/examples/declarative/animation/easing/content/quit.png
new file mode 100644
index 0000000..b822057
--- /dev/null
+++ b/examples/declarative/animation/easing/content/quit.png
Binary files differ
diff --git a/examples/declarative/animation/easing/easing.qml b/examples/declarative/animation/easing/easing.qml
index 9cdbad1..b53cb98 100644
--- a/examples/declarative/animation/easing/easing.qml
+++ b/examples/declarative/animation/easing/easing.qml
@@ -39,6 +39,7 @@
****************************************************************************/
import Qt 4.7
+import "content"
Rectangle {
id: window
@@ -134,11 +135,23 @@ Rectangle {
}
Flickable {
- anchors.fill: parent; contentHeight: layout.height
-
+ anchors.fill: parent
+ contentHeight: layout.height
+ Rectangle {
+ id: titlePane
+ color: "#444444"
+ height: 35
+ anchors { top: parent.top; left: parent.left; right: parent.right }
+ QuitButton {
+ id: quitButton
+ anchors.verticalCenter: parent.verticalCenter
+ anchors.right: parent.right
+ anchors.rightMargin: 10
+ }
+ }
Column {
id: layout
- anchors.left: parent.left; anchors.right: parent.right
+ anchors { top: titlePane.bottom; topMargin: 10; left: parent.left; right: parent.right }
Repeater { model: easingTypes; delegate: delegate }
}
}
diff --git a/examples/declarative/toys/clocks/clocks.qml b/examples/declarative/toys/clocks/clocks.qml
index 124e391..82a1dbf 100644
--- a/examples/declarative/toys/clocks/clocks.qml
+++ b/examples/declarative/toys/clocks/clocks.qml
@@ -51,4 +51,9 @@ Rectangle {
Clock { city: "Mumbai"; shift: 5.5 }
Clock { city: "Tokyo"; shift: 9 }
}
+ QuitButton {
+ anchors.right: parent.right
+ anchors.top: parent.top
+ anchors.margins: 10
+ }
}
diff --git a/examples/declarative/toys/clocks/content/QuitButton.qml b/examples/declarative/toys/clocks/content/QuitButton.qml
new file mode 100644
index 0000000..039694d
--- /dev/null
+++ b/examples/declarative/toys/clocks/content/QuitButton.qml
@@ -0,0 +1,52 @@
+/****************************************************************************
+**
+** 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
+Image {
+ source: "quit.png"
+ scale: quitMouse.pressed ? 0.8 : 1.0
+ smooth: quitMouse.pressed
+ MouseArea {
+ id: quitMouse
+ anchors.fill: parent
+ anchors.margins: -10
+ onClicked: Qt.quit()
+ }
+} \ No newline at end of file
diff --git a/examples/declarative/toys/clocks/content/quit.png b/examples/declarative/toys/clocks/content/quit.png
new file mode 100644
index 0000000..b822057
--- /dev/null
+++ b/examples/declarative/toys/clocks/content/quit.png
Binary files differ
diff --git a/examples/declarative/tutorials/samegame/samegame4/content/samegame.js b/examples/declarative/tutorials/samegame/samegame4/content/samegame.js
index b1f427c..79ff0c1 100755
--- a/examples/declarative/tutorials/samegame/samegame4/content/samegame.js
+++ b/examples/declarative/tutorials/samegame/samegame4/content/samegame.js
@@ -127,7 +127,7 @@ function shuffleDown() {
} else {
if (fallDist > 0) {
var obj = board[index(column, row)];
- obj.y += fallDist * gameCanvas.blockSize;
+ obj.y = (row + fallDist) * gameCanvas.blockSize;
board[index(column, row + fallDist)] = obj;
board[index(column, row)] = null;
}
@@ -145,7 +145,7 @@ function shuffleDown() {
obj = board[index(column, row)];
if (obj == null)
continue;
- obj.x -= fallDist * gameCanvas.blockSize;
+ obj.x = (fallDist - column) * gameCanvas.blockSize;
board[index(column - fallDist, row)] = obj;
board[index(column, row)] = null;
}
diff --git a/examples/declarative/ui-components/dialcontrol/content/QuitButton.qml b/examples/declarative/ui-components/dialcontrol/content/QuitButton.qml
new file mode 100644
index 0000000..039694d
--- /dev/null
+++ b/examples/declarative/ui-components/dialcontrol/content/QuitButton.qml
@@ -0,0 +1,52 @@
+/****************************************************************************
+**
+** 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
+Image {
+ source: "quit.png"
+ scale: quitMouse.pressed ? 0.8 : 1.0
+ smooth: quitMouse.pressed
+ MouseArea {
+ id: quitMouse
+ anchors.fill: parent
+ anchors.margins: -10
+ onClicked: Qt.quit()
+ }
+} \ No newline at end of file
diff --git a/examples/declarative/ui-components/dialcontrol/content/quit.png b/examples/declarative/ui-components/dialcontrol/content/quit.png
new file mode 100644
index 0000000..b822057
--- /dev/null
+++ b/examples/declarative/ui-components/dialcontrol/content/quit.png
Binary files differ
diff --git a/examples/declarative/ui-components/dialcontrol/dialcontrol.qml b/examples/declarative/ui-components/dialcontrol/dialcontrol.qml
index 46cc3e6..a7da5c6 100644
--- a/examples/declarative/ui-components/dialcontrol/dialcontrol.qml
+++ b/examples/declarative/ui-components/dialcontrol/dialcontrol.qml
@@ -88,5 +88,10 @@ Rectangle {
}
}
}
+ QuitButton {
+ anchors.right: parent.right
+ anchors.top: parent.top
+ anchors.margins: 10
+ }
}
//! [0]
diff --git a/examples/sql/masterdetail/mainwindow.cpp b/examples/sql/masterdetail/mainwindow.cpp
index b8c9df6..2ef8ad0 100644
--- a/examples/sql/masterdetail/mainwindow.cpp
+++ b/examples/sql/masterdetail/mainwindow.cpp
@@ -189,9 +189,9 @@ void MainWindow::deleteAlbum()
QMessageBox::StandardButton button;
button = QMessageBox::question(this, tr("Delete Album"),
- QString(tr("Are you sure you want to " \
- "delete '%1' by '%2'?"))
- .arg(title).arg(artist),
+ tr("Are you sure you want to "
+ "delete '%1' by '%2'?")
+ .arg(title, artist),
QMessageBox::Yes | QMessageBox::No);
if (button == QMessageBox::Yes) {
diff --git a/examples/tools/treemodelcompleter/mainwindow.cpp b/examples/tools/treemodelcompleter/mainwindow.cpp
index 0448e9d..cfe003a 100644
--- a/examples/tools/treemodelcompleter/mainwindow.cpp
+++ b/examples/tools/treemodelcompleter/mainwindow.cpp
@@ -241,6 +241,6 @@ void MainWindow::changeCase(int cs)
void MainWindow::updateContentsLabel(const QString& sep)
{
- contentsLabel->setText(QString(tr("Type path from model above with items at each level separated by a '%1'")).arg(sep));
+ contentsLabel->setText(tr("Type path from model above with items at each level separated by a '%1'").arg(sep));
}
diff --git a/examples/tutorials/modelview/2_formatting/mymodel.cpp b/examples/tutorials/modelview/2_formatting/mymodel.cpp
index 3e13ff4..2d2556c 100755
--- a/examples/tutorials/modelview/2_formatting/mymodel.cpp
+++ b/examples/tutorials/modelview/2_formatting/mymodel.cpp
@@ -89,7 +89,7 @@ QVariant MyModel::data(const QModelIndex &index, int role) const
if (row == 1 && col == 2) //change background only for cell(1,2)
{
- QBrush redBackground(QColor(Qt::red));
+ QBrush redBackground(Qt::red);
return redBackground;
}
break;
diff --git a/examples/xmlpatterns/filetree/mainwindow.cpp b/examples/xmlpatterns/filetree/mainwindow.cpp
index 5b9b0c3..85348f3 100644
--- a/examples/xmlpatterns/filetree/mainwindow.cpp
+++ b/examples/xmlpatterns/filetree/mainwindow.cpp
@@ -140,7 +140,7 @@ void MainWindow::loadDirectory(const QString &directory)
QXmlFormatter formatter(query, &buffer);
query.evaluateTo(&formatter);
- treeInfo->setText((QString(tr("Model of %1 output as XML.")).arg(directory)));
+ treeInfo->setText(tr("Model of %1 output as XML.").arg(directory));
fileTree->setText(QString::fromLatin1(output.constData()));
evaluateResult();
//! [6]