Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Merge master <-> api_changes
Change-Id: Iad2f07b989b25349fd2d4fff010e24dcd5a1688f
  • Loading branch information
Matthew Vogt committed Mar 5, 2012
2 parents 377eb94 + 36bd7f6 commit 0284817
Show file tree
Hide file tree
Showing 1,107 changed files with 51,141 additions and 4,207 deletions.
1 change: 1 addition & 0 deletions .gitattributes
@@ -1 +1,2 @@
.tag ident
*_crlf.* eol=crlf
16 changes: 1 addition & 15 deletions .gitignore
@@ -1,20 +1,6 @@
# 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
Expand Down Expand Up @@ -273,4 +259,4 @@ tests/auto/*/*.o
tests/auto/*/*.moc
tests/auto/*/*/*.o
tests/auto/*/*/*.moc
src/declarative/generated/
src/declarative/generated/
3 changes: 3 additions & 0 deletions bin/rename-qtdeclarative-symbols.sh
Expand Up @@ -75,6 +75,7 @@ QML_SYMBOLS="\
QDeclarativeCompiledData
QDeclarativeCompiler
QDeclarativeCompilerTypes
QDeclarativeCompilingProfiler
QDeclarativeComponent
QDeclarativeComponentAttached
QDeclarativeComponentExtension
Expand Down Expand Up @@ -152,6 +153,7 @@ QML_SYMBOLS="\
QDeclarativeGuard
QDeclarativeGuardedContextData
QDeclarativeGuardImpl
QDeclarativeHandlingSignalProfiler
QDeclarativeImageProvider
QDeclarativeImageProviderPrivate
QDeclarativeImportDatabase
Expand Down Expand Up @@ -189,6 +191,7 @@ QML_SYMBOLS="\
QDeclarativeNotifierEndpoint
QDeclarativeNullableValue
QDeclarativeNumberExtension
QDeclarativeObjectCreatingProfiler
QDeclarativeObjectData
QDeclarativeObjectProperty
QDeclarativeObserverMode
Expand Down
3 changes: 2 additions & 1 deletion doc/config/qtquick.qdocconf
Expand Up @@ -19,7 +19,8 @@ headerdirs += ../src \
imagedirs += ../src/images \

sourcedirs += ../src \
../../src
../../src \
../../examples

#indexes = $QT5DOC/doc/html/qt.index

Expand Down
29 changes: 0 additions & 29 deletions doc/src/examples/examples-groups.qdoc
Expand Up @@ -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
Expand All @@ -48,26 +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
\brief This is a collection of QML examples
\image qml-imageelements-example.png

This is a collection of small QML examples relating to image elements. 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 - Models and Views
\example declarative/modelviews
Expand Down
7 changes: 0 additions & 7 deletions doc/src/examples/examples-toys.qdoc
Expand Up @@ -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
Expand Down
17 changes: 16 additions & 1 deletion doc/src/localstorage/localstorage.qdoc
Expand Up @@ -33,9 +33,24 @@ The local storage API provides a JavaScript interface to an SQL relational
database. The QtQuick.LocalStorage module contains the API and it may be given
a namespace.

Import QtQuick.LocalStorage module from QML:
\code
import QtQuick.LocalStorage 2.0 as SQL
//sql.qml

import QtQuick.LocalStorage 2.0 as Sql
\endcode


Import QtQuick.LocalStorage module from JavaScript:
\code
//sql.js
.import QtQuick.LocalStorage 2.0 as Sql
\endcode

Note, importing a module from JavaScript is different from importing from QML.
The \l{JavaScript Code} article contains detailed information on importing in JavaScript code.


\section2 Database API

The \c openDatabaseSync() and related functions
Expand Down
Expand Up @@ -60,7 +60,7 @@ ListView {
NumberAnimation { property: "scale"; from: 0; to: 1.0; duration: 400 }
}

addDisplaced: Transition {
displaced: Transition {
NumberAnimation { properties: "x,y"; duration: 400; easing.type: Easing.OutBounce }
}

Expand Down
Expand Up @@ -60,12 +60,12 @@ ListView {
}

//! [0]
addDisplaced: Transition {
id: addDispTrans
displaced: Transition {
id: dispTrans
SequentialAnimation {
PauseAnimation {
duration: (addDispTrans.ViewTransition.index -
addDispTrans.ViewTransition.targetIndexes[0]) * 100
duration: (dispTrans.ViewTransition.index -
dispTrans.ViewTransition.targetIndexes[0]) * 100
}
NumberAnimation { properties: "x,y"; duration: 400; easing.type: Easing.OutBounce }
}
Expand Down
Expand Up @@ -60,20 +60,20 @@ ListView {
}

//! [0]
addDisplaced: Transition {
id: addDispTrans
displaced: Transition {
id: dispTrans
SequentialAnimation {
PauseAnimation {
duration: (addDispTrans.ViewTransition.index -
addDispTrans.ViewTransition.targetIndexes[0]) * 100
duration: (dispTrans.ViewTransition.index -
dispTrans.ViewTransition.targetIndexes[0]) * 100
}
ParallelAnimation {
NumberAnimation {
property: "x"; to: addDispTrans.ViewTransition.item.x + 20
property: "x"; to: dispTrans.ViewTransition.item.x + 20
easing.type: Easing.OutQuad
}
NumberAnimation {
property: "y"; to: addDispTrans.ViewTransition.item.y + 50
property: "y"; to: dispTrans.ViewTransition.item.y + 50
easing.type: Easing.OutQuad
}
}
Expand Down
Expand Up @@ -60,7 +60,7 @@ ListView {
}

//! [0]
addDisplaced: Transition {
displaced: Transition {
NumberAnimation { properties: "x,y"; duration: 400; easing.type: Easing.OutBounce }

// ensure opacity and scale values return to 1.0
Expand Down
Expand Up @@ -76,20 +76,20 @@ ListView {
}
//! [0]

addDisplaced: Transition {
id: addDispTrans
displaced: Transition {
id: dispTrans
SequentialAnimation {
PauseAnimation {
duration: (addDispTrans.ViewTransition.index -
addDispTrans.ViewTransition.targetIndexes[0]) * 100
duration: (dispTrans.ViewTransition.index -
dispTrans.ViewTransition.targetIndexes[0]) * 100
}
ParallelAnimation {
NumberAnimation {
property: "x"; to: addDispTrans.ViewTransition.item.x + 20
property: "x"; to: dispTrans.ViewTransition.item.x + 20
easing.type: Easing.OutQuad
}
NumberAnimation {
property: "y"; to: addDispTrans.ViewTransition.item.y + 50
property: "y"; to: dispTrans.ViewTransition.item.y + 50
easing.type: Easing.OutQuad
}
}
Expand Down
Expand Up @@ -70,7 +70,7 @@ ListView {
}
}

moveDisplaced: Transition {
displaced: Transition {
NumberAnimation { properties: "x,y"; duration: 400; easing.type: Easing.OutBounce }
}

Expand Down
Expand Up @@ -73,7 +73,7 @@ ListView {
}
//! [0]

moveDisplaced: Transition {
displaced: Transition {
NumberAnimation { properties: "x,y"; duration: 400; easing.type: Easing.OutBounce }
}

Expand Down
7 changes: 5 additions & 2 deletions doc/src/whatsnew.qdoc
Expand Up @@ -112,8 +112,11 @@ Setting Image sourceSize.width and sourceSize.height will now fit the image to t
Grid now has rowSpacing and columnSpacing properties. Spacing properties on positioners are now real numbers instead
of integers.

Positioners now have attached properties that can be used to determine a subitem's location within a
container such as Column or Row: Positioner.index, Positioner.isFirstItem, Positioner.isLastItem.
Positioner (Row, Column, Grid, Flow) improvements:
\list
\o Transitions used for \c add and \c move now have improved features: they can access a ViewTransition attached property (see the ViewTransition documentation for examples) and can now animate arbitrary item properties (instead of being restricted to animating an item's position).
\o Items in a positioner now have attached properties that can be used to determine a subitem's location: Positioner.index, Positioner.isFirstItem, Positioner.isLastItem.
\endlist

Loader improvements:
- "active" property added to Loader, to allow delaying instantiation of a Loader element's item property
Expand Down
23 changes: 23 additions & 0 deletions examples/HACKING
@@ -0,0 +1,23 @@
Some guidelines for QtQml 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 shared folder of 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. Usually this will consist primarily of using the macro found in shared.h.

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.
12 changes: 12 additions & 0 deletions examples/README
@@ -0,0 +1,12 @@
The Qt Declarative module provides the ability to specify and implement
your user interface declaratively, using the Qt Meta-Object Language (QML). This
language is very expressive and human readable, and can be used by
designers to actually implement their UI vision. QML UIs can integrate
with C++ code in many ways, including being loaded as a part of a C++ UI
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.
84 changes: 84 additions & 0 deletions examples/demos/calculator/CalculatorCore/Button.qml
@@ -0,0 +1,84 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/
**
** This file is part of the QtQml 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

BorderImage {
id: button

property alias operation: buttonText.text
property string color: ""

Accessible.name: operation
Accessible.description: "This button does " + operation
Accessible.role: Accessible.Button

signal clicked

source: "images/button-" + color + ".png"; clip: true
border { left: 10; top: 10; right: 10; bottom: 10 }

Rectangle {
id: shade
anchors.fill: button; radius: 10; color: "black"; opacity: 0
}

Text {
id: buttonText
anchors.centerIn: parent; anchors.verticalCenterOffset: -1
font.pixelSize: parent.width > parent.height ? parent.height * .5 : parent.width * .5
style: Text.Sunken; color: "white"; styleColor: "black"; smooth: true
}

MouseArea {
id: mouseArea
anchors.fill: parent
onClicked: {
window.doOp(operation)
button.clicked()
}
}

states: State {
name: "pressed"; when: mouseArea.pressed == true
PropertyChanges { target: shade; opacity: .4 }
}
}

0 comments on commit 0284817

Please sign in to comment.