# This file is used to ignore files which are generated in the Qt build system
# ----------------------------------------------------------------------------
-examples/*/*/*
-!examples/*/*/*[.]*
-!examples/*/*/README
-examples/*/*/*[.]app
-!examples/declarative/*
-!examples/tutorials/*
-!examples/tutorials/*/*
-!examples/ja_JP/*/*
-demos/*/*
-!demos/spectrum/*
-demos/spectrum/bin
-!demos/*/*[.]*
-demos/*/*[.]app
-!demos/declarative/*
config.tests/*/*/*
!config.tests/*/*/*[.]*
config.tests/*/*/*[.]app
tests/auto/*/*.moc
tests/auto/*/*/*.o
tests/auto/*/*/*.moc
-src/declarative/generated/
\ No newline at end of file
+src/declarative/generated/
imagedirs += ../src/images \
sourcedirs += ../src \
- ../../src
+ ../../src \
+ ../../examples
#indexes = $QT5DOC/doc/html/qt.index
\brief This is an internationalization example
*/
/*!
- \title QML Examples - Shader Effects
- \example declarative/shadereffects
- \image qml-shadereffects-example.png
- \brief This is a shader effects example
-
- This example demonstrates a couple of visual effects that you can perform
- with shaders in QtQuick 2.0
-*/
-/*!
\title QML Examples - Positioners
\example declarative/positioners
\brief This is a positioners example
This example demonstrates the positioners and some of their animations.
*/
/*!
- \title QML Examples - Animation
- \example declarative/animation
- \brief This is a collection of QML examples
- \image qml-animations-example.png
-
- This is a collection of small QML examples relating to animation. Each example is
- a small QML file, usually containing or emphasizing a particular element or
- feature. You can run and observe the behavior of each example.
-*/
-/*!
\title QML Examples - Image Elements
\example declarative/imageelements
\brief This is a collection of QML examples
/*!
- \title QML Example - Calculator
- \example declarative/calculator
- \brief This is an example application written in QML.
- \image qml-calculator-demo-small.png
-*/
-
-/*!
\title QML Example - Samegame
\example declarative/samegame
\brief This example demonstrates creating a game with javascript game logic.
--- /dev/null
+Some guidelines for QtDeclarative examples
+
+Snippets
+---
+Snippets are snatches of QML code that won't even run on their own. They don't belong here, they belong in doc/src/snippets. They should be contained in files that will compile on their own, for automated syntax validation, but don't have to look like anything.
+
+Examples
+---
+
+Examples are large blocks of QML code that demonstrate a feature. You should be able to launch an example and visually see the feature take effect. Examples should be written in a small form, and should automatically activate any features. Ideally, when you run an example, you see the feature demonstrate itself over and over until you get bored and close the application using your platform's close window mechanism. Examples shouldn't contain their own close buttons or start screen, explanatory text should be kept to a minimum (show, not tell), and reserve interaction for demonstrating interactive elements). The code should be held to a high level of quality, and should be understandable by people new to QML.
+
+Unless the demonstrated feature uses it, assume no interface devices other than a screen that can show a 320x480 rectangle and a generic pointing device (with the shared subset of mouse/touch functionality).
+
+Groups of similar examples should be placed in one folder with a single launcher application, which uses the QtQuick.Examples module for common components.
+
+The example, or launcher application in case of groups, should contain a qdoc comment explaining the example. The example or launcher should be buildable as a full C++ application and runnable with the standard qml file launcher.
+
+Demos
+---
+
+Demos are examples of creating full applications using QML. They should fit both a desktop and a mobile form factor, they should have their own start screen and method of exiting the application. They should be at a level of quality that you'd be comfortable submitting them to an app store for a platform of the appropriate hardware (screen size, input methods, etc.). The code should be written to a level that is easily understood and modified by a QML expert.
+
+Demos should have a qdoc file in their directory explaining the demo at a high level. The demo should be buildable as a full C++ application and preferably runnable with the standard qml file launcher.
Mostof these examples can be viewed directly with the
QML viewer utility, without requiring compilation.
-
Documentation for these examples can be found via the Examples
link in the main Qt documentation.
+++ /dev/null
-TEMPLATE = subdirs
-
-# These examples contain some C++ and need to be built
-SUBDIRS = \
- cppextensions \
- minehunt \
- modelviews \
- painteditem \
- tutorials \
- script
-
-# These examples contain no C++ and can simply be copied
-sources.files = \
- animation \
- calculator \
- cppextensions \
- flickr \
- i18n \
- imageelements \
- keyinteraction \
- photoviewer \
- positioners \
- rssnews \
- samegame \
- snake \
- sqllocalstorage \
- text \
- threading \
- touchinteraction \
- toys \
- twitter \
- ui-components \
- webbrowser \
- xml
-
-
-sources.path = $$[QT_INSTALL_EXAMPLES]/qtdeclarative/declarative
-INSTALLS += sources
+++ /dev/null
-/****************************************************************************
-**
-** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/
-**
-** 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 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 QtQuick 2.0
-import "content"
-
-Rectangle {
- id: page
- width: 1030; height: 540
-
- Grid {
- anchors.centerIn: parent; spacing: 20
-
- MyBorderImage {
- minWidth: 120; maxWidth: 240; minHeight: 120; maxHeight: 240
- source: "content/colors.png"; margin: 30
- }
-
- MyBorderImage {
- minWidth: 120; maxWidth: 240; minHeight: 120; maxHeight: 240
- source: "content/colors.png"; margin: 30
- horizontalMode: BorderImage.Repeat; verticalMode: BorderImage.Repeat
- }
-
- MyBorderImage {
- minWidth: 120; maxWidth: 240; minHeight: 120; maxHeight: 240
- source: "content/colors.png"; margin: 30
- horizontalMode: BorderImage.Stretch; verticalMode: BorderImage.Repeat
- }
-
- MyBorderImage {
- minWidth: 120; maxWidth: 240; minHeight: 120; maxHeight: 240
- source: "content/colors.png"; margin: 30
- horizontalMode: BorderImage.Round; verticalMode: BorderImage.Round
- }
-
- MyBorderImage {
- minWidth: 60; maxWidth: 200; minHeight: 40; maxHeight: 200
- source: "content/bw.png"; margin: 10
- }
-
- MyBorderImage {
- minWidth: 60; maxWidth: 200; minHeight: 40; maxHeight: 200
- source: "content/bw.png"; margin: 10
- horizontalMode: BorderImage.Repeat; verticalMode: BorderImage.Repeat
- }
-
- MyBorderImage {
- minWidth: 60; maxWidth: 200; minHeight: 40; maxHeight: 200
- source: "content/bw.png"; margin: 10
- horizontalMode: BorderImage.Stretch; verticalMode: BorderImage.Repeat
- }
-
- MyBorderImage {
- minWidth: 60; maxWidth: 200; minHeight: 40; maxHeight: 200
- source: "content/bw.png"; margin: 10
- horizontalMode: BorderImage.Round; verticalMode: BorderImage.Round
- }
- }
-}
+++ /dev/null
-/****************************************************************************
-**
-** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/
-**
-** 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 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 QtQuick 2.0
-import "content"
-
-Rectangle {
- width: 490
- height: 285
-
- Grid {
- property int cellWidth: (width - (spacing * (columns - 1))) / columns
- property int cellHeight: (height - (spacing * (rows - 1))) / rows
-
- anchors.fill: parent
- anchors.margins: 30
-
- columns: 3
- rows: 2
- spacing: 30
-
- ImageCell { mode: Image.Stretch; caption: "Stretch" }
- ImageCell { mode: Image.PreserveAspectFit; caption: "PreserveAspectFit" }
- ImageCell { mode: Image.PreserveAspectCrop; caption: "PreserveAspectCrop" }
-
- ImageCell { mode: Image.Tile; caption: "Tile" }
- ImageCell { mode: Image.TileHorizontally; caption: "TileHorizontally" }
- ImageCell { mode: Image.TileVertically; caption: "TileVertically" }
- }
-}
+++ /dev/null
-/****************************************************************************
-**
-** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/
-**
-** This file is part of the Declarative module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-import QtQuick 2.0
-import "content"
-
-Image {
- width: 640
- height: 360
- source: "../snake/content/pics/background.png"
-
- ShaderEffectSource {
- id: theSource
- sourceItem: theItem
- smooth: true
- }
-
- function saturate(x) {
- return Math.min(Math.max(x, 0), 1)
- }
-
- function sliderToColor(x) {
- return Qt.rgba(saturate(Math.max(2 - 6 * x, 6 * x - 4)),
- saturate(Math.min(6 * x, 4 - 6 * x)),
- saturate(Math.min(6 * x - 2, 6 - 6 * x)))
- }
-
- Grid {
- anchors.centerIn: parent
- columns: 3
-
- Item {
- id: theItem
- width: 180
- height: 180
- ListView {
- anchors.centerIn: parent
- width: 160
- height: 140
- clip: true
- snapMode: ListView.SnapOneItem
- model: VisualItemModel {
- Text {
- width: 160
- height: 140
- horizontalAlignment: Text.AlignHCenter
- verticalAlignment: Text.AlignVCenter
- font.pixelSize: 120
- font.family: "Times"
- color: "blue"
- text: "Qt"
- }
- Image {
- width: 160
- height: 140
- source: "content/qt-logo.png"
- smooth: true
- }
- Image {
- width: 160
- height: 140
- source: "content/face-smile.png"
- smooth: true
- }
- }
- }
- }
- ShaderEffect {
- width: 180
- height: 180
- property variant source: theSource
- property real amplitude: 0.04 * wobbleSlider.value
- property real frequency: 20
- property real time: 0
- NumberAnimation on time { loops: Animation.Infinite; from: 0; to: Math.PI * 2; duration: 600 }
- fragmentShader:
- "uniform lowp float qt_Opacity;" +
- "uniform highp float amplitude;" +
- "uniform highp float frequency;" +
- "uniform highp float time;" +
- "uniform sampler2D source;" +
- "varying highp vec2 qt_TexCoord0;" +
- "void main() {" +
- " highp vec2 p = sin(time + frequency * qt_TexCoord0);" +
- " gl_FragColor = texture2D(source, qt_TexCoord0 + amplitude * vec2(p.y, -p.x)) * qt_Opacity;" +
- "}"
- Slider {
- id: wobbleSlider
- anchors.left: parent.left
- anchors.right: parent.right
- anchors.bottom: parent.bottom
- height: 40
- }
- }
- ShaderEffect {
- width: 180
- height: 180
- property variant source: theSource
- property variant shadow: ShaderEffectSource {
- smooth: true
- sourceItem: ShaderEffect {
- width: theItem.width
- height: theItem.height
- property variant delta: Qt.size(0.0, 1.0 / height)
- property variant source: ShaderEffectSource {
- smooth: true
- sourceItem: ShaderEffect {
- width: theItem.width
- height: theItem.height
- property variant delta: Qt.size(1.0 / width, 0.0)
- property variant source: theSource
- fragmentShader: "
- uniform lowp float qt_Opacity;
- uniform sampler2D source;
- uniform highp vec2 delta;
- varying highp vec2 qt_TexCoord0;
- void main() {
- gl_FragColor =(0.0538 * texture2D(source, qt_TexCoord0 - 3.182 * delta)
- + 0.3229 * texture2D(source, qt_TexCoord0 - 1.364 * delta)
- + 0.2466 * texture2D(source, qt_TexCoord0)
- + 0.3229 * texture2D(source, qt_TexCoord0 + 1.364 * delta)
- + 0.0538 * texture2D(source, qt_TexCoord0 + 3.182 * delta)) * qt_Opacity;
- }"
- }
- }
- fragmentShader: "
- uniform lowp float qt_Opacity;
- uniform sampler2D source;
- uniform highp vec2 delta;
- varying highp vec2 qt_TexCoord0;
- void main() {
- gl_FragColor =(0.0538 * texture2D(source, qt_TexCoord0 - 3.182 * delta)
- + 0.3229 * texture2D(source, qt_TexCoord0 - 1.364 * delta)
- + 0.2466 * texture2D(source, qt_TexCoord0)
- + 0.3229 * texture2D(source, qt_TexCoord0 + 1.364 * delta)
- + 0.0538 * texture2D(source, qt_TexCoord0 + 3.182 * delta)) * qt_Opacity;
- }"
- }
- }
- property real angle: 0
- property variant offset: Qt.point(15.0 * Math.cos(angle), 15.0 * Math.sin(angle))
- NumberAnimation on angle { loops: Animation.Infinite; from: 0; to: Math.PI * 2; duration: 6000 }
- property variant delta: Qt.size(offset.x / width, offset.y / height)
- property real darkness: shadowSlider.value
- fragmentShader: "
- uniform lowp float qt_Opacity;
- uniform highp vec2 offset;
- uniform sampler2D source;
- uniform sampler2D shadow;
- uniform highp float darkness;
- uniform highp vec2 delta;
- varying highp vec2 qt_TexCoord0;
- void main() {
- lowp vec4 fg = texture2D(source, qt_TexCoord0);
- lowp vec4 bg = texture2D(shadow, qt_TexCoord0 + delta);
- gl_FragColor = (fg + vec4(0., 0., 0., darkness * bg.a) * (1. - fg.a)) * qt_Opacity;
- }"
- Slider {
- id: shadowSlider
- anchors.left: parent.left
- anchors.right: parent.right
- anchors.bottom: parent.bottom
- height: 40
- }
- }
- ShaderEffect {
- width: 180
- height: 180
- property variant source: theSource
- property variant delta: Qt.size(0.5 / width, 0.5 / height)
- fragmentShader: "
- uniform sampler2D source;
- uniform highp vec2 delta;
- uniform highp float qt_Opacity;
- varying highp vec2 qt_TexCoord0;
- void main() {
- lowp vec4 tl = texture2D(source, qt_TexCoord0 - delta);
- lowp vec4 tr = texture2D(source, qt_TexCoord0 + vec2(delta.x, -delta.y));
- lowp vec4 bl = texture2D(source, qt_TexCoord0 - vec2(delta.x, -delta.y));
- lowp vec4 br = texture2D(source, qt_TexCoord0 + delta);
- lowp vec4 gx = (tl + bl) - (tr + br);
- lowp vec4 gy = (tl + tr) - (bl + br);
- gl_FragColor.xyz = vec3(0.);
- gl_FragColor.w = clamp(dot(sqrt(gx * gx + gy * gy), vec4(1.)), 0., 1.) * qt_Opacity;
- }"
- }
- ShaderEffect {
- width: 180
- height: 180
- property variant source: theSource
- property color tint: sliderToColor(colorizeSlider.value)
- fragmentShader: "
- uniform sampler2D source;
- uniform lowp vec4 tint;
- uniform lowp float qt_Opacity;
- varying highp vec2 qt_TexCoord0;
- void main() {
- lowp vec4 c = texture2D(source, qt_TexCoord0);
- lowp float lo = min(min(c.x, c.y), c.z);
- lowp float hi = max(max(c.x, c.y), c.z);
- gl_FragColor = qt_Opacity * vec4(mix(vec3(lo), vec3(hi), tint.xyz), c.w);
- }"
- Slider {
- id: colorizeSlider
- anchors.left: parent.left
- anchors.right: parent.right
- anchors.bottom: parent.bottom
- height: 40
- }
- }
- ShaderEffect {
- width: 180
- height: 180
- mesh: Qt.size(10, 10)
- property variant source: theSource
- property real bend: 0
- property real minimize: 0
- property real side: genieSlider.value
- SequentialAnimation on bend {
- loops: Animation.Infinite
- NumberAnimation { to: 1; duration: 700; easing.type: Easing.InOutSine }
- PauseAnimation { duration: 1600 }
- NumberAnimation { to: 0; duration: 700; easing.type: Easing.InOutSine }
- PauseAnimation { duration: 1000 }
- }
- SequentialAnimation on minimize {
- loops: Animation.Infinite
- PauseAnimation { duration: 300 }
- NumberAnimation { to: 1; duration: 700; easing.type: Easing.InOutSine }
- PauseAnimation { duration: 1000 }
- NumberAnimation { to: 0; duration: 700; easing.type: Easing.InOutSine }
- PauseAnimation { duration: 1300 }
- }
- vertexShader: "
- uniform highp mat4 qt_Matrix;
- uniform highp float bend;
- uniform highp float minimize;
- uniform highp float side;
- uniform highp float width;
- uniform highp float height;
- attribute highp vec4 qt_Vertex;
- attribute highp vec2 qt_MultiTexCoord0;
- varying highp vec2 qt_TexCoord0;
- void main() {
- qt_TexCoord0 = qt_MultiTexCoord0;
- highp vec4 pos = qt_Vertex;
- pos.y = mix(qt_Vertex.y, height, minimize);
- highp float t = pos.y / height;
- t = (3. - 2. * t) * t * t;
- pos.x = mix(qt_Vertex.x, side * width, t * bend);
- gl_Position = qt_Matrix * pos;
- }"
- Slider {
- id: genieSlider
- anchors.left: parent.left
- anchors.right: parent.right
- anchors.bottom: parent.bottom
- height: 40
- }
- }
- }
-}
+++ /dev/null
-TEMPLATE = subdirs
-
-SUBDIRS += \
- extending
-
+++ /dev/null
-import QmlProject 1.0
-
-Project {
- /* Include .qml, .js, and image files from current directory and subdirectories */
- QmlFiles {
- directory: "."
- }
- JavaScriptFiles {
- directory: "."
- }
- ImageFiles {
- directory: "."
- }
-}
id: mouseArea
anchors.fill: parent
onClicked: {
- doOp(operation)
+ window.doOp(operation)
button.clicked()
}
}
}
function doOperation(op) {
+ if (op == '*')//Keyboard Aliases
+ op = multiplication;
+ if (op == '/')
+ op = division;
if (disabled(op)) {
return
}
--- /dev/null
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the QtDeclarative module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** GNU Lesser General Public License Usage
+** This file may be used under the terms of the GNU Lesser General Public
+** License version 2.1 as published by the Free Software Foundation and
+** appearing in the file LICENSE.LGPL included in the packaging of this
+** file. Please review the following information to ensure the GNU Lesser
+** General Public License version 2.1 requirements will be met:
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU General
+** Public License version 3.0 as published by the Free Software Foundation
+** and appearing in the file LICENSE.GPL included in the packaging of this
+** file. Please review the following information to ensure the GNU General
+** Public License version 3.0 requirements will be met:
+** http://www.gnu.org/copyleft/gpl.html.
+**
+** Other Usage
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+import QtQuick.Window 2.0
+import "CalculatorCore"
+import "CalculatorCore/calculator.js" as CalcEngine
+
+Rectangle {
+ id: window
+
+ width: 640; height: 480
+ color: "#282828"
+
+ property string rotateLeft: "\u2939"
+ property string rotateRight: "\u2935"
+ property string leftArrow: "\u2190"
+ property string division : "\u00f7"
+ property string multiplication : "\u00d7"
+ property string squareRoot : "\u221a"
+ property string plusminus : "\u00b1"
+
+ function doOp(operation) { CalcEngine.doOperation(operation) }
+ focus: true
+ Keys.onPressed: doOp(event.text);
+
+ Item {
+ id: main
+ width: 640
+ height: 480
+ anchors.centerIn: parent
+
+ Column {
+ id: box; spacing: 8
+
+ anchors { fill: parent; topMargin: 6; bottomMargin: 6; leftMargin: 6; rightMargin: 6 }
+
+ Display {
+ id: display
+ width: box.width-3
+ height: 64
+ }
+
+ Column {
+ id: column; spacing: 6
+
+ property real h: ((box.height - 72) / 6) - ((spacing * (6 - 1)) / 6)
+ property real w: (box.width / 4) - ((spacing * (4 - 1)) / 4)
+
+ Row {
+ spacing: 6
+ Button { width: column.w; height: column.h; color: 'purple'; operation: "Off" }
+ Button { width: column.w; height: column.h; color: 'purple'; operation: leftArrow }
+ Button { width: column.w; height: column.h; color: 'purple'; operation: "C" }
+ Button { width: column.w; height: column.h; color: 'purple'; operation: "AC" }
+ }
+
+ Row {
+ spacing: 6
+ property real w: (box.width / 4) - ((spacing * (4 - 1)) / 4)
+
+ Button { width: column.w; height: column.h; color: 'green'; operation: "mc" }
+ Button { width: column.w; height: column.h; color: 'green'; operation: "m+" }
+ Button { width: column.w; height: column.h; color: 'green'; operation: "m-" }
+ Button { width: column.w; height: column.h; color: 'green'; operation: "mr" }
+ }
+
+ Grid {
+ id: grid; rows: 5; columns: 5; spacing: 6
+
+ property real w: (box.width / columns) - ((spacing * (columns - 1)) / columns)
+
+ Button { width: grid.w; height: column.h; operation: "7"; color: 'blue' }
+ Button { width: grid.w; height: column.h; operation: "8"; color: 'blue' }
+ Button { width: grid.w; height: column.h; operation: "9"; color: 'blue' }
+ Button { width: grid.w; height: column.h; operation: division }
+ Button { width: grid.w; height: column.h; operation: squareRoot }
+ Button { width: grid.w; height: column.h; operation: "4"; color: 'blue' }
+ Button { width: grid.w; height: column.h; operation: "5"; color: 'blue' }
+ Button { width: grid.w; height: column.h; operation: "6"; color: 'blue' }
+ Button { width: grid.w; height: column.h; operation: multiplication }
+ Button { width: grid.w; height: column.h; operation: "x^2" }
+ Button { width: grid.w; height: column.h; operation: "1"; color: 'blue' }
+ Button { width: grid.w; height: column.h; operation: "2"; color: 'blue' }
+ Button { width: grid.w; height: column.h; operation: "3"; color: 'blue' }
+ Button { width: grid.w; height: column.h; operation: "-" }
+ Button { width: grid.w; height: column.h; operation: "1/x" }
+ Button { width: grid.w; height: column.h; operation: "0"; color: 'blue' }
+ Button { width: grid.w; height: column.h; operation: "." }
+ Button { width: grid.w; height: column.h; operation: plusminus }
+ Button { width: grid.w; height: column.h; operation: "+" }
+ Button { width: grid.w; height: column.h; operation: "="; color: 'red' }
+ }
+ }
+ }
+
+ }
+}
import QtQuick 2.0
import QtQuick.Window 2.0
-import "content"
-import "content/calculator.js" as CalcEngine
+import "CalculatorCore"
+import "CalculatorCore/calculator.js" as CalcEngine
Rectangle {
id: window
- width: 360; height: 480
+ width: 320; height: 480
color: "#282828"
property string rotateLeft: "\u2939"
id: main
state: "orientation " + Screen.orientation
+ //Note: Assumes a primarily portrait device
property bool landscapeWindow: window.width > window.height
property real baseWidth: landscapeWindow ? window.height : window.width
property real baseHeight: landscapeWindow ? window.width : window.height
--- /dev/null
+TEMPLATE = app
+
+QT += quick declarative
+SOURCES += main.cpp
+
+target.path = $$[QT_INSTALL_EXAMPLES]/qtdeclarative/demos/calculator
+qml.files = calculator-desktop.qml calculator-mobile.qml CalculatorCore
+qml.path = $$[QT_INSTALL_EXAMPLES]/qtdeclarative/demos/calculator
+INSTALLS += target qml
--- /dev/null
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:FDL$
+** GNU Free Documentation License
+** Alternatively, this file may be used under the terms of the GNU Free
+** Documentation License version 1.3 as published by the Free Software
+** Foundation and appearing in the file included in the packaging of
+** this file.
+**
+** Other Usage
+** Alternatively, this file may be used in accordance with the terms
+** and conditions contained in a signed written agreement between you
+** and Nokia.
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+/*!
+ \title QML Demo - Calculator
+ \example declarative/calculator
+ \brief This is an example calculator application written in QML.
+ \image qml-calculator-demo-small.png
+
+ The Calculator demo implements a simple calculator in QML. It is written for desktop and portrait devices,
+ although on device it supports orientation changes.
+*/
+
--- /dev/null
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** 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 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$
+**
+****************************************************************************/
+
+#include <QGuiApplication>
+#include <QStringList>
+#include <QQuickView>
+#include <QDeclarativeEngine>
+
+void usage()
+{
+ printf("Pass -desktop to use the Desktop UI");
+ exit(0);
+}
+
+int main(int argc, char* argv[])
+{
+ QGuiApplication app(argc,argv);
+ QQuickView view;
+ QUrl launchFile = QUrl::fromLocalFile(QLatin1String("calculator-mobile.qml"));
+ if (app.arguments().contains(QLatin1String("-help")))
+ usage();
+ if (app.arguments().contains(QLatin1String("-desktop")))
+ launchFile = QUrl::fromLocalFile(QLatin1String("calculator-desktop.qml"));
+ view.connect(view.engine(), SIGNAL(quit()), &app, SLOT(quit()));
+ view.setSource(launchFile);
+ view.show();
+ return app.exec();
+}
+
--- /dev/null
+TEMPLATE = subdirs
+SUBDIRS = calculator
property int activeSuns: 0
property int centerOffset: 72
- height: 480; width: 360
+ height: 480; width: 320
MouseArea {
property int verticalMovement;
property int horizontalMovement;
- x: margin + column * gridSize + 2
- y: margin + row * gridSize - 3
- Behavior on x { NumberAnimation { duration: spawned ? halfbeatInterval : 0} }
- Behavior on y { NumberAnimation { duration: spawned ? halfbeatInterval : 0 } }
+ x: screen.margin + column * screen.gridSize + 2
+ y: screen.margin + row * screen.gridSize - 3
+ Behavior on x { NumberAnimation { duration: spawned ? screen.halfbeatInterval : 0} }
+ Behavior on y { NumberAnimation { duration: spawned ? screen.halfbeatInterval : 0 } }
opacity: spawned ? 1 : 0
Behavior on opacity { NumberAnimation { duration: 200 } }
import QtQuick 2.0
import "content" as Content
import "content/snake.js" as Logic
-
+Item{
Rectangle {
id: screen;
SystemPalette { id: activePalette }
Timer {
id: heartbeat;
- interval: heartbeatInterval;
- running: activeGame
+ interval: screen.heartbeatInterval;
+ running: screen.activeGame
repeat: true
onTriggered: { Logic.move() }
}
Timer {
id: halfbeat;
- interval: halfbeatInterval;
+ interval: screen.halfbeatInterval;
repeat: true
running: heartbeat.running
onTriggered: { Logic.moveSkull() }
Timer {
id: startHeartbeatTimer;
interval: 1000 ;
- onTriggered: { state = "running"; activeGame = true; }
+ onTriggered: { screen.state = "running"; screen.activeGame = true; }
}
Image{
font.pointSize: 24
anchors.horizontalCenter: parent.horizontalCenter;
//horizontalAlignment: Text.AlignHCenter
- text: "Last Score:\t" + lastScore + "\nHighscore:\t" + highScores.topScore;
+ text: "Last Score:\t" + screen.lastScore + "\nHighscore:\t" + highScores.topScore;
}
}
}
color: "transparent"
anchors.horizontalCenter: parent.horizontalCenter
y: (screen.height - 32 - height)/2;
- width: numColumnsAvailable * gridSize + 2*margin
- height: numRowsAvailable * gridSize + 2*margin
+ width: screen.numColumnsAvailable * screen.gridSize + 2*screen.margin
+ height: screen.numRowsAvailable * screen.gridSize + 2*screen.margin
Content.Skull {
Text {
color: activePalette.text
- text: "Score: " + score; font.bold: true
+ text: "Score: " + screen.score; font.bold: true
anchors.right: parent.right; anchors.rightMargin: 3
anchors.verticalCenter: parent.verticalCenter
}
]
}
+}
+++ /dev/null
-TEMPLATE = subdirs
-SUBDIRS += qmleasing qmlflickr qmldialcontrol qmlcalculator qmlphotoviewer qmlclocks qmltwitter
+++ /dev/null
-qmlcalculator_src = $$PWD/../../declarative/calculator
-
-qmlcalculator_files.files = $$qmlcalculator_src/calculator.qml $$qmlcalculator_src/Core
-DEPLOYMENT += qmlcalculator_files
+++ /dev/null
-/****************************************************************************
-**
-** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/
-**
-** This file is part of the demonstration applications of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QtCore/QFileInfo>
-#include <QtWidgets/QApplication>
-#include <QtDeclarative/QDeclarativeView>
-#include <QtDeclarative/QDeclarativeEngine>
-
-int main(int argc, char *argv[])
-{
- QApplication application(argc, argv);
-
- const QString mainQmlApp = QLatin1String("calculator.qml");
- QDeclarativeView view;
- view.setSource(QUrl(mainQmlApp));
- view.setResizeMode(QDeclarativeView::SizeRootObjectToView);
- QObject::connect(view.engine(), SIGNAL(quit()), &application, SLOT(quit()));
-
-#if defined(QT_KEYPAD_NAVIGATION)
- QApplication::setNavigationMode(Qt::NavigationModeCursorAuto);
-#endif // QT_KEYPAD_NAVIGATION
-
- view.show();
- return application.exec();
-}
+++ /dev/null
-!wince*:warning("DEPLOYMENT support required. This project only works on WinCE.")
-
-QT += declarative
-SOURCES += $$PWD/qmlcalculator.cpp
-include($$PWD/deployment.pri)
+++ /dev/null
-qmlclocks_src = $$PWD/../../../examples/declarative/toys/clocks
-
-qmlclocks_files.files = $$qmlclocks_src/clocks.qml $$qmlclocks_src/content
-DEPLOYMENT += qmlclocks_files
+++ /dev/null
-/****************************************************************************
-**
-** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/
-**
-** This file is part of the demonstration applications of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QtCore/QFileInfo>
-#include <QtWidgets/QApplication>
-#include <QtDeclarative/QDeclarativeView>
-#include <QtDeclarative/QDeclarativeEngine>
-
-int main(int argc, char *argv[])
-{
- QApplication application(argc, argv);
-
- const QString mainQmlApp = QLatin1String("clocks.qml");
- QDeclarativeView view;
- view.setSource(QUrl(mainQmlApp));
- view.setResizeMode(QDeclarativeView::SizeRootObjectToView);
- QObject::connect(view.engine(), SIGNAL(quit()), &application, SLOT(quit()));
-
-#if defined(QT_KEYPAD_NAVIGATION)
- QApplication::setNavigationMode(Qt::NavigationModeCursorAuto);
-#endif // QT_KEYPAD_NAVIGATION
-
- view.show();
- return application.exec();
-}
+++ /dev/null
-!wince*:warning("DEPLOYMENT support required. This project only works on WinCE.")
-
-QT += declarative
-SOURCES += $$PWD/qmlclocks.cpp
-include($$PWD/deployment.pri)
+++ /dev/null
-qmldialcontrol_src = $$PWD/../../../examples/declarative/ui-components/dialcontrol
-
-qmldialcontrol_files.files = $$qmldialcontrol_src/dialcontrol.qml $$qmldialcontrol_src/content
-DEPLOYMENT += qmldialcontrol_files
+++ /dev/null
-/****************************************************************************
-**
-** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/
-**
-** This file is part of the demonstration applications of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QtCore/QFileInfo>
-#include <QtWidgets/QApplication>
-#include <QtDeclarative/QDeclarativeView>
-#include <QtDeclarative/QDeclarativeEngine>
-
-int main(int argc, char *argv[])
-{
- QApplication application(argc, argv);
-
- const QString mainQmlApp = QLatin1String("dialcontrol.qml");
- QDeclarativeView view;
- view.setSource(QUrl(mainQmlApp));
- view.setResizeMode(QDeclarativeView::SizeRootObjectToView);
- QObject::connect(view.engine(), SIGNAL(quit()), &application, SLOT(quit()));
-
-#if defined(QT_KEYPAD_NAVIGATION)
- QApplication::setNavigationMode(Qt::NavigationModeCursorAuto);
-#endif // QT_KEYPAD_NAVIGATION
-
- view.show();
- return application.exec();
-}
+++ /dev/null
-!wince*:warning("DEPLOYMENT support required. This project only works on WinCE.")
-
-QT += declarative
-SOURCES += $$PWD/qmldialcontrol.cpp
-include($$PWD/deployment.pri)
+++ /dev/null
-qmleasing_src = $$PWD/../../../examples/declarative/animation/easing
-
-qmleasing_files.files = $$qmleasing_src/easing.qml $$qmleasing_src/content
-DEPLOYMENT += qmleasing_files
+++ /dev/null
-/****************************************************************************
-**
-** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/
-**
-** This file is part of the demonstration applications of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QtCore/QFileInfo>
-#include <QtWidgets/QApplication>
-#include <QtDeclarative/QDeclarativeView>
-#include <QtDeclarative/QDeclarativeEngine>
-
-int main(int argc, char *argv[])
-{
- QApplication application(argc, argv);
-
- const QString mainQmlApp = QLatin1String("easing.qml");
- QDeclarativeView view;
- view.setSource(QUrl(mainQmlApp));
- view.setResizeMode(QDeclarativeView::SizeRootObjectToView);
- QObject::connect(view.engine(), SIGNAL(quit()), &application, SLOT(quit()));
-
-#if defined(QT_KEYPAD_NAVIGATION)
- QApplication::setNavigationMode(Qt::NavigationModeCursorAuto);
-#endif // QT_KEYPAD_NAVIGATION
-
- view.show();
- return application.exec();
-}
+++ /dev/null
-!wince*:warning("DEPLOYMENT support required. This project only works on WinCE.")
-
-QT += declarative
-SOURCES += $$PWD/qmleasing.cpp
-include($$PWD/deployment.pri)
+++ /dev/null
-qmlflickr_src = $$PWD/../../declarative/flickr
-
-qmlflickr_files.files = $$qmlflickr_src/flickr.qml $$qmlflickr_src/common $$qmlflickr_src/mobile
-DEPLOYMENT += qmlflickr_files
+++ /dev/null
-/****************************************************************************
-**
-** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/
-**
-** This file is part of the demonstration applications of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QtCore/QFileInfo>
-#include <QtCore/QSettings>
-#include <QtWidgets/QApplication>
-#include <QtDeclarative/QDeclarativeView>
-#include <QtDeclarative/QDeclarativeEngine>
-#include <QtDeclarative/QDeclarativeNetworkAccessManagerFactory>
-#include <QtNetwork/QNetworkConfiguration>
-#include <QtNetwork/QNetworkConfigurationManager>
-#include <QtNetwork/QNetworkAccessManager>
-#include <QtDeclarative/QDeclarativeEngine>
-
-// Factory to create QNetworkAccessManagers that use the saved network configuration; otherwise
-// the system default.
-class NetworkAccessManagerFactory : public QDeclarativeNetworkAccessManagerFactory
-{
-public:
- ~NetworkAccessManagerFactory() { }
-
- QNetworkAccessManager *create(QObject *parent);
-};
-
-QNetworkAccessManager *NetworkAccessManagerFactory::create(QObject *parent)
-{
- QNetworkAccessManager *accessManager = new QNetworkAccessManager(parent);
-
- QNetworkConfigurationManager manager;
- if (manager.capabilities() & QNetworkConfigurationManager::NetworkSessionRequired) {
- // Get saved network configuration
- QSettings settings(QSettings::UserScope, QLatin1String("Trolltech"));
- settings.beginGroup(QLatin1String("QtNetwork"));
- const QString id = settings.value(QLatin1String("DefaultNetworkConfiguration")).toString();
- settings.endGroup();
-
- // If the saved network configuration is not currently discovered use the system default
- QNetworkConfiguration config = manager.configurationFromIdentifier(id);
- if ((config.state() & QNetworkConfiguration::Discovered) !=
- QNetworkConfiguration::Discovered) {
- config = manager.defaultConfiguration();
- }
-
- accessManager->setConfiguration(config);
- }
-
- return accessManager;
-}
-
-int main(int argc, char *argv[])
-{
- QApplication application(argc, argv);
-
- NetworkAccessManagerFactory networkAccessManagerFactory;
-
- const QString mainQmlApp = QLatin1String("flickr.qml");
- QDeclarativeView view;
- view.engine()->setNetworkAccessManagerFactory(&networkAccessManagerFactory);
- view.setSource(QUrl(mainQmlApp));
- view.setResizeMode(QDeclarativeView::SizeRootObjectToView);
- QObject::connect(view.engine(), SIGNAL(quit()), &application, SLOT(quit()));
- view.setGeometry(QRect(100, 100, 360, 640));
- view.show();
- return application.exec();
-}
-
+++ /dev/null
-!wince*:warning("DEPLOYMENT support required. This project only works on WinCE.")
-
-QT += declarative network
-SOURCES += $$PWD/qmlflickr.cpp
-include($$PWD/deployment.pri)
+++ /dev/null
-qmlphotoviewer_src = $$PWD/../../declarative/photoviewer
-
-qmlphotoviewer_files.files = $$qmlphotoviewer_src/photoviewer.qml $$qmlphotoviewer_src/PhotoViewerCore
-DEPLOYMENT += qmlphotoviewer_files
+++ /dev/null
-/****************************************************************************
-**
-** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/
-**
-** This file is part of the demonstration applications of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QtCore/QFileInfo>
-#include <QtCore/QSettings>
-#include <QtWidgets/QApplication>
-#include <QtDeclarative/QDeclarativeView>
-#include <QtDeclarative/QDeclarativeEngine>
-#include <QtDeclarative/QDeclarativeNetworkAccessManagerFactory>
-#include <QtNetwork/QNetworkConfiguration>
-#include <QtNetwork/QNetworkConfigurationManager>
-#include <QtNetwork/QNetworkAccessManager>
-
-// Factory to create QNetworkAccessManagers that use the saved network configuration; otherwise
-// the system default.
-class NetworkAccessManagerFactory : public QDeclarativeNetworkAccessManagerFactory
-{
-public:
- ~NetworkAccessManagerFactory() { }
-
- QNetworkAccessManager *create(QObject *parent);
-};
-
-QNetworkAccessManager *NetworkAccessManagerFactory::create(QObject *parent)
-{
- QNetworkAccessManager *accessManager = new QNetworkAccessManager(parent);
-
- QNetworkConfigurationManager manager;
- if (manager.capabilities() & QNetworkConfigurationManager::NetworkSessionRequired) {
- // Get saved network configuration
- QSettings settings(QSettings::UserScope, QLatin1String("Trolltech"));
- settings.beginGroup(QLatin1String("QtNetwork"));
- const QString id = settings.value(QLatin1String("DefaultNetworkConfiguration")).toString();
- settings.endGroup();
-
- // If the saved network configuration is not currently discovered use the system default
- QNetworkConfiguration config = manager.configurationFromIdentifier(id);
- if ((config.state() & QNetworkConfiguration::Discovered) !=
- QNetworkConfiguration::Discovered) {
- config = manager.defaultConfiguration();
- }
-
- accessManager->setConfiguration(config);
- }
-
- return accessManager;
-}
-
-int main(int argc, char *argv[])
-{
- QApplication application(argc, argv);
-
- NetworkAccessManagerFactory networkAccessManagerFactory;
-
- const QString mainQmlApp = QLatin1String("photoviewer.qml");
- QDeclarativeView view;
- view.engine()->setNetworkAccessManagerFactory(&networkAccessManagerFactory);
- view.setSource(QUrl(mainQmlApp));
- view.setResizeMode(QDeclarativeView::SizeRootObjectToView);
-
- QObject::connect(view.engine(), SIGNAL(quit()), &application, SLOT(quit()));
- view.setGeometry(QRect(100, 100, 360, 640));
- view.show();
- return application.exec();
-}
-
+++ /dev/null
-!wince*:warning("DEPLOYMENT support required. This project only works on WinCE.")
-
-QT += declarative network
-SOURCES += $$PWD/qmlphotoviewer.cpp
-include($$PWD/deployment.pri)
+++ /dev/null
-qmltwitter_src = $$PWD/../../declarative/twitter
-
-qmltwitter_files.files = $$qmltwitter_src/twitter.qml $$qmltwitter_src/TwitterCore
-DEPLOYMENT += qmltwitter_files
+++ /dev/null
-/****************************************************************************
-**
-** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/
-**
-** This file is part of the demonstration applications of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QtCore/QFileInfo>
-#include <QtCore/QSettings>
-#include <QtWidgets/QApplication>
-#include <QtDeclarative/QDeclarativeView>
-#include <QtDeclarative/QDeclarativeEngine>
-#include <QtDeclarative/QDeclarativeNetworkAccessManagerFactory>
-#include <QtNetwork/QNetworkConfiguration>
-#include <QtNetwork/QNetworkConfigurationManager>
-#include <QtNetwork/QNetworkAccessManager>
-
-// Factory to create QNetworkAccessManagers that use the saved network configuration; otherwise
-// the system default.
-class NetworkAccessManagerFactory : public QDeclarativeNetworkAccessManagerFactory
-{
-public:
- ~NetworkAccessManagerFactory() { }
-
- QNetworkAccessManager *create(QObject *parent);
-};
-
-QNetworkAccessManager *NetworkAccessManagerFactory::create(QObject *parent)
-{
- QNetworkAccessManager *accessManager = new QNetworkAccessManager(parent);
-
- QNetworkConfigurationManager manager;
- if (manager.capabilities() & QNetworkConfigurationManager::NetworkSessionRequired) {
- // Get saved network configuration
- QSettings settings(QSettings::UserScope, QLatin1String("Trolltech"));
- settings.beginGroup(QLatin1String("QtNetwork"));
- const QString id = settings.value(QLatin1String("DefaultNetworkConfiguration")).toString();
- settings.endGroup();
-
- // If the saved network configuration is not currently discovered use the system default
- QNetworkConfiguration config = manager.configurationFromIdentifier(id);
- if ((config.state() & QNetworkConfiguration::Discovered) !=
- QNetworkConfiguration::Discovered) {
- config = manager.defaultConfiguration();
- }
-
- accessManager->setConfiguration(config);
- }
-
- return accessManager;
-}
-
-int main(int argc, char *argv[])
-{
- QApplication application(argc, argv);
-
- NetworkAccessManagerFactory networkAccessManagerFactory;
-
- const QString mainQmlApp = QLatin1String("twitter.qml");
- QDeclarativeView view;
- view.engine()->setNetworkAccessManagerFactory(&networkAccessManagerFactory);
- view.setSource(QUrl(mainQmlApp));
- view.setResizeMode(QDeclarativeView::SizeRootObjectToView);
- QObject::connect(view.engine(), SIGNAL(quit()), &application, SLOT(quit()));
- view.setGeometry(QRect(100, 100, 360, 640));
- view.show();
- return application.exec();
-}
-
+++ /dev/null
-!wince*:warning("DEPLOYMENT support required. This project only works on WinCE.")
-
-QT += declarative network
-SOURCES += $$PWD/qmltwitter.cpp
-include($$PWD/deployment.pri)
TEMPLATE = subdirs
-SUBDIRS += declarative tutorials
+SUBDIRS += demos shared localstorage particles qml qtquick tutorials window
contains(QT_CONFIG, qmltest): SUBDIRS += qmltest
--- /dev/null
+TEMPLATE = subdirs
--- /dev/null
+TEMPLATE = subdirs
--- /dev/null
+TEMPLATE = subdirs
--- /dev/null
+TEMPLATE = app
+
+QT += quick declarative
+SOURCES += main.cpp
+
+target.path = $$[QT_INSTALL_EXAMPLES]/qtdeclarative/qtquick/accessibility
+qml.files = accessibility.qml content
+qml.path = $$[QT_INSTALL_EXAMPLES]/qtdeclarative/qtquick/accessibility
+INSTALLS += target qml
+
****************************************************************************/
import QtQuick 2.0
-import QtQuick.Window 2.0
-import "widgets"
+import "content"
+
+/*!
+ \title QtQuick Examples - Accessibility
+ \example qtquick/accessibility
+ \brief This example has accessible buttons.
+
+*/
Rectangle {
id: window
- width: 360; height: 300
+ width: 320; height: 480
color: "white"
Column {
Accessible.role: Accessible.StaticText
Accessible.name: text
text: "Subject:"
- width: 50
}
Rectangle {
id: subjectBorder
border.width: 1
border.color: "black"
height: subjectEdit.height
- width: 304
+ width: 240
TextInput {
id: subjectEdit
text: "Vacation plans"
property alias text : textEdit.text
border.width: 1
border.color: "black"
- width: parent.width
- height: textEdit.height
+ width: parent.width - 2
+ height: parent.height - (textBorder.y + column.spacing)
TextEdit {
id: textEdit
text: "Hi, we're going to the Dolomites this summer. Weren't you also going to northern Italy? \n\nbest wishes, your friend Luke"
--- /dev/null
+import QmlProject 1.1
+
+Project {
+ mainFile: "accessibility.qml"
+
+ /* Include .qml, .js, and image files from current directory and subdirectories */
+ QmlFiles {
+ directory: "."
+ }
+ JavaScriptFiles {
+ directory: "."
+ }
+ ImageFiles {
+ directory: "."
+ }
+}
Rectangle {
id: button
+ property bool checked: false
property alias text : buttonText.text
Accessible.name: text
Accessible.description: "This button does " + text
--- /dev/null
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** 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 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$
+**
+****************************************************************************/
+#include "../../shared/shared.h"
+DECLARATIVE_EXAMPLE_MAIN(accessibility)
--- /dev/null
+TEMPLATE = app
+
+QT += quick declarative
+SOURCES += main.cpp
+
+target.path = $$[QT_INSTALL_EXAMPLES]/qtdeclarative/qtquick/animation
+qml.files = animation.qml basics behaviors easing pathanimation pathinterpolator states
+qml.path = $$[QT_INSTALL_EXAMPLES]/qtdeclarative/qtquick/animation
+INSTALLS += target qml
+
****************************************************************************/
import QtQuick 2.0
-import "../shared"
+import "../../shared" as Examples
+
+/*!
+ \title QtQuick Examples - Animation
+ \example qtquick/animation
+ \brief This is a collection of QML Animation examples.
+ \image qml-animations-example.png
+
+ This is a collection of small QML examples relating to animation. Each example is
+ a small QML file emphasizing a particular element or feature.
+
+ ColorAnimation demonstrates using a color animation to fade a sky from day to night.
+
+ PropertyAnimation demonstrates using a number animation to bounce a circle up and down.
+
+ Behaviors demonstrates using behaviors to animate moving a rectangle to whereever you click.
+
+ Wiggly Text demonstrates using more complex behaviors to animate and wiggle some text around as you drag it.
+
+ Easing Curves shows off all the easing curves available in Qt Quick animations.
+
+ States demonstrates how the properties of an item can vary between states.
+
+ Transitions takes the States example and animates the property changes.
+
+ PathAnimation animates an image along a beizer curve using a PathAnimation.
+
+ PathInterpolator animates an image along the same beizer curve, using a PathInterpolator instead.
+*/
Item {
height: 480
width: 320
- LauncherList {
+ Examples.LauncherList {
id: ll
anchors.fill: parent
Component.onCompleted: {
addExample("ColorAnimation", "Interpolates between colors", Qt.resolvedUrl("basics/color-animation.qml"));
addExample("PropertyAnimation", "Interpolates between numbers", Qt.resolvedUrl("basics/property-animation.qml"));
addExample("Behaviors", "Animates procedural movement", Qt.resolvedUrl("behaviors/behavior-example.qml"));
- addExample("WigglyText", "Text that wiggles as you drag it", Qt.resolvedUrl("behaviors/wigglytext.qml"));
+ addExample("Wiggly Text", "Text that wiggles as you drag it", Qt.resolvedUrl("behaviors/wigglytext.qml"));
addExample("Easing Curves", "Compare available easing curves", Qt.resolvedUrl("easing/easing.qml"));
addExample("States", "Simple states", Qt.resolvedUrl("states/states.qml"));
addExample("Transitions", "Simple states with animated transitions", Qt.resolvedUrl("states/transitions.qml"));
Item {
id: window
- width: 640; height: 480
+ width: 320; height: 480
// Let's draw the sky...
Rectangle {
import QtQuick 2.0
Rectangle {
- width: 600; height: 400
+ width: 320; height: 480
color: "#343434"
Rectangle {
Rectangle {
id: container
- property string text: "Drag this text..."
+ property string text: "Drag me!"
property bool animated: true
- width: 640; height: 480; color: "#474747"; focus: true
+ width: 320; height: 480; color: "#474747"; focus: true
Keys.onPressed: {
if (event.key == Qt.Key_Delete || event.key == Qt.Key_Backspace)
id: letter
property variant follow
- x: follow ? follow.x + follow.width : container.width / 3
+ x: follow ? follow.x + follow.width : container.width / 6
y: follow ? follow.y : container.height / 2
font.pixelSize: 40; font.bold: true
Rectangle {
id: window
- width: 600; height: 460; color: "#232323"
+ width: 320; height: 480; color: "#232323"
property var easingCurve: [ 0.2, 0.2, 0.13, 0.65, 0.2, 0.8,
0.624, 0.98, 0.93, 0.95, 1, 1 ]
Flickable {
anchors.fill: parent
- contentHeight: layout.height+50
- 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
- }
- }
+ contentHeight: layout.height
Column {
id: layout
- anchors { top: titlePane.bottom; topMargin: 10; left: parent.left; right: parent.right }
Repeater { model: easingTypes; delegate: delegate }
}
}
--- /dev/null
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** 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 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$
+**
+****************************************************************************/
+#include "../../shared/shared.h"
+DECLARATIVE_EXAMPLE_MAIN(animation)
Rectangle {
id: window
- width: 400
- height: 400
+ width: 320
+ height: 480
Canvas {
id: canvas
smooth: true
onPaint: {
+ var context = canvas.getContext("2d")
context.clearRect(0, 0, width, height)
context.strokeStyle = "black"
context.path = pathAnim.path
}
}
- PathAnimation {
- id: pathAnim
+ SequentialAnimation {
+ running: true
+ loops: -1
- duration: 2000
- easing.type: Easing.InQuad
+ PauseAnimation { duration: 1000 }
+ PathAnimation {
+ id: pathAnim
- target: box
- orientation: PathAnimation.RightFirst
- anchorPoint: Qt.point(box.width/2, box.height/2)
- path: Path {
- startX: 50; startY: 50
+ duration: 2000
+ easing.type: Easing.InQuad
- PathCubic {
- x: window.width - 50
- y: window.height - 50
+ target: box
+ orientation: PathAnimation.RightFirst
+ anchorPoint: Qt.point(box.width/2, box.height/2)
+ path: Path {
+ startX: 50; startY: 50
- control1X: x; control1Y: 50
- control2X: 50; control2Y: y
- }
+ PathCubic {
+ x: window.width - 50
+ y: window.height - 50
+
+ control1X: x; control1Y: 50
+ control2X: 50; control2Y: y
+ }
- onChanged: canvas.requestPaint()
+ onChanged: canvas.requestPaint()
+ }
}
}
text: "Box"
}
}
-
- MouseArea {
- anchors.fill: parent
- onClicked: pathAnim.restart()
- }
-
- Text {
- text: "Click anywhere to animate along the path"
- anchors.horizontalCenter: parent.horizontalCenter
- }
}
Rectangle {
id: window
- width: 400
- height: 400
+ width: 320
+ height: 480
Canvas {
id: canvas
smooth: true
onPaint: {
+ var context = canvas.getContext("2d")
context.clearRect(0, 0, width, height)
context.strokeStyle = "black"
context.path = motionPath.path
onChanged: canvas.requestPaint()
}
- NumberAnimation on progress {
- id: progressAnim
- running: false
- from: 0; to: 1
- duration: 2000
- easing.type: Easing.InQuad
+ SequentialAnimation on progress {
+ running: true
+ loops: -1
+ PauseAnimation { duration: 1000 }
+ NumberAnimation {
+ id: progressAnim
+ running: false
+ from: 0; to: 1
+ duration: 2000
+ easing.type: Easing.InQuad
+ }
}
}
}
}
- MouseArea {
- anchors.fill: parent
- onClicked: progressAnim.restart()
- }
-
- Text {
- text: "Click anywhere to animate along the path"
- anchors.horizontalCenter: parent.horizontalCenter
- }
}
--- /dev/null
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** 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 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 QtQuick 2.0
+import "content"
+
+Rectangle {
+ id: page
+ width: 320
+ height: 480
+
+ Flickable {
+ anchors.fill: parent
+ contentWidth: 1030
+ contentHeight: 540
+ Grid {
+ anchors.centerIn: parent; spacing: 20
+
+ MyBorderImage {
+ minWidth: 120; maxWidth: 240; minHeight: 120; maxHeight: 240
+ source: "content/colors.png"; margin: 30
+ }
+
+ MyBorderImage {
+ minWidth: 120; maxWidth: 240; minHeight: 120; maxHeight: 240
+ source: "content/colors.png"; margin: 30
+ horizontalMode: BorderImage.Repeat; verticalMode: BorderImage.Repeat
+ }
+
+ MyBorderImage {
+ minWidth: 120; maxWidth: 240; minHeight: 120; maxHeight: 240
+ source: "content/colors.png"; margin: 30
+ horizontalMode: BorderImage.Stretch; verticalMode: BorderImage.Repeat
+ }
+
+ MyBorderImage {
+ minWidth: 120; maxWidth: 240; minHeight: 120; maxHeight: 240
+ source: "content/colors.png"; margin: 30
+ horizontalMode: BorderImage.Round; verticalMode: BorderImage.Round
+ }
+
+ MyBorderImage {
+ minWidth: 60; maxWidth: 200; minHeight: 40; maxHeight: 200
+ source: "content/bw.png"; margin: 10
+ }
+
+ MyBorderImage {
+ minWidth: 60; maxWidth: 200; minHeight: 40; maxHeight: 200
+ source: "content/bw.png"; margin: 10
+ horizontalMode: BorderImage.Repeat; verticalMode: BorderImage.Repeat
+ }
+
+ MyBorderImage {
+ minWidth: 60; maxWidth: 200; minHeight: 40; maxHeight: 200
+ source: "content/bw.png"; margin: 10
+ horizontalMode: BorderImage.Stretch; verticalMode: BorderImage.Repeat
+ }
+
+ MyBorderImage {
+ minWidth: 60; maxWidth: 200; minHeight: 40; maxHeight: 200
+ source: "content/bw.png"; margin: 10
+ horizontalMode: BorderImage.Round; verticalMode: BorderImage.Round
+ }
+ }
+ }
+}
--- /dev/null
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** 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 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 QtQuick 2.0
+import "content"
+
+Rectangle {
+ width: 320
+ height: 480
+ Flickable {
+ anchors.fill: parent
+ contentWidth: 490
+ contentHeight: 285
+
+ Grid {
+ property int cellWidth: (width - (spacing * (columns - 1))) / columns
+ property int cellHeight: (height - (spacing * (rows - 1))) / rows
+
+ anchors.fill: parent
+ anchors.margins: 30
+
+ columns: 3
+ rows: 2
+ spacing: 30
+
+ ImageCell { mode: Image.Stretch; caption: "Stretch" }
+ ImageCell { mode: Image.PreserveAspectFit; caption: "PreserveAspectFit" }
+ ImageCell { mode: Image.PreserveAspectCrop; caption: "PreserveAspectCrop" }
+
+ ImageCell { mode: Image.Tile; caption: "Tile" }
+ ImageCell { mode: Image.TileHorizontally; caption: "TileHorizontally" }
+ ImageCell { mode: Image.TileVertically; caption: "TileVertically" }
+ }
+ }
+}
****************************************************************************/
import QtQuick 2.0
-import "../shared"
+import "../../shared"
Item {
height: 480
****************************************************************************/
import QtQuick 2.0
-import "../shared"
+import "../../shared"
Item {
height: 480
model: visualModel.parts.grid
}
//![0]
+ Text {
+ anchors.bottom: parent.bottom
+ text: "Tap a delegate to move between views"
+ }
}
--- /dev/null
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** 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 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 QtQuick 2.0
+
+Item {
+ id : clock
+ width: {
+ if (ListView.view && ListView.view.width >= 200)
+ return ListView.view.width / Math.floor(ListView.view.width / 200.0);
+ else
+ return 200;
+ }
+
+ height: {
+ if (ListView.view && ListView.view.height >= 240)
+ return ListView.view.height;
+ else
+ return 240;
+ }
+
+ property alias city: cityLabel.text
+ property int hours
+ property int minutes
+ property int seconds
+ property real shift
+ property bool night: false
+ property bool internationalTime: true //Unset for local time
+
+ function timeChanged() {
+ var date = new Date;
+ hours = internationalTime ? date.getUTCHours() + Math.floor(clock.shift) : date.getHours()
+ night = ( hours < 7 || hours > 19 )
+ minutes = internationalTime ? date.getUTCMinutes() + ((clock.shift % 1) * 60) : date.getMinutes()
+ seconds = date.getUTCSeconds();
+ }
+
+ Timer {
+ interval: 100; running: true; repeat: true;
+ onTriggered: clock.timeChanged()
+ }
+
+ Item {
+ anchors.centerIn: parent
+ width: 200; height: 240
+
+ Image { id: background; source: "clock.png"; visible: clock.night == false }
+ Image { source: "clock-night.png"; visible: clock.night == true }
+
+
+ Image {
+ x: 92.5; y: 27
+ source: "hour.png"
+ smooth: true
+ transform: Rotation {
+ id: hourRotation
+ origin.x: 7.5; origin.y: 73;
+ angle: (clock.hours * 30) + (clock.minutes * 0.5)
+ Behavior on angle {
+ SpringAnimation { spring: 2; damping: 0.2; modulus: 360 }
+ }
+ }
+ }
+
+ Image {
+ x: 93.5; y: 17
+ source: "minute.png"
+ smooth: true
+ transform: Rotation {
+ id: minuteRotation
+ origin.x: 6.5; origin.y: 83;
+ angle: clock.minutes * 6
+ Behavior on angle {
+ SpringAnimation { spring: 2; damping: 0.2; modulus: 360 }
+ }
+ }
+ }
+
+ Image {
+ x: 97.5; y: 20
+ source: "second.png"
+ smooth: true
+ transform: Rotation {
+ id: secondRotation
+ origin.x: 2.5; origin.y: 80;
+ angle: clock.seconds * 6
+ Behavior on angle {
+ SpringAnimation { spring: 2; damping: 0.2; modulus: 360 }
+ }
+ }
+ }
+
+ Image {
+ anchors.centerIn: background; source: "center.png"
+ }
+
+ Text {
+ id: cityLabel
+ y: 210; anchors.horizontalCenter: parent.horizontalCenter
+ color: "white"
+ font.family: "Helvetica"
+ font.bold: true; font.pixelSize: 16
+ style: Text.Raised; styleColor: "black"
+ }
+ }
+}
****************************************************************************/
import QtQuick 2.0
-import "../../toys/clocks/content" // for loading the Clock element
import "content"
Rectangle {
import QtQuick 2.0
Rectangle {
+ id: root
color: "lightgray"
- width: 240
- height: 320
+ width: 320
+ height: 480
property bool printDestruction: false
VisualItemModel {
}
Rectangle {
- width: 240; height: 30
+ width: root.width; height: 30
anchors { top: view.bottom; bottom: parent.bottom }
color: "gray"
Rectangle {
id: page
- width: 420; height: 420
+ width: 320; height: 480
+ Flickable {
+ anchors.fill: parent
+ contentWidth: 420; contentHeight: 420
Column {
id: layout1
Rectangle { color: "red"; width: 80; height: 50; border.color: "black"; radius: 15 }
}
+ }
}
--- /dev/null
+TEMPLATE = subdirs
+SUBDIRS = accessibility \
+ animation
+ #canvas \
+ #draganddrop \
+ #imageelements \
+ #keyinteraction \
+ #modelviews \
+ #mousearea \
+ #openglunderqml \
+ #painteditem \
+ #positioners \
+ #righttoleft \
+ #shadereffects \
+ #text \
+ #threading \
+ #touchinteraction
--- /dev/null
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the Declarative module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** GNU Lesser General Public License Usage
+** This file may be used under the terms of the GNU Lesser General Public
+** License version 2.1 as published by the Free Software Foundation and
+** appearing in the file LICENSE.LGPL included in the packaging of this
+** file. Please review the following information to ensure the GNU Lesser
+** General Public License version 2.1 requirements will be met:
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU General
+** Public License version 3.0 as published by the Free Software Foundation
+** and appearing in the file LICENSE.GPL included in the packaging of this
+** file. Please review the following information to ensure the GNU General
+** Public License version 3.0 requirements will be met:
+** http://www.gnu.org/copyleft/gpl.html.
+**
+** Other Usage
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+import "content"
+
+Image {
+ width: 320
+ height: 480
+/*!
+ \title QML Examples - Shader Effects
+ \example declarative/shadereffects
+ \image qml-shadereffects-example.png
+ \brief This is a shader effects example
+
+ This example demonstrates a couple of visual effects that you can perform
+ with shaders in QtQuick 2.0
+*/
+ source: "../snake/content/pics/background.png"
+
+ Flickable {
+ anchors.fill: parent
+ contentWidth: 640
+ contentHeight: 360
+
+ ShaderEffectSource {
+ id: theSource
+ sourceItem: theItem
+ smooth: true
+ }
+
+ function saturate(x) {
+ return Math.min(Math.max(x, 0), 1)
+ }
+
+ function sliderToColor(x) {
+ return Qt.rgba(saturate(Math.max(2 - 6 * x, 6 * x - 4)),
+ saturate(Math.min(6 * x, 4 - 6 * x)),
+ saturate(Math.min(6 * x - 2, 6 - 6 * x)))
+ }
+
+ Grid {
+ anchors.centerIn: parent
+ columns: 3
+
+ Item {
+ id: theItem
+ width: 180
+ height: 180
+ ListView {
+ anchors.centerIn: parent
+ width: 160
+ height: 140
+ clip: true
+ snapMode: ListView.SnapOneItem
+ model: VisualItemModel {
+ Text {
+ width: 160
+ height: 140
+ horizontalAlignment: Text.AlignHCenter
+ verticalAlignment: Text.AlignVCenter
+ font.pixelSize: 120
+ font.family: "Times"
+ color: "blue"
+ text: "Qt"
+ }
+ Image {
+ width: 160
+ height: 140
+ source: "content/qt-logo.png"
+ smooth: true
+ }
+ Image {
+ width: 160
+ height: 140
+ source: "content/face-smile.png"
+ smooth: true
+ }
+ }
+ }
+ }
+ ShaderEffect {
+ width: 180
+ height: 180
+ property variant source: theSource
+ property real amplitude: 0.04 * wobbleSlider.value
+ property real frequency: 20
+ property real time: 0
+ NumberAnimation on time { loops: Animation.Infinite; from: 0; to: Math.PI * 2; duration: 600 }
+ fragmentShader:
+ "uniform lowp float qt_Opacity;" +
+ "uniform highp float amplitude;" +
+ "uniform highp float frequency;" +
+ "uniform highp float time;" +
+ "uniform sampler2D source;" +
+ "varying highp vec2 qt_TexCoord0;" +
+ "void main() {" +
+ " highp vec2 p = sin(time + frequency * qt_TexCoord0);" +
+ " gl_FragColor = texture2D(source, qt_TexCoord0 + amplitude * vec2(p.y, -p.x)) * qt_Opacity;" +
+ "}"
+ Slider {
+ id: wobbleSlider
+ anchors.left: parent.left
+ anchors.right: parent.right
+ anchors.bottom: parent.bottom
+ height: 40
+ }
+ }
+ ShaderEffect {
+ width: 180
+ height: 180
+ property variant source: theSource
+ property variant shadow: ShaderEffectSource {
+ smooth: true
+ sourceItem: ShaderEffect {
+ width: theItem.width
+ height: theItem.height
+ property variant delta: Qt.size(0.0, 1.0 / height)
+ property variant source: ShaderEffectSource {
+ smooth: true
+ sourceItem: ShaderEffect {
+ width: theItem.width
+ height: theItem.height
+ property variant delta: Qt.size(1.0 / width, 0.0)
+ property variant source: theSource
+ fragmentShader: "
+ uniform lowp float qt_Opacity;
+ uniform sampler2D source;
+ uniform highp vec2 delta;
+ varying highp vec2 qt_TexCoord0;
+ void main() {
+ gl_FragColor =(0.0538 * texture2D(source, qt_TexCoord0 - 3.182 * delta)
+ + 0.3229 * texture2D(source, qt_TexCoord0 - 1.364 * delta)
+ + 0.2466 * texture2D(source, qt_TexCoord0)
+ + 0.3229 * texture2D(source, qt_TexCoord0 + 1.364 * delta)
+ + 0.0538 * texture2D(source, qt_TexCoord0 + 3.182 * delta)) * qt_Opacity;
+ }"
+ }
+ }
+ fragmentShader: "
+ uniform lowp float qt_Opacity;
+ uniform sampler2D source;
+ uniform highp vec2 delta;
+ varying highp vec2 qt_TexCoord0;
+ void main() {
+ gl_FragColor =(0.0538 * texture2D(source, qt_TexCoord0 - 3.182 * delta)
+ + 0.3229 * texture2D(source, qt_TexCoord0 - 1.364 * delta)
+ + 0.2466 * texture2D(source, qt_TexCoord0)
+ + 0.3229 * texture2D(source, qt_TexCoord0 + 1.364 * delta)
+ + 0.0538 * texture2D(source, qt_TexCoord0 + 3.182 * delta)) * qt_Opacity;
+ }"
+ }
+ }
+ property real angle: 0
+ property variant offset: Qt.point(15.0 * Math.cos(angle), 15.0 * Math.sin(angle))
+ NumberAnimation on angle { loops: Animation.Infinite; from: 0; to: Math.PI * 2; duration: 6000 }
+ property variant delta: Qt.size(offset.x / width, offset.y / height)
+ property real darkness: shadowSlider.value
+ fragmentShader: "
+ uniform lowp float qt_Opacity;
+ uniform highp vec2 offset;
+ uniform sampler2D source;
+ uniform sampler2D shadow;
+ uniform highp float darkness;
+ uniform highp vec2 delta;
+ varying highp vec2 qt_TexCoord0;
+ void main() {
+ lowp vec4 fg = texture2D(source, qt_TexCoord0);
+ lowp vec4 bg = texture2D(shadow, qt_TexCoord0 + delta);
+ gl_FragColor = (fg + vec4(0., 0., 0., darkness * bg.a) * (1. - fg.a)) * qt_Opacity;
+ }"
+ Slider {
+ id: shadowSlider
+ anchors.left: parent.left
+ anchors.right: parent.right
+ anchors.bottom: parent.bottom
+ height: 40
+ }
+ }
+ ShaderEffect {
+ width: 180
+ height: 180
+ property variant source: theSource
+ property variant delta: Qt.size(0.5 / width, 0.5 / height)
+ fragmentShader: "
+ uniform sampler2D source;
+ uniform highp vec2 delta;
+ uniform highp float qt_Opacity;
+ varying highp vec2 qt_TexCoord0;
+ void main() {
+ lowp vec4 tl = texture2D(source, qt_TexCoord0 - delta);
+ lowp vec4 tr = texture2D(source, qt_TexCoord0 + vec2(delta.x, -delta.y));
+ lowp vec4 bl = texture2D(source, qt_TexCoord0 - vec2(delta.x, -delta.y));
+ lowp vec4 br = texture2D(source, qt_TexCoord0 + delta);
+ lowp vec4 gx = (tl + bl) - (tr + br);
+ lowp vec4 gy = (tl + tr) - (bl + br);
+ gl_FragColor.xyz = vec3(0.);
+ gl_FragColor.w = clamp(dot(sqrt(gx * gx + gy * gy), vec4(1.)), 0., 1.) * qt_Opacity;
+ }"
+ }
+ ShaderEffect {
+ width: 180
+ height: 180
+ property variant source: theSource
+ property color tint: sliderToColor(colorizeSlider.value)
+ fragmentShader: "
+ uniform sampler2D source;
+ uniform lowp vec4 tint;
+ uniform lowp float qt_Opacity;
+ varying highp vec2 qt_TexCoord0;
+ void main() {
+ lowp vec4 c = texture2D(source, qt_TexCoord0);
+ lowp float lo = min(min(c.x, c.y), c.z);
+ lowp float hi = max(max(c.x, c.y), c.z);
+ gl_FragColor = qt_Opacity * vec4(mix(vec3(lo), vec3(hi), tint.xyz), c.w);
+ }"
+ Slider {
+ id: colorizeSlider
+ anchors.left: parent.left
+ anchors.right: parent.right
+ anchors.bottom: parent.bottom
+ height: 40
+ }
+ }
+ ShaderEffect {
+ width: 180
+ height: 180
+ mesh: Qt.size(10, 10)
+ property variant source: theSource
+ property real bend: 0
+ property real minimize: 0
+ property real side: genieSlider.value
+ SequentialAnimation on bend {
+ loops: Animation.Infinite
+ NumberAnimation { to: 1; duration: 700; easing.type: Easing.InOutSine }
+ PauseAnimation { duration: 1600 }
+ NumberAnimation { to: 0; duration: 700; easing.type: Easing.InOutSine }
+ PauseAnimation { duration: 1000 }
+ }
+ SequentialAnimation on minimize {
+ loops: Animation.Infinite
+ PauseAnimation { duration: 300 }
+ NumberAnimation { to: 1; duration: 700; easing.type: Easing.InOutSine }
+ PauseAnimation { duration: 1000 }
+ NumberAnimation { to: 0; duration: 700; easing.type: Easing.InOutSine }
+ PauseAnimation { duration: 1300 }
+ }
+ vertexShader: "
+ uniform highp mat4 qt_Matrix;
+ uniform highp float bend;
+ uniform highp float minimize;
+ uniform highp float side;
+ uniform highp float width;
+ uniform highp float height;
+ attribute highp vec4 qt_Vertex;
+ attribute highp vec2 qt_MultiTexCoord0;
+ varying highp vec2 qt_TexCoord0;
+ void main() {
+ qt_TexCoord0 = qt_MultiTexCoord0;
+ highp vec4 pos = qt_Vertex;
+ pos.y = mix(qt_Vertex.y, height, minimize);
+ highp float t = pos.y / height;
+ t = (3. - 2. * t) * t * t;
+ pos.x = mix(qt_Vertex.x, side * width, t * bend);
+ gl_Position = qt_Matrix * pos;
+ }"
+ Slider {
+ id: genieSlider
+ anchors.left: parent.left
+ anchors.right: parent.right
+ anchors.bottom: parent.bottom
+ height: 40
+ }
+ }
+ }
+ }
+}
****************************************************************************/
import QtQuick 2.0
-import "../shared"
+import "../../shared"
Item {
height: 480
****************************************************************************/
import QtQuick 2.0
-import "../shared"
+import "../../shared"
Item {
height: 480
id: ll
anchors.fill: parent
Component.onCompleted: {
- addExample("MouseArea", "Using the basic touch input element", Qt.resolvedUrl("mousearea/mousearea-example.qml"));
addExample("Multipoint Flames", "Create multiple flames with multiple fingers", Qt.resolvedUrl("multipointtouch/multiflame.qml"));
addExample("Bear-Whack", "Use multiple touches to knock all the bears down", Qt.resolvedUrl("multipointtouch/bearwhack.qml"));
addExample("Flick Resize", "Manipulate images using pinch gestures", Qt.resolvedUrl("pincharea/flickresize.qml"));
//Eats mouse events
}
Image {
- source: "back.png"
+ source: "images/back.png"
anchors.verticalCenter: parent.verticalCenter
x: 4
MouseArea {
anchors.fill: parent
+ anchors.margins: -10
onClicked: ei.exampleUrl = "";
}
}
--- /dev/null
+Button 2.0 Button.qml
+LauncherList 2.0 LauncherList.qml
+SimpleLauncherDelegate 2.0 SimpleLauncherDelegate.qml
--- /dev/null
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** 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 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$
+**
+****************************************************************************/
+#include <QGuiApplication>
+#include <QQuickView>
+#define DECLARATIVE_EXAMPLE_MAIN(NAME) int main(int argc, char* argv[]) \
+{\
+ QGuiApplication app(argc,argv);\
+ QQuickView view;\
+ view.setSource(QUrl::fromLocalFile(#NAME ".qml"));\
+ view.show();\
+ return app.exec();\
+}
--- /dev/null
+#just install the files, all QML for now
+TEMPLATE = aux
+
+qml.files = images \
+ LauncherList.qml \
+ SimpleLauncherDelegate.qml \
+ Button.qml
+qml.path = $$[QT_INSTALL_EXAMPLES]/qtdeclarative/shared
+INSTALLS = qml
--- /dev/null
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** 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 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 QtQuick 2.0
+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()
+ }
+}
excludedFiles << "doc/src/snippets/declarative/listmodel.qml"; //Just a ListModel, no root QQuickItem
// Add directories you want excluded here
- excludedDirs << "examples/declarative/text/fonts"; // QTBUG-21415
+ excludedDirs << "examples/shared"; //Not an example
+ excludedDirs << "examples/qtquick/text/fonts"; // QTBUG-21415
excludedDirs << "doc/src/snippets/declarative/path"; //No root QQuickItem
- // Not run in QQuickView
- excludedDirs << "examples/declarative/qtquick1";
-
// These snippets are not expected to run on their own.
excludedDirs << "doc/src/snippets/declarative/visualdatamodel_rootindex";
excludedDirs << "doc/src/snippets/declarative/qtbinding";
excludedDirs << "doc/src/snippets/declarative/imports";
- excludedDirs << "doc/src/snippets/qtquick1/visualdatamodel_rootindex";
- excludedDirs << "doc/src/snippets/qtquick1/qtbinding";
- excludedDirs << "doc/src/snippets/qtquick1/imports";
#ifdef QT_NO_WEBKIT
- excludedDirs << "examples/declarative/modelviews/webview";
- excludedDirs << "examples/declarative/webbrowser";
+ excludedDirs << "examples/qtquick/modelviews/webview";
+ excludedDirs << "examples/demos/webbrowser";
excludedDirs << "doc/src/snippets/declarative/webview";
- excludedDirs << "doc/src/snippets/qtquick1/webview";
#endif
#ifdef QT_NO_XMLPATTERNS
- excludedDirs << "examples/declarative/xml/xmldata";
- excludedDirs << "examples/declarative/twitter";
- excludedDirs << "examples/declarative/flickr";
- excludedDirs << "examples/declarative/photoviewer";
+ excludedDirs << "examples/demos/twitter";
+ excludedDirs << "examples/demos/flickr";
+ excludedDirs << "examples/demos/photoviewer";
#endif
}
{
QTest::addColumn<QString>("file");
- QString examples = QLatin1String(SRCDIR) + "/../../../../examples/declarative/";
- QString tutorials = QLatin1String(SRCDIR) + "/../../../../examples/tutorials/"; //Only declarative tutorials since modularization
+ QString examples = QLatin1String(SRCDIR) + "/../../../../examples/";
QStringList files;
files << findQmlFiles(QDir(examples));
- files << findQmlFiles(QDir(tutorials));
foreach (const QString &file, files)
QTest::newRow(qPrintable(file)) << file;