aboutsummaryrefslogtreecommitdiffstats
path: root/examples
diff options
context:
space:
mode:
authorLaszlo Agocs <laszlo.agocs@qt.io>2017-01-23 12:36:29 +0100
committerLaszlo Agocs <laszlo.agocs@qt.io>2017-01-23 12:36:29 +0100
commit03fe99ba3a7d29b1606660baa407cff21c4d4d35 (patch)
tree525d5f03e8703bf7e9a7851280de67a597dceea1 /examples
parentf02e234fc012f4430378bc5205f32914822e4dff (diff)
parent94e6106d357ca5a1349a2b10a69dd84db34065c8 (diff)
Merge remote-tracking branch 'origin/dev' into wip/scenegraphng
Diffstat (limited to 'examples')
-rw-r--r--examples/qml/doc/src/qml-extending.qdoc30
-rw-r--r--examples/qml/referenceexamples/extended/main.cpp4
-rw-r--r--examples/qml/referenceexamples/methods/example.qml4
-rw-r--r--examples/quick/demos/calqlatr/calqlatr.qml5
-rw-r--r--examples/quick/demos/samegame/content/+blackberry/Settings.qml47
-rw-r--r--examples/quick/demos/samegame/content/BBSettings.qml61
-rw-r--r--examples/quick/demos/samegame/content/qmldir1
-rw-r--r--examples/quick/demos/samegame/samegame.qrc2
-rw-r--r--examples/quick/localstorage/doc/src/localstorage.qdoc2
-rw-r--r--examples/quick/localstorage/localstorage/qml-localstorage-example.pngbin46168 -> 0 bytes
-rw-r--r--examples/quick/scenegraph/graph/graph.cpp2
11 files changed, 36 insertions, 122 deletions
diff --git a/examples/qml/doc/src/qml-extending.qdoc b/examples/qml/doc/src/qml-extending.qdoc
index e5b364e0bc..b4174426a8 100644
--- a/examples/qml/doc/src/qml-extending.qdoc
+++ b/examples/qml/doc/src/qml-extending.qdoc
@@ -75,9 +75,21 @@ This example builds on:
Shows how to use \l {QQmlEngine::}{qmlRegisterExtendedType()} to provide an \l {Registering
Extension Objects}{extension object} to a \l QLineEdit without modifying or
-subclassing. The QML engine instantiates a \l QLineEdit and sets a property that
-only exists on the extension type. The extension type performs calls on the \l
-QLineEdit that otherwise will not be accessible to the QML engine.
+subclassing.
+
+\snippet referenceexamples/extended/main.cpp 0
+
+The QML engine instantiates a \l QLineEdit
+
+\snippet referenceexamples/extended/main.cpp 1
+
+and sets a property that oly exists on the extension type.
+
+\snippet referenceexamples/extended/example.qml 0
+
+The QML engine instantiates a \l QLineEdit and sets a property that
+only exists on the extension type. The extension type performs calls on the
+\l QLineEdit that otherwise will not be accessible to the QML engine.
*/
@@ -174,7 +186,7 @@ and other types can be coerced to it.
\section2 Define Boy and Girl
-The implementation of Boy and Girl are trivial.
+The implementation of Boy and Girl is trivial.
\snippet referenceexamples/coercion/person.cpp 1
@@ -293,12 +305,20 @@ This example builds on:
This example builds on:
\list
-\li \l {Extending QML - Default Property Example}
\li \l {Extending QML - Inheritance and Coercion Example}
\li \l {Extending QML - Object and List Property Types Example}
\li \l {Extending QML - Adding Types Example}
\endlist
+The Methods Example has an additional method in the \c BirthdayParty class: \c invite().
+\c invite() is declared with \l Q_INVOKABLE so that it can be
+called from QML.
+
+\snippet referenceexamples/methods/birthdayparty.h 0
+
+In \c example.qml, the \c invite() method is called in the \l [QML]{QtQml::Component::completed()}{Component.onCompleted} signal handler:
+
+\snippet referenceexamples/methods/example.qml 0
*/
/*!
diff --git a/examples/qml/referenceexamples/extended/main.cpp b/examples/qml/referenceexamples/extended/main.cpp
index fc11587841..f72cb0d9e2 100644
--- a/examples/qml/referenceexamples/extended/main.cpp
+++ b/examples/qml/referenceexamples/extended/main.cpp
@@ -48,11 +48,15 @@ int main(int argc, char ** argv)
{
QApplication app(argc, argv);
+// ![0]
qmlRegisterExtendedType<QLineEdit, LineEditExtension>("People", 1,0, "QLineEdit");
+// ![0]
+// ![1]
QQmlEngine engine;
QQmlComponent component(&engine, QUrl("qrc:example.qml"));
QLineEdit *edit = qobject_cast<QLineEdit *>(component.create());
+// ![1]
if (edit) {
edit->show();
diff --git a/examples/qml/referenceexamples/methods/example.qml b/examples/qml/referenceexamples/methods/example.qml
index 58985c5d5f..197e6007e1 100644
--- a/examples/qml/referenceexamples/methods/example.qml
+++ b/examples/qml/referenceexamples/methods/example.qml
@@ -38,6 +38,7 @@
**
****************************************************************************/
+// ![0]
import QtQuick 2.0
import People 1.0
@@ -52,7 +53,6 @@ BirthdayParty {
Person { name: "Anne Brown" }
]
-// ![0]
Component.onCompleted: invite("William Green")
-// ![0]
}
+// ![0]
diff --git a/examples/quick/demos/calqlatr/calqlatr.qml b/examples/quick/demos/calqlatr/calqlatr.qml
index 81f95907a6..017d819b01 100644
--- a/examples/quick/demos/calqlatr/calqlatr.qml
+++ b/examples/quick/demos/calqlatr/calqlatr.qml
@@ -128,6 +128,7 @@ Rectangle {
height: parent.height
MouseArea {
+ id: mouseInput
property real startX: 0
property real oldP: 0
property bool rewind: false
@@ -140,7 +141,7 @@ Rectangle {
height: 50
onPositionChanged: {
var reverse = startX > window.width / 2
- var mx = mapToItem(window, mouse.x).x
+ var mx = mapToItem(window, mouseInput.mouseX, mouseInput.mouseY).x
var p = Math.abs((mx - startX) / (window.width - display.width))
if (p < oldP)
rewind = reverse ? false : true
@@ -149,7 +150,7 @@ Rectangle {
controller.progress = reverse ? 1 - p : p
oldP = p
}
- onPressed: startX = mapToItem(window, mouse.x).x
+ onPressed: startX = mapToItem(window, mouseInput.mouseX, mouseInput.mouseY).x
onReleased: {
if (rewind)
controller.completeToBeginning()
diff --git a/examples/quick/demos/samegame/content/+blackberry/Settings.qml b/examples/quick/demos/samegame/content/+blackberry/Settings.qml
deleted file mode 100644
index c744ca6f51..0000000000
--- a/examples/quick/demos/samegame/content/+blackberry/Settings.qml
+++ /dev/null
@@ -1,47 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2013 BlackBerry Limited. All rights reserved.
-** Contact: http://www.qt.io/licensing/
-**
-** This file is part of the examples 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 The Qt Company Ltd 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$
-**
-****************************************************************************/
-
-pragma Singleton
-import QtQml 2.0
-
-// Instantiating a BBSettings class that can be easily tweaked for future
-// BB devices (we may have more selectors added)
-BBSettings {
-}
diff --git a/examples/quick/demos/samegame/content/BBSettings.qml b/examples/quick/demos/samegame/content/BBSettings.qml
deleted file mode 100644
index cd6be7dcf5..0000000000
--- a/examples/quick/demos/samegame/content/BBSettings.qml
+++ /dev/null
@@ -1,61 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2013 BlackBerry Limited. All rights reserved.
-** Contact: http://www.qt.io/licensing/
-**
-** This file is part of the examples 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 The Qt Company Ltd 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 QtQml 2.0
-
-QtObject {
- // This height/width is here for desktop testing, otherwise
- // we could just use Screen.width/Screen.height.
- property int screenHeight: 1280
- property int screenWidth: 768
-
- property int menuDelay: 500
-
- property int headerHeight: 70
- property int footerHeight: 100
-
- property int fontPixelSize: 55
-
- property int blockSize: 64
-
- property int toolButtonHeight: 64
-
- property int menuButtonSpacing: 15
-}
diff --git a/examples/quick/demos/samegame/content/qmldir b/examples/quick/demos/samegame/content/qmldir
index 727989d006..3b552ec1f1 100644
--- a/examples/quick/demos/samegame/content/qmldir
+++ b/examples/quick/demos/samegame/content/qmldir
@@ -1,5 +1,4 @@
singleton Settings 1.0 Settings.qml
-BBSettings 1.0 BBSettings.qml
Block 1.0 Block.qml
BlockEmitter 1.0 BlockEmitter.qml
Button 1.0 Button.qml
diff --git a/examples/quick/demos/samegame/samegame.qrc b/examples/quick/demos/samegame/samegame.qrc
index e51d3fae05..348ee109f9 100644
--- a/examples/quick/demos/samegame/samegame.qrc
+++ b/examples/quick/demos/samegame/samegame.qrc
@@ -3,8 +3,6 @@
<file>samegame.qml</file>
<file>content/qmldir</file>
<file>content/Settings.qml</file>
- <file>content/BBSettings.qml</file>
- <file>content/+blackberry/Settings.qml</file>
<file>content/gfx/text-p1-won.png</file>
<file>content/gfx/background-puzzle.png</file>
<file>content/gfx/background.png</file>
diff --git a/examples/quick/localstorage/doc/src/localstorage.qdoc b/examples/quick/localstorage/doc/src/localstorage.qdoc
index 1bfba147e1..8ffcbe9d14 100644
--- a/examples/quick/localstorage/doc/src/localstorage.qdoc
+++ b/examples/quick/localstorage/doc/src/localstorage.qdoc
@@ -28,7 +28,7 @@
\title Qt Quick Examples - Local Storage
\example localstorage
\brief A collection of QML local storage examples.
- \image qml-localstorage-example.png
+ \borderedimage qml-localstorage-example.png
\e{Local Storage} is a collection of small QML examples relating to
Qt Quick's \l{local storage} functionality.
diff --git a/examples/quick/localstorage/localstorage/qml-localstorage-example.png b/examples/quick/localstorage/localstorage/qml-localstorage-example.png
deleted file mode 100644
index 7d7edafe63..0000000000
--- a/examples/quick/localstorage/localstorage/qml-localstorage-example.png
+++ /dev/null
Binary files differ
diff --git a/examples/quick/scenegraph/graph/graph.cpp b/examples/quick/scenegraph/graph/graph.cpp
index 389bd384c2..6048a1032c 100644
--- a/examples/quick/scenegraph/graph/graph.cpp
+++ b/examples/quick/scenegraph/graph/graph.cpp
@@ -102,7 +102,7 @@ QSGNode *Graph::updatePaintNode(QSGNode *oldNode, UpdatePaintNodeData *)
n->background = new NoisyNode(window());
n->grid = new GridNode();
n->line = new LineNode(10, 0.5, QColor("steelblue"));
- n->shadow = new LineNode(20, 0.2, QColor::fromRgbF(0.2, 0.2, 0.2, 0.4));
+ n->shadow = new LineNode(20, 0.2f, QColor::fromRgbF(0.2, 0.2, 0.2, 0.4));
n->appendChildNode(n->background);
n->appendChildNode(n->grid);