Commit 9d2b618f authored by Alan Alpert's avatar Alan Alpert Committed by Qt by Nokia

Start of examples refactor

This is the general reorg of the examples directory structure, plus additional
guidelines.

calculator, animations and accessibility have been updated to the new standards
and tested, as an example.

Task-number: QTBUG-24133
Change-Id: I76c3b86751d3195ba2a5474ff23afb875765e9a4
Reviewed-by: default avatarAlan Alpert <alan.alpert@nokia.com>
parent 91d543f0
# 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
......@@ -273,4 +259,4 @@ tests/auto/*/*.o
tests/auto/*/*.moc
tests/auto/*/*/*.o
tests/auto/*/*/*.moc
src/declarative/generated/
\ No newline at end of file
src/declarative/generated/
......@@ -19,7 +19,8 @@ headerdirs += ../src \
imagedirs += ../src/images \
sourcedirs += ../src \
../../src
../../src \
../../examples
#indexes = $QT5DOC/doc/html/qt.index
......
......@@ -31,15 +31,6 @@
\image qml-i18n-example.png
\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
......@@ -48,16 +39,6 @@
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
......
......@@ -26,13 +26,6 @@
****************************************************************************/
/*!
\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
......
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.
......@@ -8,6 +8,5 @@ and loading data models from C++ and interacting with them.
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.
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
/****************************************************************************
**
** 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
}
}
}
/****************************************************************************
**
** 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.