Merge branch 'dev' of ssh://codereview.qt-project.org/qt/qtdeclarative into wip/v4
Conflicts: src/imports/qtquick2/plugins.qmltypes src/qml/debugger/qv8debugservice.cpp src/qml/qml/qml.pri src/qml/qml/qqmlcompiler.cpp src/qml/qml/qqmlcomponent.cpp src/qml/qml/qqmlcontext.cpp src/qml/qml/qqmldata_p.h src/qml/qml/qqmlengine_p.h src/qml/qml/qqmljavascriptexpression.cpp src/qml/qml/qqmlxmlhttprequest.cpp src/qml/qml/v4/qv4bindings.cpp src/qml/qml/v4/qv4irbuilder.cpp src/qml/qml/v4/qv4jsonobject_p.h src/qml/qml/v8/qqmlbuiltinfunctions.cpp src/qml/qml/v8/qv8bindings.cpp src/qml/qml/v8/qv8contextwrapper.cpp src/qml/qml/v8/qv8listwrapper.cpp src/qml/qml/v8/qv8qobjectwrapper.cpp src/qml/qml/v8/qv8qobjectwrapper_p.h src/qml/qml/v8/qv8sequencewrapper_p_p.h src/qml/qml/v8/qv8typewrapper.cpp src/qml/qml/v8/qv8valuetypewrapper.cpp src/qml/types/qqmldelegatemodel.cpp src/quick/items/context2d/qquickcanvasitem.cpp src/quick/items/context2d/qquickcontext2d.cpp sync.profile tests/auto/qml/qjsengine/tst_qjsengine.cpp tests/benchmarks/qml/animation/animation.pro tools/qmlprofiler/qmlprofiler.pro Change-Id: I18a76b8a81d87523247fa03a44ca334b1a2360c9
|
@ -32,10 +32,32 @@ Third party components
|
|||
* Important Behavior Changes *
|
||||
****************************************************************************
|
||||
|
||||
- A Window declared nested inside another Item or Window automatically
|
||||
becomes transient for (centered upon) its parent's window, if x and y
|
||||
were not explicitly specified
|
||||
- The resources property of Item is now its own property independent
|
||||
of QObject. It no longer returns all QObject children, or explicitly
|
||||
sets QObject parent. The resources property now behaves as documented.
|
||||
|
||||
- As part of a fix for QTBUG-30555, ListView and GridView properties, such
|
||||
as count, which are based off of the data model will no longer update
|
||||
immediately if queried. Updates are batched to happen once per frame (or
|
||||
when properties are being set).
|
||||
|
||||
- tryCompare now correctly fails when it only gets two parameters
|
||||
|
||||
- If a QObject has a property and a slot (or invokable method) with the same
|
||||
name, in QML the previous behavior was to let the property obscure the
|
||||
method; from Qt 5.1 things work in the opposite way, that is a property can
|
||||
never obscure a method having the same name. This is especially important
|
||||
for objects having dynamic properties, such as QQmlPropertyMap. This change
|
||||
was a consequence of the fix for QTBUG-29836.
|
||||
|
||||
****************************************************************************
|
||||
* Library *
|
||||
****************************************************************************
|
||||
- QTBUG-30837: The Flickable type no longer fixes up the content area on
|
||||
startup to move it inside the viewport.
|
||||
|
||||
|
||||
****************************************************************************
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
Some guidelines for QtQml examples
|
||||
Some guidelines for Qt QML examples
|
||||
|
||||
Snippets
|
||||
---
|
||||
|
|
|
@ -34,7 +34,7 @@
|
|||
The Adding Types Example shows how to add a new object type, \c Person, to QML.
|
||||
The \c Person type can be used from QML like this:
|
||||
|
||||
\snippet qml/referenceexamples/adding/example.qml 0
|
||||
\snippet referenceexamples/adding/example.qml 0
|
||||
|
||||
\section1 Declare the Person class
|
||||
|
||||
|
@ -43,11 +43,11 @@ with the two properties we want accessible on the QML type - name and shoeSize.
|
|||
Although in this example we use the same name for the C++ class as the QML
|
||||
type, the C++ class can be named differently, or appear in a namespace.
|
||||
|
||||
\snippet qml/referenceexamples/adding/person.h 0
|
||||
\snippet referenceexamples/adding/person.h 0
|
||||
|
||||
\section1 Define the Person class
|
||||
|
||||
\snippet qml/referenceexamples/adding/person.cpp 0
|
||||
\snippet referenceexamples/adding/person.cpp 0
|
||||
|
||||
The Person class implementation is quite basic. The property accessors simply
|
||||
return members of the object instance.
|
||||
|
@ -78,33 +78,33 @@ properties in QML. This example adds a BirthdayParty type that specifies
|
|||
a birthday party, consisting of a celebrant and a list of guests. People are
|
||||
specified using the People QML type built in the previous example.
|
||||
|
||||
\snippet qml/referenceexamples/properties/example.qml 0
|
||||
\snippet referenceexamples/properties/example.qml 0
|
||||
|
||||
\section1 Declare the BirthdayParty
|
||||
|
||||
The BirthdayParty class is declared like this:
|
||||
|
||||
\snippet qml/referenceexamples/properties/birthdayparty.h 0
|
||||
\snippet qml/referenceexamples/properties/birthdayparty.h 1
|
||||
\snippet qml/referenceexamples/properties/birthdayparty.h 2
|
||||
\snippet qml/referenceexamples/properties/birthdayparty.h 3
|
||||
\snippet referenceexamples/properties/birthdayparty.h 0
|
||||
\snippet referenceexamples/properties/birthdayparty.h 1
|
||||
\snippet referenceexamples/properties/birthdayparty.h 2
|
||||
\snippet referenceexamples/properties/birthdayparty.h 3
|
||||
|
||||
The class contains a member to store the celebrant object, and also a
|
||||
QList<Person *> member.
|
||||
|
||||
In QML, the type of a list properties - and the guests property is a list of
|
||||
people - are all of type QDeclarativeListProperty<T>. QDeclarativeListProperty is simple value
|
||||
people - are all of type QQmlListProperty<T>. QQmlListProperty is simple value
|
||||
type that contains a set of function pointers. QML calls these function
|
||||
pointers whenever it needs to read from, write to or otherwise interact with
|
||||
the list. In addition to concrete lists like the people list used in this
|
||||
example, the use of QDeclarativeListProperty allows for "virtual lists" and other advanced
|
||||
example, the use of QQmlListProperty allows for "virtual lists" and other advanced
|
||||
scenarios.
|
||||
|
||||
\section2 Define the BirthdayParty
|
||||
|
||||
The implementation of BirthdayParty property accessors is straight forward.
|
||||
|
||||
\snippet qml/referenceexamples/properties/birthdayparty.cpp 0
|
||||
\snippet referenceexamples/properties/birthdayparty.cpp 0
|
||||
|
||||
\section1 Running the example
|
||||
|
||||
|
@ -128,11 +128,11 @@ The Inheritance and Coercion Example shows how to use base classes to assign
|
|||
types of more than one type to a property. It specializes the Person type
|
||||
developed in the previous examples into two types - a \c Boy and a \c Girl.
|
||||
|
||||
\snippet qml/referenceexamples/coercion/example.qml 0
|
||||
\snippet referenceexamples/coercion/example.qml 0
|
||||
|
||||
\section1 Declare Boy and Girl
|
||||
|
||||
\snippet qml/referenceexamples/coercion/person.h 0
|
||||
\snippet referenceexamples/coercion/person.h 0
|
||||
|
||||
The Person class remains unaltered in this example and the Boy and Girl C++
|
||||
classes are trivial extensions of it. As an example, the inheritance used here
|
||||
|
@ -147,7 +147,7 @@ previous example. However, as we have repurposed the People class as a common
|
|||
base for Boy and Girl, we want to prevent it from being instantiated from QML
|
||||
directly - an explicit Boy or Girl should be instantiated instead.
|
||||
|
||||
\snippet qml/referenceexamples/coercion/main.cpp 0
|
||||
\snippet referenceexamples/coercion/main.cpp 0
|
||||
|
||||
While we want to disallow instantiating Person from within QML, it still needs
|
||||
to be registered with the QML engine, so that it can be used as a property type
|
||||
|
@ -157,7 +157,7 @@ and other types can be coerced to it.
|
|||
|
||||
The implementation of Boy and Girl are trivial.
|
||||
|
||||
\snippet qml/referenceexamples/coercion/person.cpp 1
|
||||
\snippet referenceexamples/coercion/person.cpp 1
|
||||
|
||||
All that is necessary is to implement the constructor, and to register the types
|
||||
and their QML name with the QML engine.
|
||||
|
@ -167,7 +167,7 @@ and their QML name with the QML engine.
|
|||
The BirthdayParty type has not changed since the previous example. The
|
||||
celebrant and guests property still use the People type.
|
||||
|
||||
\snippet qml/referenceexamples/coercion/birthdayparty.h 0
|
||||
\snippet referenceexamples/coercion/birthdayparty.h 0
|
||||
|
||||
However, as all three types, Person, Boy and Girl, have been registered with the
|
||||
QML system, on assignment QML automatically (and type-safely) converts the Boy
|
||||
|
@ -194,14 +194,14 @@ The Default Property Example is a minor modification of the
|
|||
\l {Extending QML - Inheritance and Coercion Example} that simplifies the
|
||||
specification of a BirthdayParty through the use of a default property.
|
||||
|
||||
\snippet qml/referenceexamples/default/example.qml 0
|
||||
\snippet referenceexamples/default/example.qml 0
|
||||
|
||||
\section1 Declaring the BirthdayParty class
|
||||
|
||||
The only difference between this example and the last, is the addition of the
|
||||
\c DefaultProperty class info annotation.
|
||||
|
||||
\snippet qml/referenceexamples/default/birthdayparty.h 0
|
||||
\snippet referenceexamples/default/birthdayparty.h 0
|
||||
|
||||
The default property specifies the property to assign to whenever an explicit
|
||||
property is not specified, in the case of the BirthdayParty type the guest
|
|
@ -33,8 +33,8 @@
|
|||
Types in this example are augmented with meta-data for accessiblity systems.
|
||||
|
||||
For example, the button identifies itself and its functionality to the accessibility system:
|
||||
\snippet quick/accessibility/content/Button.qml button
|
||||
\snippet accessibility/content/Button.qml button
|
||||
|
||||
As do Text types inside the example:
|
||||
\snippet quick/accessibility/accessibility.qml text
|
||||
\snippet accessibility/accessibility.qml text
|
||||
*/
|
||||
|
|
|
@ -36,37 +36,37 @@
|
|||
a small QML file emphasizing a particular type or feature.
|
||||
|
||||
ColorAnimation demonstrates using a color animation to fade a sky from day to night.
|
||||
\snippet quick/animation/basics/color-animation.qml 0
|
||||
\snippet animation/basics/color-animation.qml 0
|
||||
|
||||
PropertyAnimation demonstrates using a number animation to bounce a circle up and down.
|
||||
\snippet quick/animation/basics/property-animation.qml 0
|
||||
\snippet animation/basics/property-animation.qml 0
|
||||
|
||||
Behaviors demonstrates using behaviors to animate moving a rectangle to whereever you click.
|
||||
\snippet quick/animation/behaviors/behavior-example.qml 0
|
||||
\snippet animation/behaviors/behavior-example.qml 0
|
||||
|
||||
Wiggly Text demonstrates using more complex behaviors to animate and wiggle some text around as you drag it.
|
||||
It does this by assigning a complex binding to each letter:
|
||||
\snippet quick/animation/behaviors/wigglytext.qml 0
|
||||
\snippet animation/behaviors/wigglytext.qml 0
|
||||
Then, it uses behaviors to animate the movement on each letter:
|
||||
\snippet quick/animation/behaviors/wigglytext.qml 1
|
||||
\snippet animation/behaviors/wigglytext.qml 1
|
||||
|
||||
Tv Tennis demonstrates using more complex behaviors to get paddles following a ball for an infinite game.
|
||||
Again a binding which depends on other values is applied to the position and a behavior provided the animation.
|
||||
\snippet quick/animation/behaviors/tvtennis.qml 0
|
||||
\snippet animation/behaviors/tvtennis.qml 0
|
||||
|
||||
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.
|
||||
It defines several states:
|
||||
\snippet quick/animation/states/states.qml 0
|
||||
\snippet animation/states/states.qml 0
|
||||
Note that there is also the implicit 'base state' from properties set directly on objects.
|
||||
|
||||
Transitions takes the States example and animates the property changes by setting transitions:
|
||||
\snippet quick/animation/states/transitions.qml 0
|
||||
\snippet animation/states/transitions.qml 0
|
||||
|
||||
PathAnimation animates an image along a beizer curve using a PathAnimation.
|
||||
\snippet quick/animation/pathanimation/pathanimation.qml 0
|
||||
\snippet animation/pathanimation/pathanimation.qml 0
|
||||
|
||||
PathInterpolator animates an image along the same beizer curve, using a PathInterpolator instead.
|
||||
\snippet quick/animation/pathinterpolator/pathinterpolator.qml 0
|
||||
\snippet animation/pathinterpolator/pathinterpolator.qml 0
|
||||
*/
|
||||
|
|
|
@ -36,12 +36,12 @@
|
|||
a small QML file emphasizing a particular type or feature.
|
||||
|
||||
Red heart demonstrates using a bezierCurve API to stroke and fill a red heart.
|
||||
\snippet quick/canvas/bezierCurve/bezierCurve.qml 0
|
||||
\snippet canvas/bezierCurve/bezierCurve.qml 0
|
||||
|
||||
Talk bubble demonstrates using a quadraticCurveTo API to stroke and fill a customized talk bubble:
|
||||
\snippet quick/canvas/quadraticCurveTo/quadraticCurveTo.qml 0
|
||||
\snippet canvas/quadraticCurveTo/quadraticCurveTo.qml 0
|
||||
This example also demonstrates the fillText API:
|
||||
\snippet quick/canvas/quadraticCurveTo/quadraticCurveTo.qml 1
|
||||
\snippet canvas/quadraticCurveTo/quadraticCurveTo.qml 1
|
||||
|
||||
Squircle demonstrates using a collection of simple moveTo/lineTo path APIs to draw a smooth squircle.
|
||||
|
||||
|
@ -50,9 +50,9 @@
|
|||
Smile face demonstrates using several complex path APIs to draw an fill a smile face.
|
||||
|
||||
Clip demonstrates using clip API to clip a given image.
|
||||
\snippet quick/canvas/clip/clip.qml 0
|
||||
\snippet canvas/clip/clip.qml 0
|
||||
|
||||
Tiger demonstrates using SVG path API to draw a tiger with a collection of SVG path strings.
|
||||
\snippet quick/canvas/tiger/tiger.qml 0
|
||||
\snippet canvas/tiger/tiger.qml 0
|
||||
|
||||
*/
|
||||
|
|
|
@ -116,13 +116,12 @@ Item {
|
|||
if (canvas.stroke)
|
||||
ctx.stroke();
|
||||
|
||||
ctx.restore();
|
||||
|
||||
// ![1]
|
||||
ctx.fillStyle = "white";
|
||||
ctx.font = "Bold 17px";
|
||||
ctx.fillText("Qt Quick", 110, 140);
|
||||
ctx.fillText("Qt Quick", 40, 70);
|
||||
// ![1]
|
||||
ctx.restore();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -42,7 +42,7 @@
|
|||
|
||||
#include <QStyleHints>
|
||||
#include <QGuiApplication>
|
||||
|
||||
#include <qqmlfile.h>
|
||||
|
||||
MaskedMouseArea::MaskedMouseArea(QQuickItem *parent)
|
||||
: QQuickItem(parent),
|
||||
|
@ -74,7 +74,7 @@ void MaskedMouseArea::setMaskSource(const QUrl &source)
|
|||
{
|
||||
if (m_maskSource != source) {
|
||||
m_maskSource = source;
|
||||
m_maskImage = QImage(source.toLocalFile());
|
||||
m_maskImage = QImage(QQmlFile::urlToLocalFileOrQrc(source));
|
||||
emit maskSourceChanged();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -18,3 +18,6 @@ qmldir.files = TextBalloonPlugin/qmldir
|
|||
qmldir.path = $$[QT_INSTALL_EXAMPLES]/quick/customitems/painteditem/TextBalloonPlugin
|
||||
|
||||
INSTALLS += qmldir target
|
||||
|
||||
OTHER_FILES += \
|
||||
textballoons.qml
|
||||
|
|
|
@ -6,5 +6,24 @@ SOURCES += main.cpp
|
|||
RESOURCES += calqlatr.qrc \
|
||||
../../shared/shared.qrc
|
||||
|
||||
OTHER_FILES = calqlatr.qml \
|
||||
content/Button.qml \
|
||||
content/Display.qml \
|
||||
content/NumberPad.qml \
|
||||
content/StyleLabel.qml \
|
||||
content/audio/touch.wav \
|
||||
content/calculator.js \
|
||||
content/images/icon-back.png \
|
||||
content/images/icon-close.png \
|
||||
content/images/icon-settings.png \
|
||||
content/images/logo.png \
|
||||
content/images/paper-edge-left.png \
|
||||
content/images/paper-edge-right.png \
|
||||
content/images/paper-grip.png \
|
||||
content/images/settings-selected-a.png \
|
||||
content/images/settings-selected-b.png \
|
||||
content/images/touch-green.png \
|
||||
content/images/touch-white.png
|
||||
|
||||
target.path = $$[QT_INSTALL_EXAMPLES]/quick/demos/calqlatr
|
||||
INSTALLS += target
|
||||
|
|
|
@ -57,7 +57,7 @@ Rectangle {
|
|||
|
||||
Item {
|
||||
id: pad
|
||||
width: window.width * 0.58
|
||||
width: 180
|
||||
NumberPad { y: 10; anchors.horizontalCenter: parent.horizontalCenter }
|
||||
}
|
||||
|
||||
|
@ -77,7 +77,7 @@ Rectangle {
|
|||
Display {
|
||||
id: display
|
||||
x: -16
|
||||
width: window.width * 0.42
|
||||
width: window.width - pad.width
|
||||
height: parent.height
|
||||
|
||||
MouseArea {
|
||||
|
@ -85,7 +85,12 @@ Rectangle {
|
|||
property real oldP: 0
|
||||
property bool rewind: false
|
||||
|
||||
anchors.fill: parent
|
||||
anchors {
|
||||
bottom: parent.bottom
|
||||
left: parent.left
|
||||
right: parent.right
|
||||
}
|
||||
height: 50
|
||||
onPositionChanged: {
|
||||
var reverse = startX > window.width / 2
|
||||
var mx = mapToItem(window, mouse.x).x
|
||||
|
|
|
@ -42,23 +42,38 @@ import QtQuick 2.0
|
|||
|
||||
Item {
|
||||
id: display
|
||||
property bool enteringDigits: false
|
||||
|
||||
function displayOperator(operator)
|
||||
{
|
||||
listView.model.append({ "operator": operator, "operand": "" })
|
||||
enteringDigits = true
|
||||
}
|
||||
|
||||
function newLine(operator, operand)
|
||||
{
|
||||
listView.model.append({ "operator": operator, "operand": operand })
|
||||
enteringDigits = false
|
||||
listView.positionViewAtEnd()
|
||||
}
|
||||
|
||||
function appendDigit(digit)
|
||||
{
|
||||
if (!listView.model.count)
|
||||
if (!enteringDigits)
|
||||
listView.model.append({ "operator": "", "operand": "" })
|
||||
var i = listView.model.count - 1;
|
||||
listView.model.get(i).operand = listView.model.get(i).operand + digit;
|
||||
enteringDigits = true
|
||||
}
|
||||
|
||||
function clear()
|
||||
{
|
||||
if (enteringDigits) {
|
||||
var i = listView.model.count - 1
|
||||
if (i >= 0)
|
||||
listView.model.remove(i)
|
||||
enteringDigits = false
|
||||
}
|
||||
}
|
||||
|
||||
Item {
|
||||
|
@ -87,6 +102,7 @@ Item {
|
|||
}
|
||||
|
||||
Image {
|
||||
id: grip
|
||||
source: "images/paper-grip.png"
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
anchors.bottom: parent.bottom
|
||||
|
@ -97,7 +113,7 @@ Item {
|
|||
id: listView
|
||||
x: 16; y: 30
|
||||
width: display.width
|
||||
height: display.height
|
||||
height: display.height - 50 - y
|
||||
delegate: Item {
|
||||
height: 20
|
||||
width: parent.width
|
||||
|
|
|
@ -60,7 +60,7 @@ Grid {
|
|||
Button { text: "±"; color: "#6da43d"; operator: true }
|
||||
Button { text: "−"; color: "#6da43d"; operator: true }
|
||||
Button { text: "+"; color: "#6da43d"; operator: true }
|
||||
Button { text: " "; color: "#6da43d"; operator: true }
|
||||
Button { text: "√"; color: "#6da43d"; operator: true }
|
||||
Button { text: "÷"; color: "#6da43d"; operator: true }
|
||||
Button { text: "×"; color: "#6da43d"; operator: true }
|
||||
Button { text: "C"; color: "#6da43d"; operator: true }
|
||||
|
|
|
@ -84,7 +84,7 @@ function operatorPressed(op)
|
|||
} else if (previousOperator == "×") {
|
||||
digits = Number(curVal) * Number(digits.valueOf())
|
||||
} else if (previousOperator == "÷") {
|
||||
digits = Number(Number(curVal) / Number(digits.valueOf())).toString()
|
||||
digits = Number(curVal) / Number(digits.valueOf())
|
||||
} else if (previousOperator == "=") {
|
||||
}
|
||||
|
||||
|
@ -110,9 +110,9 @@ function operatorPressed(op)
|
|||
digits = (Math.abs(digits.valueOf())).toString()
|
||||
} else if (op == "Int") {
|
||||
digits = (Math.floor(digits.valueOf())).toString()
|
||||
} else if (op == window.plusminus) {
|
||||
} else if (op == "±") {
|
||||
digits = (digits.valueOf() * -1).toString()
|
||||
} else if (op == window.squareRoot) {
|
||||
} else if (op == "√") {
|
||||
digits = (Math.sqrt(digits.valueOf())).toString()
|
||||
} else if (op == "mc") {
|
||||
memory = 0;
|
||||
|
@ -130,7 +130,7 @@ function operatorPressed(op)
|
|||
} else if (op == "Off") {
|
||||
Qt.quit();
|
||||
} else if (op == "C") {
|
||||
digits = "0"
|
||||
display.clear()
|
||||
} else if (op == "AC") {
|
||||
curVal = 0
|
||||
memory = 0
|
||||
|
|
Before Width: | Height: | Size: 36 KiB After Width: | Height: | Size: 36 KiB |
|
@ -26,13 +26,11 @@
|
|||
****************************************************************************/
|
||||
|
||||
/*!
|
||||
\title QML Demo - Calqlatr
|
||||
\title Qt Quick Demo - Calqlatr
|
||||
\ingroup qtquickdemos
|
||||
\example demos/calqlatr
|
||||
\brief This is an example calculator written in QML.
|
||||
\image qml-calqlatr-demo-small.png
|
||||
\ingroup qmldemos
|
||||
|
||||
This demo implements a simple calculator app, designed for portrait devices.
|
||||
\brief A simple calculator app, designed for portrait devices.
|
||||
\image qtquick-demo-calqlatr.png
|
||||
|
||||
This app has the logic implemented in Javascipt and the appearance implemented in QML.
|
||||
*/
|
||||
|
|
After Width: | Height: | Size: 26 KiB |
|
@ -0,0 +1,35 @@
|
|||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
|
||||
** Contact: http://www.qt-project.org/legal
|
||||
**
|
||||
** This file is part of the documentation of the Qt Toolkit.
|
||||
**
|
||||
** $QT_BEGIN_LICENSE:FDL$
|
||||
** Commercial License Usage
|
||||
** Licensees holding valid commercial Qt licenses may use this file in
|
||||
** accordance with the commercial license agreement provided with the
|
||||
** Software or, alternatively, in accordance with the terms contained in
|
||||
** a written agreement between you and Digia. For licensing terms and
|
||||
** conditions see http://qt.digia.com/licensing. For further information
|
||||
** use the contact form at http://qt.digia.com/contact-us.
|
||||
**
|
||||
** GNU Free Documentation License Usage
|
||||
** 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. Please review the following information to ensure
|
||||
** the GNU Free Documentation License version 1.3 requirements
|
||||
** will be met: http://www.gnu.org/copyleft/fdl.html.
|
||||
** $QT_END_LICENSE$
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
/*!
|
||||
\title Qt Quick Demo - Clocks
|
||||
\ingroup qtquickdemos
|
||||
\example demos/clocks
|
||||
\brief An app that shows the current time in different cities.
|
||||
\image qtquick-demo-clocks-small.png
|
||||
*/
|
||||
|
After Width: | Height: | Size: 72 KiB |
After Width: | Height: | Size: 60 KiB |
|
@ -0,0 +1,36 @@
|
|||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
|
||||
** Contact: http://www.qt-project.org/legal
|
||||
**
|
||||
** This file is part of the documentation of the Qt Toolkit.
|
||||
**
|
||||
** $QT_BEGIN_LICENSE:FDL$
|
||||
** Commercial License Usage
|
||||
** Licensees holding valid commercial Qt licenses may use this file in
|
||||
** accordance with the commercial license agreement provided with the
|
||||
** Software or, alternatively, in accordance with the terms contained in
|
||||
** a written agreement between you and Digia. For licensing terms and
|
||||
** conditions see http://qt.digia.com/licensing. For further information
|
||||
** use the contact form at http://qt.digia.com/contact-us.
|
||||
**
|
||||
** GNU Free Documentation License Usage
|
||||
** 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. Please review the following information to ensure
|
||||
** the GNU Free Documentation License version 1.3 requirements
|
||||
** will be met: http://www.gnu.org/copyleft/fdl.html.
|
||||
** $QT_END_LICENSE$
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
/*!
|
||||
\title Qt Quick Demo - Maroon in Trouble
|
||||
\ingroup qtquickdemos
|
||||
\example demos/maroon
|
||||
\brief A cute game designed for touchscreens.
|
||||
\image qtquick-demo-maroon-med-1.png
|
||||
\image qtquick-demo-maroon-med-2.png
|
||||
*/
|
||||
|
Before Width: | Height: | Size: 46 KiB After Width: | Height: | Size: 46 KiB |
|
@ -26,11 +26,11 @@
|
|||
****************************************************************************/
|
||||
|
||||
/*!
|
||||
\title QML Demo - Photo Surface
|
||||
\title Qt Quick Demo - Photo Surface
|
||||
\ingroup qtquickdemos
|
||||
\example demos/photosurface
|
||||
\brief This is the typical touch photo-shuffling example written in QML.
|
||||
\image qml-photosurface-example-small.png
|
||||
\ingroup qtquickexamples
|
||||
\brief A touch-based app for shuffling photos around a virtual surface.
|
||||
\image qtquick-demo-photosurface-small.png
|
||||
|
||||
This example demonstrates how to handle dragging, rotation and
|
||||
pinch zooming within the same item using a PinchArea containing a MouseArea.
|
||||
|
|
After Width: | Height: | Size: 72 KiB |
|
@ -0,0 +1,35 @@
|
|||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
|
||||
** Contact: http://www.qt-project.org/legal
|
||||
**
|
||||
** This file is part of the documentation of the Qt Toolkit.
|
||||
**
|
||||
** $QT_BEGIN_LICENSE:FDL$
|
||||
** Commercial License Usage
|
||||
** Licensees holding valid commercial Qt licenses may use this file in
|
||||
** accordance with the commercial license agreement provided with the
|
||||
** Software or, alternatively, in accordance with the terms contained in
|
||||
** a written agreement between you and Digia. For licensing terms and
|
||||
** conditions see http://qt.digia.com/licensing. For further information
|
||||
** use the contact form at http://qt.digia.com/contact-us.
|
||||
**
|
||||
** GNU Free Documentation License Usage
|
||||
** 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. Please review the following information to ensure
|
||||
** the GNU Free Documentation License version 1.3 requirements
|
||||
** will be met: http://www.gnu.org/copyleft/fdl.html.
|
||||
** $QT_END_LICENSE$
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
/*!
|
||||
\title Qt Quick Demo - Photo Viewer
|
||||
\ingroup qtquickdemos
|
||||
\example demos/photoviewer
|
||||
\brief An online photo viewer that displays Flickr feeds.
|
||||
\image qtquick-demo-photoviewer-small.png
|
||||
*/
|
||||
|
After Width: | Height: | Size: 42 KiB |
|
@ -0,0 +1,35 @@
|
|||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
|
||||
** Contact: http://www.qt-project.org/legal
|
||||
**
|
||||
** This file is part of the documentation of the Qt Toolkit.
|
||||
**
|
||||
** $QT_BEGIN_LICENSE:FDL$
|
||||
** Commercial License Usage
|
||||
** Licensees holding valid commercial Qt licenses may use this file in
|
||||
** accordance with the commercial license agreement provided with the
|
||||
** Software or, alternatively, in accordance with the terms contained in
|
||||
** a written agreement between you and Digia. For licensing terms and
|
||||
** conditions see http://qt.digia.com/licensing. For further information
|
||||
** use the contact form at http://qt.digia.com/contact-us.
|
||||
**
|
||||
** GNU Free Documentation License Usage
|
||||
** 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. Please review the following information to ensure
|
||||
** the GNU Free Documentation License version 1.3 requirements
|
||||
** will be met: http://www.gnu.org/copyleft/fdl.html.
|
||||
** $QT_END_LICENSE$
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
/*!
|
||||
\title Qt Quick Demo - RSS News
|
||||
\ingroup qtquickdemos
|
||||
\example demos/rssnews
|
||||
\brief An RSS news reader.
|
||||
\image qtquick-demo-rssnews-small.png
|
||||
*/
|
||||
|
After Width: | Height: | Size: 98 KiB |
After Width: | Height: | Size: 132 KiB |
|
@ -0,0 +1,36 @@
|
|||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
|
||||
** Contact: http://www.qt-project.org/legal
|
||||
**
|
||||
** This file is part of the documentation of the Qt Toolkit.
|
||||
**
|
||||
** $QT_BEGIN_LICENSE:FDL$
|
||||
** Commercial License Usage
|
||||
** Licensees holding valid commercial Qt licenses may use this file in
|
||||
** accordance with the commercial license agreement provided with the
|
||||
** Software or, alternatively, in accordance with the terms contained in
|
||||
** a written agreement between you and Digia. For licensing terms and
|
||||
** conditions see http://qt.digia.com/licensing. For further information
|
||||
** use the contact form at http://qt.digia.com/contact-us.
|
||||
**
|
||||
** GNU Free Documentation License Usage
|
||||
** 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. Please review the following information to ensure
|
||||
** the GNU Free Documentation License version 1.3 requirements
|
||||
** will be met: http://www.gnu.org/copyleft/fdl.html.
|
||||
** $QT_END_LICENSE$
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
/*!
|
||||
\title Qt Quick Demo - Same Game
|
||||
\ingroup qtquickdemos
|
||||
\example demos/samegame
|
||||
\brief A QML implementation of the popular puzzle game by Kuniaki Moribe.
|
||||
\image qtquick-demo-samegame-med-1.png
|
||||
\image qtquick-demo-samegame-med-2.png
|
||||
*/
|
||||
|
|
@ -40,13 +40,12 @@
|
|||
|
||||
import QtQuick 2.0
|
||||
|
||||
Row {
|
||||
Item {
|
||||
id: button
|
||||
property alias text: txt.text
|
||||
property bool buttonEnabled: true
|
||||
width: 140
|
||||
height: 25
|
||||
spacing: 5
|
||||
x: 5
|
||||
MouseArea {
|
||||
id: mouse
|
||||
|
@ -75,14 +74,14 @@ Row {
|
|||
radius: 1
|
||||
color: mouse.pressed || buttonEnabled ? "#76644A" : "transparent"
|
||||
}
|
||||
Text {
|
||||
id: txt
|
||||
anchors.left: checkbox.right
|
||||
anchors.leftMargin: 4
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
text: "Close "
|
||||
color: "#ecc089"
|
||||
font.pixelSize: 18
|
||||
}
|
||||
}
|
||||
Text {
|
||||
id: txt
|
||||
anchors.left: checkbox.right
|
||||
anchors.leftMargin: 4
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
text: "Close "
|
||||
color: "#ecc089"
|
||||
font.pixelSize: 18
|
||||
}
|
||||
}
|
||||
|
|
|
@ -88,7 +88,6 @@ Rectangle {
|
|||
anchors.leftMargin: 30
|
||||
anchors.top: startDateText.bottom
|
||||
anchors.topMargin: 8
|
||||
date: new Date(1995, 3, 25)
|
||||
}
|
||||
|
||||
Text {
|
||||
|
@ -212,4 +211,6 @@ Rectangle {
|
|||
onClicked: root.chartType = "all"
|
||||
}
|
||||
}
|
||||
|
||||
Component.onCompleted: startDatePicker.date = new Date(1995, 3, 25)
|
||||
}
|
||||
|
|
After Width: | Height: | Size: 24 KiB |
|
@ -0,0 +1,35 @@
|
|||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
|
||||
** Contact: http://www.qt-project.org/legal
|
||||
**
|
||||
** This file is part of the documentation of the Qt Toolkit.
|
||||
**
|
||||
** $QT_BEGIN_LICENSE:FDL$
|
||||
** Commercial License Usage
|
||||
** Licensees holding valid commercial Qt licenses may use this file in
|
||||
** accordance with the commercial license agreement provided with the
|
||||
** Software or, alternatively, in accordance with the terms contained in
|
||||
** a written agreement between you and Digia. For licensing terms and
|
||||
** conditions see http://qt.digia.com/licensing. For further information
|
||||
** use the contact form at http://qt.digia.com/contact-us.
|
||||
**
|
||||
** GNU Free Documentation License Usage
|
||||
** 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. Please review the following information to ensure
|
||||
** the GNU Free Documentation License version 1.3 requirements
|
||||
** will be met: http://www.gnu.org/copyleft/fdl.html.
|
||||
** $QT_END_LICENSE$
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
/*!
|
||||
\title Qt Quick Demo - StocQt
|
||||
\ingroup qtquickdemos
|
||||
\example demos/stocqt
|
||||
\brief A configurable stock chart for the NASDAQ-100.
|
||||
\image qtquick-demo-stocqt.png
|
||||
*/
|
||||
|
After Width: | Height: | Size: 18 KiB |
After Width: | Height: | Size: 88 KiB |
|
@ -0,0 +1,36 @@
|
|||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
|
||||
** Contact: http://www.qt-project.org/legal
|
||||
**
|
||||
** This file is part of the documentation of the Qt Toolkit.
|
||||
**
|
||||
** $QT_BEGIN_LICENSE:FDL$
|
||||
** Commercial License Usage
|
||||
** Licensees holding valid commercial Qt licenses may use this file in
|
||||
** accordance with the commercial license agreement provided with the
|
||||
** Software or, alternatively, in accordance with the terms contained in
|
||||
** a written agreement between you and Digia. For licensing terms and
|
||||
** conditions see http://qt.digia.com/licensing. For further information
|
||||
** use the contact form at http://qt.digia.com/contact-us.
|
||||
**
|
||||
** GNU Free Documentation License Usage
|
||||
** 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. Please review the following information to ensure
|
||||
** the GNU Free Documentation License version 1.3 requirements
|
||||
** will be met: http://www.gnu.org/copyleft/fdl.html.
|
||||
** $QT_END_LICENSE$
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
/*!
|
||||
\title Qt Quick Demo - Tweet Search
|
||||
\ingroup qtquickdemos
|
||||
\example demos/tweetsearch
|
||||
\brief A Twitter search client with 3D effects.
|
||||
\image qtquick-demo-tweetsearch-med-1.png
|
||||
\image qtquick-demo-tweetsearch-med-2.png
|
||||
*/
|
||||
|
|
@ -46,9 +46,10 @@ Rectangle {
|
|||
width: 320
|
||||
height: 200
|
||||
color: palette.window
|
||||
|
||||
SystemPalette { id: palette }
|
||||
clip: true
|
||||
|
||||
//! [colordialog]
|
||||
ColorDialog {
|
||||
id: colorDialog
|
||||
visible: colorDialogVisible.checked
|
||||
|
@ -59,10 +60,11 @@ Rectangle {
|
|||
onAccepted: { console.log("Accepted: " + color) }
|
||||
onRejected: { console.log("Rejected") }
|
||||
}
|
||||
//! [colordialog]
|
||||
|
||||
Column {
|
||||
anchors.fill: parent
|
||||
anchors.margins: 8
|
||||
anchors.margins: 12
|
||||
spacing: 8
|
||||
Text {
|
||||
font.bold: true
|
||||
|
@ -106,4 +108,38 @@ Rectangle {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
Rectangle {
|
||||
anchors {
|
||||
left: parent.left
|
||||
right: parent.right
|
||||
bottom: parent.bottom
|
||||
}
|
||||
height: 50
|
||||
color: Qt.darker(palette.window, 1.1)
|
||||
border.color: Qt.darker(palette.window, 1.3)
|
||||
Row {
|
||||
spacing: 6
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
anchors.left: parent.left
|
||||
anchors.leftMargin: 12
|
||||
height: parent.height - 6
|
||||
width: parent.width
|
||||
Button {
|
||||
text: "Open"
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
onClicked: colorDialog.open()
|
||||
}
|
||||
Button {
|
||||
text: "Close"
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
onClicked: colorDialog.close()
|
||||
}
|
||||
Button {
|
||||
text: "set to green"
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
onClicked: colorDialog.color = "green"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -43,44 +43,13 @@ import QtQuick.Dialogs 1.0
|
|||
import "../shared"
|
||||
|
||||
Rectangle {
|
||||
|
||||
width: 580
|
||||
height: 360
|
||||
height: 400
|
||||
color: palette.window
|
||||
SystemPalette { id: palette }
|
||||
clip: true
|
||||
|
||||
Rectangle {
|
||||
id: toolbar
|
||||
width: parent.width
|
||||
height: 40
|
||||
color: Qt.darker(palette.window, 1.1)
|
||||
border.color: Qt.darker(palette.window, 1.3)
|
||||
Row {
|
||||
spacing: 6
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
anchors.left: parent.left
|
||||
anchors.leftMargin: 8
|
||||
height: parent.height - 6
|
||||
width: parent.width
|
||||
Button {
|
||||
text: "Open"
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
onClicked: fileDialog.open()
|
||||
}
|
||||
Button {
|
||||
text: "Close"
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
onClicked: fileDialog.close()
|
||||
}
|
||||
Button {
|
||||
text: "/tmp"
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
// TODO: QTBUG-29814 This isn't portable, but we don't expose QDir::tempPath to QML yet.
|
||||
onClicked: fileDialog.folder = "/tmp"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//! [filedialog]
|
||||
FileDialog {
|
||||
id: fileDialog
|
||||
visible: fileDialogVisible.checked
|
||||
|
@ -95,12 +64,11 @@ Rectangle {
|
|||
onAccepted: { console.log("Accepted: " + fileUrls) }
|
||||
onRejected: { console.log("Rejected") }
|
||||
}
|
||||
//! [filedialog]
|
||||
|
||||
Column {
|
||||
anchors.left: parent.left
|
||||
anchors.right: parent.right
|
||||
anchors.top: toolbar.bottom
|
||||
anchors.margins: 8
|
||||
anchors.fill: parent
|
||||
anchors.margins: 12
|
||||
spacing: 8
|
||||
Text {
|
||||
color: palette.windowText
|
||||
|
@ -163,4 +131,39 @@ Rectangle {
|
|||
wrapMode: Text.Wrap
|
||||
}
|
||||
}
|
||||
|
||||
Rectangle {
|
||||
anchors {
|
||||
left: parent.left
|
||||
right: parent.right
|
||||
bottom: parent.bottom
|
||||
}
|
||||
height: 50
|
||||
color: Qt.darker(palette.window, 1.1)
|
||||
border.color: Qt.darker(palette.window, 1.3)
|
||||
Row {
|
||||
spacing: 6
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
anchors.left: parent.left
|
||||
anchors.leftMargin: 12
|
||||
height: parent.height - 6
|
||||
width: parent.width
|
||||
Button {
|
||||
text: "Open"
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
onClicked: fileDialog.open()
|
||||
}
|
||||
Button {
|
||||
text: "Close"
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
onClicked: fileDialog.close()
|
||||
}
|
||||
Button {
|
||||
text: "go to /tmp"
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
// TODO: QTBUG-29814 This isn't portable, but we don't expose QDir::tempPath to QML yet.
|
||||
onClicked: fileDialog.folder = "/tmp"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,17 @@
|
|||
TEMPLATE = app
|
||||
|
||||
QT += quick qml
|
||||
SOURCES += main.cpp
|
||||
RESOURCES += dialogs.qrc ../shared/shared.qrc
|
||||
|
||||
OTHER_FILES += \
|
||||
dialogs.qml \
|
||||
FileDialogs.qml \
|
||||
ColorDialogs.qml
|
||||
|
||||
EXAMPLE_FILES = \
|
||||
FileDialogs.qml \
|
||||
ColorDialogs.qml
|
||||
|
||||
target.path = $$[QT_INSTALL_EXAMPLES]/quick/dialogs
|
||||
INSTALLS += target
|
|
@ -39,20 +39,21 @@
|
|||
****************************************************************************/
|
||||
|
||||
import QtQuick 2.0
|
||||
import QtQuick.Window 2.0
|
||||
import "../shared"
|
||||
|
||||
Window {
|
||||
width: 640
|
||||
height: 480
|
||||
visible: true //It's false by default
|
||||
property Component self
|
||||
Component.onCompleted: self = Qt.createComponent("Window.qml")
|
||||
Text{
|
||||
text: "Hello World!"
|
||||
anchors.centerIn: parent
|
||||
}
|
||||
MouseArea{
|
||||
TabSet {
|
||||
width: 580
|
||||
height: 440
|
||||
|
||||
FileDialogs {
|
||||
property string title: "File Dialog"
|
||||
anchors.fill: parent
|
||||
onClicked: self.createObject();
|
||||
color: "#e3e3e3" // to match tab.png
|
||||
}
|
||||
|
||||
ColorDialogs {
|
||||
property string title: "Color Dialog"
|
||||
anchors.fill: parent
|
||||
color: "#e3e3e3" // to match tab.png
|
||||
}
|
||||
}
|
|
@ -0,0 +1,7 @@
|
|||
<RCC>
|
||||
<qresource prefix="/dialogs">
|
||||
<file>dialogs.qml</file>
|
||||
<file>FileDialogs.qml</file>
|
||||
<file>ColorDialogs.qml</file>
|
||||
</qresource>
|
||||
</RCC>
|
After Width: | Height: | Size: 46 KiB |
|
@ -0,0 +1,44 @@
|
|||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
|
||||
** Contact: http://www.qt-project.org/legal
|
||||
**
|
||||
** This file is part of the documentation of the Qt Toolkit.
|
||||
**
|
||||
** $QT_BEGIN_LICENSE:FDL$
|
||||
** Commercial License Usage
|
||||
** Licensees holding valid commercial Qt licenses may use this file in
|
||||
** accordance with the commercial license agreement provided with the
|
||||
** Software or, alternatively, in accordance with the terms contained in
|
||||
** a written agreement between you and Digia. For licensing terms and
|
||||
** conditions see http://qt.digia.com/licensing. For further information
|
||||
** use the contact form at http://qt.digia.com/contact-us.
|
||||
**
|
||||
** GNU Free Documentation License Usage
|
||||
** 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. Please review the following information to ensure
|
||||
** the GNU Free Documentation License version 1.3 requirements
|
||||
** will be met: http://www.gnu.org/copyleft/fdl.html.
|
||||
** $QT_END_LICENSE$
|
||||
**
|
||||
****************************************************************************/
|
||||
/*!
|
||||
\title Qt Quick Dialog Examples
|
||||
\example dialogs
|
||||
\brief This example demonstrates the dialog types in QML
|
||||
\image dialogs-example.jpg
|
||||
\ingroup qtquickdialog_examples
|
||||
|
||||
This example demonstrates the system dialogs in the \l{Qt Quick Dialogs}
|
||||
module. The appearance and behavior is platform-dependent.
|
||||
|
||||
A \l FileDialog is used to choose a single file, multiple files or a
|
||||
single directory, depending on how it is configured.
|
||||
\snippet dialogs/FileDialogs.qml filedialog
|
||||
|
||||
A \l ColorDialog is used to choose a color, with or without alpha (transparency)
|
||||
depending on how it is configured.
|
||||
\snippet dialogs/ColorDialogs.qml colordialog
|
||||
*/
|
|
@ -3,7 +3,7 @@
|
|||
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
|
||||
** Contact: http://www.qt-project.org/legal
|
||||
**
|
||||
** This file is part of the documentation of the Qt Toolkit.
|
||||
** 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:
|
||||
|
@ -37,10 +37,5 @@
|
|||
** $QT_END_LICENSE$
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
//![0]
|
||||
// main.qml
|
||||
import QtQuick 2.0
|
||||
|
||||
Image { source: "images/background.png" }
|
||||
//![0]
|
||||
#include "../shared/shared.h"
|
||||
DECLARATIVE_EXAMPLE_MAIN(dialogs/dialogs)
|
|
@ -37,12 +37,12 @@
|
|||
|
||||
It has a DragTile component which uses a MouseArea to move an item when dragged:
|
||||
|
||||
\snippet quick/draganddrop/tiles/DragTile.qml 0
|
||||
\snippet quick/draganddrop/tiles/DragTile.qml 1
|
||||
\snippet draganddrop/tiles/DragTile.qml 0
|
||||
\snippet draganddrop/tiles/DragTile.qml 1
|
||||
|
||||
And a DropTile component which the dragged tiles can be dropped onto:
|
||||
|
||||
\snippet quick/draganddrop/tiles/DropTile.qml 0
|
||||
\snippet draganddrop/tiles/DropTile.qml 0
|
||||
|
||||
The keys property of the DropArea will only allow an item with matching key in
|
||||
it's Drag.keys property to be dropped on it.
|
||||
|
@ -52,7 +52,7 @@
|
|||
It uses a DelegateModel to move a delegate item to the position of another item
|
||||
it is dragged over.
|
||||
|
||||
\snippet quick/draganddrop/views/gridview.qml 0
|
||||
\snippet quick/draganddrop/views/gridview.qml 1
|
||||
\snippet draganddrop/views/gridview.qml 0
|
||||
\snippet draganddrop/views/gridview.qml 1
|
||||
*/
|
||||
|
||||
|
|
|
@ -25,7 +25,7 @@
|
|||
**
|
||||
****************************************************************************/
|
||||
/*!
|
||||
\title QML Examples - Image Elements
|
||||
\title Qt Quick Examples - Image Elements
|
||||
\example imageelements
|
||||
\brief This is a collection of QML examples relating to image types.
|
||||
\image qml-imageelements-example.png
|
||||
|
@ -40,20 +40,20 @@
|
|||
|
||||
'Shadows' shows how to create a drop shadow effect for a rectangular item
|
||||
using a BorderImage:
|
||||
\snippet quick/imageelements/content/ShadowRectangle.qml shadow
|
||||
\snippet imageelements/content/ShadowRectangle.qml shadow
|
||||
|
||||
'AnimatedSprite' shows how to display a simple animation using an
|
||||
AnimatedSprite object:
|
||||
\snippet quick/imageelements/animatedsprite.qml sprite
|
||||
\snippet imageelements/animatedsprite.qml sprite
|
||||
The sprite animation will loop 3 times.
|
||||
|
||||
'SpriteSequence' demonstrates using a sprite sequence to draw an animated
|
||||
and interactive bear.
|
||||
The SpriteSequence defines 5 different sprites. The bear is initially in
|
||||
a 'still' state:
|
||||
\snippet quick/imageelements/spritesequence.qml still
|
||||
\snippet imageelements/spritesequence.qml still
|
||||
When the scene is clicked, an animation sets the sprite sequence to the
|
||||
'falling' states and animates the bear's y property.
|
||||
\snippet quick/imageelements/spritesequence.qml animation
|
||||
\snippet imageelements/spritesequence.qml animation
|
||||
At the end of the animation the bear is set back to its initial state.
|
||||
*/
|
||||
|
|
|
@ -37,10 +37,10 @@
|
|||
of that click which are available to QML.
|
||||
|
||||
Signals are emitted by the MouseArea when clicks or other discrete operations occur within it
|
||||
\snippet quick/mousearea/mousearea.qml clicks
|
||||
\snippet mousearea/mousearea.qml clicks
|
||||
|
||||
The MouseArea can also be used to drag items around. By setting the parameters of the drag property,
|
||||
the target item will be dragged around if the user starts to drag within the MouseArea.
|
||||
\snippet quick/mousearea/mousearea.qml drag
|
||||
\snippet mousearea/mousearea.qml drag
|
||||
|
||||
*/
|
||||
|
|
|
@ -27,7 +27,7 @@
|
|||
|
||||
|
||||
/*!
|
||||
\title Scenegraph Painted Item Example
|
||||
\title Scene Graph - Painted Item
|
||||
\brief Shows how to implement QPainter-based custom scenegraph items.
|
||||
\example customitems/painteditem
|
||||
\ingroup qtquickexamples
|
||||
|
@ -43,12 +43,12 @@
|
|||
The example consists of an item class, a plugin class and a QML file
|
||||
to use this plugin. The \c TextBalloon class represents the individual
|
||||
text balloons extending QQuickPaintedItem, the \c TextBalloonPlugin class
|
||||
represents the skeleton code for a QtQuick plugin and the
|
||||
represents the skeleton code for a \l {Qt Quick} plugin and the
|
||||
\c textballoons.qml file is used to load the plugin and display the text
|
||||
balloons.
|
||||
|
||||
We will focus on the \c TextBalloon class first and continue with the
|
||||
\c textballoons.qml file. For an example on how to implement a QtQuick
|
||||
\c textballoons.qml file. For an example on how to implement a \l {Qt Quick}
|
||||
plugin please look at \l{declarative/tutorials/extending/chapter6-plugins}
|
||||
{Writing an Extension Plugin}
|
||||
|
||||
|
@ -58,7 +58,7 @@
|
|||
is the base class for all QPainter based items in the QML Scene Graph
|
||||
framework.
|
||||
|
||||
\snippet quick/customitems/painteditem/textballoon.h 0
|
||||
\snippet customitems/painteditem/textballoon.h 0
|
||||
|
||||
To implement a QQuickPaintedItem you must implement QQuickPaintedIem's pure
|
||||
virtual function \l {QQuickPaintedItem::}{paint()} which implements the
|
||||
|
@ -69,13 +69,13 @@
|
|||
We have to be sure to initialize the rightAligned property for a
|
||||
TextBalloon item.
|
||||
|
||||
\snippet quick/customitems/painteditem/textballoon.cpp 0
|
||||
\snippet customitems/painteditem/textballoon.cpp 0
|
||||
|
||||
Then we implement the \c paint() function which is automatically called by
|
||||
the Scenegraph framework to paint the contents of the item. The function
|
||||
the Scene Graph framework to paint the contents of the item. The function
|
||||
paints the item in local coordinates.
|
||||
|
||||
\snippet quick/customitems/painteditem/textballoon.cpp 1
|
||||
\snippet customitems/painteditem/textballoon.cpp 1
|
||||
|
||||
We start with setting the pen and brush on the item to define the look of
|
||||
the item. After that we start drawing. Note that the \l {QQuickPaintedItem::}{boundingRect()}
|
||||
|
@ -90,7 +90,7 @@
|
|||
|
||||
\section2 BalloonView
|
||||
|
||||
\snippet quick/customitems/painteditem/textballoons.qml 0
|
||||
\snippet customitems/painteditem/textballoons.qml 0
|
||||
|
||||
The balloonModel contains two types at application start which will be
|
||||
displayed by the balloonView. The balloonView alernates the TextBalloon
|
||||
|
@ -98,7 +98,7 @@
|
|||
|
||||
\section2 Controls
|
||||
|
||||
\snippet quick/customitems/painteditem/textballoons.qml 1
|
||||
\snippet customitems/painteditem/textballoons.qml 1
|
||||
|
||||
The controls part of the UI contains a rectangle with a MouseArea which
|
||||
changes color when the mouse hovers over it. This control 'button' adds
|
||||
|
|
|
@ -77,7 +77,7 @@ Rectangle {
|
|||
ImageParticle {
|
||||
id: stars
|
||||
groups: ["stars"]
|
||||
source: "../../images/star.png"
|
||||
source: "qrc:///particleresources/star.png"
|
||||
color: "white"
|
||||
colorVariation: 0.1
|
||||
alpha: 0
|
||||
|
@ -96,7 +96,7 @@ Rectangle {
|
|||
ImageParticle {
|
||||
id: shot
|
||||
groups: ["shot"]
|
||||
source: "../../images/star.png"
|
||||
source: "qrc:///particleresources/star.png"
|
||||
|
||||
color: "#0FF06600"
|
||||
colorVariation: 0.3
|
||||
|
@ -104,7 +104,7 @@ Rectangle {
|
|||
ImageParticle {
|
||||
id: engine
|
||||
groups: ["engine"]
|
||||
source: "../../images/particle4.png"
|
||||
source: "qrc:///particleresources/fuzzydot.png"
|
||||
|
||||
color: "orange"
|
||||
SequentialAnimation on color {
|
||||
|
|
|
@ -124,7 +124,7 @@ Rectangle {
|
|||
id: smoke
|
||||
anchors.fill: parent
|
||||
groups: ["smoke"]
|
||||
source: "../../images/particle.png"
|
||||
source: "qrc:///particleresources/glowdot.png"
|
||||
colorVariation: 0
|
||||
color: "#00111111"
|
||||
}
|
||||
|
@ -132,7 +132,7 @@ Rectangle {
|
|||
id: pilot
|
||||
anchors.fill: parent
|
||||
groups: ["pilot"]
|
||||
source: "../../images/particle.png"
|
||||
source: "qrc:///particleresources/glowdot.png"
|
||||
redVariation: 0.01
|
||||
blueVariation: 0.4
|
||||
color: "#0010004f"
|
||||
|
|
|
@ -50,7 +50,7 @@ Rectangle {
|
|||
ImageParticle {
|
||||
groups: ["A"]
|
||||
anchors.fill: parent
|
||||
source: "../../images/star.png"
|
||||
source: "qrc:///particleresources/star.png"
|
||||
color:"#FF1010"
|
||||
redVariation: 0.8
|
||||
}
|
||||
|
@ -80,7 +80,7 @@ Rectangle {
|
|||
ImageParticle {
|
||||
groups: ["B"]
|
||||
anchors.fill: parent
|
||||
source: "../../images/star.png"
|
||||
source: "qrc:///particleresources/star.png"
|
||||
color:"#10FF10"
|
||||
greenVariation: 0.8
|
||||
}
|
||||
|
@ -112,7 +112,7 @@ Rectangle {
|
|||
ImageParticle {
|
||||
groups: ["C"]
|
||||
anchors.fill: parent
|
||||
source: "../../images/star.png"
|
||||
source: "qrc:///particleresources/star.png"
|
||||
color:"#1010FF"
|
||||
blueVariation: 0.8
|
||||
}
|
||||
|
|
|
@ -66,7 +66,7 @@ Item {
|
|||
ImageParticle {
|
||||
system: sys
|
||||
groups: ["starfield"]
|
||||
source: "../../images/star.png"
|
||||
source: "qrc:///particleresources/star.png"
|
||||
colorVariation: 0.3
|
||||
color: "white"
|
||||
}
|
||||
|
@ -170,7 +170,7 @@ Item {
|
|||
z:0
|
||||
system: sys
|
||||
groups: ["exhaust"]
|
||||
source: "../../images/particle4.png"
|
||||
source: "qrc:///particleresources/fuzzydot.png"
|
||||
|
||||
color: "orange"
|
||||
SequentialAnimation on color {
|
||||
|
|
|
@ -75,13 +75,13 @@ Rectangle {
|
|||
|
||||
ImageParticle {
|
||||
groups: ["smoke"]
|
||||
source: "../../images/particle.png"
|
||||
source: "qrc:///particleresources/glowdot.png"
|
||||
color: "#11111111"
|
||||
colorVariation: 0
|
||||
}
|
||||
ImageParticle {
|
||||
groups: ["flame"]
|
||||
source: "../../images/particle.png"
|
||||
source: "qrc:///particleresources/glowdot.png"
|
||||
color: "#11ff400f"
|
||||
colorVariation: 0.1
|
||||
}
|
||||
|
|
|
@ -35,7 +35,7 @@
|
|||
Each example is a small QML file emphasizing a particular type or feature.
|
||||
|
||||
Age demonstrates using an Age affector to prematurely end the lives of particles.
|
||||
\snippet quick/particles/affectors/content/age.qml 0
|
||||
\snippet particles/affectors/content/age.qml 0
|
||||
|
||||
As you move the affector around the screen, the particles inside it
|
||||
(which haven't already been affected) jump to a period near the end
|
||||
|
@ -44,7 +44,7 @@
|
|||
the end of their life instantly.
|
||||
|
||||
Attractor demonstrates using an Attractor affector to simulate a black hole
|
||||
\snippet quick/particles/affectors/content/attractor.qml 0
|
||||
\snippet particles/affectors/content/attractor.qml 0
|
||||
|
||||
All particles in the scene, including the rocket ship's exhaust and pellets, are pulled
|
||||
towards the black hole. This effect is stronger closer to the black hole, so the
|
||||
|
@ -55,58 +55,58 @@
|
|||
Custom Affector manipulates the properties of the particles directly in javascript.
|
||||
One Affector is used to make the leaves rock back and forth as they fall, looking more
|
||||
leaf-like than just spinning in circles:
|
||||
\snippet quick/particles/affectors/content/customaffector.qml 0
|
||||
\snippet particles/affectors/content/customaffector.qml 0
|
||||
Another is used to provide a slightly varying friction to the leaves as they 'land',
|
||||
to look more natural:
|
||||
\snippet quick/particles/affectors/content/customaffector.qml 1
|
||||
\snippet particles/affectors/content/customaffector.qml 1
|
||||
|
||||
Friction is similar to the falling leaves in the custom affector, except that it uses a
|
||||
flat friction the whole way down instead of custom affectors.
|
||||
\snippet quick/particles/affectors/content/friction.qml 0
|
||||
\snippet particles/affectors/content/friction.qml 0
|
||||
|
||||
Gravity is a convenience affector for applying a constant acceleration to particles inside it
|
||||
\snippet quick/particles/affectors/content/gravity.qml 0
|
||||
\snippet particles/affectors/content/gravity.qml 0
|
||||
|
||||
GroupGoal sets up two particle groups for flaming and non-flaming balls, and gives you various
|
||||
ways to transition between them.
|
||||
\snippet quick/particles/affectors/content/groupgoal.qml unlit
|
||||
\snippet particles/affectors/content/groupgoal.qml unlit
|
||||
The non-flaming balls have a one in a hundred chance of lighting on their own each second, but they also
|
||||
have a GroupGoal set on the whole group. This affector affects all particles of the unlit group, when colliding
|
||||
with particles in the lit group, and cause them to move to the lighting group.
|
||||
\snippet quick/particles/affectors/content/groupgoal.qml lighting
|
||||
\snippet particles/affectors/content/groupgoal.qml lighting
|
||||
lighting is an intermediate group so that the glow builds up and the transition is less jarring. So it automatically
|
||||
moves into the lit group after 100ms.
|
||||
\snippet quick/particles/affectors/content/groupgoal.qml lit
|
||||
\snippet particles/affectors/content/groupgoal.qml lit
|
||||
The lit group also has TrailEmitters on it for additional fire and smoke, but does not transition anywhere.
|
||||
There are two more GroupGoal objects that allow particles in the unlit group to transition to the lighting group
|
||||
(and then to the lit group).
|
||||
\snippet quick/particles/affectors/content/groupgoal.qml groupgoal-pilot
|
||||
\snippet particles/affectors/content/groupgoal.qml groupgoal-pilot
|
||||
The first is just an area bound to the location of an image of a pilot flame. When unlit balls pass through the flame,
|
||||
they go straight to lit because the pilot flame is so hot.
|
||||
\snippet quick/particles/affectors/content/groupgoal.qml groupgoal-ma
|
||||
\snippet particles/affectors/content/groupgoal.qml groupgoal-ma
|
||||
The second is bound to the location of the last pointer interaction, so that touching or clicking on unlit balls (which
|
||||
is hard due to their constant movement) causes them to move to the lighting group.
|
||||
|
||||
Move shows some simple effects you can get by altering trajectory midway.
|
||||
The red particles have an affector that affects their position, jumping them forwards by 120px.
|
||||
\snippet quick/particles/affectors/content/move.qml A
|
||||
\snippet particles/affectors/content/move.qml A
|
||||
The green particles have an affector that affects their velocity, but with some angle variation. By adding some random direction
|
||||
velocity to their existing forwards velocity, they begin to spray off in a cone.
|
||||
\snippet quick/particles/affectors/content/move.qml B
|
||||
\snippet particles/affectors/content/move.qml B
|
||||
The blue particles have an affector that affects their acceleration, and because it sets relative to false this resets the acceleration instead of
|
||||
adding to it. Once the blue particles reach the affector, their horizontal velocity stops increasing as their vertical velocity decreases.
|
||||
\snippet quick/particles/affectors/content/move.qml C
|
||||
\snippet particles/affectors/content/move.qml C
|
||||
|
||||
SpriteGoal has an affector which interacts with the sprite engine of particles, if they are being drawn as sprites by ImageParticle.
|
||||
\snippet quick/particles/affectors/content/spritegoal.qml 0
|
||||
\snippet particles/affectors/content/spritegoal.qml 0
|
||||
The SpriteGoal follows the image of the rocket ship on screen, and when it interacts with particles drawn by ImageParticle as sprites,
|
||||
it instructs them to move immediately to the "explode" state, which in this case is the animation of the asteroid breaking into many pieces.
|
||||
|
||||
Turbulence has a flame with smoke, and both sets of particles being affected by a Turbulence affector. This gives a faint wind effect.
|
||||
\snippet quick/particles/affectors/content/turbulence.qml 0
|
||||
\snippet particles/affectors/content/turbulence.qml 0
|
||||
To make the wind change direction, subsitute a black and white noise image in the noiseSource parameter (it currently uses a default noise source).
|
||||
|
||||
Wander uses a Wander affector to add some horizontal drift to snowflakes as they fall down.
|
||||
\snippet quick/particles/affectors/content/wander.qml 0
|
||||
\snippet particles/affectors/content/wander.qml 0
|
||||
There are different movements given by applying the Wander to different attributes of the trajectory, so the example makes it easy to play around and see the difference.
|
||||
*/
|
||||
|
|
|
@ -71,7 +71,7 @@ Rectangle {
|
|||
}
|
||||
Image {
|
||||
id: particle
|
||||
source: "../../images/particle4.png"
|
||||
source: "qrc:///particleresources/fuzzydot.png"
|
||||
}
|
||||
//! [vertex]
|
||||
vertexShader:"
|
||||
|
|
|
@ -36,19 +36,19 @@
|
|||
|
||||
Blur Particles adds a blur effect to the particles, which increases over the particle's life time.
|
||||
It uses a custom vertex shader:
|
||||
\snippet quick/particles/customparticle/content/blurparticles.qml vertex
|
||||
\snippet particles/customparticle/content/blurparticles.qml vertex
|
||||
to propagate life time simulation to a custom fragement shader:
|
||||
\snippet quick/particles/customparticle/content/blurparticles.qml fragment
|
||||
\snippet particles/customparticle/content/blurparticles.qml fragment
|
||||
which has access to both the normal image sampler and a blurred sampler, the image plus a ShaderEffect.
|
||||
|
||||
Fragment Shader just uses the particle system as a vertex delivery system.
|
||||
\snippet quick/particles/customparticle/content/fragmentshader.qml 0
|
||||
\snippet particles/customparticle/content/fragmentshader.qml 0
|
||||
|
||||
Image Colors uses CustomParticle to assign colors to particles based on their location in a picture.
|
||||
The vertex shader,
|
||||
\snippet quick/particles/customparticle/content/imagecolors.qml vertex
|
||||
\snippet particles/customparticle/content/imagecolors.qml vertex
|
||||
passes along the starting position for each vertex to the fragment shader,
|
||||
\snippet quick/particles/customparticle/content/imagecolors.qml fragment
|
||||
\snippet particles/customparticle/content/imagecolors.qml fragment
|
||||
which uses it to determine the color for that particle.
|
||||
|
||||
*/
|
||||
|
|
|
@ -67,7 +67,7 @@ Rectangle {
|
|||
id: particles
|
||||
anchors.fill: parent
|
||||
ImageParticle {
|
||||
source: "../../images/star.png"
|
||||
source: "qrc:///particleresources/star.png"
|
||||
alpha: 0
|
||||
colorVariation: 0.6
|
||||
}
|
||||
|
|
|
@ -90,7 +90,7 @@ ParticleSystem {
|
|||
}
|
||||
|
||||
ImageParticle {
|
||||
source: "../../images/particle4.png"
|
||||
source: "qrc:///particleresources/fuzzydot.png"
|
||||
alpha: 0.0
|
||||
}
|
||||
}
|
||||
|
|
|
@ -51,7 +51,7 @@ Rectangle {
|
|||
anchors.centerIn: parent
|
||||
|
||||
ImageParticle {
|
||||
source: "../../images/particle.png"
|
||||
source: "qrc:///particleresources/glowdot.png"
|
||||
z: 2
|
||||
anchors.fill: parent
|
||||
color: "#336666CC"
|
||||
|
|
|
@ -53,7 +53,7 @@ Rectangle {
|
|||
ImageParticle {
|
||||
system: sys
|
||||
id: cp
|
||||
source: "../../images/particle.png"
|
||||
source: "qrc:///particleresources/glowdot.png"
|
||||
colorVariation: 0.4
|
||||
color: "#000000FF"
|
||||
}
|
||||
|
|