diff options
Diffstat (limited to 'examples')
-rw-r--r-- | examples/qml/doc/src/qml-extending.qdoc | 28 | ||||
-rw-r--r-- | examples/qml/referenceexamples/extended/main.cpp | 4 | ||||
-rw-r--r-- | examples/qml/referenceexamples/methods/example.qml | 4 | ||||
-rw-r--r-- | examples/quick/demos/samegame/content/+blackberry/Settings.qml | 47 | ||||
-rw-r--r-- | examples/quick/demos/samegame/content/BBSettings.qml | 61 | ||||
-rw-r--r-- | examples/quick/demos/samegame/content/qmldir | 1 | ||||
-rw-r--r-- | examples/quick/demos/samegame/samegame.qrc | 2 | ||||
-rw-r--r-- | examples/quick/scenegraph/graph/graph.cpp | 2 |
8 files changed, 31 insertions, 118 deletions
diff --git a/examples/qml/doc/src/qml-extending.qdoc b/examples/qml/doc/src/qml-extending.qdoc index 0812a3dba1..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. */ @@ -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/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/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); |